Compare commits

..
409 Commits
Author SHA1 Message Date
Lucas Vivo ff6da7c88b feat(post_install): add screen 2026-11-23 21:00:52 +01:00
Lucas Vivo f59810c989 docs(torrent_api): readme
Torrent API CI / test (push) Successful in 16s
Torrent API CI / install (quiethost) (push) Successful in 7s
Torrent API CI / install (mediahost) (push) Successful in 7s
Torrent API CI / lint (push) Successful in 13s
Torrent API CI / build (push) Successful in 45s
Torrent API CI / install (serverhost) (push) Successful in 7s
Torrent API CI / install (vivohost) (push) Successful in 7s
2026-11-23 20:14:11 +01:00
Lucas Vivo c58d0f1101 test(torrent_api): load env file 2026-11-23 20:13:57 +01:00
Lucas Vivo fec627a7c1 fix(torrent_api): load env from execution dir 2026-11-23 20:13:46 +01:00
Lucas Vivo a350796ccb test(torrent_api): test torrent copy progress
Torrent API CI / test (push) Successful in 13s
Torrent API CI / install (mediahost) (push) Successful in 1s
Torrent API CI / install (quiethost) (push) Successful in 43s
Torrent API CI / build (push) Successful in 31s
Torrent API CI / lint (push) Successful in 8s
Torrent API CI / install (serverhost) (push) Successful in 2s
Torrent API CI / install (vivohost) (push) Successful in 42s
2026-11-23 18:16:03 +01:00
Lucas Vivo c15822190f feat(torrent_api): add progress to copy_torrents 2026-11-23 18:15:48 +01:00
Lucas Vivo 7d50901a2c test(wallpaper_changer): add priority for test output check
Torrent API CI / test (push) Successful in 12s
Torrent API CI / install (quiethost) (push) Successful in 2s
Torrent API CI / install (mediahost) (push) Successful in 2s
Torrent API CI / lint (push) Successful in 8s
Torrent API CI / build (push) Successful in 31s
Torrent API CI / install (vivohost) (push) Successful in 3s
Torrent API CI / install (serverhost) (push) Successful in 2s
2026-11-23 17:57:32 +01:00
Lucas Vivo 8acb36dd59 feat(gimp): add gimp default files script
Torrent API CI / test (push) Failing after 14s
Torrent API CI / install (mediahost) (push) Skipped
Torrent API CI / install (quiethost) (push) Skipped
Torrent API CI / lint (push) Successful in 10s
Torrent API CI / build (push) Skipped
Torrent API CI / install (serverhost) (push) Skipped
Torrent API CI / install (vivohost) (push) Skipped
2026-11-23 17:26:40 +01:00
Lucas Vivo 13cfcdf7f0 fix(torrent_api): fix priority filter in copy to loop 2026-11-23 17:26:40 +01:00
Lucas Vivo f877d2da7c feat(torrent_api): show priority 2026-11-23 17:26:35 +01:00
Lucas Vivo 6010a3921b test(wallpaper_changer): test clear remove arguments
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 21s
Wallpaper Changer CI / build (push) Successful in 49s
Wallpaper Changer CI / install (vivohost) (push) Successful in 5s
Wallpaper Changer CI / install (serverhost) (push) Successful in 3s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 8s
Wallpaper Changer CI / install (mediahost) (push) Successful in 4s
2026-11-23 16:24:40 +01:00
Lucas Vivo 359945fed0 feat(wallpaper_changer): clear remove list of arguments 2026-11-23 16:24:09 +01:00
Lucas Vivo 9caa2c10bc test(torrent_api): fix priority in mock tests
Torrent API CI / test (push) Successful in 16s
Torrent API CI / install (quiethost) (push) Successful in 3s
Torrent API CI / install (mediahost) (push) Successful in 2s
Torrent API CI / build (push) Successful in 29s
Torrent API CI / lint (push) Successful in 9s
Torrent API CI / install (vivohost) (push) Successful in 3s
Torrent API CI / install (serverhost) (push) Successful in 2s
2026-11-23 14:37:37 +01:00
Lucas Vivo e889a4dc73 fix(torrent_api): move load_env to main 2026-11-23 14:37:09 +01:00
Lucas Vivo 8eb7f77751 fix(torrent_api): add priority filter to copy_torrents
Torrent API CI / test (push) Failing after 12s
Torrent API CI / install (mediahost) (push) Skipped
Torrent API CI / install (quiethost) (push) Skipped
Torrent API CI / lint (push) Successful in 8s
Torrent API CI / build (push) Skipped
Torrent API CI / install (serverhost) (push) Skipped
Torrent API CI / install (vivohost) (push) Skipped
2026-11-23 14:23:25 +01:00
Lucas Vivo 3d827ceb61 chore(configure_indexers): launch.json
Torrent API CI / test (push) Successful in 12s
Torrent API CI / install (mediahost) (push) Successful in 3s
Torrent API CI / install (quiethost) (push) Successful in 2s
Torrent API CI / lint (push) Successful in 9s
Torrent API CI / build (push) Successful in 30s
Torrent API CI / install (vivohost) (push) Successful in 3s
Torrent API CI / install (serverhost) (push) Successful in 3s
2026-11-23 13:18:32 +01:00
Lucas Vivo 5f60b7a44e docs(torrent_api): readme 2026-11-23 13:18:05 +01:00
Lucas Vivo 2c51aa79b5 test(torrent_api): test path mappings 2026-11-23 13:17:41 +01:00
Lucas Vivo 1ad39ee042 feat(qbittorrent_api): add path mappings for docker container 2026-11-23 13:17:25 +01:00
Lucas Vivo 501caee8b9 feat(configure_indexers): add 0dayfiles, add usnet client support, ignore spaces in indexer names 2026-11-23 13:16:34 +01:00
Lucas Vivo 1992a3dcd0 feat(torrent_api): load env file in current dir and execution dir
Torrent API CI / test (push) Successful in 12s
Torrent API CI / install (mediahost) (push) Successful in 2s
Torrent API CI / install (quiethost) (push) Successful in 8s
Torrent API CI / build (push) Successful in 36s
Torrent API CI / lint (push) Successful in 7s
Torrent API CI / install (vivohost) (push) Successful in 2s
Torrent API CI / install (serverhost) (push) Successful in 3s
2026-11-23 12:28:30 +01:00
Lucas Vivo 5c1d9be81a ci(torrent_api): fix ruff job
Serverlibrary CI / test-serverlibrary (push) Successful in 11s
Serverlibrary CI / lint-serverlibrary (push) Successful in 8s
Torrent API CI / test (push) Successful in 12s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
Torrent API CI / install (mediahost) (push) Successful in 3s
Torrent API CI / install (quiethost) (push) Successful in 5s
Wallpaper Changer CI / build (push) Successful in 47s
Wallpaper Changer CI / install (vivohost) (push) Successful in 4s
Wallpaper Changer CI / install (quiethost) (push) Successful in 3s
Wallpaper Changer CI / install (serverhost) (push) Successful in 6s
Torrent API CI / lint (push) Successful in 8s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 7s
Torrent API CI / build (push) Successful in 30s
Torrent API CI / install (vivohost) (push) Successful in 4s
Torrent API CI / install (serverhost) (push) Successful in 2s
Wallpaper Changer CI / install (mediahost) (push) Successful in 2s
2026-11-23 11:55:50 +01:00
Lucas Vivo ad738d8fdb fix(torrent_api): fix dry run for copy_torrents
Torrent API CI / test (push) Successful in 12s
Torrent API CI / install (mediahost) (push) Skipped
Torrent API CI / install (quiethost) (push) Skipped
Torrent API CI / lint (push) Failing after 7s
Torrent API CI / build (push) Skipped
Torrent API CI / install (serverhost) (push) Skipped
Torrent API CI / install (vivohost) (push) Skipped
2026-11-23 11:52:14 +01:00
Lucas Vivo 9aacdc40e6 ci(wallpaper_changer): change ci trigger
Serverlibrary CI / test-serverlibrary (push) Successful in 12s
Serverlibrary CI / lint-serverlibrary (push) Successful in 8s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / install (serverhost) (push) Skipped
Wallpaper Changer CI / install (vivohost) (push) Skipped
Wallpaper Changer CI / install (mediahost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 8s
2026-11-23 11:45:59 +01:00
Lucas Vivo cfa80f38cf ci(serverlibrary): change ci trigger 2026-11-23 11:45:46 +01:00
Lucas Vivo 6e2d041814 ci(torrent_api): add serverlibrary to cicd
Serverlibrary CI / test-serverlibrary (push) Successful in 10s
Serverlibrary CI / lint-serverlibrary (push) Successful in 7s
Torrent API CI / test (push) Failing after 12s
Torrent API CI / install (mediahost) (push) Skipped
Torrent API CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / build (push) Successful in 48s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 19s
Wallpaper Changer CI / install (vivohost) (push) Successful in 5s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (serverhost) (push) Successful in 6s
Torrent API CI / lint (push) Failing after 8s
Torrent API CI / build (push) Skipped
Torrent API CI / install (serverhost) (push) Skipped
Torrent API CI / install (vivohost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 8s
Wallpaper Changer CI / install (mediahost) (push) Successful in 3s
2026-11-23 11:44:58 +01:00
Lucas Vivo 94bd900f81 feat(find_duplicates): add find_duplicatespython script 2026-11-23 11:37:08 +01:00
Lucas Vivo 5d026332c0 docs(torrent_api): readme
Torrent API CI / test (push) Failing after 9s
Torrent API CI / install (mediahost) (push) Skipped
Torrent API CI / install (quiethost) (push) Skipped
Torrent API CI / lint (push) Failing after 7s
Torrent API CI / build (push) Skipped
Torrent API CI / install (serverhost) (push) Skipped
Torrent API CI / install (vivohost) (push) Skipped
2026-11-23 11:36:36 +01:00
Lucas Vivo fbb5efa838 chore(torrent_api): project files 2026-11-23 11:36:25 +01:00
Lucas Vivo 5b940129ca test(torrent_api): test host check and dry run 2026-11-23 11:35:50 +01:00
Lucas Vivo 2bb1d67c21 feat(torrent_api): copy completed torrents: add host check and dry run 2026-11-23 11:35:36 +01:00
Lucas Vivo 8fafb937aa test(audiobook_library): test series and number recognition
Audiobook Library CI / test (push) Successful in 1m11s
Audiobook Library CI / install (vivohost) (push) Successful in 9s
Audiobook Library CI / build (push) Successful in 47s
Audiobook Library CI / lint (push) Successful in 9s
Audiobook Library CI / install (quiethost) (push) Successful in 1s
Audiobook Library CI / install (serverhost) (push) Successful in 4s
Audiobook Library CI / install (mediahost) (push) Successful in 6s
2026-11-22 19:51:29 +01:00
Lucas Vivo da544f490e feat(audiobook_library): add support for more ways to write series and number 2026-11-22 19:51:10 +01:00
Lucas Vivo 49801263c6 test(audiobook_library): add tests for series extraction
Audiobook Library CI / test (push) Successful in 58s
Audiobook Library CI / install (vivohost) (push) Successful in 2s
Audiobook Library CI / install (serverhost) (push) Successful in 4s
Audiobook Library CI / lint (push) Successful in 9s
Audiobook Library CI / build (push) Successful in 47s
Audiobook Library CI / install (mediahost) (push) Successful in 1s
Audiobook Library CI / install (quiethost) (push) Successful in 2s
2026-11-22 19:10:18 +01:00
Lucas Vivo 06719968a3 feat(audiobook_library): add support for series and number extraction from path 2026-11-22 19:09:41 +01:00
Lucas Vivo 774e8792b9 chore(torrent_api): readme 2026-11-22 16:53:04 +01:00
Lucas Vivo f4c7610ab4 test(torrent_api): test copy function 2026-11-22 16:48:23 +01:00
Lucas Vivo b973aa9e9b feat(torrent_api): add copy function to get_torrent_files 2026-11-22 16:48:06 +01:00
Lucas Vivo 3fe6b39f22 test(wallpaper_changer): integration test for convert_jpg, check_consecutive_filenames and check_encryption
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 27s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / install (serverhost) (push) Skipped
Wallpaper Changer CI / install (vivohost) (push) Skipped
Wallpaper Changer CI / install (mediahost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 9s
2026-11-22 16:26:02 +01:00
Lucas Vivo bc1cf8278d fixllpaper_changer): convert_jpg in New & Img folder 2026-11-22 16:21:16 +01:00
Lucas Vivo 4d0595e967 chore(scripts): add torrent_api to workspace 2026-11-22 16:18:04 +01:00
Lucas Vivo 74d54baa1b chore(gitignore): add env files 2026-11-22 16:17:31 +01:00
Lucas Vivo d146f18144 test(torrent_api): add unit tests 2026-11-22 16:16:32 +01:00
Lucas Vivo be8e17f398 chore(torrent_api): add project files 2026-11-22 16:16:14 +01:00
Lucas Vivo 4a0bf338dc feat(torrent_api): split into modules, add show file progress of torrent 2026-11-22 16:15:29 +01:00
Lucas Vivo e73c8263a4 chote(torrent_ondexers): add MVGroup 2026-11-22 16:14:39 +01:00
Lucas Vivo d41debdf81 feat(bash_aliases): add clear recent files for ubuntu 2026-11-22 16:14:18 +01:00
Lucas Vivo 04f4278770 ci(torrent_api): test, lint, build and install torrent_api 2026-11-22 16:13:54 +01:00
Lucas Vivo c61c480cbb ci(wallpaper_changer): add mediahost to install matrix
Serverlibrary CI / test-serverlibrary (push) Successful in 12s
Serverlibrary CI / lint-serverlibrary (push) Successful in 9s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 22s
Wallpaper Changer CI / build (push) Successful in 51s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (vivohost) (push) Successful in 3s
Wallpaper Changer CI / install (serverhost) (push) Successful in 4s
FFmpeg Handling CI / build (push) Successful in 31s
FFmpeg Handling CI / install (quiethost) (push) Successful in 3s
Audiobook Library CI / test (push) Successful in 54s
Audiobook Library CI / install (vivohost) (push) Successful in 3s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 10s
Wallpaper Changer CI / install (mediahost) (push) Successful in 4s
FFmpeg Handling CI / test (push) Successful in 48s
FFmpeg Handling CI / lint (push) Successful in 9s
FFmpeg Handling CI / install (vivohost) (push) Successful in 3s
FFmpeg Handling CI / install (serverhost) (push) Successful in 4s
FFmpeg Handling CI / install (mediahost) (push) Successful in 4s
Audiobook Library CI / lint (push) Successful in 8s
Audiobook Library CI / build (push) Successful in 33s
Audiobook Library CI / install (quiethost) (push) Successful in 2s
Audiobook Library CI / install (mediahost) (push) Successful in 3s
Audiobook Library CI / install (serverhost) (push) Successful in 2s
2026-11-21 15:56:52 +01:00
Lucas Vivo b48cd97076 ci(ffmpeg_handling): add mediahost to install matrix 2026-11-21 15:56:38 +01:00
Lucas Vivo e60a0898a0 ci(audiobook_library): add mediahost to install matrix 2026-11-21 15:56:18 +01:00
Lucas Vivo a92eee5beb chore(services): add gitea-runner service 2026-11-21 15:54:46 +01:00
Lucas Vivo 93ab3bdcee style(audiobook_library): keep line length
Audiobook Library CI / test (push) Successful in 1m9s
Audiobook Library CI / install (vivohost) (push) Skipped
FFmpeg Handling CI / build (push) Skipped
FFmpeg Handling CI / install (quiethost) (push) Skipped
Audiobook Library CI / lint (push) Successful in 8s
Audiobook Library CI / build (push) Skipped
Audiobook Library CI / install (quiethost) (push) Skipped
Audiobook Library CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / test (push) Successful in 47s
FFmpeg Handling CI / lint (push) Successful in 8s
FFmpeg Handling CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / install (vivohost) (push) Skipped
2026-11-21 15:45:07 +01:00
Lucas Vivo 4c7eaf4f22 chore(ffmpeg_handling): fix ruff version
Audiobook Library CI / test (push) Successful in 1m9s
Audiobook Library CI / install (vivohost) (push) Skipped
FFmpeg Handling CI / build (push) Successful in 30s
FFmpeg Handling CI / install (quiethost) (push) Successful in 2s
Audiobook Library CI / lint (push) Failing after 8s
Audiobook Library CI / build (push) Skipped
Audiobook Library CI / install (quiethost) (push) Skipped
Audiobook Library CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / test (push) Successful in 48s
FFmpeg Handling CI / lint (push) Successful in 8s
FFmpeg Handling CI / install (vivohost) (push) Failing after 1s
FFmpeg Handling CI / install (serverhost) (push) Failing after 0s
2026-11-21 15:39:20 +01:00
Lucas Vivo 29eec52099 chore(audiobook_library): fix ruff version 2026-11-21 15:39:10 +01:00
Lucas Vivo 9c963ce74b style(wallpaper_changer): keep line length
Audiobook Library CI / test (push) Successful in 55s
Audiobook Library CI / install (vivohost) (push) Skipped
Serverlibrary CI / test-serverlibrary (push) Successful in 12s
Serverlibrary CI / lint-serverlibrary (push) Successful in 9s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
FFmpeg Handling CI / build (push) Successful in 29s
FFmpeg Handling CI / install (quiethost) (push) Successful in 2s
Wallpaper Changer CI / build (push) Successful in 48s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (vivohost) (push) Successful in 10s
Wallpaper Changer CI / install (serverhost) (push) Canceled after 0s
Audiobook Library CI / lint (push) Failing after 8s
Audiobook Library CI / build (push) Skipped
Audiobook Library CI / install (quiethost) (push) Skipped
Audiobook Library CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / test (push) Successful in 52s
FFmpeg Handling CI / lint (push) Successful in 8s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 8s
FFmpeg Handling CI / install (vivohost) (push) Successful in 6s
FFmpeg Handling CI / install (serverhost) (push) Canceled after 0s
2026-11-21 15:28:07 +01:00
Lucas Vivo 9c69dab395 chore(audiobook_library): add readme
Audiobook Library CI / test (push) Successful in 54s
Audiobook Library CI / install (vivohost) (push) Skipped
Serverlibrary CI / test-serverlibrary (push) Successful in 12s
Serverlibrary CI / lint-serverlibrary (push) Successful in 8s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 23s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / install (serverhost) (push) Skipped
Wallpaper Changer CI / install (vivohost) (push) Skipped
Audiobook Library CI / lint (push) Failing after 8s
Audiobook Library CI / build (push) Skipped
Audiobook Library CI / install (quiethost) (push) Skipped
Audiobook Library CI / install (serverhost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Failing after 8s
2026-11-21 15:20:52 +01:00
Lucas Vivo 0ab31d16c2 test(audiobook_library): add test functions 2026-11-21 15:20:39 +01:00
Lucas Vivo 8f027e2226 feat(audiobook_library): split audiobooks_library in modules for each class and add helper module
remove original
2026-11-21 15:20:19 +01:00
Lucas Vivo c894b465d2 ci(audiobook_library): add ci workflow for audiobook library 2026-11-21 15:19:04 +01:00
Lucas Vivo d131533ae6 test(ffmpeg_handling): move testfiles
FFmpeg Handling CI / build (push) Skipped
FFmpeg Handling CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 22s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / install (serverhost) (push) Skipped
Wallpaper Changer CI / install (vivohost) (push) Skipped
FFmpeg Handling CI / test (push) Successful in 49s
FFmpeg Handling CI / lint (push) Successful in 8s
FFmpeg Handling CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / install (vivohost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Failing after 8s
2026-11-21 15:14:51 +01:00
Lucas Vivo 9e8ac1d37d test(wallpaper_changer): move testfiles 2026-11-21 15:13:27 +01:00
Lucas Vivo 70904598fb test(testfiles): move testfiles to scripts dir for all projects
FFmpeg Handling CI / build (push) Skipped
FFmpeg Handling CI / install (quiethost) (push) Skipped
FFmpeg Handling CI / test (push) Failing after 39s
FFmpeg Handling CI / lint (push) Successful in 7s
FFmpeg Handling CI / install (serverhost) (push) Skipped
FFmpeg Handling CI / install (vivohost) (push) Skipped
2026-11-21 15:12:17 +01:00
Lucas Vivo cdad6a5dca chore(audiobook_library): add project files 2026-11-21 14:57:30 +01:00
Lucas Vivo dac70a632c chore(wallpaper_changer): fix desktop app
Serverlibrary CI / test-serverlibrary (push) Successful in 10s
Serverlibrary CI / lint-serverlibrary (push) Successful in 5s
FFmpeg Handling CI / build (push) Successful in 27s
FFmpeg Handling CI / install (quiethost) (push) Successful in 12s
Wallpaper Changer CI / build (push) Successful in 44s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 19s
Wallpaper Changer CI / install (quiethost) (push) Successful in 2s
Wallpaper Changer CI / install (vivohost) (push) Successful in 4s
Wallpaper Changer CI / install (serverhost) (push) Canceled after 0s
FFmpeg Handling CI / test (push) Successful in 51s
FFmpeg Handling CI / lint (push) Successful in 7s
FFmpeg Handling CI / install (vivohost) (push) Successful in 5s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 7s
FFmpeg Handling CI / install (serverhost) (push) Canceled after 0s
2026-11-21 14:56:42 +01:00
Lucas Vivo d229d4a980 ci(ffmpeg_handling): add serverhost to install matrix 2026-11-21 14:56:18 +01:00
Lucas Vivo 753b4bcd35 ci(wallpaper_changer): add serverhost to install matrix 2026-11-21 14:55:56 +01:00
Lucas Vivo 968ef5dedb fix(wallpaper_changer): restart srevice
Serverlibrary CI / test-serverlibrary (push) Successful in 16s
Serverlibrary CI / lint-serverlibrary (push) Successful in 7s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
Wallpaper Changer CI / build (push) Successful in 50s
Wallpaper Changer CI / install (quiethost) (push) Successful in 6s
Wallpaper Changer CI / install (vivohost) (push) Successful in 27s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 7s
2026-11-21 10:03:50 +01:00
Lucas Vivo 740d25f4e3 chore(wallpaper_changer): readme
Wallpaper Changer CI / build (push) Successful in 44s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 17s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (vivohost) (push) Successful in 7s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 6s
2026-11-21 09:55:08 +01:00
Lucas Vivo fb9e0c9c44 test(wallpaper_changer): add tests for new xrandr call function 2026-11-21 09:54:32 +01:00
Lucas Vivo 08f1b7a3e8 feat(wallpaper_changer): read virtual size from gbus call for x11 sessions 2026-11-21 09:54:09 +01:00
Lucas Vivo e063c32342 test(wallpaper_changer): add xrandr test files 2026-11-21 09:51:25 +01:00
Lucas Vivo c4a1c76370 chore(wallpaper_changer): launch config
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 17s
Wallpaper Changer CI / build (push) Successful in 47s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (vivohost) (push) Successful in 7s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 8s
2026-11-21 09:37:55 +01:00
Lucas Vivo a47f913cc1 test(wallpaper_changer): add monitor test files
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 18s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (quiethost) (push) Skipped
Wallpaper Changer CI / install (vivohost) (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 7s
2026-11-21 09:33:37 +01:00
Lucas Vivo 5c3550b657 test(wallpaper_changer): add tests for new gbus monitor call 2026-11-21 09:33:37 +01:00
Lucas Vivo 97ef35caf5 feat(wallpaper_changer): read virtual size from gbus call for gnome sessions 2026-11-21 09:33:37 +01:00
Lucas Vivo c46871e41f test(wallpaper_changer): remove skipping monitors file for one monitor 2026-11-21 09:33:37 +01:00
Lucas Vivo 9dc8b11673 feat(wallpaper_changer): remove skipping monitors file on one monitor 2026-11-21 09:33:37 +01:00
Lucas Vivo 792e86ae0d feat(bash_aliases): change wallpaper_changer script location 2026-11-21 09:33:37 +01:00
Lucas Vivo 7f2e61746f chore(wallpaper_changer): add shebang 2026-11-21 09:33:37 +01:00
Lucas Vivo d99ef28e71 ci(ffmpeg_handling): install on all hosts# 2026-11-21 09:33:37 +01:00
Lucas Vivo 8ca880ddff ci(wallpaper_changer): deploy new passphrase 2026-11-21 09:33:37 +01:00
Lucas Vivo b89eb89d5e chore(wallpaper_changer): readme 2026-11-21 09:33:37 +01:00
Lucas Vivo 8b7d92d97b feat(wallpaper_changer): save naming table after every encoded image 2026-11-20 20:42:00 +01:00
Lucas Vivo 88cb666848 test(wallpaper_changer): add tests for new passphrase 2026-11-20 20:41:36 +01:00
Lucas Vivo 632bca8642 feat(wallpaper_changer): change private_key for passphrase 2026-11-20 20:41:11 +01:00
Lucas Vivo 49b3c6a649 test(wallpaper_changer): add new test assets 2026-11-20 20:37:06 +01:00
Lucas Vivo 277a8cedaf ci(wallpaper_changer): add run on all hosts
Serverlibrary CI / test-serverlibrary (push) Successful in 14s
Serverlibrary CI / lint-serverlibrary (push) Successful in 6s
Wallpaper Changer CI / build (push) Successful in 2m49s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 24s
Wallpaper Changer CI / install (quiethost) (push) Successful in 4s
Wallpaper Changer CI / install (vivohost) (push) Successful in 5s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 7s
2026-11-20 20:01:00 +01:00
lucas dbff6b8327 Merge pull request 'ci(ffmpeg_handling): add main restriction for build task' (#2) from dev into main
FFmpeg Handling CI / build (push) Successful in 26s
Serverlibrary CI / test-serverlibrary (push) Successful in 9s
Serverlibrary CI / lint-serverlibrary (push) Successful in 5s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 34s
Wallpaper Changer CI / build (push) Successful in 52s
Wallpaper Changer CI / install (push) Successful in 3s
FFmpeg Handling CI / test (push) Successful in 46s
FFmpeg Handling CI / lint (push) Successful in 5s
FFmpeg Handling CI / install (push) Successful in 3s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 17s
Reviewed-on: #2
2026-11-20 18:14:28 +01:00
Lucas Vivo 02c53e0839 ci(ffmpeg_handling): add main restriction for build task
FFmpeg Handling CI / build (push) Skipped
Serverlibrary CI / test-serverlibrary (push) Successful in 9s
Serverlibrary CI / lint-serverlibrary (push) Successful in 6s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 19s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (push) Skipped
FFmpeg Handling CI / test (push) Successful in 45s
FFmpeg Handling CI / lint (push) Successful in 5s
FFmpeg Handling CI / install (push) Skipped
Serverlibrary CI / test-serverlibrary (pull_request) Successful in 10s
Serverlibrary CI / lint-serverlibrary (pull_request) Successful in 5s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
2026-11-20 18:05:41 +01:00
Lucas Vivo c92987736f ci(ffmpeg_handling): add cicd test, lint and buld and deploy for ffmpeg handling
Serverlibrary CI / test-serverlibrary (push) Successful in 9s
Serverlibrary CI / lint-serverlibrary (push) Successful in 5s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 19s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (push) Skipped
FFmpeg Handling CI / build (push) Successful in 26s
FFmpeg Handling CI / test (push) Successful in 50s
FFmpeg Handling CI / lint (push) Successful in 8s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
FFmpeg Handling CI / install (push) Skipped
2026-11-20 18:00:00 +01:00
Lucas Vivo 96e06bb223 chore(ffmpeg_handling): project files 2026-11-20 17:59:34 +01:00
Lucas Vivo 7d5494243f test(ffmpeg_handling): add test commands for ffmpeg_handler 2026-11-20 17:59:11 +01:00
Lucas Vivo 74519f62d7 fix(ffmpeg_handling): remove test cmd, ensure args.input is Path 2026-11-20 17:58:40 +01:00
Lucas Vivo e4263dd19b feat(ffmpeg_handling): move and split ffmpeg_handling
split the script in modules:
audio_, metadata_ and video_commands for the separate ffmpeg commands
cli for the main input handling and algorithm
helpers for small function as get_codec, etc
switch tu subprocess ffmpeg
2026-11-20 17:28:52 +01:00
Lucas Vivo 145242ebcc chore(ffmpeg_handling): add project files for ffmpeg_hanler 2026-11-20 17:26:21 +01:00
lucas ed4c6253ea Merge pull request 'chore(wallpaper_changer): bump version to 0.1.2' (#1) from dev into main
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
Wallpaper Changer CI / build (push) Successful in 46s
Wallpaper Changer CI / install (push) Successful in 4s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 6s
Reviewed-on: #1
2026-11-20 16:43:26 +01:00
Lucas Vivo d40d4368b1 chore(wallpaper_changer): bump version to 0.1.2
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 19s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
2026-11-20 16:38:59 +01:00
Lucas Vivo 896fbab32d ci(wallpaper_changer): diagnose install
Serverlibrary CI / test-serverlibrary (push) Successful in 14s
Serverlibrary CI / lint-serverlibrary (push) Successful in 7s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 20s
Wallpaper Changer CI / build (push) Successful in 47s
Wallpaper Changer CI / install (push) Successful in 4s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
2026-11-20 16:33:49 +01:00
Lucas Vivo a7c8a6641e ci(wallpaper_changer): run tests on dev and build and install on main
Serverlibrary CI / test-serverlibrary (push) Successful in 23s
Serverlibrary CI / lint-serverlibrary (push) Successful in 5s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 18s
Wallpaper Changer CI / build (push) Successful in 45s
Wallpaper Changer CI / install (push) Canceled after 3m40s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
2026-11-20 16:26:35 +01:00
Lucas Vivo b327399efa test(CICD):
Serverlibrary CI / test-serverlibrary (push) Successful in 10s
Serverlibrary CI / lint-serverlibrary (push) Successful in 7s
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 24s
Wallpaper Changer CI / build (push) Successful in 45s
Wallpaper Changer CI / install (push) Canceled after 1m7s
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
asd
2026-11-20 16:16:13 +01:00
Lucas Vivo a575fd8586 ci(wallpaper_changer): fix service deployment
Serverlibrary CI / test-serverlibrary (push) Successful in 10s
Serverlibrary CI / lint-serverlibrary (push) Successful in 5s
Wallpaper Changer CI / test-wallpaper-changer (push) Failing after 18s
Wallpaper Changer CI / build (push) Skipped
Wallpaper Changer CI / install (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 6s
2026-11-20 16:16:06 +01:00
Lucas Vivo 90fe1ae01f fix(wallpaper_changer): remove icon from system service
Wallpaper Changer CI / test-wallpaper-changer (push) Successful in 18s
Wallpaper Changer CI / build (push) Successful in 1m1s
Wallpaper Changer CI / install (push) Skipped
Wallpaper Changer CI / lint-wallpaper-changer (push) Successful in 5s
2026-11-20 16:03:15 +01:00
Lucas Vivo 1e3b3ea62d ci(wallpaper_changer): add service installation 2026-11-20 15:58:06 +01:00
Lucas Vivo 5f0de3e4cf ci(CICD): simplify CICD install trigger for wallpaper_changer 2026-11-20 15:58:06 +01:00
Lucas Vivo 58d03c3ce2 chore(wallpaper_changer): add project files 2026-11-20 15:58:06 +01:00
Lucas Vivo e972f8b0ec feat(wallpaper_changer): move main.py into src dir 2026-11-20 15:58:06 +01:00
Lucas Vivo f2a70dca82 chore(wallpaper_changer): readme 2026-11-20 15:58:06 +01:00
Lucas Vivo c65e9b2e5e chore(wallpaper_changer): set correct path in desktop app 2026-11-20 15:58:06 +01:00
Lucas Vivo ea5216cf0a chore(wallpaper_changer): change serverlibrary to workspace library 2026-11-20 15:58:06 +01:00
Lucas Vivo cdd7ebdb9f ci(wallpaper_changer): run CICD on changes in wallpaper_changer dir
asd
2026-11-20 15:58:06 +01:00
Lucas Vivo 20109e7edf ci(wallpaper_changer): add install workflow 2026-11-20 15:58:06 +01:00
Lucas Vivo c7ea308c19 test(wallpaper_manager): test encryption and config 2026-11-20 15:58:06 +01:00
Lucas Vivo d6a828bb2e feat(wallpaper_changer): change private key name and handling of RSA header 2026-11-20 15:58:06 +01:00
Lucas Vivo 2fded74b59 fix(wallpaper_changer): daemon load config mode during operation 2026-11-20 15:58:06 +01:00
Lucas Vivo cb37ee9275 chore(wallpaper_changer): adapt build command 2026-11-20 15:58:06 +01:00
Lucas Vivo e5fd0dd82a test(wallpaper_changer): test missing New folder 2026-11-20 15:58:06 +01:00
Lucas Vivo ad6a853771 fix(wallpaper_changer): create missing New folder 2026-11-20 15:58:05 +01:00
Lucas Vivo 26f387865c chore(wallpaper_changer): move desktop application files 2026-11-20 15:58:05 +01:00
Lucas Vivo 2e8f47ab86 feat(wallaper_changer): add minimal kotlin example 2026-11-20 15:58:05 +01:00
Lucas Vivo f6e2d4a1cd ci(CICD): remove wallpaper_changer from serverlibrary CICD 2026-11-20 15:58:05 +01:00
Lucas Vivo c9a4d7f0c3 chore(wallapper_changer): move testfiles 2026-11-20 15:58:05 +01:00
Lucas Vivo 6ac508745c chore(wallpaper_changer): move python file to subdir 2026-11-20 15:58:05 +01:00
Lucas Vivo f2d5311719 build(CICD): split CICD in 2 files for serverlibrary and wallpaper_changer 2026-11-20 15:58:05 +01:00
Lucas Vivo 9ae7083992 test(serverlibrary): test serverlibrary 2026-11-20 15:58:05 +01:00
Lucas Vivo 082bca7828 feat(serverlibrary): add option to trunctate logfiles 2026-11-20 15:58:05 +01:00
Lucas Vivo 359f64df8e test(immich_api): test immich_api 2026-11-20 15:58:05 +01:00
Lucas Vivo d28185b387 chore(immich_api): add pyproject files 2026-11-20 15:58:05 +01:00
Lucas Vivo e7577de379 feat(immich_api): add asset duplicate handling
add function to find duplicates
add function to add all duplicates of a folder to an album and delete
original duplicates
add function to delete duplicates in one folder
2026-11-20 15:58:05 +01:00
Lucas Vivo 87ebf3bd66 feat(wallpaper_changer): update deamon minutes from config file 2026-11-20 15:58:05 +01:00
Lucas Vivo 118b73fda2 ci(CICD): add path filter 2026-11-20 15:58:04 +01:00
Lucas Vivo 5249a6916d chore(ffmpeg_handling): move ffmpeg_handling script and testfiles 2026-11-20 15:58:04 +01:00
Lucas Vivo 30dfc6fa53 chore(audiobook_metadata): move audiobook scripts 2026-11-20 15:58:04 +01:00
Lucas Vivo bc26e4dbb0 test(wallpaper_manager): test daemon 2026-11-20 15:58:04 +01:00
Lucas Vivo 0c3830c8f3 feat(wallpaper_changer): deamon, only update search terms between runs 2026-11-20 15:58:04 +01:00
Lucas Vivo c2507707aa chore(wallpaper_changer): add pyinstaller, pytest 2026-11-20 15:58:04 +01:00
Lucas Vivo 44e9f47185 test(wallpaper_changer): add daemon tests 2026-11-20 15:58:04 +01:00
Lucas Vivo 8591d15f48 feat(wallpaper_changer): use wpD.conf for daemon, read config during daemon wait 2026-11-20 15:58:04 +01:00
lucas 89eb301664 chore(backup_docker): listenarr-exporter python draft 2026-11-20 15:58:04 +01:00
lucas 1a2f3ddf88 chore(backup_docker): remove smtp from diun 2026-11-20 15:58:04 +01:00
lucas 5a83f8fe40 chore(backup_docker): backup exportfs, crontab, fstab 2026-11-20 15:58:04 +01:00
lucas 725ee08897 chore(backup_docker): fix: add GPU dev to jellyfin 2026-11-20 15:58:04 +01:00
lucas 4fbc6f1c90 chore(backup_docker): separate sonarr-en/de, remove rundfunkarr-at - use local build for de, stop cleanuparr 2026-11-20 15:58:04 +01:00
lucas f5b580c870 chore(backup_docker): add ollama, immich to nginx, immich power tools 2026-11-20 15:58:04 +01:00
lucas a85f5d90c1 chore(backup_docker): add gitea runner 2026-11-20 15:58:04 +01:00
lucas ecc053bd0a chore(backup_docker): remove arr-exporter, add quiethost diun and crowdsec to prometheus 2026-11-20 15:58:04 +01:00
lucas b29bade385 feat(post_install_script): add vivohost wifi fix and sudoers shutwon 2026-11-20 15:58:04 +01:00
Lucas Vivo dcddaf0f79 chore(wallpaper_changer): add wallpaper_changer service file 2026-11-20 15:58:04 +01:00
Lucas Vivo db4a293a6d test(wallpaper_changer): test config 2026-11-20 15:58:04 +01:00
Lucas Vivo ba5fbac806 feat(wallpaper_changer): clear -x from wp.conf
add method to config moule to clear -x from general config file
2026-11-20 15:58:04 +01:00
Lucas Vivo 07da497eed ci(CICD): add pyinstaller build for binary 2026-11-20 15:58:04 +01:00
Lucas Vivo 060f429282 ci(CICD): add missing working_dir, add build module, change artifacts to gitea compatible ones 2026-11-20 15:58:04 +01:00
Lucas Vivo 0989ced202 test(wallapaper_changer): test daemon and wallpaper_changer 2026-11-20 15:58:04 +01:00
Lucas Vivo 15a1fddab3 feat(wallpaper_changer): add daemon mode
move several args variables to config
add Wallpaper_changer module with change_wallpaper func
add daemon module calling change_wallpaper in a loop
2026-11-20 15:58:04 +01:00
Lucas Vivo 23ad42d2b2 ci(CICD): add separate linters, build wallpaperchanger 2026-11-20 15:58:04 +01:00
lucas 045a33d324 chore(docker_backup): quiethost new crontab, diun, fstab, ollama, node-exporter
first backup on quiethost
2026-11-20 15:58:04 +01:00
lucas ea620151e9 fix(backup_docker): add check for exports file 2026-11-20 15:58:04 +01:00
Lucas Vivo 0a691c49f6 chore(wallpaper_changer): add test asset 2026-11-20 15:58:04 +01:00
Lucas Vivo 048654f238 test(wallpaper_manager): all tests done
added image_repository tests
moved decode_all test to iamge_repository
2026-11-20 15:58:04 +01:00
Lucas Vivo 6743772c33 feat(wallpaper_changer): decode_all should decode lonley jpg_enc with default name 2026-11-20 15:58:04 +01:00
Lucas Vivo 6db5fb528e style(wallpaper_changer): refactoring and default values 2026-11-20 15:58:04 +01:00
Lucas Vivo 4792a47c25 fix(wallpaper_changer): main would trigger encryption on any folder argument
it should only encrypt with mode != default
2026-11-20 15:58:04 +01:00
Lucas Vivo 8136a9c3af chore(qbittorrent_api): launch json 2026-11-20 15:58:04 +01:00
Lucas Vivo cc4b092a08 style(audiobooks_library): ruff changes 2026-11-20 15:58:04 +01:00
Lucas Vivo 06f290e99a style(torrent_scripts): ruff changes 2026-11-20 15:58:04 +01:00
Lucas Vivo 9b4bf7422a style(wallpaper_changer): ruff auto changes 2026-11-20 15:58:04 +01:00
Lucas Vivo 9f73b601e8 test(wallpaper_changer): add config, wallpaper_builder, wallpaper_setter test cases 2026-11-20 15:58:04 +01:00
Lucas Vivo e079a08d14 feat(wallpaper_changer): remove DOUBLE as identifier for duplcate filenames
available_path() function also continues numbering
2026-11-20 15:58:04 +01:00
Lucas Vivo 49fbc0a6ad feat(wallpaper_changer): add CUstomArgPArser to raise ValueError on false argument 2026-11-20 15:58:04 +01:00
Lucas Vivo 1667362b9d style(wallpaper_changer): ruff auto fix 2026-11-20 15:58:04 +01:00
Lucas Vivo 79b3bdd91f chore(wallpaper_changer): ruff settings 2026-11-20 15:58:04 +01:00
Lucas Vivo e67dc91cc8 style(serverlibrary): fix permissions and shebang
asd
2026-11-20 15:58:04 +01:00
Lucas Vivo 9f18d2975d style(wallpaper_changer): ruff auto fix 2026-11-20 15:58:04 +01:00
Lucas Vivo be3e96b90f fix(serverlibrary): add shebangä 2026-11-20 15:58:04 +01:00
Lucas Vivo c5c293d7dc fix(serverlibrary): switch to unittest 2026-11-20 15:58:04 +01:00
Lucas Vivo e9fb04cefe fix(serverlibrary): remove pytest module 2026-11-20 15:58:04 +01:00
Lucas Vivo 44957441b5 ci(CICD): add linter job 2026-11-20 15:58:04 +01:00
Lucas Vivo 50467b8565 test(wallpaper_changer): remove test requiring physical monitor 2026-11-20 15:58:04 +01:00
Lucas Vivo 56d988faa3 ci(CICD): add serverlibrary tests 2026-11-20 15:58:04 +01:00
Lucas Vivo f14cd89d7c test(wallpaper_changer): remove test description 2026-11-20 15:58:04 +01:00
Lucas Vivo d3561978fe test(wallpaper_changer): test behaviour for duplicate hashs 2026-11-20 15:58:04 +01:00
Lucas Vivo dcbf8c8be0 fix(wallaper_changer): remove hostname 2026-11-20 15:58:04 +01:00
Lucas Vivo 5223bf030f test(serverlibrary): add unit tests for serverlibrary 2026-11-20 15:58:04 +01:00
Lucas Vivo 3db65acf60 ci(CICD): add group test to pip install 2026-11-20 15:58:04 +01:00
Lucas Vivo ad00c3c0f3 fix(serverlibrary): fix logfile path 2026-11-20 15:58:04 +01:00
Lucas Vivo e37cf79883 fix(serverlibrary): fix home dir for logfile 2026-11-20 15:58:04 +01:00
Lucas Vivo 009e43382d ci(CICD): explicitly install serverlibrary and wallapper_changer 2026-11-20 15:58:04 +01:00
Lucas Vivo b511ea636e ci(CICD): change to image with python and nodejs 2026-11-20 15:57:57 +01:00
Lucas Vivo 33a3cf036b ci(CICD): create workflow for wallpaper_changer 2026-11-20 15:57:48 +01:00
Lucas Vivo 5bb4a20da2 ci(CICD): wallpaper_changer CICD test
create ci.yaml under .gitea/workflows
2026-11-20 15:57:40 +01:00
Lucas Vivo 69b39940b0 test(wallaper_changer): add tests modules
add tests for monitor_manager, wallpaper_builder, encryption_manager,
walpaper_Setter
2026-11-16 19:48:08 +01:00
Lucas Vivo 8669499c36 chore(wallpaper_changer): test assets: move image files to folder, add monitor.xml files 2026-11-16 19:48:08 +01:00
Lucas Vivo 9ddb167eb3 feat(wallpaper_changer): remove hosts, add cfg for headless mode and monitor file 2026-11-16 19:48:08 +01:00
Lucas Vivo 3c21820b3a chore(wallpaper_changer): add dependency for tests to test group 2026-11-16 19:48:08 +01:00
Lucas Vivo 2c7fe68b33 faet(wallaper_changer): filp ratio to with/height, add lid_state check, create parser functions
parse_monitor_config parses monitors.xml file and returns config struct
grm_to_gnome function tranlates card names
remove hostnames from algorithm
lid_state is processed by _connected_drm_connectors
2026-11-16 19:48:08 +01:00
Lucas Vivo 7ac877f018 feat(wallpaper_changer): replace shorter filenames of same hash, add raise error
raise error if naming table is missing
raise error if check_encription finds no folder
duplcate hashes take the longer filename from new image
2026-11-16 19:48:08 +01:00
Lucas Vivo 152a095f51 feat(wallpaper_changer): remove hostname, add headless and monitor_file to config
set default monitor_file
transfer headless arg to config struct
2026-11-16 19:48:08 +01:00
Lucas Vivo 9373e23592 feat(wallpaper_changer): add argument for monitor search term, remove old monitor cfg
remove cfg number for monitor file, headless move requires normal
monitors.xml
2026-11-16 19:48:08 +01:00
Lucas Vivo 37014ac829 feat(wallpaper_changer): add search term for monitor and general search
monitor search term: one tem per monitor
gen search term_ multiple terms all filtering the same image
2026-11-16 19:48:08 +01:00
Lucas Vivo 69234da7cf style(wallpaper_changer): organize import 2026-11-16 19:48:08 +01:00
Lucas Vivo 1aeccb7b82 fix(configure_idexers): fix regex
unintentional pipe | caused all indexers to be routet private qbit
2026-11-16 19:48:08 +01:00
Lucas Vivo b76155f96d feat(post_install): add wifi device changes for vivohost to stop network stalls 2026-11-16 19:48:08 +01:00
lucas 692ab8c6d8 chore(gitignore): add wg0.conf 2026-11-16 19:48:08 +01:00
lucas 78d32e3219 chore(backup_docker): move specialt torrent mountpoint, add fstab and exports 2026-11-16 19:48:08 +01:00
lucas 09752d64ad feat(backup_docker): add fstab and exportfs 2026-11-16 19:48:08 +01:00
Lucas Vivo 25bf86a8ec chore(wallpaper_changer): add numpy and correct venv path 2026-11-16 19:48:08 +01:00
Lucas Vivo 3a50a94c17 feat(wallpaper_changer): image_repository, correct number series not starting with 1 2026-11-16 19:48:08 +01:00
Lucas Vivo 27f5dc644f feat(wallpaper_changer): wallpaper builder distinguish between left/right in image name
center images with left in their name from their left corner
center images with right in their name from their center
2026-11-16 19:48:08 +01:00
Lucas Vivo 5d5ca4a6d6 fix(wallpaper_changer): wallpaper bulder use correct dir, return image list 2026-11-16 19:48:08 +01:00
Lucas Vivo db1995c7b9 chore(wallpaper_changer): bump version to 0.1.1 2026-11-16 19:48:08 +01:00
Lucas Vivo ce7da99296 style(wallpaper_changer): fix Ruff linting and formatting issues
fix declarations to acommodate None
organize imports
fix with indents
2026-11-16 19:48:08 +01:00
Lucas Vivo 5daa680948 chore(gitignore): add kilo to gitignore 2026-11-16 19:48:08 +01:00
Lucas Vivo 8c48239b77 feat(wallpaper_changer): move parser to module
move argparse to its own module
add options for print/encrypt/decrypt Namingtable, decode images/all
add conf_dir, private_key parameters
2026-11-16 19:48:07 +01:00
Lucas Vivo 4481664c0b test(wallpaper_changer): test image repository
test check_encryption
test convert_to_jpg
test scan folders
test decode_all
test decode_images
2026-11-16 19:48:07 +01:00
Lucas Vivo 6fb22a7582 test(wallpaper_changer): run config tests
check if conf file is written and read
check if cfg struct is set correctls
check correct private key
test versioning
2026-11-16 19:48:07 +01:00
Lucas Vivo 74c66ec88f test(wallpaper_changer): run unit and integration tests, integration test dir 2026-11-16 19:48:07 +01:00
Lucas Vivo 8801ee5153 feat(wallpaper_changer): add image hash, use conf_dir, scan dir parameter, move to src
add FileInfo class to store hash
use conf_dir instead of ~/Wallpaper
scan: opt scan dir as parameter
encode directly in confdir/New
skip adding images with same hash
add images with same name, change number only
add decode_image function to chack hash after decoding
2026-11-16 19:48:07 +01:00
Lucas Vivo 807d03f808 feat(wallpaper_changer): add image hash, move to src
decode and leave: decrypt file instead of saving loaded image
add conf_dir instead of ~/Wallpaper
add decode_image function instead of decrypting directly
2026-11-16 19:48:07 +01:00
Lucas Vivo 24292a3d01 feat(wallpaper_changer): add logging, move to src
move file to sorc dir
add logging for all modules
2026-11-13 10:48:03 +01:00
Lucas Vivo 057f3101bf feat(wallpaper_changer): add FileInfo class, remove overloading of decript func, move to src
add FIleInfo class for naming_table entries
remove overloading of decrypt function, return None instead
2026-11-13 10:46:07 +01:00
Lucas Vivo ba81e01fee feat(wallpaper_changer): ignore hostname in config, set conf dir from argument, move to src
extra parameters for wallpaper_dir, conf_dir and private key
move file to new src dir
2026-11-13 10:46:07 +01:00
Lucas Vivo 2dc2483c04 feat(wallpaper_changer): argparse: add version, config_dir, temp_dir(wallpapers), move to src
add mode which determines wallpaper folder
add conf_dir where wallpaper/wp.conf etc are located
move all files to new src dir
2026-11-13 10:46:07 +01:00
Lucas Vivo f8aa8a73d1 chore(wallpaper_changer): delete unneeded modules, move init to src
move deamon file
2026-11-13 10:46:07 +01:00
Lucas Vivo 4d8d20c6d9 chore(wallpaper_changer): test assets
private key for testing
images for testing
2026-11-13 10:37:10 +01:00
Lucas Vivo d09706f3be chore(wallpaper_changer): project documents 2026-11-13 10:36:35 +01:00
Lucas Vivo 3aa90fa629 chore(wallpaper_changer): add vscode project settings 2026-11-13 10:35:59 +01:00
Lucas Vivo f5c794e9f5 fix(wallpaper_changer): add wallpaper_changer as member to pyproject 2026-11-13 10:35:33 +01:00
Lucas Vivo db4778811f fix(serverlibrary): add correct dependencies to pyproject 2026-11-13 10:35:04 +01:00
Lucas Vivo def77826ba feat(configure_indexers): add PL and GoldenGate 2026-11-13 10:33:40 +01:00
Lucas Vivo dc0609480f feat(bash_aliases): add WC alias for python executable and script 2026-11-13 10:33:01 +01:00
lucas 08171bf2fb feat(docker_compose): mediahost nfs, update backup for py,remove old copy torrent_complete scripts 2026-11-09 20:40:46 +01:00
lucas 6c06998788 feat(torrent_qbittorrent): move torrent scripts to docker backup
change torrent scp to mediahost to cp to nfs directory
2026-11-09 20:40:46 +01:00
lucas 419d6ed784 chore(ffmpeg_handling): formatting changes 2026-11-09 20:16:32 +01:00
lucas a3f818f601 fix(ffmpeg_handling): change folder handling and overwrite function
get video files from fideo_files() function
choose correct filenames fi suffix changes for overwrite
overwrite files for convert-av ffmpeg
2026-11-09 20:16:32 +01:00
lucas 079915ee49 feat(post_install_script): add nfs for serverhost and mediahost 2026-11-09 20:16:32 +01:00
lucas 371faab2d9 feat(serverlibrary): add logging to safe_delete, style changes 2026-11-09 20:16:32 +01:00
Lucas Vivo 04ac7f9ff7 chore(code-workspace): add a workspace folder for every bash/python folder 2026-11-09 20:09:41 +01:00
Lucas Vivo 968d007954 feat(wallpaper-changer.py): add modular Python port
Introduce a Python CLI for selecting, processing, and setting
wallpapers,
including encrypted image and naming-table workflows, monitor-aware
image
composition, search and exclusion filters, and migration and usage
notes.

Module guide:
- main.py: validates command combinations and coordinates configuration,
  encryption commands, image processing, monitor detection, wallpaper
  composition, and GNOME wallpaper setting.
- wallpaper_changer/__init__.py: marks the application package.
- wallpaper_changer/argument_parser.py: defines CLI options and merges
  command-line arguments with arguments loaded from the config file.
- wallpaper_changer/config.py: loads host-specific image, wallpaper, and
  private-key settings.
- wallpaper_changer/encryption_manager.py: reads and writes legacy
OpenSSL
  encrypted files and loads, stores, encrypts, or decrypts naming
tables.
- wallpaper_changer/image_repository.py: scans and converts images,
manages
  encrypted images and naming-table entries, and handles image decoding
and  sequential filename correction.
- wallpaper_changer/logging_utils.py: configures and retrieves the
project's custom logger.
- wallpaper_changer/monitor_manager.py: discovers monitor layouts from
DRM data or host configuration files.
- wallpaper_changer/naming_table.py: loads legacy plaintext naming-table
entries.
- wallpaper_changer/wallpaper_builder.py: filters and selects images,
decrypts as needed, and composes a labeled multi-monitor wallpaper.
- wallpaper_changer/wallpaper_setter.py: sets GNOME background settings
using gsettings.
2026-11-09 20:09:12 +01:00
Lucas Vivo 0bc0b53ed1 feat(wallpaper-changer.sh): change default image format to jpg
Add image-to-JPEG conversion
change image format to jpg everywhere
update getimageAR function to handle jpg
2026-11-09 20:09:12 +01:00
Lucas Vivo 0c8f33559d feat(fix_filenames): Separate Words in filenames not separated by special char 2026-11-09 20:09:12 +01:00
Lucas Vivo d3410521bd chore(configure_idexers): add prowlarr 2026-11-09 20:09:12 +01:00
Lucas Vivo 492a2f0d5d fix(lazygit): add filename to edit - editor 2026-11-09 20:09:12 +01:00
Lucas Vivo 2670e46526 feat(resize_images): add png support and add argument for target directory 2026-11-09 20:09:12 +01:00
lucas edae754aa4 feat(bash_aliases): add rmf alias for rm 2026-11-08 08:33:46 +01:00
lucas 98c687ea9e fix(profile_motd): remove padding from hour string 2026-11-08 08:33:46 +01:00
lucas b6a2908b48 fix(torrent_complete): log category of arr torrents 2026-11-08 08:33:46 +01:00
Lucas Vivo 5ca383e0da feat(ffmpeg_handling): convert all files with suffix to new_suffix
change convert-av to subprocess
add test file for .avi
2026-11-05 14:54:40 +01:00
lucas 3470e24c82 fix(ffmpeg_handling): add parser to parser_add_loglevel function 2026-11-05 13:54:15 +01:00
Lucas Vivo f55b671ba3 fix(immich_auto_album): fix venv location in shebang 2026-11-05 13:53:40 +01:00
Lucas Vivo 7c6c9e6f58 feat(ffmpeg_handling): add suffix for convert-av 2026-11-05 13:53:40 +01:00
lucas cfe2ae0c9d feat(sonarr_database): creata arg match_threshold
continue loop in recheck episodes if names are the same
2026-11-05 10:33:06 +01:00
lucas d0731ef2b0 feat(post_install_script): add trash-cli, move to post_install_script 2026-11-05 10:31:53 +01:00
lucas 7404473a60 feat(immich_dropfolder_sync): sync Nextcloud Dropfolder to immich ext library 2026-11-05 10:30:54 +01:00
lucas 6268fca868 feat(searc_image_duplcates): loof for hash of image A in search_dir 2026-11-05 10:30:25 +01:00
lucas c24a20cbf6 chore(profile_motd): new profile motd script
reformat network print
reformat memory print
update bashrc
2026-11-04 11:31:59 +01:00
lucas 745503a1ab chore(profile_motd): new profile motd script
reformat network print
reformat memory print
2026-11-04 11:29:20 +01:00
lucas 266cfd5bf9 feat(bash_aliases): update bash aliases to new host structure 2026-11-04 11:29:20 +01:00
lucas 3dbdda0472 fix(sonarr_database): remove recall_jaccard
with recall jaccard title like "Der Strand" and "Surfing Hippos – Der
Strand der Dschungeltiere" give a false positive match
create match group dict for episode title
2026-11-04 08:31:20 +01:00
lucas f3a1ca0842 feat(audiobook_library): improve logging, add actions variable to choose what metadata to fix 2026-11-04 07:53:28 +01:00
lucas 5a397e482c chore(immich): move all images to immich dir, adapt backup, remove sync script 2026-11-04 07:52:49 +01:00
Lucas Vivo 373030ae74 feat(configure_indexers): add sonarr-en instance to configure_indexers 2026-11-04 07:50:44 +01:00
Lucas Vivo f0c651691e feat(sonarr_database): add recheck_current_episodes function
use title matching to find episode number of already matched episodes
2026-11-04 07:50:44 +01:00
Lucas Vivo 64a94c865c feat(immich): move restore user script to immich api and add find duplicate people function 2026-11-04 07:50:44 +01:00
Lucas Vivo 033ada3924 feat(audiobook_library): add AudiobookshelfApi client and function to trigger metadata embedding for ids 2026-11-04 07:50:44 +01:00
lucas 836d8351b8 feat(node_exporter): add reboot required flag 2026-11-03 20:23:38 +01:00
Lucas Vivo 2994ffcc52 feat(immich): add immich-folder-album script,add restore user script
github: create albums from immich ext library folders
restore deleted user script
2026-11-02 14:25:06 +01:00
Lucas Vivo 408293d866 feat(serverlibrary): add log-level parser function to serverlibrary 2026-11-02 14:20:55 +01:00
Lucas Vivo aff23eae88 feat(configure_indexers): move to torrent dir and add whisparr 2026-11-02 14:20:55 +01:00
lucas 68819a3fce feat(smartd.conf): change runtime of short test to daily 17:00 and long 1dom 1:00 2026-11-01 16:57:11 +01:00
Lucas Vivo eb3d4a71f8 fix(audiobook_library): fix genres variable for database fix_genres 2026-11-01 15:52:10 +01:00
Lucas Vivo b00d8b8249 feat(qbittorrent_api): add support for mult qbittorrent instances 2026-11-01 15:52:10 +01:00
Lucas Vivo 8377e61306 chore(gitconfig): viviohost gitconfig example# 2026-11-01 15:52:10 +01:00
lucas fbddea4ff6 feat(smartmon_grafana_script): add wc lineclounter for apt list --upgradable 2026-11-01 15:30:42 +01:00
lucas 001165c1a6 fix(audiobook_library): split genres on ; and fix ValueError on init 2026-11-01 11:27:09 +01:00
lucas 229e6f9b2b chore(aidiobook_library): pyright formatter and value definition fixes 2026-11-01 10:49:22 +01:00
lucas 3aadb9b700 fix(audiobook_library): discard short matches for authors 2026-11-01 09:47:38 +01:00
Lucas Vivo 2d988203b8 fix(upgrade): remove -it from docker nextcloud update 2026-10-31 20:23:07 +01:00
Lucas Vivo 97b9232cef fix(audiobook_library): use raw ID3 for read/write metadata 2026-10-31 17:37:48 +01:00
lucas 4b42e5915e feat(audiobook_library): opus support for write_metadata 2026-10-31 16:23:50 +01:00
Lucas Vivo 58bc7fb4bb fix(audiobook_library): use mutagen mp4/mp3 split for write/read metadata 2026-10-31 12:21:31 +01:00
Lucas Vivo ab300bfa01 feat(audiobook_library): move file logging 2026-10-31 09:26:58 +01:00
Lucas Vivo 60ab92d5e2 fix(audiobook_library): use mutage mp4 for m4b files 2026-10-31 09:19:17 +01:00
lucas 1a8b65cdb1 style(audiobook_library): auto format from nvim 2026-10-31 09:13:39 +01:00
Lucas Vivo 077c4899a0 feat(audiobook_library): use mutagen instead
add function to fix titles and write title list to files
2026-10-30 15:11:18 +01:00
Lucas Vivo c8b9a25ead feat(audiobook_library): use exiftool instead of kid3 and ffprobe 2026-10-30 13:04:24 +01:00
Lucas Vivo 6d8b2957c6 fix(audiobook_library): only fix series if it differs from current one 2026-10-30 11:46:06 +01:00
Lucas Vivo 517490384f feat(audiobook_library): only write metadata keys that have changed 2026-10-30 11:26:36 +01:00
Lucas Vivo 50a6d786f0 fix(audiobook_library): move path_filter to general library, remove "remove series from name" 2026-10-30 10:27:41 +01:00
Lucas Vivo db350414d4 feat(ffmpeg_handling): move tag function and SUFFIX array to serverlibrary 2026-10-30 10:27:41 +01:00
Lucas Vivo 0272366480 feat(bash_aliases): add low priority copy 2026-10-30 10:27:41 +01:00
Lucas Vivo d99ad7b966 feat(audiobook_library): sorting key, normalize names
new sorting key to extract track numbers
get codec from audio file
normalize album name to remove brackets and series name
create book dir from metadata
load all tables into database object
2026-10-30 10:27:41 +01:00
lucas 1b6d39037c feat(diun): add metrics for diun 2026-10-30 10:27:41 +01:00
lucas 6f6bae9a55 fix(upgrade): repair qbittorrent find latest image 2026-10-30 10:27:41 +01:00
lucas 8268b69004 feat(wg-randomize): rotate qbittorrent-public gluetun VPN config
crontab entry for randomize script and docker restart
vpn config file
use Dockerfile to install scp
2026-10-30 10:27:41 +01:00
Lucas Vivo e571fdc729 feat(audiobook_library): functional write_metadata, create_m4b
shebang python venv
get all metadata tags
kid3 command corrections, add "" to fields
sort self.files
add changed flag to fix_... cmds
fix series numbering
2026-10-30 10:27:41 +01:00
Lucas Vivo 8fb3d4d3b9 feat(serverlibrary): add logfiles without datetime to setup_loging 2026-10-30 10:27:41 +01:00
lucas 11027fa9dc refactor(serverlibrary): move suffixes to library
move audio/video suffixes to serverlibrary
remove from audiobooks_library, ffmpeg_handling
2026-10-30 10:27:41 +01:00
lucas 38736bb6b5 feat(sonarr_database_tool): working translation and extra_episodes functions
get last update time of tvdb/tmdb
get_tvdb_by_tmdb_id
add the same dict keys for both databases
lookup episodes in german for foreign language media
2026-10-29 09:01:15 +01:00
lucas 3df29a6da6 chore(pyrightconfig): library defintition for nvim pyright 2026-10-29 08:58:42 +01:00
lucas 6cf309b454 refactor(serverlibrary): move suffixes to library
move audio/video suffixes to serverlibrary
2026-10-29 08:58:10 +01:00
lucas 73d6dc947b feat(rotate_logs): add a function to cleanup log dir
trunctuate big files
rotate log groups
remove old files
2026-10-29 08:56:01 +01:00
lucas e8a0b2daf9 fix(ffmpeg_handling): remove word boundaries \b from translation function 2026-10-27 19:56:35 +01:00
Lucas Vivo 2bea411e45 feat(sonarr_database_tool): add tvdb and tmdb fucntions
add functions from tmdb and tvdb script
rename match_series file to sonarr_database_tool
2026-10-27 19:53:41 +01:00
Lucas Vivo 0b020ab4ae feat(audiobookss_library): add new logger format 2026-10-27 19:49:14 +01:00
lucas 7c50f30ad1 feat(ffmpeg_handling): dictonary expansion, change russ search function
generate search function from translation keys
dont require perfect match for translation
expand vocabulary
2026-10-27 19:45:26 +01:00
lucas 540a837052 config(docker_compose): add diun metrics to prometheus and grafana 2026-10-27 19:45:26 +01:00
Lucas Vivo 89d2049288 chore(git): remove media files .gitignore 2026-10-27 16:40:38 +01:00
lucas 995939d73b fix(sonar_translation): add new logging 2026-10-27 16:38:50 +01:00
Lucas Vivo 6e5f0ca0d0 feat(ffmpeg_handling): add only_russian testfile 2026-10-27 13:52:14 +01:00
lucas a41b5c837f config(docker compose): add local rundfunkarr-at, unpackerr config, gitea bidy_size fix
add local rundfunkarr from git fork
update unpackerr dafult config(generated at docker compose up)
reverse proxy change: client_max_body_size 10G to transfer larger files
to gitea
2026-10-27 10:00:25 +01:00
Lucas Vivo 5ae7a8cd7f feat(ffmpeg_handling): remove subs with remove_russian
add remove stream function
change remove audio and remove subs to use this function
fix: show_metadata returns default values and return_tags is given as
parameter
2026-10-27 09:48:06 +01:00
Lucas Vivo 6f4dbfeb61 faet(serverlibrary): add colorlog to custom logger
import colorlog and change formatter for console
no change needed in client
2026-10-27 09:46:01 +01:00
Lucas Vivo 75267aad49 fix(ffmpeg_handling): fix return value for remove russian only files 2026-10-27 08:23:09 +01:00
Lucas Vivo 68ab26a509 fix(serverlibrary): correct file structure agian
serverlibrary/
├── pyproject.toml
└── src/
└── serverlibrary/
├── __init__.py
└── core.py

add src location to pyproject
2026-10-27 07:58:36 +01:00
lucas 163319b1cf feat(rename_camera_folder): restructuring, add path to subprocess 2026-10-26 18:56:40 +01:00
lucas 8fc0b60838 fix(match_series_to_tvdb): add new logging from serverlibrary, move files to series folder 2026-10-26 18:55:56 +01:00
lucas af2f942465 feat(syncNC): waiting function for psgrep nextcloud
wait 3x20s for nextcloudcmds to finish before exiting
2026-10-26 18:55:04 +01:00
lucas 62b73656e6 fix(serverlibrary): fix package structure
structure needs to be:
serverlibrary/
├── pyproject.toml
└── serverlibrary/
    ├── __init__.py
    └── core.py
2026-10-26 18:54:09 +01:00
lucas 44c2f16c97 fix(upgrade.sh): fix local qbittorrent case query 2026-10-26 14:56:30 +01:00
lucas 8c2541fb34 fix(ffmpeg handling): add language tag to is russian identification 2026-10-26 13:00:58 +01:00
Lucas Vivo 942bd7c1f7 feat(ffmpeg handling): add return value for cmd_ function if files need to be moved 2026-10-26 10:22:06 +01:00
lucas c81d160d5c fix(ffmpeg handling): add translation, revise logging
add more translations
add setup logging function for file and stdout logger
combine translation functions: translate_audio_tracks,
translate_audio_descriptions
formatting changes
fix move_override function
2026-10-26 09:44:05 +01:00
Lucas Vivo 45aed47f03 fix(ffmpeg handling): revise argparser, ffprobe requres string
add add_command function
one shared parent parser

fix(ffmpeg handling): ffprobe requres string not path

fix(ffmpeg handling): unify no output return string
2026-10-25 19:16:27 +01:00
Lucas Vivo 4708d6a138 transefer LOG vars to serverlib# 2026-10-25 18:33:03 +01:00
Lucas Vivo 7bbedc8549 ffmpeg handling: change directory handling for remove russian audio
change directory handling for remove-russian to default
use Path everywhere
transfer LOG vars to serverlibrary
2026-10-25 18:32:51 +01:00
Lucas Vivo 1a99bd631f check in test files for ffmpeg 2026-10-25 14:31:50 +01:00
Lucas Vivo 6c61138a5e ffmpeg handling remove russian subs
remove subtitle removal for russian media
2026-10-25 14:31:20 +01:00
Lucas Vivo c9ba870bf5 metadata audiobook library
delete old scripts
load metadata from file
clean genre
fix artist/comment/composer/series
read books from database
write books to database
2026-10-25 14:30:05 +01:00
lucas aa01414bd8 match series to tvdb: save series/media and season data 2026-10-25 14:24:05 +01:00
lucas 76983f3783 read torrent seed time and ratio from qbittorrent 2026-10-25 14:23:29 +01:00
lucas 6c1de5f350 remove old serverhost scripts 2026-10-24 20:11:28 +02:00
lucas 2bb2f17746 add qbittorrent custom image upgrade agian 2026-10-24 20:11:11 +02:00
lucas 00768fda2e backup system scripts
backup system via restic
backup dav script, remove unneseccary lines
2026-10-24 15:20:23 +02:00
lucas ae91f3073d fix crontab scripts
exclude database files from immich sync
add docker compose file to certbot renew command
2026-10-24 15:20:23 +02:00
lucas e9ed3ff9ab qbittorrent private/public separation
revert from qbit Dockerfile to startup script
remove custom qbittorrent from upgrade script
2026-10-24 15:20:23 +02:00
lucas a553e51dd7 crontab backup 2026-10-24 15:20:23 +02:00
lucas cfdadfd9aa fix smartd conf error 2026-10-24 15:20:23 +02:00
lucas a6bd1c2d1a syncNC return value, youtubelist path 2026-10-24 15:20:23 +02:00
lucas 07e24ad97e move generateAlina chart 2026-10-24 15:20:23 +02:00
lucas bbc56a9908 unpackerr, qbittorent separation
add unpackerr docker compose
separate qbittorrent into public/private
gluetun DNS issue w rundfunkarr
2026-10-24 15:20:00 +02:00
lucas 7214cfd52b crontab logging and docker command scripts 2026-10-24 15:20:00 +02:00
lucas 58795e9d5e docker container debug info script 2026-10-24 15:20:00 +02:00
lucas d241017c2a match series to tvdb episodes py
adapt serverlibrary
2026-10-24 15:19:17 +02:00
lucas 104b912404 fix syncNC in py scripts 2026-10-24 15:09:59 +02:00
lucas e4ebc3c5b2 remove rename camera sh and add syncNC to py script 2026-10-24 15:09:59 +02:00
lucas 6e369c3656 add qbittorrent to node_exporter 2026-10-24 15:09:37 +02:00
Lucas Vivo 63c34f5387 script: search series on tvdb and rename episodes with season/episode number 2026-10-24 10:51:21 +02:00
Lucas Vivo fcde06e8b6 add tmdb/tvdb get to serverlibrary 2026-10-24 10:51:21 +02:00
Lucas Vivo f54919554b remove tmdb_get from sonar translation script 2026-10-24 10:51:21 +02:00
Lucas Vivo 93a464f49d remove ffmpeg_handling shell script(deprecated) 2026-10-24 10:51:21 +02:00
Lucas Vivo 437c91dc7a fix install_nvim script 2026-10-24 10:51:21 +02:00
lucas 7f27f187d8 update randomize vpn script to get IP from endpoint 2026-10-23 19:42:39 +02:00
Lucas Vivo 073ddf11fc WallpaperChanger add encryptNT
fix paths
add encryptNT function
fix WC in bash_aliases
2026-10-23 17:03:16 +02:00
Lucas Vivo f5d7962aba remove functions from reference_playlists_to_library.py move to serverlibary 2026-10-23 17:02:12 +02:00
Lucas Vivo 0a6457abe0 set download client for all indexers 2026-10-23 17:01:22 +02:00
Lucas Vivo aa27e1f350 ffmpeg handling: move log-level to general parser 2026-10-19 13:38:01 +02:00
Lucas Vivo 59f1bcb5c1 add scripts dir to python path 2026-10-19 13:37:40 +02:00
Lucas Vivo b1c8365bd8 pyproject toml serverlibrary 2026-10-19 13:25:23 +02:00
Lucas Vivo c5cf55fe21 ffmpeg handling py
proper testing for chapters and metadata
remove all russian finction
2026-10-19 13:24:14 +02:00
lucas 99573fb241 adjust docker number 2026-10-18 16:07:16 +00:00
lucas f9d97de61f upgrade.sh remove docker restart
remove unnecessary docker compose up -d if statement
2026-10-18 16:07:16 +00:00
Lucas Vivo d5c82e364d rename folders 2026-10-17 10:17:13 +02:00
Lucas Vivo c192114bcf create WallpaperCHanger desktop icons 2026-10-17 10:17:13 +02:00
lucas 179256de3e docker backup
mediahost crontab for user lucas
mediarr: set lidarr to develpp
install cleanuparr
install readrr/sonarr/lidarr/prowlarr exporter for prometheus
nextcloud: remive nginx hostname from trusted proxies
wireguard: add wg0 conf
2026-10-17 08:06:23 +00:00
lucas 0e52aefa07 move node exporter and backup docker script 2026-10-17 08:03:23 +00:00
Lucas Vivo 95c2f90031 add parallization to metadata_audiobooks_library.py 2026-10-16 22:30:57 +02:00
Lucas Vivo 1dd80d9a45 WallpaperChanger: private key for decryption 2026-10-16 22:05:47 +02:00
Lucas Vivo dc537635bb write metadata to file on m4b creation 2026-10-16 22:05:09 +02:00
Lucas Vivo be012e334b move and adapt wallpaper changer 2026-10-16 20:14:31 +02:00
Lucas Vivo 35c2104852 add create m4b to audiobook library
add find_by path method
ffmetadata_escape, get_chapters
add per file chapter support for create m4b
2026-10-16 17:44:44 +02:00
Lucas Vivo d1e2f8a3e5 assign raw socket access to etherwake 2026-10-16 17:44:44 +02:00
lucas 2eb7b8d6d1 reference all songs in playlist after Lidarr update 2026-10-16 14:01:30 +00:00
lucas 045861ada6 update docker container number 2026-10-16 14:01:07 +00:00
lucas 8ae894ffb6 add tabstop rules to nvim 2026-10-16 14:00:57 +00:00
lucas 208fbd96b4 move move old scripts 2026-10-16 14:00:42 +00:00
lucas 93b262977b remove old scripts 2026-10-16 13:58:47 +00:00
lucas fd91e7d678 python script to reference media files to playlist 2026-10-15 09:42:59 +00:00
lucas 9a476ef5cd move other dir to os_and_install
asd
2026-10-15 09:42:59 +00:00
lucas dbb8eda1e6 install script for serverhost
asd
2026-10-15 11:41:52 +02:00
lucas 2e273985b7 download ubuntu images and keep them current 2026-10-14 20:51:31 +00:00
lucas f7865f05a1 script to reference moved song in playlists 2026-10-14 20:51:31 +00:00
lucas 719c7068e2 smartd.conf add start stop hostname, qbittorrenthost 2026-10-14 17:43:31 +02:00
lucas 580b667119 node exporter: counter corretion for samsung hdd 2026-10-14 17:42:52 +02:00
lucas 3bf1fc1be6 add exportfs config
ads
2026-10-14 07:31:43 +02:00
lucas 7b0b438740 add nextcloud app update to upgrade script 2026-10-13 20:15:03 +02:00
lucas 2eda7cd33e align convert heic with mediahost and new picture sync
asd
2026-10-13 20:15:03 +02:00
lucas efc150d9ce ssh config and hosts
asd
2026-10-13 20:15:03 +02:00
lucas 044fbd81ad working smartmon node exporter script for sd/nvme 2026-10-12 21:54:40 +02:00
lucas 01ab319eea node exporter: add hostname dependent docker count and default value for smartd script 2026-10-12 19:19:15 +00:00
lucas d5e627325d add quiethost to smartd 2026-10-12 20:49:53 +02:00
lucas deaff35bc3 remove raspberry from bash_aliases
add mediahost to wol.sh
2026-10-12 20:40:34 +02:00
lucas 27d570fc5c node exporter script for smartd 2026-10-12 18:39:53 +00:00
lucas d5fb01adb2 docker backup serverhost
add cadvisor to serverhost
change node-exporter to network host to see propper netw traffic
refine torrentscomplete script
2026-10-12 20:10:54 +02:00
lucas 52c02beb3d mediahost docker backup
add gite to shared proxy
add usb dev and NET privilige to HA
add immich image server
remove sonarr-en
add jackett indexer for ABB
add gluetun-proxy for general proxy
add blackbox exporter to check https sites
set node-exporter to network host to see interface traffic
decrease resolution of cadvisor to save RAM
add status and code SANs for nginx
add upstream block so sites are not redirecte to cloud...
add homeassistant config
add nginx exporter for prometheus
2026-10-12 18:10:41 +00:00
lucas 3f14f53184 add serverhost to smartd.conf 2026-10-12 17:59:00 +00:00
lucas c41bf36afb add smartd conf 2026-10-12 17:50:54 +00:00
lucas 07bab58ae0 add smartctl service 2026-10-12 15:01:20 +00:00
Lucas Vivo d06cff4cbd compare playlists m3u und navidrome 2026-10-12 16:33:53 +02:00
Lucas Vivo 09343a7523 first version of general audiobook library.py 2026-10-12 16:33:53 +02:00
Lucas Vivo dc0cd02e58 combine audiobooks: remove unecessary function 2026-10-12 16:33:53 +02:00
lucas 7158dd4960 change mqtt broker user to new mediahost impl 2026-10-12 12:07:28 +02:00
lucas 4c299c5a38 move sudo for upgrades into script and call script as user 2026-10-12 10:06:37 +00:00
Lucas Vivo 2f3a763054 adapt nextloud scan to docker 2026-10-09 17:36:49 +02:00
Lucas Vivo f7ff789d81 translate edit genre metadata to python
ads

asd
2026-10-08 16:25:50 +02:00
Lucas Vivo 7c6a121504 finalize metadata edit_database
asd
2026-10-08 16:25:50 +02:00
lucas 144d974731 add log to audiobooks edit database
asd
2026-10-08 14:06:41 +02:00
lucas 9e4901699d move metadate 2026-10-08 12:06:09 +00:00
lucas 8c29731ddc update sed in remove_genre 2026-10-08 12:05:53 +00:00
lucas 80ad918686 add log to audiobooks edit database 2026-10-08 10:38:54 +00:00
379 changed files with 23596 additions and 5930 deletions

No files matched your search

+132
View File
@@ -0,0 +1,132 @@
name: Audiobook Library CI
permissions:
contents: read
on:
push:
branches:
- dev
- main
paths:
- "audiobook_library/**"
- "serverlibrary/**"
- "testassets/audiobook_library/**"
- ".gitea/workflows/audiobook_library.yaml"
pull_request:
branches:
- dev
paths:
- "audiobook_library/**"
- "serverlibrary/**"
- "testassets/audiobook_library/**"
- ".gitea/workflows/audiobook_library.yaml"
jobs:
test:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
env:
AUDIOBOOK_TEST_ASSETS: ../testassets/audiobook_library
AUDIOBOOK_TEST_DATABASE: test/ci-assets/absdatabase.sqlite_test
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install FFmpeg
run: |
apt-get update
apt-get install --yes --no-install-recommends ffmpeg
- name: Install audiobook_library
working-directory: audiobook_library
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
- name: Generate database fixture
working-directory: audiobook_library
run: python test/create_ci_fixtures.py test/ci-assets
- name: Run tests
working-directory: audiobook_library
run: python run_tests.py
lint:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install Ruff
run: python -m pip install ruff
- name: Lint audiobook_library
run: ruff check audiobook_library/src audiobook_library/test audiobook_library/main.py audiobook_library/run_tests.py
build:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [test, lint]
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install build dependencies
working-directory: audiobook_library
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
python -m pip install pyinstaller
- name: Build one-file executable
working-directory: audiobook_library
run: python -m PyInstaller --clean --noconfirm --onefile --paths src --name audiobook_library main.py
- name: Verify executable
working-directory: audiobook_library
run: |
test -x dist/audiobook_library
dist/audiobook_library --help
- name: Upload executable
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
with:
name: audiobook-library-build
path: audiobook_library/dist/audiobook_library
if-no-files-found: error
install:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build
strategy:
fail-fast: false
matrix:
runner:
- vivohost
- quiethost
- serverhost
- mediahost
runs-on: ${{ matrix.runner }}
steps:
- name: Download executable
uses: https://github.com/christopherHX/gitea-download-artifact@v4
with:
name: audiobook-library-build
path: dist/
- name: Install audiobook_library
shell: bash
run: |
set -euo pipefail
install -d -m 755 "$HOME/tools"
install -m 755 dist/audiobook_library "$HOME/tools/audiobook_library"
+119
View File
@@ -0,0 +1,119 @@
name: FFmpeg Handling CI
permissions:
contents: read
on:
push:
branches:
- dev
- main
paths:
- "ffmpeg_handling/**"
- "serverlibrary/**"
- ".gitea/workflows/ffmpeg_handling.yaml"
pull_request:
branches:
- dev
paths:
- "ffmpeg_handling/**"
- "serverlibrary/**"
- ".gitea/workflows/ffmpeg_handling.yaml"
jobs:
test:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install FFmpeg
run: |
apt-get update
apt-get install --yes --no-install-recommends ffmpeg
- name: Install ffmpeg_handling
working-directory: ffmpeg_handling
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
- name: Run tests
working-directory: ffmpeg_handling
run: python src/ffmpeg_handling/run_test.py
lint:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install Ruff
run: python -m pip install ruff
- name: Lint ffmpeg_handling
run: ruff check ffmpeg_handling/src ffmpeg_handling/tests ffmpeg_handling/main.py
build:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [test, lint]
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install build dependencies
working-directory: ffmpeg_handling
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
python -m pip install pyinstaller
- name: Build one-file executable
working-directory: ffmpeg_handling
run: python -m PyInstaller --clean --noconfirm ffmpeg_handling.spec
- name: Verify executable
run: test -x ffmpeg_handling/dist/ffmpeg_handling
- name: Upload executable
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
with:
name: ffmpeg-handling-build
path: ffmpeg_handling/dist/ffmpeg_handling
if-no-files-found: error
install:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build
strategy:
fail-fast: false
matrix:
runner:
- vivohost
- quiethost
- serverhost
- mediahost
runs-on: ${{ matrix.runner }}
steps:
- name: Download executable
uses: https://github.com/christopherHX/gitea-download-artifact@v4
with:
name: ffmpeg-handling-build
path: dist/
- name: Install ffmpeg_handling
run: |
set -euo pipefail
install -d -m 755 "$HOME/tools"
install -m 755 dist/ffmpeg_handling "$HOME/tools/ffmpeg_handling"
+49
View File
@@ -0,0 +1,49 @@
name: Serverlibrary CI
permissions:
contents: read
on:
push:
paths:
- "serverlibrary/**"
- ".gitea/workflows/serverlibrary.yaml"
pull_request:
paths:
- "serverlibrary/**"
- ".gitea/workflows/serverlibrary.yaml"
jobs:
test-serverlibrary:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install serverlibrary
working-directory: serverlibrary
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Run serverlibrary tests
working-directory: serverlibrary
run: python run_tests.py
lint-serverlibrary:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Ruff
run: python -m pip install ruff
- name: Lint serverlibrary
run: ruff check serverlibrary/src serverlibrary/tests serverlibrary/run_tests.py
+108
View File
@@ -0,0 +1,108 @@
name: Torrent API CI
permissions:
contents: read
on:
push:
branches:
- dev
- main
paths:
- "torrent_api/**"
- "serverlibrary/**"
- ".gitea/workflows/torrent_api.yaml"
pull_request:
branches:
- dev
paths:
- "torrent_api/**"
- "serverlibrary/**"
- ".gitea/workflows/torrent_api.yaml"
jobs:
test:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install torrent-api
working-directory: torrent_api
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
- name: Run tests
working-directory: torrent_api
run: python run_tests.py
lint:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install Ruff
run: python -m pip install ruff
- name: Lint torrent_api
run: ruff check torrent_api/src torrent_api/tests torrent_api/main.py
build:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: [test, lint]
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install build dependencies
working-directory: torrent_api
run: |
python -m pip install --upgrade pip
python -m pip install ../serverlibrary .
python -m pip install pyinstaller
- name: Build one-file executable
working-directory: torrent_api
run: python -m PyInstaller --noconfirm torrent_api.spec
- name: Verify executable
working-directory: torrent_api
run: |
test -x dist/torrent_api
dist/torrent_api --help
- name: Upload executable
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
with:
name: torrent-api-build
path: torrent_api/dist/torrent_api
if-no-files-found: error
install:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build
strategy:
fail-fast: false
matrix:
runner:
- vivohost
- quiethost
- serverhost
- mediahost
runs-on: ${{ matrix.runner }}
steps:
- name: Download executable
uses: https://github.com/christopherHX/gitea-download-artifact@v4
with:
name: torrent-api-build
path: dist/
- name: Install torrent_api
run: |
set -euo pipefail
install -d -m 755 "$HOME/tools"
install -m 755 dist/torrent_api "$HOME/tools/torrent_api"
+208
View File
@@ -0,0 +1,208 @@
name: Wallpaper Changer CI
permissions:
contents: read
on:
push:
branches:
- dev
- main
paths:
- "wallpaper_changer/python/**"
- ".gitea/workflows/wallpaper_changer.yaml"
pull_request:
branches:
- dev
paths:
- "wallpaper_changer/python/**"
- ".gitea/workflows/wallpaper_changer.yaml"
jobs:
test-wallpaper-changer:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install serverlibrary and wallpaper_changer
working-directory: wallpaper_changer/python
run: |
python -m pip install --upgrade pip
python -m pip install ../../serverlibrary
python -m pip install --group test .
- name: Run wallpaper_changer tests
working-directory: wallpaper_changer/python
run: python tests/run_tests.py all
lint-wallpaper-changer:
if: >-
${{ github.event_name != 'workflow_run'
|| github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
- name: Install Ruff
run: python -m pip install ruff
- name: Lint wallpaper_changer
run: ruff check wallpaper_changer/python
build:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: test-wallpaper-changer
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.12-nodejs20
steps:
- name: Check out the tested commit
uses: actions/checkout@v4
- name: Install build dependencies
working-directory: wallpaper_changer/python
run: |
python -m pip install --upgrade pip
python -m pip install ../../serverlibrary
python -m pip install --group test .
python -m pip install build
- name: Build executable
working-directory: wallpaper_changer/python
run: |
python -m PyInstaller \
--clean \
--onefile \
--paths src \
--name wallpaper_changer \
main.py
- name: Build wheel
working-directory: wallpaper_changer/python
run: python -m build --wheel
- name: Include user service unit
working-directory: wallpaper_changer/python
run: cp systemd/wallpaper-changer.service dist/
- name: Verify build outputs
working-directory: wallpaper_changer/python
run: |
ls -lh dist/
test -f dist/wallpaper_changer
test -f dist/wallpaper-changer.service
ls dist/*.whl
- name: Upload build artifacts
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
with:
name: wallpaper-changer-build
path: wallpaper_changer/python/dist/
if-no-files-found: error
install:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build
strategy:
fail-fast: false
matrix:
runner:
- vivohost
- quiethost
- serverhost
- mediahost
runs-on: ${{ matrix.runner }}
timeout-minutes: 5
steps:
- name: Check runner environment
run: |
set -eux
whoami
echo "$HOME"
id
echo "UID: $(id -u)"
echo "Checking user systemd bus..."
ls -l "/run/user/$(id -u)/bus" || true
- name: Download build artifacts
uses: https://github.com/christopherHX/gitea-download-artifact@v4
with:
name: wallpaper-changer-build
path: dist/
- name: Verify downloaded artifacts
run: |
set -eux
ls -lah dist/
test -f dist/wallpaper_changer
test -f dist/wallpaper-changer.service
- name: Install executable and provision encryption passphrase
env:
WALLPAPER_ENCRYPTION_PASSPHRASE: ${{ secrets.WALLPAPER_ENCRYPTION_PASSPHRASE }}
shell: bash
run: |
set -euo pipefail
echo "1. Preparing directories"
key_dir="$HOME/.wallpaper"
passphrase_file="$key_dir/encryption.passphrase"
install -d -m 700 "$key_dir"
install -d -m 755 "$HOME/tools"
temporary_passphrase=""
cleanup() {
test -z "$temporary_passphrase" || rm -f "$temporary_passphrase"
}
trap cleanup EXIT
echo "2. Installing encryption passphrase"
if [ -L "$passphrase_file" ] || { [ -e "$passphrase_file" ] && [ ! -f "$passphrase_file" ]; }; then
echo "Invalid passphrase path" >&2
exit 1
fi
if [ ! -f "$passphrase_file" ]; then
: "${WALLPAPER_ENCRYPTION_PASSPHRASE:?Missing encryption passphrase secret}"
temporary_passphrase="$(mktemp "$key_dir/.encryption_passphrase.XXXXXX")"
printf '%s' "$WALLPAPER_ENCRYPTION_PASSPHRASE" > "$temporary_passphrase"
chmod 600 "$temporary_passphrase"
mv "$temporary_passphrase" "$passphrase_file"
else
echo "Preserving existing encryption passphrase"
fi
echo "3. Installing executable"
install -m 755 dist/wallpaper_changer "$HOME/tools/wallpaper_changer"
echo "4. Installing systemd service"
user_unit_dir="$HOME/.config/systemd/user"
install -d -m 755 "$user_unit_dir"
install -m 644 dist/wallpaper-changer.service "$user_unit_dir/wallpaper-changer.service"
echo "5. Connecting to user systemd"
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
test -S "$XDG_RUNTIME_DIR/bus"
echo "6. Reloading systemd"
timeout 15s systemctl --user daemon-reload
echo "7. Enabling service"
timeout 15s systemctl --user enable wallpaper-changer.service
echo "8. Starting service"
timeout 15s systemctl --user restart --no-block wallpaper-changer.service
echo "9. Installation completed"
+6 -2
View File
@@ -15,8 +15,12 @@ wheels/
.idea
uv.lock
youtubelist.txt
*.mkv
*.mp4
.spotdl-cache
script_template.txt
.kilo/
/docker_compose/serverhost/qbittorrent/gluetun/wg0.conf
# Android/Gradle local state
.gradle/
local.properties
.env
+12
View File
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: torrent_qbittorrent_api",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/torrent/torrent_configure_indexers.py",
"console": "integratedTerminal"
}
]
}
+26
View File
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "audiobook_library: Run sample command",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/main.py",
"args": [],
"cwd": "${workspaceFolder}",
"python": "${workspaceFolder}/.venv/bin/python3",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "audiobook_library: Run tests",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/run_tests.py",
"cwd": "${workspaceFolder}",
"python": "${workspaceFolder}/.venv/bin/python3",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
+32
View File
@@ -0,0 +1,32 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "audiobook_library: Run tests",
"type": "process",
"command": "${workspaceFolder}/.venv/bin/python3",
"args": [
"run_tests.py"
],
"options": {
"cwd": "${workspaceFolder}"
},
"group": "test",
"problemMatcher": []
},
{
"label": "audiobook_library: Build package",
"type": "process",
"command": "uv",
"args": ["build"],
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": []
}
]
}
+15
View File
@@ -0,0 +1,15 @@
## CI
The Gitea workflow runs the test suite with committed audiobook media and a
generated database fixture, and lints with Ruff. On pushes to `main`, it builds a
standalone executable and installs it to `~/tools/audiobook_library` on the
same runners used by ffmpeg_handling. FFmpeg and ffprobe must be available
on the target host.
To run the suite locally, use `python run_tests.py`. It uses
the committed MP3 files in `testassets/audiobook_library` at the scripts
repository root by default; set `AUDIOBOOK_TEST_ASSETS` to use another media
fixture directory. `AUDIOBOOK_TEST_DATABASE` can point to a database fixture
file. CI generates only the database fixture with
`python test/create_ci_fixtures.py <directory>`. Do not commit private database
fixtures.
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env python3
import sys
from audiobook_library.cli import main
if __name__ == "__main__":
sys.exit(main())
+31
View File
@@ -0,0 +1,31 @@
[project]
name = "audiobook-library"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
{ name = "Lucas Vivo", email = "lucas@mediahost" }
]
requires-python = ">=3.12"
dependencies = [
"mutagen>=1.47.0",
"requests>=2.33.1",
"serverlibrary",
]
[project.scripts]
audiobook-library = "audiobook_library:main"
[build-system]
requires = ["uv_build>=0.12.19,<0.13.0"]
build-backend = "uv_build"
[tool.uv.sources]
serverlibrary = { path = "../serverlibrary" }
[tool.ruff]
line-length = 120
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I"]
+24
View File
@@ -0,0 +1,24 @@
"""Discover and run the audiobook_library unittest suite."""
import sys
import unittest
from pathlib import Path
PROJECT_DIR = Path(__file__).resolve().parent
SOURCE_DIR = PROJECT_DIR / "src"
TEST_DIR = PROJECT_DIR / "test"
sys.path.insert(0, str(SOURCE_DIR))
def run_tests(verbosity: int = 2) -> bool:
suite = unittest.defaultTestLoader.discover(
str(TEST_DIR),
pattern="test_*.py",
top_level_dir=str(TEST_DIR),
)
result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
return result.wasSuccessful()
if __name__ == "__main__":
sys.exit(0 if run_tests() else 1)
@@ -0,0 +1,13 @@
from .audiobook import Audiobook
from .audiobook_library import AudiobookLibrary
from .audiobookshelf_api import AudiobookshelfApi
from .cli import main
from .sql_database import SqlDatabase
__all__ = [
"Audiobook",
"AudiobookLibrary",
"AudiobookshelfApi",
"SqlDatabase",
"main",
]
@@ -0,0 +1,6 @@
import sys
from .cli import main
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,105 @@
import argparse
import sys
from pathlib import Path
from serverlibrary import parser_add_loglevel
def create_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Audiobook Directory Processing")
parser.add_argument("library", type=Path, help="Library path")
parser_add_loglevel(parser)
m4b_group = parser.add_argument_group("M4B creation")
m4b_group.add_argument(
"-cm",
"--create-m4b",
action="store_true",
help="Create M4B files from multi-file audiobooks",
)
m4b_group.add_argument(
"--keep-originals",
action="store_true",
help="Do not delete source files after M4B creation",
)
m4b_group.add_argument(
"--name-filter",
metavar="NAME",
default="",
help="Process only books whose name contains NAME",
)
m4b_group.add_argument(
"--path-filter",
metavar="PATH",
default="",
help="Process only books whose path contains PATH",
)
parser.add_argument("--dry-run", action="store_true", help="Dry run only")
parser.add_argument(
"--sql-database",
type=Path,
default=Path("/docker/audiobookshelf/config/absdatabase.sqlite"),
help="SQL Database Path",
)
parser.add_argument(
"--api-url",
default="https://audiobooks.someoneslinux.selfhost.eu",
help="API Url for Audiobookshelf API",
)
parser.add_argument(
"--api-key",
default="",
help="API key for Audiobookshelf API",
)
parser.add_argument(
"-em",
"--encode-meta",
action="store_true",
help="Encode Metadata to Audiobook files",
)
parser.add_argument("-fd", "--fix-db", action="store_true", help="Fix the Database")
parser.add_argument(
"-fa",
"--force-artist-from-path",
action="store_true",
help="Force overwrite Artist from Path, only use if Path is correct",
)
parser.add_argument(
"-m",
"--move",
action="store_true",
help="Create structured directories for all books",
)
parser.add_argument(
"--actions",
nargs="+",
choices=[
"artist_dir",
"artists",
"composers",
"series",
"names",
"genres",
"comments",
"titles",
],
default=[
"artist_dir",
"artists",
"composers",
"series",
"names",
"genres",
"comments",
"titles",
],
)
return parser
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
arguments = sys.argv[1:] if argv is None else argv
args = create_parser().parse_args(arguments)
if "--sql-database" in arguments:
args.fix_db = True
return args
@@ -0,0 +1,703 @@
import re
import subprocess
import tempfile
from pathlib import Path
from serverlibrary import (
AUDIO_RE_SUFFIXES,
AUDIO_SUFFIXES,
blue_tag,
green_tag,
red_tag,
)
from .audiobook_helpers import (
SEP,
clean_genre,
cleanup,
ffmetadata_escape,
ffmpeg_escape,
get_chapters,
get_codec_bitrate,
get_duration_ms,
get_empty_keys,
get_metadata_all,
logger,
normalize_name,
series_patterns,
write_metadata,
)
class Audiobook:
def __init__(self, book_path: Path, library_root_path: Path) -> None:
self.action_required = False
self.changed = None
# Metadata
self.metadata = {}
self.metadata_original = {}
self.artist = ""
self.genre = ""
self.composer = ""
self.name = ""
self.comment = ""
self.description = ""
self.series_and_num = ""
self.series = ""
self.series_num = ""
self.title: str = ""
self.title_list: list = []
# File Paths
self.files: list[Path] = []
self.files_extra = []
self.bookPath = book_path
self.library_root_path = library_root_path
self.firstFile: Path | None = None
self.pdf_file = None
self.epub_file = None
# Files
self.singleFile = False
self.fileConunt = 0
self.size = 0
def init_book(self) -> None:
self.files = sorted(
(
file
for file in self.bookPath.iterdir()
if file.is_file() and file.suffix.lower() in AUDIO_SUFFIXES
),
key=self.extract_track_number,
)
epubs = list(self.bookPath.glob("*.epub"))
self.epub_file = epubs[0] if len(epubs) == 1 else None
pdfs = list(self.bookPath.glob("*.pdf"))
self.pdf_file = pdfs[0] if len(pdfs) == 1 else None
self.files_extra = [
file
for file in self.bookPath.glob("*")
if file.suffix.lower() not in AUDIO_SUFFIXES
]
self.firstFile = self.get_first_file()
self.size = sum(
file.stat().st_size
for pattern in AUDIO_RE_SUFFIXES
for file in self.bookPath.glob(pattern)
)
self.fileConunt = len(self.files)
self.singleFile = self.fileConunt == 1
# Metadata
self.load_metadata()
logger.info(
f"Found {self.bookPath.name}, {self.fileConunt} files, {get_empty_keys(self.metadata)}"
)
self.changed = False
def __repr__(self):
return (
f"Audiobook("
f"name={self.name!r}, "
f"artist={self.artist!r}, "
f"composer={self.composer!r}, "
f"path={str(self.bookPath)!r}),"
f"size={self.size!r}, "
f"fileConunt={self.fileConunt!r}, "
)
def get_first_file(self) -> Path:
return self.files[0]
def write_fields_from_metadata(self) -> None:
self.name = self.metadata["album"]
self.title = self.metadata["title"]
self.composer = self.metadata["composer"]
self.comment = self.metadata["comment"]
self.genre = self.metadata["genre"]
if "#" in self.metadata["grouping"]:
self.series, self.series_num = self.metadata["grouping"].rsplit("#", 1)
self.series = self.series.strip()
self.series_and_num = self.metadata["grouping"]
if self.series_and_num and not self.series:
self.series = self.series_and_num.split("#", 1)[0].strip()
self.series_num = self.series_and_num.split("#", 1)[1].strip() if "#" in self.series_and_num else ""
if self.metadata.get("artist"):
self.artist = self.metadata["artist"].strip()
elif self.metadata.get("albumartist"):
self.artist = self.metadata.get("albumartist")
self.description = self.metadata["description"]
def write_metadata_from_fields(self):
self.metadata["album"] = self.name
self.metadata["title"] = self.title
self.metadata["composer"] = self.composer
self.metadata["genre"] = self.genre
self.metadata["grouping"] = self.series_and_num
self.metadata["comment"] = self.comment
self.metadata["description"] = self.description
if self.artist:
self.metadata["artist"] = self.artist
self.metadata["albumartist"] = self.artist
def extract_track_number(self, file: Path) -> int:
stem = file.stem
title = self.name
# Remove title if it appears at the beginning
if title:
escaped_title = re.escape(title)
stem = re.sub(
rf"^{escaped_title}(?:\s*[-_:]\s*)?",
"",
stem,
flags=re.IGNORECASE,
).strip()
patterns = [
# 0099_Apollo, 01 Title, 001 Chapter, 02GLCK~1.WMA
r"^(\d+)(?=\D|$)",
# CD1-01, CD 1 - 01, CD1 - 01.
r"CD\s*(\d+)\s*-\s*(\d{1,3})",
# 018-01, 018 - 01, 138-01, 0001-0999
r"^(\d+)\s*-\s*(\d+)(?:\D|$)",
# Track 01
r"Track\s+(\d+)$",
# 01 - Kapitel 01
r"^(\d+)\s*-",
# Rubinrot 101, 102, 201, 202
r".*?(\d)(\d{2})$",
# A Thousand Ships - 007
r".*?-\s*(\d+)\s*$",
]
for pattern in patterns:
m = re.search(pattern, stem, re.IGNORECASE)
if not m:
continue
groups = m.groups()
if len(groups) == 1:
return int(groups[0])
if len(groups) == 2 and "CD" in pattern:
disc = int(groups[0])
track = int(groups[1])
return (disc - 1) * 1000 + track
if len(groups) == 2 and stem.startswith(groups[0]):
disc = int(groups[0])
track = int(groups[1])
if track < 100:
return disc * 1000 + track
if len(groups) == 2 and len(groups[0]) == 1:
disc = int(groups[0])
track = int(groups[1])
return disc * 1000 + track
return int(groups[-1])
return 0
def load_metadata(self):
self.metadata = get_metadata_all(self.get_first_file())
self.metadata_original = self.metadata.copy()
self.write_fields_from_metadata()
logger.trace(f"Load metadata {self.metadata}")
def fix_artist_dir(self):
rel_path = self.bookPath.relative_to(self.library_root_path).parts
if not self.artist:
logger.trace(f"No artist tag for {self.name}")
return
if len(rel_path) < 2:
desired_path, desired_name = self.generate_dir_from_metadata()
self.move(desired_path, desired_name)
logger.debug(f"Artist not visible in folder structure: {rel_path}")
def fix_artist_from_comment(self):
if not isinstance(self.comment, str):
logger.trace(f"No comment for {self.name}")
return
m = re.search(
r"(?:"
r"author(?:s)?:?|"
r"writer(?:s)?:?|"
r"co[- ]?author(?:s)?:?|"
r"co[- ]?writer(?:s)?:?|"
r"creator(?:s)?:?|"
r"contributor(?:s)?:?|"
r"composer(?:s)?:?|"
r"lyricist(?:s)?:?|"
r"songwriter(?:s)?:?|"
r"written\s+by:?|"
r"story\s+by:?|"
r"autorin(?:nen)?:?|"
r"autor\(en\):?|"
r"autor(?:en)?:?|"
r"text(?:e)?\s+von:?|"
r"geschrieben\s+von:?|"
r"verfasst\s+von:?|"
r"auteur(?:s)?:?|"
r"autore(?:i)?:?|"
r"autor(?:es)?:?|"
r"escritor(?:es|as)?:?"
r")\s*:?\s*([^\n.,;]+)",
self.comment,
re.IGNORECASE,
)
if not m:
logger.trace(f"No artist found in comment for {self.bookPath}")
return
if len(m.group(1).strip()) < 5:
logger.debug(f"Match group {m.group(1)} found but discarded")
return
logger.trace(f"Match groups: {m.group()}, Book: {self.name}")
self.changed = True
artist = re.sub(r"\s*\([^)]*\)", "", m.group(1).strip()).strip()
logger.trace(f"Remove {artist} from comment: {self.comment}")
self.comment = (self.comment[: m.start()] + self.comment[m.end() :]).strip(
" .,;\n"
)
self.comment = cleanup(self.comment)
if not self.artist:
self.artist = artist
self.changed = True
elif self.artist != artist:
logger.warning(
f"{red_tag('Action Required')} artist {artist} found not matching {self.artist} for {self.bookPath}"
)
self.action_required = True
else:
logger.debug(f"Artist {artist} matches file metadata for {self.name}")
def fix_artist_from_path(self, force_artist_from_path):
rel_path = self.bookPath.relative_to(self.library_root_path).parts
if len(rel_path) < 2:
logger.trace(f"Artist not visible in folder structure: {rel_path}")
return
if self.artist == rel_path[0]:
return
if not self.artist or force_artist_from_path:
self.changed = True
self.artist = rel_path[0]
logger.info(
f"[Updated] artist {self.artist} found in path for {self.bookPath}"
)
def fix_composer_from_narrator(self):
if not self.metadata.get("narrator"):
logger.trace(f"No Narrator found in metadata for {self.name}")
return
if not self.composer or len(self.composer) < 5:
self.composer = self.metadata["narrator"]
def fix_composer_from_comment(self):
m = re.search(
r"(?:read\s+by:?|"
r"spoken\s+by:?|"
r"erzähler:?|"
r"narrated\s+by:?|"
r"gesprochen\s+von:?|"
r"gelesen\s+von)\s+([^\n.,;]+)",
self.comment,
re.IGNORECASE,
)
if not m:
logger.trace(f"No composer found in comment for {self.name}")
return
self.changed = True
self.comment = (self.comment[: m.start()] + self.comment[m.end() :]).strip(
" .,;\n"
)
self.comment = cleanup(self.comment)
if not self.composer or len(self.composer) < 5:
logger.info(f"[Updated] composer found in comment for {self.name}")
self.composer = str(m.group(1).strip())
def fix_composer_from_path(self):
rel_path = self.bookPath.relative_to(self.library_root_path)
m = re.search(
r"(?:read\s+by:?|"
r"spoken\s+by:?|"
r"narrated\s+by:?|"
r"gesprochen\s+von:?|"
r"gelesen\s+von)\s+([^\n.,;]+)",
str(rel_path),
re.IGNORECASE,
)
if not m:
logger.trace(f"No composer found in path for {self.bookPath}")
return
if not self.composer or len(self.composer) < 5:
self.changed = True
logger.info(f"[Updated] composer found in Path for {self.bookPath}")
self.composer = str(m.group(1).strip())
def fix_name(self):
if not self.name:
self.name = normalize_name(self.bookPath.name, self.series)
self.changed = True
logger.info(f"[Updated] name {self.name} found in path for {self.bookPath}")
return
name = normalize_name(self.name, self.series)
if name != self.name:
logger.info(f"[Updated] name by cleaning {self.name} to {name}")
self.name = name
self.changed = True
def fix_series(self):
if self.series_and_num:
logger.trace(f"{self.name} already has series: {self.series_and_num}")
rel_path = self.bookPath.relative_to(self.library_root_path).parts
if not rel_path:
logger.trace(f"No series found for {self.name}")
return
series = self.series.strip()
if not series and self.series_and_num:
series = self.series_and_num.split("#", 1)[0].strip()
number = ""
if series:
match = re.match(
rf"^{re.escape(series)}(?:{SEP}|\s+)"
rf"(?:Book|Band|Volume|Vol)?\s*#?\s*(\d+)(?:{SEP}.+)?$",
rel_path[-1],
re.IGNORECASE,
)
if match:
number = match.group(1)
if not number:
for pattern in series_patterns:
match = re.match(pattern, rel_path[-1], re.IGNORECASE)
if not match:
continue
if pattern.startswith(r"^(\d+)"):
number = match.group(1)
else:
number = match.group(2)
break
if not series and len(rel_path) > 2:
series = rel_path[-2]
number_str = ""
and_number = ""
if not number:
logger.trace(f"No series number found for {self.name}")
else:
number_str = " #" + number
and_number = " and number"
self.series_num = number
if not series:
return
if self.series_and_num != series + number_str:
self.series_and_num = series + number_str
self.series = series
self.changed = True
logger.info(
f"[Updated] series{and_number} found for {self.name} to {self.series_and_num}"
)
return
def fix_genre(self):
self.genre = clean_genre(self.genre)
self.changed = True
def move(self, desired_path: Path, desired_name_stem: str, dry_run=False):
logger.trace(f"Moving {self.bookPath} to {desired_path}")
desired_path.mkdir(parents=True, exist_ok=True)
padding = len(str(len(self.files)))
once = True
for number, file in enumerate(self.files, start=1):
if self.singleFile:
new_name = desired_path / f"{desired_name_stem}{file.suffix.lower()}"
else:
new_name = (
desired_path
/ f"{number:0{padding}d} - {desired_name_stem}{file.suffix}"
)
if file == new_name:
continue
if once:
once = False
logger.debug(f"Moving {file} to {new_name}")
else:
logger.trace(f"Moving {file} to {new_name}")
if dry_run:
continue
self.files[number - 1] = file.rename(new_name)
for file in self.files_extra:
if file.suffix.lower() in {".cue", ".log"} or file in {
self.epub_file,
self.pdf_file,
}:
filename = f"{desired_name_stem}{file.suffix.lower()}"
else:
filename = file.name
new_file = desired_path / filename
if file == new_file:
continue
logger.trace(f"Moving {file} to {new_file}")
if dry_run:
continue
new_file = file.rename(new_file)
if file == self.epub_file:
self.epub_file = new_file
elif file == self.pdf_file:
self.pdf_file = new_file
if self.bookPath != desired_path:
logger.debug(f"Moving {self.bookPath} to {desired_path}")
remaining = list(self.bookPath.iterdir())
if not remaining and not dry_run:
self.bookPath.rmdir()
else:
logger.warning(
f"{red_tag('Action Required')} old path not empty after move: "
f"{self.bookPath}: {remaining}"
)
self.bookPath = desired_path
self.files = sorted(self.files, key=self.extract_track_number)
self.firstFile = self.get_first_file()
def generate_dir_from_metadata(self):
composer = ""
name = self.name
if self.composer:
composer = f" (by {self.composer})"
name = self.name + composer
artist = ""
if self.artist:
artist = re.split(r"[,;]", self.artist)[0].strip().replace("/", "_")
desired_path = self.library_root_path / artist / name
if self.series_and_num:
series = self.series_and_num
number = ""
if "#" in self.series_and_num:
series = self.series_and_num.split("#")
number = f"{series[1]} - "
series = series[0].rstrip()
desired_path = (
self.library_root_path
/ artist
/ series.replace("/", "_")
/ f"{number}{name}".replace("/", "_")
)
desired_name_stem = (
f"{self.artist} - {self.name}{composer}{self.bookPath.suffix}"
)
desired_name_stem = desired_name_stem.replace("/", "_")
return desired_path, desired_name_stem
def create_m4b_from_book(self, creat_m4b_no_delete: bool = False) -> None:
output_file_final = self.bookPath / f"{self.bookPath.name}.m4b"
if self.action_required:
logger.warning("Action required, resolve before creating m4b file")
return
if output_file_final.exists():
logger.info(f"{red_tag('SKIP')} {output_file_final}")
logger.info("Book already present")
return
logger.info(f"{blue_tag('create')} {output_file_final}")
with tempfile.TemporaryDirectory(dir=self.library_root_path.parent) as tmp:
tmpdir = Path(tmp)
output_file_tmp = tmpdir / f"{self.bookPath.name}.m4b"
concat_file = tmpdir / "concat.txt"
metadata_file = tmpdir / "chapters.txt"
# Inspect all inputs before deciding how to create chapters.
file_info = []
has_existing_chapters = False
for media in self.files:
chapters = get_chapters(media)
duration_ms = get_duration_ms(media)
file_info.append(
{
"media": media,
"chapters": chapters,
"duration_ms": duration_ms,
}
)
if chapters:
has_existing_chapters = True
if has_existing_chapters:
logger.debug(
"Existing chapter tracks found; preserving chapter metadata"
)
else:
logger.debug(
"No existing chapters found; generating chapters from filenames"
)
current_ms = 0
with (
concat_file.open("w", encoding="utf-8") as cf,
metadata_file.open("w", encoding="utf-8") as mf,
):
mf.write(";FFMETADATA1\n")
for key, value in self.metadata.items():
if key == "title":
mf.write(
f"{ffmetadata_escape(key)}={ffmetadata_escape(self.metadata['album'])}\n"
)
else:
mf.write(
f"{ffmetadata_escape(key)}={ffmetadata_escape(value)}\n"
)
for info in file_info:
media = info["media"]
media_name = info["media"].name
# Remove title
media_name = media_name.replace(self.name, "")
# Clean separators and whitespace
media_name = re.sub(r"[\s._-]+", " ", media_name).strip()
# Remove leading/trailing separators again if needed
media_name = re.sub(r"^[\s._-]+|[\s._-]+$", "", media_name)
info["media"].with_name(media_name)
chapters = info["chapters"]
duration_ms = info["duration_ms"]
cf.write(f"file '{ffmpeg_escape(media)}'\n")
if has_existing_chapters:
# Preserve actual chapter boundaries and titles.
for chapter in chapters:
start_ms = round(float(chapter["start_time"]) * 1000)
end_ms = round(float(chapter["end_time"]) * 1000)
tags = chapter.get("tags", {})
title = tags.get("title", media.stem)
mf.write("[CHAPTER]\n")
mf.write("TIMEBASE=1/1000\n")
mf.write(f"START={current_ms + start_ms}\n")
mf.write(f"END={current_ms + end_ms}\n")
mf.write(f"title={ffmetadata_escape(title)}\n")
else:
# No input contains chapters: one chapter per file.
mf.write("[CHAPTER]\n")
mf.write("TIMEBASE=1/1000\n")
mf.write(f"START={current_ms}\n")
mf.write(f"END={current_ms + duration_ms}\n")
mf.write(f"title={ffmetadata_escape(media.stem)}\n")
current_ms += duration_ms
codec, bitrate_k = get_codec_bitrate(self.firstFile)
codec_args = ["-c:a", "copy"]
if codec == "mp3":
codec_args = ["-c:a", "aac", "-b:a", bitrate_k]
elif codec == "flac":
codec_args = ["-c:a", "alac", "-b:a", bitrate_k]
elif codec not in {"aac", "alac"}:
codec_args = ["-c:a", "aac", "-b:a", bitrate_k]
cmd = [
"ffmpeg",
"-y",
"-f",
"concat",
"-safe",
"0",
"-i",
str(concat_file),
"-i",
str(metadata_file),
"-i",
str(self.firstFile),
# audio from concat
"-map",
"0:a",
# cover image from first media
"-map",
"2:v?",
# Metadata and chapters from our generated FFMETADATA file
"-map_metadata",
"1",
"-map_chapters",
"1",
*codec_args,
"-c:v",
"copy",
"-disposition:v:0",
"attached_pic",
str(output_file_tmp),
]
result = subprocess.run(
cmd,
capture_output=True,
text=True,
check=True,
)
logger.trace(result.stdout)
if result.returncode == 0:
output_file_tmp.rename(output_file_final)
for media in self.files:
if creat_m4b_no_delete:
continue
media.unlink()
self.files = [output_file_final]
self.firstFile = output_file_final
self.fileConunt = 1
self.singleFile = True
self.changed = False
self.size = Path(output_file_final).stat().st_size
logger.info(
f"{green_tag('SUCCESS')} - {self.bookPath.name} - delete media files"
)
else:
logger.error(
f"{red_tag('ERROR')} - {self.bookPath.name} - Code: {result.returncode}, Stderr: {result.stderr}"
)
def write_metadata(self, keys=None, dry_run=False):
if self.action_required:
logger.warning("Action required, resolve before writing metadata file")
return
self.write_metadata_from_fields()
if keys is None:
keys = []
for key, value in self.metadata.items():
if self.metadata_original.get(key) != value and not isinstance(
value, list
):
keys.append(key)
self.metadata_original = self.metadata.copy()
values = [self.metadata[key] for key in keys]
if (not keys or not values) and self.metadata_original.get(
"title"
) != self.title:
logger.trace(f"Nothing to write to file for {self.name}")
return
if keys:
for file in self.files:
write_metadata(file, keys, values, dry_run)
if len(self.title_list) == len(self.files):
for title, file in zip(self.title_list, self.files):
write_metadata(file, ["title"], [title], dry_run)
self.changed = False
def fix_title(self):
if not self.title:
if self.singleFile:
self.title = self.name
else:
padding = len(str(len(self.files)))
for idx, file in enumerate(self.files):
self.title_list.append(f"{self.name} - {idx + 1:0{padding}d}")
@@ -0,0 +1,402 @@
import json
import logging
import re
import subprocess
from pathlib import Path
from mutagen import File
from mutagen.id3 import (
COMM,
ID3,
TALB,
TCOM,
TCON,
TIT1,
TIT2,
TPE1,
TPE2,
)
from mutagen.mp4 import MP4, MP4Tags
from mutagen.oggopus import OggOpus
from serverlibrary import (
CustomLogger,
score_match_jaccard,
words,
)
ID3_FRAME_CLASSES = {
"TIT2": TIT2,
"TALB": TALB,
"TPE1": TPE1,
"TPE2": TPE2,
"TCON": TCON,
"TCOM": TCOM,
"TIT1": TIT1,
}
logging.setLoggerClass(CustomLogger)
logger: CustomLogger = logging.getLogger(__name__) # type: ignore[assignment]
MP4_MAP = {
"artist": "\xa9ART",
"album": "\xa9alb",
"title": "\xa9nam",
"genre": "\xa9gen",
"comment": "\xa9cmt",
"composer": "\xa9wrt",
"albumartist": "aART",
"grouping": "\xa9grp",
"description": "desc",
}
ID3_MAP = {
"artist": "TPE1",
"album": "TALB",
"title": "TIT2",
"genre": "TCON",
"composer": "TCOM",
"albumartist": "TPE2",
"grouping": "TIT1",
}
metadata_fields = [
"artist",
"album",
"composer",
"comment",
"genre",
"grouping",
"albumartist",
"description",
"title",
]
SEP = r"\s*[-_:,.]+\s*"
series_patterns = [
rf"^(.+?){SEP}(?:Book|Band|Volume|Vol)\s+(\d+)(?:{SEP}(.+))$",
rf"^(.+?){SEP}(?:Book|Band|Volume|Vol)\s+(\d+)$",
rf"^(\d+){SEP}(.+)$",
rf"^(.+?){SEP}(\d+)$",
]
def ffmpeg_escape(path: Path) -> str:
return str(path.resolve()).replace("'", r"'\''")
def clean_genre(genre):
if not genre:
return ""
genre_old = genre
# genre = genre.lower()
genre = re.sub(r"(?i)^audio\s*books?$", "", genre)
genre = re.sub(r"(?i)^audiobooks?;?$", "", genre)
genre = re.sub(r"(?i)\b(hörb(uch|ücher)|hoerb(uch|uecher))\b", "", genre)
genre = re.sub(r"(?i)^(hörspiele?|hoerspiele?)$", "", genre)
genre = re.sub(r"(?i)^spoken\s*word$", "", genre)
genre = re.sub(r"(?i)gesprochene\s*inhalte$", "", genre)
genre = re.sub(r"(?i)^speech$", "", genre)
genre = re.sub(r"Fanasie", "Fantasie", genre)
genre = re.sub(r"Mit Videospiel-?", "Videospielbezug", genre)
genre = re.sub(r"(?i)nonfiction", "NonFiction", genre)
genre = re.sub(r"(?i)^speech$", "", genre)
genre = re.sub(r"(?i)^vocal$", "", genre)
genre = re.sub(r"(?i)^retail$", "", genre)
genre = re.sub(r"(?i)^other$", "", genre)
genre = re.sub(r"(?i)^misc$", "", genre)
genre = re.sub(r"(?i)^(sci[- ]?fi|sf)$", "Science Fiction", genre)
genre = re.sub(r"(?i)^\(?science fiction\)?$", "Science Fiction", genre)
genre = re.sub(r"Thrillers", "Thriller", genre)
genre = re.sub(r"(?i)\bchildren'?s audiobooks?\b", "", genre)
genre = re.sub(r"^-\s*|\s*-$", "", genre)
genre = re.sub(r"(?i)Engelske\s*\sLydbånd", "", genre)
genre = re.sub(r"^FIC028000.*$", "", genre)
genre = re.sub(r"^800.*$", "", genre)
genre = re.sub(r"^Fantastic Beasts.*$", "", genre)
genre = re.sub(r"^and thei.*$", "", genre)
genre = re.sub(r"^those you.*$", "", genre)
# Normalize separators
genre = re.sub(r"\s*[,:/]\s*", ";", genre)
genre = re.sub(r"\s*;\s*", "; ", genre)
# Trim punctuation / whitespace
genre = re.sub(r"^[\s,;:\-]+", "", genre)
genre = re.sub(r"[\s,;\-]+$", "", genre)
genre = genre.strip()
genre = genre.lstrip()
if genre != genre_old:
logger.debug(f"Update genre from {genre_old} to {genre}")
return genre
def ffmetadata_escape(value: str) -> str:
return (
value.replace("\\", "\\\\")
.replace("=", "\\=")
.replace(";", "\\;")
.replace("#", "\\#")
.replace("\n", "\\\n")
)
def get_chapters(media: Path) -> list[dict]:
result = subprocess.run(
[
"ffprobe",
"-v",
"error",
"-show_chapters",
"-of",
"json",
str(media),
],
capture_output=True,
text=True,
check=True,
)
data = json.loads(result.stdout)
return data.get("chapters", [])
def _to_str(value) -> str:
if value is None:
return ""
if hasattr(value, "text"):
value = value.text
if isinstance(value, (list, tuple)):
return "; ".join(str(v) for v in value)
return str(value)
def get_metadata_all(file: Path) -> dict[str, str]:
metadata = dict.fromkeys(metadata_fields, "")
try:
audio = File(file)
if audio is None or audio.tags is None:
return metadata
# MP4/M4A/M4B
if isinstance(audio.tags, MP4Tags):
for field, tag in MP4_MAP.items():
value = audio.tags.get(tag)
if value:
metadata[field] = _to_str(value)
# ID3 (MP3 or mislabeled .m4b)
elif isinstance(audio.tags, ID3):
for field, frame_id in ID3_MAP.items():
frame = audio.tags.get(frame_id)
if frame:
metadata[field] = _to_str(frame)
comments = audio.tags.getall("COMM")
if comments:
metadata["comment"] = _to_str(comments[0])
# Optional fallback
if not metadata["description"]:
metadata["description"] = metadata["comment"]
# FLAC / Opus / Vorbis
else:
for field in metadata_fields:
value = audio.tags.get(field)
if value:
metadata[field] = _to_str(value)
except Exception:
logger.exception(f"Error getting metadata for {file}")
return metadata
def write_metadata(file, fields, values, dry_run=False):
changes = {
field.lower().replace(" ", ""): str(value)
for field, value in zip(fields, values)
}
logger.debug(f"Writing metadata for {file}: {changes}")
if dry_run:
return
try:
suffix = file.suffix.lower()
# MP3 / ID3
if suffix == ".mp3":
tags = ID3(file)
for field, value in changes.items():
if field == "comment":
tags.delall("COMM")
if value:
tags.add(
COMM(
encoding=3,
lang="eng",
desc="",
text=[value],
)
)
continue
frame_id = ID3_MAP.get(field)
if not frame_id:
continue
tags.delall(frame_id)
if value:
frame_cls = ID3_FRAME_CLASSES[frame_id]
tags.add(frame_cls(encoding=3, text=[value]))
tags.save(file)
# M4A / M4B / MP4
elif suffix in {".m4a", ".m4b", ".mp4"}:
tags = MP4(file)
for field, value in changes.items():
mp4_key = MP4_MAP.get(field)
if not mp4_key:
logger.debug(f"Unsupported MP4 tag: {field}")
continue
if value:
tags[mp4_key] = [value]
else:
tags.pop(mp4_key, None)
tags.save()
# Opus
elif suffix == ".opus":
tags = OggOpus(file)
for field, value in changes.items():
if value:
tags[field] = [value]
else:
tags.pop(field, None)
tags.save()
else:
logger.warning(f"Unsupported file type: {file}")
except Exception:
logger.exception(f"Error writing metadata for {file}")
def get_duration_ms(media: Path) -> int:
duration = subprocess.check_output(
[
"ffprobe",
"-v",
"error",
"-show_entries",
"format=duration",
"-of",
"default=noprint_wrappers=1:nokey=1",
str(media),
],
text=True,
).strip()
return int(float(duration) * 1000)
def normalize_name(name: str, series: str) -> str:
# Remove anything in (), [], {}
name_out = ""
# name = re.sub(
# rf"^(?:{re.escape(series)}){SEP}|{SEP}(?:{re.escape(series)})$",
# "", name, flags=re.IGNORECASE, ).strip()
name = re.sub(r"\s*[(\[{].*?[)\]}]\s*", " ", name).strip()
name = re.sub(r"\s+", " ", name)
for pattern in series_patterns:
match = re.match(pattern, name, re.IGNORECASE)
if match:
if pattern.startswith(r"^(\d+)"):
name_out = match.group(2).strip()
else:
name_out = match.group(1).strip()
break
else:
name_out = name
pattern = rf"^(.+?){SEP}(?:Book|Band|Volume)\s+(\d+){SEP}(.+)$"
match = re.match(pattern, name, re.IGNORECASE)
if match:
name_out1 = match.group(1).strip()
name_out3 = match.group(3).strip()
if score_match_jaccard(words(name_out1), words(series)) > score_match_jaccard(
words(name_out3), words(series)
):
return name_out3
else:
return name_out1
return name_out
def cleanup(text: str) -> str:
# Collapse repeated punctuation groups like ", ,", ". .", "! !", "? ?"
while True:
new_text = re.sub(r"([.,!?;:-])(?:\s+\1)+", r"\1", text)
if new_text == text:
break
text = new_text
# Optional: normalize multiple spaces
text = re.sub(r"\s{2,}", " ", text)
return text.strip()
def get_empty_keys(data: dict) -> str:
empty_keys = [str(key) for key, value in data.items() if not value]
return f"Empty: {', '.join(empty_keys)}" if empty_keys else ""
def get_codec_bitrate(file: Path | None) -> tuple[str, str]:
if not file:
raise ValueError
info = json.loads(
subprocess.check_output(
[
"ffprobe",
"-v",
"error",
"-select_streams",
"a:0",
"-show_entries",
"stream=codec_name,bit_rate",
"-of",
"json",
str(file),
],
text=True,
)
)
stream = info["streams"][0]
bitrate = int(stream.get("bit_rate") or 128000)
bitrate_k = f"{bitrate // 1000}k"
return stream["codec_name"].lower(), bitrate_k # codec, bits/s
@@ -0,0 +1,169 @@
import logging
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from serverlibrary import AUDIO_SUFFIXES
from .audiobook import Audiobook
from .audiobook_helpers import CustomLogger, logger
from .audiobookshelf_api import AudiobookshelfApi
from .sql_database import SqlDatabase
class AudiobookLibrary:
SqlDatabase = SqlDatabase
AudiobookshelfApi = AudiobookshelfApi
def __init__(
self,
library_path: Path,
api_url: str,
api_key: str,
sql_database_path: Path,
dry_run: bool,
path_filter: str = "",
logfilename: str = "audiobook_library.log",
):
self.path_filter = path_filter
self.sql_database_instance = SqlDatabase(sql_database_path)
self.api_instance = AudiobookshelfApi(api_url,api_key)
self.dry_run = dry_run
logging.setLoggerClass(CustomLogger)
logger: CustomLogger = logging.getLogger(__name__) # type: ignore[assignment]
logger.info("Started")
self.libraryPath: Path = Path(library_path)
self.audiobooks: list[Audiobook] = []
self._by_path = {}
self._by_name = defaultdict(list)
self._by_artist = defaultdict(list)
self._by_composer = defaultdict(list)
self.load_audiobooks_from_dir()
self.size = sum(
audiobook.size for audiobook in self.audiobooks
) # size in bytes
def add(self, book: Audiobook):
self.audiobooks.append(book)
self._by_path[book.bookPath] = book
self._by_name[book.name].append(book)
if book.artist:
self._by_artist[book.artist].append(book)
if book.composer:
self._by_composer[book.composer].append(book)
def print_name(self, books):
if not isinstance(books, list):
books = [books]
for book in books:
if book.name:
logger.info(book.name)
else:
logger.info(f"No name in {book.bookPath.name}")
def get_by_path(self, path):
return self._by_path.get(Path(path))
def get_by_name(self, name):
return self._by_name.get(name, [])
def get_by_artist(self, artist):
return self._by_artist.get(artist, [])
def get_by_composer(self, composer):
return self._by_composer.get(composer, [])
def find_path_contains(self, path) -> list[Audiobook]:
return [
book
for book in self.audiobooks
if book.bookPath == path or book.bookPath.is_relative_to(path)
]
def find_name_contains(self, text):
text = text.lower()
return [book for book in self.audiobooks if text in book.name.lower()]
def find_artist_contains(self, text):
text = text.lower()
return [
book
for book in self.audiobooks
if book.artist and text in book.artist.lower()
]
def load_audiobooks_from_dir(self):
"""
A book directory is any directory containing more than one
audiobook file (.mp3, .m4a, .m4b)
"""
media_files = [
file
for file in self.libraryPath.rglob("*")
if file.is_file()
and file.suffix.lower() in AUDIO_SUFFIXES
and self.path_filter in str(file)
]
dirs = {file.parent for file in media_files}
for directory in dirs:
self.add(Audiobook(directory, self.libraryPath))
for audiobook in self.audiobooks:
audiobook.init_book()
def load_metadata(self):
for audiobook in self.audiobooks:
audiobook.load_metadata()
def write_metadata(self, keys=None):
for audiobook in self.audiobooks:
if audiobook.changed:
logger.trace(f"Writing metadata: {audiobook.name}")
audiobook.write_metadata(keys, dry_run=self.dry_run)
def fix_artist_dir(self):
for book in self.audiobooks:
book.fix_artist_dir()
def create_structured_directories(self, dry_run=False):
for book in self.audiobooks:
desired_path, desired_name = book.generate_dir_from_metadata()
book.move(desired_path, desired_name, dry_run)
def fix_artists(self, force_artist_from_path=False):
for book in self.audiobooks:
book.fix_artist_from_comment()
book.fix_artist_from_path(force_artist_from_path)
def fix_composers(self):
for book in self.audiobooks:
book.fix_composer_from_narrator()
book.fix_composer_from_comment()
book.fix_composer_from_path()
def fix_names(self):
for book in self.audiobooks:
book.fix_name()
def fix_comments(self):
for book in self.audiobooks:
if book.comment and len(book.comment) < 40:
logger.info(f"Remove short comment of {book.name}: {book.comment}")
book.comment = ""
book.changed = True
def fix_genres(self):
for book in self.audiobooks:
book.fix_genre()
def fix_titles(self):
for book in self.audiobooks:
book.fix_title()
def fix_series(self):
for book in self.audiobooks:
book.fix_series()
def create_m4b_from_dir(self, keep_originals: bool = False) -> None:
audiobooks = self.audiobooks
jobs = [audiobook for audiobook in audiobooks if not audiobook.singleFile]
for audiobook in jobs:
logger.debug(f"Create m4b file for {audiobook.name}")
if not self.dry_run:
with ThreadPoolExecutor(max_workers=8) as executor:
futures = {
executor.submit(
audiobook.create_m4b_from_book,
keep_originals,
): audiobook
for audiobook in jobs
}
for future in as_completed(futures):
audiobook = futures[future]
try:
future.result()
except Exception:
logger.exception(f"Failed to create m4b for {audiobook.name}")
raise
@@ -0,0 +1,140 @@
from pathlib import Path
from typing import Any
import requests
from .audiobook_helpers import logger
class AudiobookshelfApi:
def __init__(self, url: str, api_key: str, timeout: int = 30):
self.url = url.rstrip("/")
self.timeout = timeout
self.session = requests.Session()
self.session.headers["Authorization"] = f"Bearer {api_key}"
self.books = []
def _request(self, method: str, endpoint: str, **kwargs) -> Any:
resp = self.session.request(
method,
f"{self.url}{endpoint}",
timeout=self.timeout,
**kwargs,
)
try:
resp.raise_for_status()
except requests.exceptions.HTTPError:
logger.error(f"{method} {endpoint}")
logger.error(resp)
if not resp.content or resp.status_code != 200:
logger.error(f"Request failed: {resp}")
return None
# No content
if not resp.content:
return None
# Only parse JSON if response claims to be JSON
content_type = resp.headers.get("Content-Type", "")
if "application/json" in content_type:
return resp.json()
# Return raw text otherwise
return resp.text
def get(self, endpoint: str, **kwargs):
return self._request("GET", endpoint, params=kwargs)
def post(self, endpoint: str, data: dict, **kwargs):
return self._request("POST", endpoint, json=data, params=kwargs)
def put(self, endpoint: str, data: dict):
return self._request("PUT", endpoint, json=data)
def delete(self, endpoint: str):
return self._request("DELETE", endpoint)
def load_books(self) -> list[dict]:
"""Load all books from all libraries into self.books."""
self.books = []
libraries = self.get("/api/libraries")["libraries"]
for library in libraries:
library_id = library["id"]
response = self.get(
f"/api/libraries/{library_id}/items",
minified="0"
)
self.books.extend(response["results"])
return self.books
def embed_metadata_for_book(self, item_id: str) -> None:
book = next((b for b in self.books if b["id"] == item_id), None)
if book:
title = (
book.get("media", {})
.get("metadata", {})
.get("title", item_id)
)
if book.get("media", {}).get("numAudioFiles", 0) > 0:
logger.info(f"Embedding metadata: {title}")
self.post(
f"/api/tools/item/{item_id}/embed-metadata",
data={},
backup=False,
)
else:
logger.info(f"{title} is an epub only book")
else:
logger.info(f"Book not found: {item_id}")
def embed_metadata_for_all_books(self, args) -> None:
for book in self.books:
item_id = book["id"]
book_name = (
book.get("media", {})
.get("metadata", {})
.get("title", item_id)
)
book_path = book.get("path", "")
logger.info(f"Embedding metadata: {book_name} ({book_path})")
if args.dry_run:
continue
try:
self.embed_metadata_for_book(item_id)
except Exception as e:
logger.error(f"Failed: {book_name}: {e}")
raise
def embed_metadata_from_file(self, filename: str) -> None:
resolved_path = Path(filename).expanduser().resolve()
with open(resolved_path, encoding="utf-8") as f:
item_ids = [
line.strip()
for line in f
if line.strip() and not line.startswith("#")
]
logger.info(f"Loaded {len(item_ids)} item IDs from {resolved_path}")
for item_id in item_ids:
_books = next(
(b for b in self.books if b["id"] == item_id),
None
)
try:
self.embed_metadata_for_book(item_id)
except Exception as e:
logger.error(f"Failed: {item_id}: {e}")
raise
@@ -0,0 +1,66 @@
from serverlibrary import setup_logging
from .argparser import parse_args
from .audiobook_helpers import logger
from .audiobook_library import AudiobookLibrary
def main(argv: list[str] | None = None) -> int:
args = parse_args(argv)
setup_logging(args.log_level, "audiobook_library")
library_dir = args.library.expanduser().resolve()
if not library_dir.exists():
logger.error(f"Library directory does not exist: {library_dir}")
return 1
database_path = args.sql_database.expanduser().resolve()
library = AudiobookLibrary(
library_dir,
args.api_url,
args.api_key,
database_path,
args.dry_run,
path_filter=args.path_filter,
)
if args.encode_meta:
library.api_instance.load_books()
library.api_instance.embed_metadata_from_file("~/embed_ids.txt")
if "artist_dir" in args.actions:
library.fix_artist_dir()
if "artists" in args.actions:
library.fix_artists(args.force_artist_from_path)
if "composers" in args.actions:
library.fix_composers()
if "series" in args.actions:
library.fix_series()
if "names" in args.actions:
library.fix_names()
if "comments" in args.actions:
library.fix_comments()
if "genres" in args.actions:
library.fix_genres()
if "titles" in args.actions:
library.fix_titles()
if args.fix_db:
if not database_path.is_file():
logger.error(f"Database is not a file: {database_path}")
return 1
library.sql_database_instance.init()
library.sql_database_instance.fix_genres()
library.sql_database_instance.fix_comments()
if not args.dry_run:
library.sql_database_instance.update_books()
library.sql_database_instance.commit()
library.sql_database_instance.close()
if args.create_m4b:
library.create_m4b_from_dir(keep_originals=args.keep_originals)
library.write_metadata()
if args.move:
library.create_structured_directories(args.dry_run)
logger.info("All Operations completed successfully")
return 0
@@ -0,0 +1,157 @@
import json
import sqlite3
from pathlib import Path
from .audiobook_helpers import clean_genre, logger
class SqlDatabase:
def __init__(self, sql_database_path: Path):
self.tables = []
self.data = {}
self.db = None
self.path = sql_database_path
self.books = []
def connect(self):
if not self.path.is_file():
logger.error(f"{self.path} does not exist")
raise FileExistsError
self.db = sqlite3.connect(self.path)
self.db.row_factory = sqlite3.Row
return True
def cursor(self):
if not self.db:
raise ValueError
return self.db.cursor()
def commit(self):
if not self.db:
raise ValueError
self.db.commit()
def close(self):
if not self.db:
raise ValueError
self.db.close()
def init(self):
if not self.connect():
return False
logger.info("Database initialized successfully")
return self.load_database_data()
def load_database_data(self) -> bool:
logger.info("Load Database data")
if not self.db:
raise ValueError
self.tables = self.db.execute(
"SELECT name FROM sqlite_master WHERE type='table'"
).fetchall()
for table in self.tables:
table_name = table["name"]
rows = []
for row in self.db.execute(f'SELECT * FROM "{table_name}"'):
record = dict(row)
# Auto-decode JSON columns
for key, value in record.items():
if isinstance(value, str) and value[:1] in "[{":
try:
record[key] = json.loads(value)
except json.JSONDecodeError:
pass
rows.append(record)
self.data[table_name] = rows
self.books = self.data["books"]
return True
def update_books(self):
for book in self.books:
self._save_book(book)
def _save_book(self, book):
book = book.copy()
for key, value in book.items():
if isinstance(value, (list, dict)):
book[key] = json.dumps(value, ensure_ascii=False)
columns = [c for c in book if c != "id"]
sql = f"""
UPDATE books
SET {", ".join(f'"{c}" = ?' for c in columns)}
WHERE id = ?
"""
values = [book[c] for c in columns]
values.append(book["id"])
if not self.db:
raise ValueError
self.db.execute(sql, values)
# commit once after all updates
def fix_genres(self):
logger.info("Fix genres in database")
for book in self.books:
genres = book.get("genres")
if not genres or not any(g.strip() for g in genres):
continue
new_genres = []
for genre in genres:
genre = clean_genre(genre)
if "," in genre:
genre = genre.split(",")
elif ";" in genre:
genre = genre.split(";")
elif " - " in genre:
genre = genre.split(" - ")
elif "Historical Adventure Thriller Mystery" in genre:
genre = genre.split(" ")
if isinstance(genre, str):
if len(genre) > 50 or (5 > len(genre) > 0):
genre = ""
logger.trace(f"Too long or too short: {genre}")
genre = genre.strip()
genre = genre.lstrip()
if genre:
new_genres.append(genre)
elif isinstance(genre, list):
genre_buf = genre
if len(genre) > 1:
genre_buf = [g.strip() for g in genre if g]
new_genres.extend(genre_buf)
new_genres = sorted(set(new_genres))
logger.trace(f"{new_genres}")
list_difference = False
if len(new_genres) < len(genres):
list_difference = True
for old, new in zip(genres, new_genres):
if old != new:
list_difference = True
break
if not list_difference:
logger.trace("No difference: Dont Commit to Database")
continue
logger.debug(f"{genres} -> {new_genres}")
book["genres"] = new_genres
def fix_comments(self):
logger.info("Fix comments in database")
for book in self.books:
for file in book.get("audioFiles"):
comment = file.get("metaTags").get("tagComment")
if comment and len(comment) < 40:
logger.debug(f"Fix short comment for {book.get('title')}")
comment = ""
file["metaTags"]["tagComment"] = comment
@@ -0,0 +1,29 @@
"""Generate non-sensitive database fixtures for CI."""
import json
import sqlite3
import sys
from pathlib import Path
def create_fixtures(assets: Path) -> None:
assets.mkdir(parents=True, exist_ok=True)
with sqlite3.connect(assets / "absdatabase.sqlite_test") as db:
db.execute(
"CREATE TABLE books (id INTEGER PRIMARY KEY, title TEXT, genres TEXT, audioFiles TEXT)"
)
db.execute("CREATE TABLE libraries (id INTEGER PRIMARY KEY, name TEXT)")
db.execute("INSERT INTO libraries VALUES (1, 'Test Library')")
db.execute(
"INSERT INTO books VALUES (?, ?, ?, ?)",
(
1,
"Test Book",
json.dumps(["Sci-Fi"]),
json.dumps([{"metaTags": {"tagComment": "short"}}]),
),
)
if __name__ == "__main__":
create_fixtures(Path(sys.argv[1]))
+221
View File
@@ -0,0 +1,221 @@
import json
import os
import shutil
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
from audiobook_library import Audiobook
from audiobook_library import audiobook as audiobook_module
from audiobook_library import audiobook_helpers as helpers
class AudiobookTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.root = Path(self.tempdir.name)
def tearDown(self):
self.tempdir.cleanup()
def make_book(self):
book_dir = self.root / "Artist" / "Book"
book_dir.mkdir(parents=True)
files = [book_dir / "02 - track.mp3", book_dir / "01 - track.mp3"]
for file in files:
file.touch()
book = Audiobook(book_dir, self.root)
book.files = files
book.firstFile = files[0]
book.fileConunt = 2
book.singleFile = False
book.metadata = {
"artist": "Artist",
"album": "Book",
"composer": "Reader",
"comment": "comment",
"genre": "Fantasy",
"grouping": "Series #1",
"albumartist": "",
"description": "description",
"title": "Book",
}
book.write_fields_from_metadata()
return book
def test_helper_functions(self):
self.assertEqual(
helpers.ffmpeg_escape(Path("a'b")),
str(Path("a'b").resolve()).replace("'", r"'\''"),
)
self.assertEqual(helpers.clean_genre(" audio books "), "audio books")
self.assertEqual(helpers.clean_genre("Sci-Fi"), "Science Fiction")
self.assertEqual(
helpers.ffmetadata_escape(r"a\=b;c#d\n"),
r"a\\\=b\;c\#d\\n",
)
self.assertEqual(helpers._to_str(None), "")
self.assertEqual(helpers._to_str(["a", "b"]), "a; b")
self.assertEqual(helpers.cleanup("a, , b c"), "a, b c")
self.assertEqual(helpers.get_empty_keys({"a": "", "b": "x"}), "Empty: a")
self.assertEqual(helpers.get_empty_keys({"a": "x"}), "")
self.assertEqual(
helpers.normalize_name("Series - Book 2 - Title", "Series"), "Title"
)
result = SimpleNamespace(stdout=json.dumps({"chapters": [{"title": "x"}]}))
with patch.object(helpers.subprocess, "run", return_value=result):
self.assertEqual(
helpers.get_chapters(self.root / "book.mp3"), [{"title": "x"}]
)
with patch.object(helpers.subprocess, "check_output", return_value="12.5"):
self.assertEqual(helpers.get_duration_ms(self.root / "book.mp3"), 12500)
with patch.object(
helpers.subprocess,
"check_output",
return_value=json.dumps(
{"streams": [{"codec_name": "MP3", "bit_rate": "96000"}]}
),
):
self.assertEqual(
helpers.get_codec_bitrate(self.root / "book.mp3"), ("mp3", "96k")
)
with self.assertRaises(ValueError):
helpers.get_codec_bitrate(None)
def test_metadata_read_write_boundaries(self):
class Tags:
def __init__(self):
self.saved = False
def save(self, *args):
self.saved = True
def delall(self, _):
pass
def add(self, _):
pass
tags = Tags()
with patch.object(helpers, "ID3", return_value=tags), patch.object(
helpers, "File", return_value=None
):
self.assertEqual(
helpers.get_metadata_all(self.root / "x.mp3")["title"], ""
)
helpers.write_metadata(
self.root / "x.mp3", ["title"], ["Book"], dry_run=True
)
helpers.write_metadata(self.root / "x.mp3", ["title"], ["Book"])
self.assertTrue(tags.saved)
def test_metadata_and_track_methods(self):
book = self.make_book()
self.assertEqual(book.get_first_file(), book.files[0])
self.assertEqual(book.extract_track_number(Path("CD2-03.mp3")), 1003)
self.assertEqual(book.extract_track_number(Path("Track 07.mp3")), 7)
self.assertEqual(book.extract_track_number(Path("unknown.mp3")), 0)
self.assertIn("Book", repr(book))
book.write_metadata_from_fields()
self.assertEqual(book.metadata["albumartist"], "Artist")
book.metadata["grouping"] = "Series #2"
book.write_fields_from_metadata()
self.assertEqual((book.series, book.series_num), ("Series", "2"))
with patch.object(audiobook_module, "get_metadata_all", return_value=book.metadata):
book.load_metadata()
book.fix_artist_from_comment()
book.comment = "Narrated by Reader, extra"
book.fix_composer_from_comment()
self.assertEqual(book.composer, "Reader")
book.fix_composer_from_path()
book.fix_composer_from_narrator()
book.name = ""
book.fix_name()
book.genre = "Sci-Fi"
book.fix_genre()
self.assertEqual(book.genre, "Science Fiction")
book.title = ""
book.singleFile = True
book.fix_title()
self.assertEqual(book.title, book.name)
book.series_and_num = ""
book.fix_series()
self.assertTrue(book.generate_dir_from_metadata()[0].is_relative_to(self.root))
def test_fix_series_from_series_number_title_path(self):
examples = [
("Jack Reacher 10: The Hard Way (by Dick Hill)", "10"),
("Jack Reacher 1: Killing Floor (by Dick Hill)", "1"),
("Jack Reacher 28: The Secret (by Jeff Harding)", "28"),
("Jack Reacher 10 - The Hard Way", "10"),
("Jack Reacher #10: The Hard Way", "10"),
("Jack Reacher - #10 - The Hard Way", "10"),
("Jack Reacher - 10 - The Hard Way", "10"),
("Jack Reacher - Book 10 - The Hard Way", "10"),
("Jack Reacher Book 10 - The Hard Way", "10"),
("Jack Reacher: Book 10: The Hard Way", "10"),
("Jack Reacher - Band 10 - The Hard Way", "10"),
("Jack Reacher - Volume 10 - The Hard Way", "10"),
("Jack Reacher - Vol 10 - The Hard Way", "10"),
("Jack Reacher - Book 10", "10"),
("10 - The Hard Way", "10"),
("Jack Reacher - 10", "10"),
]
for path_name, number in examples:
with self.subTest(path_name=path_name):
book_dir = self.root / "Author" / path_name
book_dir.mkdir(parents=True)
book = Audiobook(book_dir, self.root)
book.series_and_num = "Jack Reacher"
book.fix_series()
self.assertEqual(book.series, "Jack Reacher")
self.assertEqual(book.series_num, number)
self.assertEqual(book.series_and_num, f"Jack Reacher #{number}")
def test_file_operations(self):
book = self.make_book()
destination = self.root / "new"
book.move(destination, "Artist - Book", dry_run=True)
self.assertEqual(book.bookPath, destination)
self.assertTrue(book.files[0].exists())
book.action_required = True
book.create_m4b_from_book()
book.write_metadata()
book.action_required = False
with patch.object(audiobook_module, "write_metadata"):
book.changed = True
book.write_metadata(keys=["title"], dry_run=True)
book.fix_artist_dir()
book.fix_artist_from_path(False)
def test_create_m4b_from_audio_assets(self):
assets = Path(os.environ.get("AUDIOBOOK_TEST_ASSETS", Path(__file__).resolve().parents[2] /\
"testassets" / "audiobook_library"))
source_book = next(assets.glob("*/*"))
expected_track_count = len(list(source_book.glob("*.mp3")))
self.assertGreater(expected_track_count, 0)
book_dir = self.root / source_book.name
shutil.copytree(source_book, book_dir)
book = Audiobook(book_dir, self.root)
book.init_book()
book.create_m4b_from_book(creat_m4b_no_delete=True)
output = book_dir / f"{book_dir.name}.m4b"
self.assertTrue(output.is_file())
self.assertEqual(len(list(book_dir.glob("*.mp3"))), expected_track_count)
self.assertEqual(book.files, [output])
self.assertTrue(book.singleFile)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,103 @@
import tempfile
import unittest
from collections import defaultdict
from pathlib import Path
from unittest.mock import patch
from audiobook_library import Audiobook, AudiobookLibrary
from audiobook_library import audiobook_library as library_module
class AudiobookLibraryTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.root = Path(self.tempdir.name)
def tearDown(self):
self.tempdir.cleanup()
def make_book(self):
book_dir = self.root / "Artist" / "Book"
book_dir.mkdir(parents=True)
files = [book_dir / "02 - track.mp3", book_dir / "01 - track.mp3"]
for file in files:
file.touch()
book = Audiobook(book_dir, self.root)
book.files = files
book.firstFile = files[0]
book.fileConunt = 2
book.singleFile = False
book.metadata = {
"artist": "Artist",
"album": "Book",
"composer": "Reader",
"comment": "comment",
"genre": "Fantasy",
"grouping": "Series #1",
"albumartist": "",
"description": "description",
"title": "Book",
}
book.write_fields_from_metadata()
return book
def test_indexing_and_orchestration(self):
library = object.__new__(AudiobookLibrary)
library.audiobooks = []
library._by_path = {}
library._by_name = defaultdict(list)
library._by_artist = defaultdict(list)
library._by_composer = defaultdict(list)
book = self.make_book()
library.add(book)
self.assertIs(library.get_by_path(book.bookPath), book)
self.assertEqual(library.get_by_name(book.name), [book])
self.assertEqual(library.get_by_artist(book.artist), [book])
self.assertEqual(library.get_by_composer(book.composer), [book])
self.assertEqual(library.find_name_contains("book"), [book])
self.assertEqual(library.find_artist_contains("art"), [book])
self.assertEqual(library.find_path_contains(self.root), [book])
library.print_name(book)
calls = []
for name in (
"fix_artist_dir",
"fix_artists",
"fix_composers",
"fix_names",
"fix_comments",
"fix_genres",
"fix_titles",
"fix_series",
):
setattr(book, name, lambda name=name, **kwargs: calls.append(name))
library.fix_artist_dir()
library.fix_artists()
library.fix_composers()
library.fix_names()
library.fix_comments()
library.fix_genres()
library.fix_titles()
library.fix_series()
self.assertTrue(calls)
library.dry_run = True
library.create_structured_directories()
library.write_metadata()
library.create_m4b_from_dir()
def test_loading_and_init(self):
(self.root / "Artist" / "Book").mkdir(parents=True)
(self.root / "Artist" / "Book" / "01.mp3").touch()
with patch.object(Audiobook, "init_book", lambda self: setattr(self, "size", 1)), patch.object(
library_module, "SqlDatabase", return_value=object()
), patch.object(library_module, "AudiobookshelfApi", return_value=object()):
library = AudiobookLibrary(
self.root, "https://example.test", "key", self.root / "db.sqlite", True
)
self.assertEqual(library.size, 1)
self.assertEqual(len(library.audiobooks), 1)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,62 @@
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
from typing import ClassVar
from unittest.mock import patch
from audiobook_library import AudiobookshelfApi
class AudiobookshelfApiTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.root = Path(self.tempdir.name)
def tearDown(self):
self.tempdir.cleanup()
def test_api_methods(self):
api = AudiobookshelfApi("https://example.test/", "key")
class Response:
status_code = 200
content = b"{}"
headers: ClassVar[dict[str, str]] = {"Content-Type": "application/json"}
text = ""
def raise_for_status(self):
return None
def json(self):
return {"ok": True}
with patch.object(api.session, "request", return_value=Response()):
self.assertEqual(api.get("/x"), {"ok": True})
self.assertEqual(api.post("/x", {}), {"ok": True})
self.assertEqual(api.put("/x", {}), {"ok": True})
self.assertEqual(api.delete("/x"), {"ok": True})
responses = iter(
[
{"libraries": [{"id": "l1"}]},
{"results": [{"id": "b1", "media": {"metadata": {"title": "Book"}}}]},
]
)
with patch.object(api, "get", side_effect=lambda *args, **kwargs: next(responses)):
self.assertEqual(
api.load_books(),
[{"id": "b1", "media": {"metadata": {"title": "Book"}}}],
)
api.post = lambda *args, **kwargs: {"ok": True}
api.embed_metadata_for_book("b1")
api.embed_metadata_for_book("missing")
api.embed_metadata_for_all_books(SimpleNamespace(dry_run=True))
ids = self.root / "ids.txt"
ids.write_text("# comment\nb1\n")
api.embed_metadata_from_file(str(ids))
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,81 @@
import os
import shutil
import sqlite3
import tempfile
import unittest
from pathlib import Path
from audiobook_library import SqlDatabase
class SqlDatabaseTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.TemporaryDirectory()
self.root = Path(self.tempdir.name)
def tearDown(self):
self.tempdir.cleanup()
def test_database_methods(self):
db_path = self.root / "books.sqlite"
connection = sqlite3.connect(db_path)
connection.execute(
"CREATE TABLE books (id INTEGER PRIMARY KEY, title TEXT, genres TEXT, audioFiles TEXT)"
)
connection.execute(
"INSERT INTO books VALUES (1, 'Book', '[\"Sci-Fi\"]', '[]')"
)
connection.commit()
connection.close()
database = SqlDatabase(db_path)
self.assertTrue(database.connect())
self.assertIsNotNone(database.cursor())
self.assertTrue(database.load_database_data())
self.assertEqual(database.books[0]["genres"], ["Sci-Fi"])
database.books[0]["title"] = "Updated"
database._save_book(database.books[0])
database.update_books()
database.fix_genres()
database.fix_comments()
database.commit()
database.close()
with self.assertRaises(ValueError):
SqlDatabase(db_path).cursor()
with self.assertRaises(FileExistsError):
SqlDatabase(self.root / "missing.sqlite").connect()
def test_asset_fixture(self):
assets = Path(os.environ.get("AUDIOBOOK_TEST_ASSETS", Path(__file__).resolve().parents[2] /\
"testassets" / "audiobook_library"))
database_fixture = os.environ.get("AUDIOBOOK_TEST_DATABASE")
fixture = (
Path(database_fixture)
if database_fixture
else assets / "absdatabase.sqlite_test"
)
with sqlite3.connect(fixture.resolve().as_uri() + "?mode=ro", uri=True) as source:
expected_books = source.execute("SELECT COUNT(*) FROM books").fetchone()[0]
self.assertGreater(expected_books, 0)
database_path = self.root / "absdatabase.sqlite"
shutil.copyfile(fixture, database_path)
database = SqlDatabase(database_path)
self.assertTrue(database.init())
self.assertEqual(len(database.books), expected_books)
self.assertTrue(database.data["libraries"])
database.fix_genres()
database.fix_comments()
database.update_books()
database.commit()
database.close()
reopened = SqlDatabase(database_path)
self.assertTrue(reopened.init())
self.assertEqual(len(reopened.books), expected_books)
reopened.close()
if __name__ == "__main__":
unittest.main()
@@ -1,231 +0,0 @@
#!/usr/bin/env python3
from __future__ import annotations
from concurrent.futures import ProcessPoolExecutor, as_completed
import argparse
import subprocess
import tempfile
from pathlib import Path
import time
from typing import Any
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
BLUE = "\033[94m"
RESET = "\033[0m"
logfile=Path(f"media_{time.strftime("%Y%m%d_%H%M%S")}.log")
def log_message(message):
with open(logfile, "a") as log:
log.write(f"{message}\n")
print(message)
def get_duration_ms(media: Path) -> int:
duration = subprocess.check_output(
[
"ffprobe",
"-v",
"error",
"-show_entries",
"format=duration",
"-of",
"default=noprint_wrappers=1:nokey=1",
str(media),
],
text=True,
).strip()
return int(float(duration) * 1000)
def ffmpeg_escape(path: Path) -> str:
return str(path.resolve()).replace("'", r"'\''")
def create_m4b(root_path: Path, book_dir: Path) -> None:
media_files = sorted(list(book_dir.glob("*.mp3"))
+ list(book_dir.glob("*.m4a"))
+ list(book_dir.glob("*.m4b"))
+ list(book_dir.glob("*.opus")))
if not media_files:
return
output_file_final = book_dir / f"{book_dir.name}.m4b"
if output_file_final.exists():
log_message(f"{RED}[SKIP]{RESET} {output_file_final}")
log_message("Book already present")
return
log_message(f"[CREATE] {output_file_final}")
with (tempfile.TemporaryDirectory(dir=root_path.parent) as tmp):
tmpdir = Path(tmp)
output_file_tmp = tmpdir / f"{book_dir.name}.m4b"
concat_file = tmpdir / "concat.txt"
metadata_file = tmpdir / "chapters.txt"
current_ms = 0
with concat_file.open("w", encoding="utf-8") as cf, \
metadata_file.open("w", encoding="utf-8") as mf:
mf.write(";FFMETADATA1\n")
for media in media_files:
cf.write(f"file '{ffmpeg_escape(media)}'\n")
duration_ms = get_duration_ms(media)
mf.write("[CHAPTER]\n")
mf.write("TIMEBASE=1/1000\n")
mf.write(f"START={current_ms}\n")
mf.write(f"END={current_ms + duration_ms}\n")
mf.write(f"title={media.stem}\n")
current_ms += duration_ms
cmd_backup = [ "ffmpeg","-y","-f","concat","-safe","0",
"-i",str(concat_file),"-i",str(metadata_file),
# cover from first media
"-i",str(media_files[0]),
# audio from concat
"-map","0:a",
# cover image from first media
"-map","2:v?",
# copy artist/album/composer/etc from first media file
"-map_metadata", "2",
# copy chapters from ffmetadata
"-map_chapters", "1",
"-c:a","copy",
"-c:a", "aac",
"-b:a", "128k",
# copy cover image without re-encoding
"-c:v","copy","-disposition:v:0","attached_pic",
str(output_file_tmp),
]
cmd_default = ["ffmpeg", "-y", "-f", "concat", "-safe", "0",
"-i", str(concat_file), "-i", str(metadata_file),
# cover from first media
"-i", str(media_files[0]),
# audio from concat
"-map", "0:a",
# cover image from first media
"-map", "2:v?",
# copy artist/album/composer/etc from first media file
"-map_metadata", "2",
# copy chapters from ffmetadata
"-map_chapters", "1",
"-c:a", "copy",
# copy cover image without re-encoding
"-c:v", "copy", "-disposition:v:0", "attached_pic",
str(output_file_tmp),
]
with logfile.open("a", encoding="utf-8") as log:
result = subprocess.run(
cmd_default,
stdout=log,
stderr=subprocess.STDOUT,
text=True,
)
if result.returncode == 234:
log_message(f"{YELLOW}[WARNING]{RESET} - {book_dir.name} - {result.returncode} retrying with aac encoder")
result = subprocess.run(
cmd_backup,
stdout=log,
stderr=subprocess.STDOUT,
text=True,
)
if result.returncode == 0:
output_file_tmp.rename(output_file_final)
for media in media_files:
media.unlink()
log_message(f"{GREEN}[SUCCESS]{RESET} - {book_dir.name} - delete media files")
else:
log_message(f"{RED}[ERROR]{RESET} - {book_dir.name} - Code: {result.returncode}, Stderr: {result.stderr}")
def find_book_dirs(root: Path) -> tuple[list[Any], int]:
"""
A book directory is any directory containing more than one
audiobook file (.mp3, .m4a, .m4b)
"""
media_files = (
list(root.rglob("*.mp3"))
+ list(root.rglob("*.m4a"))
+ list(root.rglob("*.m4b"))
+ list(root.rglob("*.opus"))
)
counts: dict[Path, int] = {}
for file in media_files:
if counts.get(file.parent, 0) > 1:
continue
counts[file.parent] = counts.get(file.parent, 0) + 1
directories = []
size = 0
for directory, count in counts.items():
if count > 1:
directories.append(directory)
size += sum(file.stat().st_size for pattern in ("*.mp3", "*.m4a", "*.m4b", "*.opus") for file in directory.glob(pattern))
return sorted(directories), size
def process_book(args):
target, book_dir = args
try:
create_m4b(target, book_dir)
return book_dir, None
except Exception as exc:
return book_dir, str(exc)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"path",
type=Path,
help="Book folder or root folder",
)
args = parser.parse_args()
target = args.path.resolve()
if not target.exists():
raise SystemExit(f"Path does not exist: {target}")
# Direct book folder
if any(list(target.glob("*.mp3"))
+ list(target.glob("*.m4a"))
+ list(target.glob("*.m4b"))
+ list(target.glob("*.opus"))):
create_m4b(target.parent,target)
return
book_dir_set, library_size = find_book_dirs(target)
for book_dir in book_dir_set:
log_message(f"Found Media: {book_dir}")
print("Proceed? y/n")
name = input()
if name != "y":
log_message(f"Aborted")
exit(0)
# Root folder containing many books
with ProcessPoolExecutor(max_workers=8) as executor:
for book_dir, error in executor.map(
process_book,
((target, book_dir) for book_dir in book_dir_set),
):
if error:
log_message(f"{RED}[ERROR]{RESET} {book_dir}: {error}")
if __name__ == "__main__":
main()
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env python3
import sys
import subprocess
from pathlib import Path
ROOT = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".")
audio_extensions = {
".m4b",
".m4a",
".mp3",
".flac",
".ogg",
}
def get_metadata(field, file):
try:
result = subprocess.run(
["kid3-cli", "-c", f"get {field}", str(file)],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
text=True,
)
return result.stdout.strip()
except (OSError, subprocess.SubprocessError):
return ""
# Include ROOT itself, matching find "$ROOT" -type d
for directory in [ROOT] + [p for p in ROOT.rglob("*") if p.is_dir()]:
audio_files = sorted(
(
file
for file in directory.iterdir()
if file.is_file()
and file.suffix.lower() in audio_extensions
),
key=lambda p: str(p),
)
if not audio_files:
continue
first_file = audio_files[0]
artist = get_metadata("artist", first_file)
album = get_metadata("album", first_file)
composer = get_metadata("composer", first_file)
comment = get_metadata("comment", first_file)
print("====≠===============================")
print(f"Folder: {directory.name}")
print(f"Album: {album}")
print(f"Artist: {artist}")
print(f"Narrator: {composer}")
print(f"Comment: {comment}")
@@ -1,90 +0,0 @@
import json
import re
import sqlite3
import argparse
from pathlib import Path
def load_genre(conn, unique=False):
"""
Return all genres from the books table.
Args:
conn: sqlite3 connection
unique: if True, return unique genres only
Returns:
list[str]
"""
genres = []
for (genres_json,) in conn.execute("SELECT genres FROM books"):
if not genres_json:
continue
try:
genres.extend(json.loads(genres_json))
except Exception:
pass
if unique:
return sorted(set(genres))
return genres
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"database",
type=Path,
help="SQL Database Path",
)
args = parser.parse_args()
database = args.database.resolve()
if not database.is_file():
parser.error(f"Database is not a file: {database}")
db = sqlite3.connect(database)
cur = db.cursor()
list_genres = load_genre(cur,True)
for genre in list_genres:
print(genre)
for book_id, genres_json in cur.execute("SELECT id, genres FROM books"):
if not genres_json:
continue
genres = json.loads(genres_json)
new_genres = []
for genre in genres:
genre = re.sub(r'(?i)^audio\s*books?$', '', genre)
genre = re.sub(r'(?i)^audiobooks?$', '', genre)
genre = re.sub(r'(?i)^hörb(uch|ücher)$', '', genre)
genre = re.sub(r'(?i)^hörspiele?$', '', genre)
genre = re.sub(r'(?i)^spoken\s*word$', '', genre)
genre = re.sub(r'(?i)^speech$', '', genre)
genre = re.sub(r'(?i)^(sci[- ]?fi|sf)$', 'Science Fiction', genre)
genre = re.sub(r'(?i)^nonfiction$', 'NonFiction', genre)
genre = genre.strip()
if genre:
new_genres.append(genre)
new_genres = sorted(set(new_genres))
cur.execute(
"UPDATE books SET genres=? WHERE id=?",
(json.dumps(new_genres), book_id),
)
db.commit()
if __name__ == "__main__":
main()
-27
View File
@@ -1,27 +0,0 @@
#!/usr/bin/env bash
ROOT="${1:-.}"
find "$ROOT" -type d | while read -r dir; do
first_file=$(
find "$dir" -maxdepth 1 -type f \
\( -iname "*.m4b" -o -iname "*.m4a" -o -iname "*.mp3" \
-o -iname "*.flac" -o -iname "*.ogg" \) |
sort |
head -n1
)
[[ -z "$first_file" ]] && continue
artist=$(kid3-cli -c "get artist" "$first_file" 2>/dev/null)
album=$(kid3-cli -c "get album" "$first_file" 2>/dev/null)
composer=$(kid3-cli -c "get composer" "$first_file" 2>/dev/null)
comment=$(kid3-cli -c "get comment" "$first_file" 2>/dev/null)
echo "====≠==============================="
echo "Folder: $(basename "$dir")"
echo "Album: $album"
echo "Artist: $artist"
echo "Narrator: $composer"
echo "Comment: $comment"
done
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/python3
import json
import re
import sqlite3
import argparse
from pathlib import Path
def load_genre(conn, unique=False):
"""
Return all genres from the books table.
Args:
conn: sqlite3 connection
unique: if True, return unique genres only
Returns:
list[str]
"""
genres = []
for (genres_json,) in conn.execute("SELECT genres FROM books"):
if not genres_json:
continue
try:
genres.extend(json.loads(genres_json))
except Exception:
pass
if unique:
return sorted(set(genres))
return genres
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-p", "--print-only",
action="store_true",
help="Print data only",
)
parser.add_argument(
"--print-all",
action="store_true",
help="Print all data only",
)
parser.add_argument(
"database",
type=Path,
help="SQL Database Path",
)
args = parser.parse_args()
database = args.database.resolve()
if not database.is_file():
parser.error(f"Database is not a file: {database}")
db = sqlite3.connect(database)
cur = db.cursor()
list_genres = load_genre(cur,True)
if args.print_all:
for genre in list_genres:
print(genre)
return
rows = cur.execute(
"SELECT id, genres FROM books"
).fetchall()
for book_id, genres_json in rows:
if not genres_json:
continue
genres = json.loads(genres_json)
genres_new = []
new_genres = []
print("=================================")
print(f"Before sed: {genres}")
for genre in genres:
if "Drachen" in genre:
pass
if "Fantastic" in genre:
pass
genre = re.sub(r'(?i)^audio\s*books?$', '', genre)
genre = re.sub(r'(?i)^audiobooks?$', '', genre)
genre = re.sub(r'(?i)\b(hörb(uch|ücher)|hoerb(uch|uecher))\b', '', genre)
genre = re.sub(r'(?i)^(hörspiele?|hoerspiele?)$', '', genre)
genre = re.sub(r'(?i)^spoken\s*word$', '', genre)
genre = re.sub(r'(?i)gesprochene\s*inhalte$', '', genre)
genre = re.sub(r'(?i)^speech$', '', genre)
genre = re.sub(r'Fanasie', 'Fantasie', genre)
genre = re.sub(r'Mit Videospiel', 'Videospielbezug', genre)
genre = re.sub(r'(?i)nonfiction', 'NonFiction', genre)
genre = re.sub(r'(?i)^speech$', '', genre)
genre = re.sub(r'(?i)^vocal$', '', genre)
genre = re.sub(r'(?i)^retail$', '', genre)
genre = re.sub(r'(?i)^other$', '', genre)
genre = re.sub(r'(?i)^misc$', '', genre)
genre = re.sub(r'(?i)^(sci[- ]?fi|sf)$', 'Science Fiction', genre)
genre = re.sub(r'(?i)^\(?science fiction\)?$', 'Science Fiction', genre)
genre = re.sub(r'Thrillers', 'Thriller', genre)
genre = re.sub(r"(?i)\bchildren'?s audiobooks?\b", "",genre)
genre = re.sub(r'^-\s*|\s*-$', '', genre)
genre = re.sub(r'(?i)Engelske\s*\sLydbånd','',genre)
genre = re.sub(r'^FIC028000.*$', '', genre)
genre = re.sub(r'^800.*$', '', genre)
genre = re.sub(r'^Fantastic Beasts.*$', '', genre)
genre = re.sub(r'^and thei.*$', '', genre)
genre = re.sub(r'^those you.*$', '', genre)
genre = genre.strip()
genre = genre.lstrip()
if "," in genre:
genre = genre.split(",")
elif " - " in genre:
genre = genre.split(" - ")
elif "Historical Adventure Thriller Mystery" in genre:
genre = genre.split(" ")
if isinstance(genre, str):
if len(genre) > 50 or (5 > len(genre) > 0):
genre = ""
print(f"Too long or too short: {genre}")
genre = genre.strip()
genre = genre.lstrip()
new_genres.append(genre)
elif isinstance(genre, list):
if len(genres) > 1:
genres = [g for g in genres if g]
new_genres.extend(genre)
new_genres = sorted(set(new_genres))
print(f"After sed: {new_genres}")
list_difference = False
print("Write to Database")
if len(new_genres) < len(genres):
list_difference = True
for old,new in zip(genres,new_genres):
if old != new:
list_difference = True
break
if not list_difference:
print("No difference: Dont Commit to Database")
continue
if args.print_only:
print("Print only: Dont Commit to database")
continue
print("Write to Database")
print("=================================")
cur.execute(
"UPDATE books SET genres=? WHERE id=?",
(json.dumps(new_genres), book_id),
)
print("Database Updated")
db.commit()
if __name__ == "__main__":
main()
@@ -6,15 +6,6 @@ import subprocess
from pathlib import Path
from difflib import SequenceMatcher
AUDIO_EXTENSIONS = {
".mp3",
".m4b",
".m4a",
}
RED = "\033[31m"
GREEN = "\033[32m"
RESET = "\033[0m"
USE_KID3 = True
def normalize(text: str) -> str:
return re.sub(r"[^a-z0-9]", "", text.lower())
@@ -27,7 +27,7 @@ fi
list="$1"
while IFS= read -r file; do
book
[[ -z "$file" ]] && continue
if [[ ! -e "$file" ]]; then
@@ -41,8 +41,8 @@ for file in "${FILES[@]}"; do
[[ -z "$genre" ]] && continue
cleaned=$(printf '%s\n' "$genre" | sed -E '
s/[Aa]udio[[:space:]]*[Bb]ooks?//g
s/\b(Hörb(uch|ücher)|Hoerb(uch|uecher)|Hörspiel(e)?|Hoerspiel(e)?)\b//Ig
s/-?(Hörb(uch|ücher)|Hoerb(uch|uecher)|Hörspiel(e)?|Hoerspiel(e)?)\b//Ig
s/[Gg]esprochene[[:space:]]*[Ii]nhalte//g
s/[Ss]poken[[:space:]]*[Ww]ord//g
s/[Ss]peech//g
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <dir1> <dir2> [del]"
exit 1
fi
dir1="$1"
dir2="$2"
find "$dir1" -mindepth 2 -maxdepth 2 -type d -printf '%P\n' |
while IFS= read -r rel; do
if [[ -d "$dir2/$rel" ]]; then
# Exists in both
if [[ "$3" == "del" ]]; then
echo "Deleting: $dir1/$rel"
rm -rf -- "$dir1/$rel"
# Remove empty author directory
author="${rel%%/*}"
rmdir --ignore-fail-on-non-empty "$dir1/$author" 2>/dev/null
fi
else
# Only exists in $1
echo "$rel"
fi
done
-63
View File
@@ -1,63 +0,0 @@
#!/bin/bash
USER="lucas"
DEST="~/Downloads"
get_config() {
while [[ ${1:0:1} == - ]]; do
echo "Param: $1"
[[ $1 == -h ]] && {
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
HOST="$2"
shift 2;
continue;
};
[[ $1 == -f ]] && {
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
file="$2"
shift 2;
continue;
};
[[ $1 == -o ]] && {
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
opt="$2"
shift 2;
continue;
};
[[ $1 == -d ]] && {
if [ "$2" == "" ]; then echo "Too few arguments"; usage; exit; fi
DEST="$2"
shift 2;
continue;
};
[[ $1 == -p ]] && {
DEST="~/Videos/.stuff"
shift 1;
continue;
};
[[ $1 == --help ]] && {
usage
exit
};
echo "Parameter $1 discarded"
usage
exit
done
}
usage() {
printf "Usage:
-h <hostname>\tRemote Hostname
-f <filename>\tPath of local file
-o <options>\tGive additional Options
-d <dest>\tChoose other Destination Folder
-p\t\tChange Destination
--help\t\tDisplay Usage\n"
exit
}
get_config "$@"
if [ "${HOST}" == "deluge" ]; then
HOST="serverhost"
USER="deluge-user"
DEST="/home/deluge-user/Downloads/Torrents/"
fi
echo "Copy ${file} to ${HOST}:${DEST}"
scp -r ${opt} "${file}" ${USER}@${HOST}:${DEST}
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
scp lucas@serverhost:/etc/update-motd.d/10-help-text ~/Documents/Dokumente/Dokumente/Projekte/Server/motd.serverhost.10-help-text
scp lucas@raspberry:~/.profile ~/Documents/Dokumente/Dokumente/Projekte/Server/motd.raspberry.profile
rm 0
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/expect -f
#Copy Crontab of raspberry and serverhost
set host "raspberry"
array set user { 0 "root" 1 "lucas"}
set port "1160"
for {set j 0} {$j < 2} {incr j 1} {
spawn ssh -p $port lucas@$host
expect {
"No route to host" {
puts "spawn ssh -p $port SendEnv=TERM lucas@$host failed."
exit 0
}
"Login Sucsessfull" {
if {$user($j)=="root"} {
send "sudo crontab -l >> crontab.buf\r"
expect "lucas: "
send "Gina\&1994\&Nonna\r"
} else {
send "crontab -l >> crontab.buf\r"
}
#expect "$ "
#send "cat crontab.buf\r"
expect "$ "
send "scp -P 3032 crontab.buf lucas@serverhost:~/Documents/Dokumente/Dokumente/Projekte/Server/crontab.$host.$user($j)\r"
expect "$ "
send "rm crontab.buf\r"
puts "crontab.$host.$user($j) created."
}
}
}
-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/expect -f
#Copy Crontab of raspberry and serverhost
array set host { 0 "serverhost" 1 "raspberry"}
array set user { 0 "root" 1 "lucas"}
array set port { 0 "3032" 1 "1160"}
for {set i 0} {$i < 2} {incr i 1} {
for {set j 0} {$j < 2} {incr j 1} {
spawn ssh -p $port($i) lucas@$host($i)
expect {
"No route to host" {
puts "spawn ssh -p $port($i) lucas@$host($i) failed."
exit 0
}
"Login Sucsessfull" {
if {$user($j)=="root"} {
send "sudo crontab -l >> crontab.buf\r"
expect "lucas: "
send "Gina\&1994\&Nonna\r"
} else {
send "crontab -l >> crontab.buf\r"
}
#expect "$ "
#send "cat crontab.buf\r"
expect "$ "
send "scp -P 1160 crontab.buf lucas@workhost:~/Documents/Dokumente/Dokumente/Projekte/Server/crontab.$host($i).$user($j)\r"
expect "$ "
send "rm crontab.buf\r"
puts "crontab.$host($i).$user($j) created."
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=sudo systemctl hibernate
Name=Hibernate
Comment=Hibernate GW
Icon=/home/lucas/Documents/Dokumente/Projekte/Icons/hibernate.png
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
cd /docker
find . -maxdepth 3 -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.conf" -o -name "*.sh" -o -name "*.py" \) \
-print0 2>/dev/null | rsync -aR --files-from=- --from0 ./ /home/lucas/scripts/docker_compose/$(hostname)
crontab -l > /home/lucas/scripts/docker_compose/$(hostname)/crontab.bak
cp /etc/fstab /home/lucas/scripts/docker_compose/$(hostname)
if [ -f /etc/exports ]; then
cp /etc/exports /home/lucas/scripts/docker_compose/$(hostname)
fi
@@ -0,0 +1,189 @@
#!/usr/bin/env bash
set -uo pipefail
CONTAINER="${1:-}"
COMPOSE_FILE="${2:-}"
if [ -z "$CONTAINER" ]; then
echo "Usage:"
echo " $0 <container-name> [docker-compose.yml]"
exit 1
fi
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
OUTDIR="/tmp/${CONTAINER}-debug-${TIMESTAMP}"
mkdir -p "$OUTDIR"
echo "[*] Collecting debug data for container: $CONTAINER"
# --------------------------------------------------
# Docker info
# --------------------------------------------------
docker inspect "$CONTAINER" \
> "$OUTDIR/docker-inspect.json" 2>&1 || true
docker inspect "$CONTAINER" --format '{{.Config.Image}}' \
> "$OUTDIR/image.txt" 2>&1 || true
# --------------------------------------------------
# Logs
# --------------------------------------------------
docker logs "$CONTAINER" --tail=10000 \
> "$OUTDIR/container.log" 2>&1 || true
# --------------------------------------------------
# Environment
# --------------------------------------------------
docker exec "$CONTAINER" env \
> "$OUTDIR/container-env.txt" 2>&1 || true
# --------------------------------------------------
# Host information
# --------------------------------------------------
{
echo "=== HOST ==="
if command -v lsb_release >/dev/null 2>&1; then
lsb_release -a
fi
uname -a
echo
echo "=== DOCKER ==="
docker --version
} > "$OUTDIR/host.txt" 2>&1
PROGRAMS=(
"yt-dlp"
"ffmpeg"
"ffprobe"
"node"
"npm"
"python"
"python3"
"java"
"curl"
"wget"
"git"
)
# --------------------------------------------------
# Common program versions
# --------------------------------------------------
{
echo "=== PROGRAM VERSIONS ==="
echo
for prog in "${PROGRAMS[@]}"; do
echo "----- $prog -----"
if docker exec "$CONTAINER" sh -c "command -v '$prog'" \
>/dev/null 2>&1; then
docker exec "$CONTAINER" sh -c "
$prog --version 2>/dev/null ||
$prog -version 2>/dev/null ||
$prog -V 2>/dev/null ||
true
" | head -n 5
else
echo "not installed"
fi
echo
done
} > "$OUTDIR/versions.txt" 2>&1
# --------------------------------------------------
# Compose snippet
# --------------------------------------------------
if [ -n "$COMPOSE_FILE" ] && [ -f "$COMPOSE_FILE" ]; then
SERVICE=$(docker inspect "$CONTAINER" \
--format '{{ index .Config.Labels "com.docker.compose.service" }}' \
2>/dev/null)
if [ -n "$SERVICE" ]; then
yq ".services.\"$SERVICE\"" "$COMPOSE_FILE" \
> "$OUTDIR/compose-service.yaml" 2>&1 || true
fi
fi
# --------------------------------------------------
# Summary
# --------------------------------------------------
{
echo "================================="
echo "Debug Summary"
echo "================================="
echo
echo "Container:"
echo " $CONTAINER"
echo
echo "Image:"
cat "$OUTDIR/image.txt" 2>/dev/null
echo
echo "Host:"
uname -a
lsb_release -a
docker --version
echo
echo "Compose Service:"
docker inspect "$CONTAINER" \
--format '{{ index .Config.Labels "com.docker.compose.service" }}' \
2>/dev/null || echo "unknown"
if [ -n "$SERVICE" ]; then
echo "Docker Compose Config"
yq ".services.\"$SERVICE\"" "$COMPOSE_FILE"
fi
echo
echo "Programs found:"
for prog in "${PROGRAMS[@]}"; do
if docker exec "$CONTAINER" sh -c "command -v '$prog'" \
>/dev/null 2>&1; then
echo "$prog: $(
$prog --version 2>/dev/null ||
$prog -version 2>/dev/null ||
$prog -V 2>/dev/null ||
true
)" | head -n1
fi
done
} | tee "$OUTDIR/summary.txt"
# --------------------------------------------------
# Archive
# --------------------------------------------------
ARCHIVE="${OUTDIR}.tar.gz"
tar czf "$ARCHIVE" \
-C "$(dirname "$OUTDIR")" \
"$(basename "$OUTDIR")"
echo
echo "[OK] Debug report created:"
echo "$ARCHIVE"
echo
ls -lh "$ARCHIVE"
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/docker compose -f /docker/nginx/docker-compose.yaml run --rm certbot renew && \
/usr/bin/docker compose -f /docker/nginx/docker-compose.yaml exec nginx nginx -s reload
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
/usr/bin/docker exec -u www-data nextcloud /usr/local/bin/php -f /var/www/html/cron.php
+41
View File
@@ -0,0 +1,41 @@
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
*/5 * * * * /home/lucas/scripts/docker_compose/docker_update_nextcloud.sh && logger "CRON_SUCCESS nextcloud" || logger "CRON_FAILURE nextcloud"
*/5 * * * * /home/lucas/scripts/docker_compose/node-exporter-pubip-docker-states.sh && logger "CRON_SUCCESS pubip" || logger "CRON_FAILURE pubip"
#0 * * * * /home/lucas/scripts/media_editing/convert_heic.sh && logger "CRON_SUCCESS conv_heic" || logger "CRON_FAILURE conv_heic"
0 * * * * /home/lucas/scripts/file_processing/rename_memes_folder.sh && logger "CRON_SUCCESS rename_mem" || logger "CRON_FAILURE rename_mem"
0 * * * * /home/lucas/scripts/file_processing/sync_dropfolder_to_immich.sh && logger "CRON_SUCCESS immich" || logger "CRON_FAILURE immich"
#10 * * * * /home/lucas/scripts/file_processing/rename_camera_folder.py && logger "CRON_SUCCESS rename_cam" || logger "CRON_FAILURE rename_cam"
0 3 * * * /home/lucas/scripts/docker_compose/docker_renew_certbot.sh && logger "CRON_SUCCESS renew_cert" || logger "CRON_FAILURE renew_cert"
0 3 * * 0 /home/lucas/scripts/utils/download_latest_ubuntu.sh && logger "CRON_SUCCESS ubuntu" || logger "CRON_FAILURE ubuntu"
0 3 * * 0 /home/lucas/scripts/utils/rotate_logs.py && logger "CRON_SUCCESS logs" || logger "CRON_FAILURE logs"
0 0 1 * * /home/lucas/scripts/network/wol.sh quiethost && logger "CRON_SUCCESS quietwake" || logger "CRON_FAILURE quietwake"
@@ -17,17 +17,27 @@ services:
DIUN_PROVIDERS_DOCKER: "true"
DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT: "true"
# Email notifications
DIUN_NOTIF_MAIL_HOST: smtp.web.de
DIUN_NOTIF_MAIL_PORT: 587
DIUN_NOTIF_MAIL_USERNAME: ll_m@web.de
DIUN_NOTIF_MAIL_PASSWORD: Mira2012
DIUN_NOTIF_MAIL_FROM: ll_m@web.de
DIUN_NOTIF_MAIL_TO: ll_m@web.de
DIUN_NOTIF_MAIL_INSECURESKIPVERIFY: "false"
# Metrics
DIUN_METRICS_ENABLED: "true"
DIUN_METRICS_ADDR: ":9090"
DIUN_METRICS_TOKEN: "Qj#8C!@Uz3uRWm@mCd@KH6Bo7nfQ4K"
# # Email notifications
# DIUN_NOTIF_MAIL_HOST: smtp.web.de
# DIUN_NOTIF_MAIL_PORT: 587
# DIUN_NOTIF_MAIL_USERNAME: ll_m@web.de
# DIUN_NOTIF_MAIL_PASSWORD: Mira2012
# DIUN_NOTIF_MAIL_FROM: ll_m@web.de
# DIUN_NOTIF_MAIL_TO: ll_m@web.de
# DIUN_NOTIF_MAIL_INSECURESKIPVERIFY: "false"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
- shared-prometheus-services
networks:
shared-prometheus-services:
external: true
+12
View File
@@ -0,0 +1,12 @@
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/data/torrent/qbittorrent/mediahost 192.168.0.2(rw,sync,no_subtree_check)
+23
View File
@@ -0,0 +1,23 @@
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-r8YfWcv5quj81USd5JVq2hhAsFYHSOzApd2lI7XnRXm9tFwB4UaNsO2f5le5eX0f / ext4 defaults 0 1
# /boot was on /dev/nvme0n1p2 during curtin installation
/dev/disk/by-uuid/d88641c2-0c6a-47a6-b3e6-af4b6bbd9b05 /boot ext4 defaults 0 1
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/CEA1-EE2F /boot/efi vfat defaults 0 1
# /docker was on /dev/ubuntu-vg/docker-vg during curtin installation
/dev/disk/by-id/dm-uuid-LVM-r8YfWcv5quj81USd5JVq2hhAsFYHSOzAoaSA1n5zU8GkQuzTSQ9OBbNTaAoY2giE /docker ext4 defaults 0 1
/swap.img none swap sw 0 0
192.168.0.2:/torrent/qbittorrent-private/downloads /data/torrent/qbittorrent-private/downloads nfs defaults,_netdev 0 0
192.168.0.2:/torrent/qbittorrent-public/downloads /data/torrent/qbittorrent-public/downloads nfs defaults,_netdev 0 0
192.168.0.2:/special-torrent/torrent /data/torrent/qbittorrent-special/downloads nfs defaults,_netdev 0 0
#192.168.0.2:/torrent/qbittorrent/downloads /torrent/qbittorrent/downloads nfs defaults,_netdev,uid=1000,gid=1000 0 0
# Backup
/dev/disk/by-uuid/8a602724-8401-4b4b-8b54-7e9d2f633a9c /backup ext4 defaults 0 1
@@ -0,0 +1,2 @@
container:
network: gitea-network
@@ -16,4 +16,44 @@ services:
- /data/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- gitea-network
- shared-proxy-services
gitea-runner:
image: docker.io/gitea/act_runner:latest
container_name: gitea-runner
restart: unless-stopped
environment:
GITEA_INSTANCE_URL: http://gitea:3000
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_TOKEN}
GITEA_RUNNER_NAME: docker-runner
GITEA_RUNNER_LABELS: ubuntu-latest:docker://node:20-bookworm
CONFIG_FILE: /config.yaml
volumes:
- ./runner-data:/data
- ./config.yaml:/config.yaml:ro
- /var/run/docker.sock:/var/run/docker.sock
networks:
- gitea-network
# gitea-runner:
# image: docker.io/gitea/runner:5-dind
# container_name: gitea-runner
# restart: unless-stopped
# privileged: true
# environment:
# GITEA_INSTANCE_URL: http://gitea:3000
# GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_RUNNER_TOKEN}
# GITEA_RUNNER_NAME: docker-runner
# GITEA_RUNNER_LABELS: ubuntu-latest:docker://node:20-bookworm
#
# volumes:
# - ./runner-data:/data
# - ./config.yaml:/config.yaml
# networks:
# - gitea-network
networks:
gitea-network:
external: true
shared-proxy-services:
external: true
@@ -9,6 +9,11 @@ services:
TZ: Europe/Vienna
volumes:
- /srv/homeassistant:/config
devices:
- /dev/bus/usb:/dev/bus/usb
cap_add:
- NET_ADMIN
- NET_RAW
mosquitto:
container_name: mosquitto
@@ -0,0 +1,105 @@
#
# WARNING: To install Immich, follow our guide: https://docs.immich.app/install/docker-compose
#
# Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
name: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
# file: hwaccel.transcoding.yml
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /data/immich/pictures:/library
- /data/immich/dropfolder:/library_dropfolder
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
ports:
- '2283:2283'
depends_on:
- database
restart: always
healthcheck:
disable: false
networks:
- immich
- shared-redis-services
- shared-proxy-services
immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
# extends: # uncomment this section for hardware acceleration - see https://docs.immich.app/features/ml-hardware-acceleration
# file: hwaccel.ml.yml
# service: cpu # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
env_file:
- .env
restart: always
healthcheck:
disable: false
networks:
- immich
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
# Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
DB_STORAGE_TYPE: 'HDD'
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 128mb
restart: always
healthcheck:
disable: false
networks:
- immich
immich-power-tools:
container_name: immich_power_tools
image: ghcr.io/immich-power-tools/immich-power-tools:latest
restart: unless-stopped
ports:
- "8001:3000"
env_file:
- .env
volumes:
- immich-power-tools-data:/app/data
environment:
IMMICH_URL: http://immich_server:2283
EXTERNAL_IMMICH_URL: https://fotos.someoneslinux.selfhost.eu
IMMICH_API_KEY: "ROCfyJGLFBJSxKYXBcdfEfec7P80FVkvyr6fk8hThg"
DB_HOST: database
DB_PORT: 5432
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_DATABASE_NAME: ${DB_DATABASE_NAME}
networks:
- immich
volumes:
model-cache:
immich-power-tools-data:
networks:
immich:
shared-redis-services:
external: true
shared-proxy-services:
external: true
@@ -7,6 +7,8 @@ services:
- /docker/jellyfin/config:/config
- /docker/jellyfin/cache:/cache
- /data/jellyfin/media:/media
devices:
- /dev/dri:/dev/dri
restart: unless-stopped
ports:
- "8096:8096"
@@ -15,7 +17,6 @@ services:
networks:
- default
- shared-proxy-services
seerr:
image: ghcr.io/seerr-team/seerr:latest
container_name: seerr
@@ -29,6 +30,7 @@ services:
networks:
- default
- shared-proxy-services
networks:
default:
external: true
@@ -1,7 +1,29 @@
services:
sonarr-de:
# image: lscr.io/linuxserver/sonarr:latest
image: ghcr.io/hotio/sonarr:latest
container_name: sonarr-de
restart: unless-stopped
ports:
- "8990:8989"
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin
volumes:
- ./sonarr_DE:/config
- /data/jellyfin/media/series-german:/JellyfinSeriesGerman
- /data/jellyfin/media/anime-german:/JellyfinAnimeGerman
- /data/jellyfin/media/series-kids:/JellyfinKinder
- /data/jellyfin/media/documentaries-german:/JellyfinDocusGerman
- /data/jellyfin/buffer:/buffer
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
- /torrent/rundfunkarr-de:/downloads-rundfunkarr
sonarr-en:
image: lscr.io/linuxserver/sonarr:latest
# image: lscr.io/linuxserver/sonarr:latest
image: ghcr.io/hotio/sonarr:latest
container_name: sonarr-en
restart: unless-stopped
ports:
@@ -16,25 +38,8 @@ services:
- /data/jellyfin/media/anime-english:/JellyfinAnimeEnglish
- /data/jellyfin/media/documentaries-english:/JellyfinDocus
- /data/jellyfin/buffer:/buffer
- /torrent/qbittorrent/downloads:/downloads
sonarr-de:
image: lscr.io/linuxserver/sonarr:latest
container_name: sonarr-de
restart: unless-stopped
ports:
- "8990:8989"
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin
volumes:
- ./sonarr_DE:/config
- /data/jellyfin/media/series-german:/JellyfinSeriesGerman
- /data/jellyfin/media/anime-german:/JellyfinAnimeGerman
- /data/jellyfin/media/series-kids:/JellyfinKinder
- /data/jellyfin/buffer:/buffer
- /torrent/qbittorrent/downloads:/downloads
- /torrent/rundfunkarr:/downloads-rundfunkarr
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
radarr-en:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr-en
@@ -49,7 +54,8 @@ services:
- ./radarr_EN:/config
- /data/jellyfin/media/movies-english:/JellyfinMoviesEnglish
- /data/jellyfin/media/comedy-english:/JellyfinComedy
- /torrent/qbittorrent/downloads:/downloads
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
- /data/jellyfin/buffer:/buffer
radarr-de:
image: lscr.io/linuxserver/radarr:latest
@@ -66,8 +72,9 @@ services:
- /data/jellyfin/media/movies-german:/JellyfinMoviesGerman
- /data/jellyfin/media/movies-kids:/JellyfinKinder
- /data/jellyfin/buffer:/buffer
- /torrent/qbittorrent/downloads:/downloads
- /torrent/rundfunkarr:/downloads-rundfunkarr
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
- /torrent/rundfunkarr-de:/downloads-rundfunkarr
prowlarr:
image: lscr.io/linuxserver/prowlarr:latest
container_name: prowlarr
@@ -80,25 +87,36 @@ services:
- TZ=Europe/Vienna
volumes:
- ./prowlarr:/config
gluetun-rundfunkarr-de:
image: qmcgaw/gluetun
image: qmcgaw/gluetun:latest
container_name: gluetun-rundfunkarr-de
cap_add:
- NET_ADMIN
restart: unless-stopped
volumes:
- ./gluetun-de:/gluetun/wireguard
environment:
- VPN_SERVICE_PROVIDER=custom
- VPN_TYPE=wireguard
ports:
- "6767:6767" # Rundfunkarr UI
# rundfunkarr-at:
# image: rundfunkarr:local
# container_name: rundfunkarr-at
# environment:
# - TZ=Europe/Berlin
# - PUID=1000 # User ID (id -u)
# - PGID=1000 # Group ID (id -g)
# - DOWNLOAD_FOLDER_PATH=/downloads-rundfunkarr
# volumes:
# - ./rundfunkarr-at:/app/prisma/data
# - /torrent/rundfunkarr-at:/downloads-rundfunkarr
# ports:
# - 6768:6767
# restart: unless-stopped
rundfunkarr-de:
image: ghcr.io/rundfunkarr/rundfunkarr:latest
# image: ghcr.io/rundfunkarr/rundfunkarr:latest
image: rundfunkarr:local
container_name: rundfunkarr-de
environment:
- TZ=Europe/Berlin
@@ -114,18 +132,14 @@ services:
network_mode: "service:gluetun-rundfunkarr-de"
depends_on:
- gluetun-rundfunkarr-de
gluetun-at:
image: qmcgaw/gluetun:latest
container_name: gluetun-at
restart: unless-stopped
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- "8888:8888" # HTTP Proxy
- "1080:1080" # SOCKS5 Proxy
@@ -134,10 +148,12 @@ services:
- VPN_TYPE=wireguard
- SOCKS5_ENABLED=on
- HTTPPROXY=on
- HTTP_LISTENING_ADDRESS:=8888
- SOCKSPROXY=on
- TZ=Europe/Vienna
- DNS_SERVER=on
- DNS_UPSTREAM_RESOLVER_TYPE=plain
- DNS_UPSTREAM_PLAIN_ADDRESSES=1.1.1.1:53,8.8.8.8:53
volumes:
- ./gluetun-at:/gluetun/wireguard
# lazylibrarian:
@@ -154,7 +170,7 @@ services:
# - ./lazylibrarian:/config
# - /data/audiobookshelf/podcasts:/podcasts
# - /data/audiobookshelf/audiobooks-englisch:/audiobooks
# - /torrent/qbittorrent/downloads:/downloads
# - /torrent/qbittorrent-private/downloads:/downloads
flaresolverr:
image: ghcr.io/flaresolverr/flaresolverr:latest
@@ -169,7 +185,7 @@ services:
- "8191:8191"
lidarr:
image: lscr.io/linuxserver/lidarr:latest
image: lscr.io/linuxserver/lidarr:develop #latest
container_name: lidarr
environment:
- PUID=1000
@@ -177,8 +193,9 @@ services:
- TZ=Europe/Berlin
volumes:
- ./lidarr:/config
- /data/navidrome/music:/music
- /torrent/qbittorrent/downloads:/downloads
- /data/navidrome/music/music:/music
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
ports:
- 8686:8686
@@ -232,44 +249,129 @@ services:
- /data/audiobookshelf/data/audiobooks-englisch:/audiobooks-english
- /data/audiobookshelf/data/audiobooks-deutsch:/audiobooks-german
- /data/audiobookshelf/data/audiobooks-kinder:/audiobooks-kinder
- /torrent/qbittorrent/downloads:/downloads
- /torrent/qbittorrent-public/downloads:/downloads-public
- /torrent/qbittorrent-private/downloads:/downloads-private
restart: unless-stopped
upload-assistant:
image: ghcr.io/audionut/upload-assistant:latest
container_name: upload-assistant
restart: unless-stopped
ports:
- "5000:5000"
jackett:
image: lscr.io/linuxserver/jackett:latest
container_name: jackett
environment:
- PUID=1000
- PGID=1000
# Paths visible in the file browser
- UA_BROWSE_ROOTS=/downloads,/data
command: ["--webui", "0.0.0.0:5000"]
- TZ=Europe/Vienna
volumes:
- ./upload-assistant:/Upload-Assistant/data
# Sonarr/Radarr libraries
- /data/jellyfin/media/series-english:/data/series-english:ro
- /data/jellyfin/media/anime-english:/data/anime-english:ro
- /data/jellyfin/media/documentaries-english:/docus-english:ro
- /data/jellyfin/media/series-german:/series-german:ro
- /data/jellyfin/media/anime-german:/anime-german:ro
- /data/jellyfin/media/series-kids:/series-kids:ro
- /data/jellyfin/media/movies-english:/data/movies-english:ro
- /data/jellyfin/media/comedy-english:/data/comedy-english:ro
- /data/jellyfin/media/movies-german:/data/movies-german:ro
- /data/jellyfin/media/movies-kids:/data/movies-kids:ro
# - /data/audiobookshelf/podcasts:/podcasts
# - /data/audiobookshelf/audiobooks-englisch:/audiobooks
- /data/navidrome/music:/data/music:ro
- /data/audiobookshelf/data/audiobooks-englisch:/data/audiobooks-english:ro
- /data/audiobookshelf/data/audiobooks-deutsch:/data/audiobooks-german:ro
- /data/audiobookshelf/data/audiobooks-kinder:/data/audiobooks-kinder:ro
# Download location
- /torrent/qbittorrent/downloads:/downloads
- ./jackett/config:/config
- ./jackett/downloads:/downloads
ports:
- "9117:9117"
restart: unless-stopped
gluetun-proxy:
image: qmcgaw/gluetun:latest
container_name: gluetun-proxy
cap_add:
- NET_ADMIN
ports:
- "8889:8888" # HTTP proxy
- "8388:8388" # SOCKS5 proxy
volumes:
- ./gluetun-proxy:/gluetun/wireguard
- /dev/net/tun:/dev/net/tun
environment:
- VPN_SERVICE_PROVIDER=custom
- VPN_TYPE=wireguard
- SOCKS5_ENABLED=on
- HTTPPROXY=on
- SOCKSPROXY=on
restart: unless-stopped
#cleanuparr:
# image: ghcr.io/cleanuparr/cleanuparr:latest
# container_name: cleanuparr
# restart: unless-stopped
# ports:
# - "11011:11011"
# volumes:
# - ./cleanuparr:/config
# - /torrent/qbittorrent-private/downloads:/downloads-private
# - /torrent/qbittorrent-public/downloads:/downloads-public
# - /torrent/qbittorrent-private/orphaned:/orphaned
# environment:
# - PORT=11011
# - BASE_PATH=
# - PUID=1000
# - PGID=1000
# - UMASK=022
# - TZ=Europe/Vienna
whisparr:
image: ghcr.io/thespad/whisparr:latest
container_name: whisparr
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Vienna
ports:
- "6969:6969"
volumes:
- ./whisparr:/config
- /data/whisparr:/data
- /torrent/qbittorrent-private/downloads:/downloads-private
- /torrent/qbittorrent-public/downloads:/downloads-public
restart: unless-stopped
unpackerr:
image: golift/unpackerr
container_name: unpackerr
volumes:
- /torrent/qbittorrent-private/downloads:/downloads-private
- ./unpackerr:/config
restart: always
user: 1000:1000
environment:
- TZ=America/New_York
- PUID=1000
- PGID=1000
## Global Settings
- UN_DEBUG=true
- UN_LOG_FILE=/config/unpackerr.log
- UN_LOG_FILES=10
- UN_LOG_FILE_MB=10
- UN_INTERVAL=10m
- UN_PROGRESS=15s
- UN_START_DELAY=1m
- UN_RETRY_DELAY=5m
- UN_MAX_RETRIES=2
- UN_REMNANT_ACTION=rename
- UN_PARALLEL=1
- UN_FILE_MODE=0644
- UN_DIR_MODE=0755
# Sonarr-de
- UN_SONARR_0_URL=http://sonarr-de:8989
- UN_SONARR_0_API_KEY=707d4fcbb3d74822ba990c6a8b7278e9
- UN_SONARR_0_PATHS_0=/downloads-private/tv-sonarr-de
- UN_SONARR_0_DELETE_DELAY=5m
# Sonarr-en
- UN_SONARR_1_URL=http://sonarr-en:8989
- UN_SONARR_1_API_KEY=e2005c5c204840878f8eb37d1ac6aa0e
- UN_SONARR_1_PATHS_0=/downloads-private/tv-sonarr-en
- UN_SONARR_1_DELETE_DELAY=5m
# Radarr-de
- UN_RADARR_0_URL=http://radarr-de:7878
- UN_RADARR_0_API_KEY=29f67f0ac8894357b22ea3f7fc1abfdf
- UN_RADARR_0_PATHS_0=/downloads-private/radarr-de
- UN_RADARR_0_DELETE_DELAY=5m
# Radarr-en
- UN_RADARR_1_URL=http://radarr-en:7878
- UN_RADARR_1_API_KEY=4332aee075c748f2acee41aa26f06007
- UN_RADARR_1_PATHS_0=/downloads-private/radarr-en
- UN_RADARR_1_DELETE_DELAY=5m
# Lidarr
- UN_LIDARR_0_URL=http://lidarr:8686
- UN_LIDARR_0_API_KEY=bb41cbf2b17e439290f90ecfaeb24dff
- UN_LIDARR_0_PATHS_0=/downloads-private/lidarr
- UN_LIDARR_0_DELETE_DELAY=5m
# Whisparr
- UN_WHISPARR_0_URL=http://whisparr:6969
- UN_WHISPARR_0_API_KEY=3a5403b7a36f4e679398d959cdd39b1b
- UN_WHISPARR_0_PATHS_0=/downloads-private/whisparr
- UN_WHISPARR_0_DELETE_DELAY=5m
networks:
default:
external: true
@@ -0,0 +1,11 @@
#
# Use this configuration with WireGuard client
#
[Interface]
Address = 10.14.0.2/16
PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I=
DNS = 162.252.172.57, 149.154.159.92
[Peer]
PublicKey = dPZe8Jq3Hu0k07MDk+Y4+AS2XHSLYalyg91TSFXRYEA=
AllowedIPs = 0.0.0.0/0
Endpoint = 87.249.133.4:51820
@@ -0,0 +1,566 @@
#######################################################
## Unpackerr Example Configuration File ##
#######################################################
## The values are a mix of defaults and examples. ##
## Env vars overlay the process, not this file. ##
## More configuration help: https://unpackerr.zip ##
## Config Generator: https://notifiarr.com/unpackerr ##
#######################################################
## Turn on debug messages in the output. Do not wrap this in quotes.
## Recommend trying this so you know what it looks like. I personally leave it on.
#debug = false
## Disable writing messages to stdout/stderr. This silences the app. Set a log
## file below if you set this to true. Recommended when starting with systemctl.
#quiet = false
## Send error output to stderr instead of stdout by setting error_stderr to true.
## Recommend leaving this at false. Ignored if quiet (above) is true.
#error_stderr = false
## Setting activity to true will silence all app queue log lines with only zeros.
## Set this to true when you want less log spam.
#activity = false
## The Starr-application activity queue is logged on an interval.
## Adjust that interval with this setting.
## Default is a minute. 2m, 5m, 10m, 30m, 1h are also perfectly acceptable.
#log_queues = "1m"
## Write messages to a log file. This is the same data that is normally output to stdout.
## This setting is great for Docker users that want to export their logs to a file.
## The alternative is to use syslog to log the output of the application to a file.
## Default is no log file; this is unset.
## Except on macOS and Windows, the log file gets set to "~/.unpackerr/unpackerr.log"
## log_files=0 turns off auto-rotation so logrotate can own the file.
## After logrotate renames the live file, send SIGHUP (`systemctl reload unpackerr`)
## to close and reopen it. Use logrotate `create` plus postrotate HUP, not copytruncate.
## Default files is 10 and size(mb) is 10 Megabytes.
#log_file = ''
#log_files = 10
#log_file_mb = 10
#log_file_mode = "0600"
## How many completed or failed items to keep in unpackerr.history.jsonl
## (next to the log file, or the config file if logs go to stdout).
## With neither a log file nor a config file, history stays in memory
## for this process and is not written to disk, so it does not survive
## a restart. Set `log_file` or use a config file to persist it.
## In-progress extracts are also written so a restart can resume them
## for 72 hours (Starr waiting for import, folders waiting on
## delete_after). Those in-progress rows do not count against this
## number. Imported and failed rows do. The history API still lists
## only completed or failed rows.
## `0` disables history and restart resume.
#keep_history = 400
## How often to poll starr apps (sonarr, radarr, etc).
## Recommend 1m-5m. Uses Go Duration.
#interval = "2m"
## How often status is logged for in-progress extractions.
## `0` uses the default `15s`. Uses Go Duration.
#progress = "15s"
## How long an item must be queued (download complete) before extraction will start.
## One minute is the historic default and works well. Set higher if your downloads
## take longer to finalize (or transfer locally). Uses Go Duration.
#start_delay = "1m"
## How long to wait before removing the history for a failed extraction.
## Once the history is deleted the item will be recognized as new and
## extraction will start again. Uses Go Duration.
#retry_delay = "5m"
## How many times to retry a failed extraction after the first try. Default is 2
## (3 attempts total). `0` uses that default. Pauses retry_delay between attempts.
#max_retries = 2
## Applies to Starr apps and to watched folders with `move_back` enabled
## (the default folder config extracts into a sidecar tree and does not
## classify leftovers there). When an extracted file cannot be moved into
## place because the destination already exists, Unpackerr checks whether
## that name was present before extraction. Names that arrived with the
## download are kept; names that were not (leftovers from an interrupted
## extraction) are handled by this setting. `rename` (default) moves the
## leftover to a sibling named with a `.remnant` suffix and retries the
## extract. `delete` removes it and retries. `off` leaves the leftover
## in place and fails the extract without retrying. The item stays failed
## until it leaves the Starr queue (folders are untracked). Bounded by
## max_retries; if retries are exhausted the leftover fails the extract
## instead of reporting success.
#remnant_action = "rename"
## How many files may be extracted in parallel. 1 works fine.
## Do not wrap the number in quotes. Raise this only if you have fast disks and CPU.
#parallel = 1
## Extracted files are created with this mode. The process umask still
## applies, so 0666 becomes 0644 under umask 0022. Use 0644, or 0660 or
## 0666 when another user must write the extracted files. Archive
## execute bits are kept only for a watched folder with preserve_exec
## enabled.
#file_mode = "0644"
## Extracted directories are created with this mode. The process umask
## still applies.
#dir_mode = "0755"
## List of passwords to use for encrypted archives. Must be a list of strings.
## Use this special format as a password to read more passwords from a file:
## passwords = [ "filepath:/path/to/passwords.txt" ]
#passwords = []
[webserver]
## Expose Prometheus metrics at /metrics. The HTTP server starts whenever listen_addr is set;
## this only controls the /metrics route. Scrapes must send an API key with
## system:metrics:read via Authorization: Bearer or X-Api-Key.
# metrics = false
## Expose Go pprof handlers at /debug/pprof/. Leave this false unless you
## are debugging the running process.
# pprof = false
## This may be set to a port or an ip:port to bind a specific IP. 0.0.0.0 binds ALL IPs.
## Set this to an empty string to disable the HTTP server.
# listen_addr = "0.0.0.0:5656"
## Local UI login. Use user:pass (hashed on startup), !!cryptd!!user:$2a$...
## for a stored hash, webauth:X-Webauth-User for a reverse-proxy header, or
## noauth. The HTTP API does not accept plaintext; send user:<PBKDF2 hex>
## (same digest as login) and uiCurrentKdf when changing a live password.
## filepath:/path reads that file for the live password and keeps filepath: in the
## config. Empty generates a temporary password when the HTTP server is enabled.
## Reset with --reset. Do not set an empty
## UN_WEBSERVER_UI_PASSWORD; a present empty env value wipes a stored hash.
ui_password = "!!cryptd!!admin:$2a$10$t8pChUtJw.VZW2DO47Lh/.2nE9J.jHnx.MH5VncjCZ2LADfso64oe"
## Used with webauth (proxy header auth). Empty keeps those proxy users
## as admin. Ignored for noauth and local password login. Set this to a
## header the reverse proxy fills, for example X-Webauth-Role or
## X-Authentik-Groups. Matching names are a built-in admin or a custom
## [webserver.roles] name. Comma, semicolon, pipe, or space separated
## lists are unioned; extra IdP groups are ignored. A selected header
## that is missing, empty, or has no matching role is access denied,
## not admin.
## example: ui_role_header = "X-Webauth-Role"
# ui_role_header = ""
## Recommend setting a log file for HTTP requests. Otherwise, they go with other logs.
# log_file = ''
## This app automatically rotates logs. Set these to the size and number to keep.
## log_files=0 disables auto-rotation; SIGHUP reopens the HTTP log too.
# log_files = 10
# log_file_mb = 10
## Set both of these to valid file paths to enable HTTPS/TLS.
# ssl_cert_file = ''
# ssl_key_file = ''
## Base URL from which to serve content.
# urlbase = "/"
## Upstreams should be set to the IP or CIDR of your trusted upstream proxy.
## Setting this correctly allows X-Forwarded-For to be used in logs.
## In the future it may control auth proxy trust. Must be a list of strings.
## example: upstreams = [ "127.0.0.1/32", "10.1.2.0/24" ]
# upstreams = []
## Empty keeps the library same-origin check (the embedded UI). Add hosts
## when a browser on another origin should open GET /ws, for example
## localhost:5173 or https://ui.example.com. Patterns use path.Match;
## a URI scheme is matched as scheme://host. Do not set * unless you
## intend to allow every origin.
## example: ws_origins = [ "localhost:5173" ]
# ws_origins = []
## Nested [[webserver.api_keys]] tables, not an inline array. Each key is 60–150 ASCII
## characters. Names and key values must be unique. Built-in role `admin` grants every
## permission. Custom roles are listed under [webserver.roles].
## Env uses UN_WEBSERVER_API_KEYS_0_NAME, _KEY, and _ROLES_0.
## Nested [webserver.roles.<name>] tables. Names are letters, digits, _ or -.
## Built-in admin cannot be redefined. `*` is reserved for that built-in role.
## Each custom role needs at least one known permission.
## File browser is system:browse:read (list) and system:browse:write (create folder).
## Env works but is picky: do not set UN_WEBSERVER_ROLES itself. Role names are
## case-sensitive and may contain underscores. Index permissions from 0:
## UN_WEBSERVER_ROLES_stats_PERMISSIONS_0=system:stats:read
## UN_WEBSERVER_ROLES_read_only_PERMISSIONS_0=system:stats:read
## [webserver.roles.stats]
## permissions = ["system:stats:read"]
[[webserver.api_keys]]
name = "admin"
key = "Gv7I8Y0wY7-KFjZxeRD_mVvSm8Ca2sxvo267DY9GG5YKD34BBMGIeudHQy_tI7gq"
roles = ["admin"]
## Global Folder configuration that affects all watched folders.
[folders]
## How many new folder events can be immediately queued. Don't change this.
# buffer = 20000
###############################################################################
##-IMPORTANT-#######-READ THIS!!!-################ Seriously, read this. ######
###############################################################################
## The following sections can be repeated if you have more than one Sonarr, ##
## Radarr, Lidarr, Readarr, Folder, Webhook, and/or Command Hook. ##
## Identify each instance with a short key: [sonarr.uhd], [folder.tv]. ##
## Changed in v1.0.0 (October 2026): map keys, not [[array]] list rows. ##
## You MUST uncomment the [header.0], url and api_key for any Starr app. ##
## Uncomment [sonarr.0], [radarr.0], [lidarr.0], and/or [readarr.0] plus the ##
## url and api_key if that app is in use. ##
## Do not set a bare UN_SONARR / UN_FOLDER / UN_WEBHOOK / UN_CMDHOOK. ##
###############################################################################
###############################################################################
## ALL LINES BEGINNING WITH A HASH # ARE IGNORED COMMENTS ##
## REMOVE THE HASH # FROM CONFIG LINES YOU WANT TO CHANGE ##
###############################################################################
###############################################################################
#[sonarr.0]
## Empty uses the app name (Sonarr, Radarr, and so on). Set this for a
## Sonarr-compatible app such as Sportarr so logs and Discord are not
## tagged Sonarr. Add Whisparr as a Radarr instance with name = "Whisparr".
## Hook exclude matches this name or the app dialect.
## Names must be printable and cannot contain quotes, braces, or angle brackets.
# name = ""
# url = "http://127.0.0.1:8989"
# api_key = "0123456789abcdef0123456789abcdef"
## Username for HTTP basic authentication on the Starr app, if enabled.
# http_user = ""
## Password for HTTP basic authentication on the Starr app, if enabled.
# http_pass = ""
## Username for Starr native (forms) authentication, if enabled.
# username = ""
## Password for Starr native (forms) authentication, if enabled.
# password = ""
## List of paths where content is downloaded for this app.
## Used as fallback if the path the Starr app reports does not exist or is not accessible.
# paths = ['/downloads']
## Protocols to process from the download queue. Starr apps historically
## used "torrent" and "usenet" as the protocol strings, but newer versions
## emit the full class names "TorrentDownloadProtocol" and
## "UsenetDownloadProtocol" instead. List every string your app may return,
## separated by commas. The default covers both the legacy and new torrent
## strings. Add "usenet,UsenetDownloadProtocol" if you use a Usenet client.
# protocols = "torrent,TorrentDownloadProtocol"
## How long to wait for a reply from the backend.
# timeout = "10s"
## How long to wait after import before deleting the extracted items.
# delete_delay = "5m"
## If you use this app with NZB you may wish to delete archives after extraction.
## General recommendation is: do not enable this for torrent use.
## Setting this to true deletes the entire original download folder after import.
# delete_orig = false
## If you use Syncthing, setting this to true will make unpackerr wait for syncs to finish.
# syncthing = false
## When true, Unpackerr verifies the Starr app HTTPS certificate.
## The default is false for backward compatibility.
# valid_ssl = false
## Per-archive uncompressed-byte cap. Empty uses the app default:
## Sonarr 20GB, Radarr 75GB, Lidarr 4GB, Readarr 1GB.
## `0` or `0B` disables the cap for this instance.
# max_bytes = ""
#[radarr.0]
## Empty uses the app name (Sonarr, Radarr, and so on). Set this for a
## Sonarr-compatible app such as Sportarr so logs and Discord are not
## tagged Sonarr. Add Whisparr as a Radarr instance with name = "Whisparr".
## Hook exclude matches this name or the app dialect.
## Names must be printable and cannot contain quotes, braces, or angle brackets.
# name = ""
# url = "http://127.0.0.1:7878"
# api_key = "0123456789abcdef0123456789abcdef"
## Username for HTTP basic authentication on the Starr app, if enabled.
# http_user = ""
## Password for HTTP basic authentication on the Starr app, if enabled.
# http_pass = ""
## Username for Starr native (forms) authentication, if enabled.
# username = ""
## Password for Starr native (forms) authentication, if enabled.
# password = ""
## List of paths where content is downloaded for this app.
## Used as fallback if the path the Starr app reports does not exist or is not accessible.
# paths = ['/downloads']
## Protocols to process from the download queue. Starr apps historically
## used "torrent" and "usenet" as the protocol strings, but newer versions
## emit the full class names "TorrentDownloadProtocol" and
## "UsenetDownloadProtocol" instead. List every string your app may return,
## separated by commas. The default covers both the legacy and new torrent
## strings. Add "usenet,UsenetDownloadProtocol" if you use a Usenet client.
# protocols = "torrent,TorrentDownloadProtocol"
## How long to wait for a reply from the backend.
# timeout = "10s"
## How long to wait after import before deleting the extracted items.
# delete_delay = "5m"
## If you use this app with NZB you may wish to delete archives after extraction.
## General recommendation is: do not enable this for torrent use.
## Setting this to true deletes the entire original download folder after import.
# delete_orig = false
## If you use Syncthing, setting this to true will make unpackerr wait for syncs to finish.
# syncthing = false
## When true, Unpackerr verifies the Starr app HTTPS certificate.
## The default is false for backward compatibility.
# valid_ssl = false
## Per-archive uncompressed-byte cap. Empty uses the app default:
## Sonarr 20GB, Radarr 75GB, Lidarr 4GB, Readarr 1GB.
## `0` or `0B` disables the cap for this instance.
# max_bytes = ""
#[lidarr.0]
## Empty uses the app name (Sonarr, Radarr, and so on). Set this for a
## Sonarr-compatible app such as Sportarr so logs and Discord are not
## tagged Sonarr. Add Whisparr as a Radarr instance with name = "Whisparr".
## Hook exclude matches this name or the app dialect.
## Names must be printable and cannot contain quotes, braces, or angle brackets.
# name = ""
# url = "http://127.0.0.1:8686"
# api_key = "0123456789abcdef0123456789abcdef"
## Username for HTTP basic authentication on the Starr app, if enabled.
# http_user = ""
## Password for HTTP basic authentication on the Starr app, if enabled.
# http_pass = ""
## Username for Starr native (forms) authentication, if enabled.
# username = ""
## Password for Starr native (forms) authentication, if enabled.
# password = ""
## List of paths where content is downloaded for this app.
## Used as fallback if the path the Starr app reports does not exist or is not accessible.
# paths = ['/downloads']
## Protocols to process from the download queue. Starr apps historically
## used "torrent" and "usenet" as the protocol strings, but newer versions
## emit the full class names "TorrentDownloadProtocol" and
## "UsenetDownloadProtocol" instead. List every string your app may return,
## separated by commas. The default covers both the legacy and new torrent
## strings. Add "usenet,UsenetDownloadProtocol" if you use a Usenet client.
# protocols = "torrent,TorrentDownloadProtocol"
## How long to wait for a reply from the backend.
# timeout = "10s"
## How long to wait after import before deleting the extracted items.
# delete_delay = "5m"
## If you use this app with NZB you may wish to delete archives after extraction.
## General recommendation is: do not enable this for torrent use.
## Setting this to true deletes the entire original download folder after import.
# delete_orig = false
## If you use Syncthing, setting this to true will make unpackerr wait for syncs to finish.
# syncthing = false
## When true, Unpackerr verifies the Starr app HTTPS certificate.
## The default is false for backward compatibility.
# valid_ssl = false
## Per-archive uncompressed-byte cap. Empty uses the app default:
## Sonarr 20GB, Radarr 75GB, Lidarr 4GB, Readarr 1GB.
## `0` or `0B` disables the cap for this instance.
# max_bytes = ""
## When enabled, FLAC and APE files with CUE sheets are split into
## individual track files. ape_format and ape_compression choose what
## an APE image becomes.
# split_flac = false
## ape keeps Monkey's Audio. wav and flac decode the audio.
## Empty means ape. FLAC cannot store 32-bit or float PCM.
## Compression is ignored unless the format is ape.
# ape_format = "ape"
## Used only when ape_format is ape (or empty). A default of 0 is set
## to 2000. Accepted values are 1000, 2000, 3000, 4000, and 5000.
## WAV and FLAC ignore this.
# ape_compression = 0
#[readarr.0]
## Empty uses the app name (Sonarr, Radarr, and so on). Set this for a
## Sonarr-compatible app such as Sportarr so logs and Discord are not
## tagged Sonarr. Add Whisparr as a Radarr instance with name = "Whisparr".
## Hook exclude matches this name or the app dialect.
## Names must be printable and cannot contain quotes, braces, or angle brackets.
# name = ""
# url = "http://127.0.0.1:8787"
# api_key = "0123456789abcdef0123456789abcdef"
## Username for HTTP basic authentication on the Starr app, if enabled.
# http_user = ""
## Password for HTTP basic authentication on the Starr app, if enabled.
# http_pass = ""
## Username for Starr native (forms) authentication, if enabled.
# username = ""
## Password for Starr native (forms) authentication, if enabled.
# password = ""
## List of paths where content is downloaded for this app.
## Used as fallback if the path the Starr app reports does not exist or is not accessible.
# paths = ['/downloads']
## Protocols to process from the download queue. Starr apps historically
## used "torrent" and "usenet" as the protocol strings, but newer versions
## emit the full class names "TorrentDownloadProtocol" and
## "UsenetDownloadProtocol" instead. List every string your app may return,
## separated by commas. The default covers both the legacy and new torrent
## strings. Add "usenet,UsenetDownloadProtocol" if you use a Usenet client.
# protocols = "torrent,TorrentDownloadProtocol"
## How long to wait for a reply from the backend.
# timeout = "10s"
## How long to wait after import before deleting the extracted items.
# delete_delay = "5m"
## If you use this app with NZB you may wish to delete archives after extraction.
## General recommendation is: do not enable this for torrent use.
## Setting this to true deletes the entire original download folder after import.
# delete_orig = false
## If you use Syncthing, setting this to true will make unpackerr wait for syncs to finish.
# syncthing = false
## When true, Unpackerr verifies the Starr app HTTPS certificate.
## The default is false for backward compatibility.
# valid_ssl = false
## Per-archive uncompressed-byte cap. Empty uses the app default:
## Sonarr 20GB, Radarr 75GB, Lidarr 4GB, Readarr 1GB.
## `0` or `0B` disables the cap for this instance.
# max_bytes = ""
##################################################################################
### ### STOP HERE ### STOP HERE ### STOP HERE ### STOP HERE #### STOP HERE ### #
### Only using Starr apps? The things above. The below configs are OPTIONAL. ### #
##################################################################################
##-Folders-#######################################################################
## This application can also watch folders for things to extract. If you copy a ##
## subfolder into a watched folder (defined below) any extractable items in the ##
## folder will be decompressed. This has nothing to do with Starr applications. ##
##################################################################################
#[folder.0]
# path = '/downloads/auto_extract'
## How often this folder is scanned for new archives.
## Off (`0s`) uses filesystem events (inotify and friends).
## Enable a poll interval if files never show up in the queue, which is
## common on Docker and CIFS. Polling increases disk reads and is not
## recommended when fsnotify works.
# interval = "0s"
## Paths to ignore while watching this folder. Excluded paths and their
## children are not tracked or extracted.
## Paths may be absolute, or relative to this folder's `path`.
# exclude_paths = []
## Path to extract files to. The default (leaving this blank) is the same as `path` (above).
# extract_path = ''
## Delete extracted or original files this long after extraction.
## The default is 10m. Set to 0 to disable all deletes. Deletes also
## require `delete_files` and/or `delete_original`. Uses Go Duration.
# delete_after = "10m"
## Nested archives are extracted by default. Disable recursion to extract only the outer archive.
# disable_recursion = false
## Per-archive uncompressed-byte cap. Empty is unlimited. `0` or `0B` is also unlimited.
# max_bytes = ""
## Cap on files, directories, and symlinks created during extract. `0` is unlimited.
# max_files = 0
## Cap on `bytes written / archive file size`. `0` is unlimited.
# max_ratio = 0
## Cap on archives extracted from this folder's output (one extras pass). `0` is unlimited.
# max_nested = 0
## Walk depth for the extras pass. `0` is unlimited.
# extras_max_depth = 0
## When true, the initial archive search may include symlink-named files.
## The extras pass never follows archive-member zip links.
# allow_symlinks = false
## Delete extracted files after successful extraction? delete_after must be greater than 0.
# delete_files = false
## Delete original items after successful extraction? delete_after must be greater than 0.
# delete_original = false
## Disable extraction log (unpackerred.txt) file creation?
# disable_log = false
## Move extracted files into original folder? If false, files go into an _unpackerred folder.
# move_back = false
## Set this to true if you want this app to extract ISO files with .iso extension.
# extract_isos = false
## When true, an execute bit stored in the archive is kept for owner,
## group, or other only when file_mode already grants that class access.
## A 6 beside an archived 7 becomes 7, a 4 becomes 5, and a 0 stays 0.
## Off, extracted files use file_mode only. Starr extracts stay off.
## The process umask still applies.
# preserve_exec = false
## Incomplete-download suffixes such as `.part` or `.crdownload`. Extraction
## stays in waiting as long as any matching file is in the watched item's
## top folder. Subfolders are not scanned. The UI and config always store
## a leading period. Waiting items are rechecked every 5s even without the
## poller. Enabling folder poller will double-poll the folder and increase
## disk reads. Useful when fsnotify is not available, and not recommended
## when it is.
# wait_extensions = []
## After start delay, skip watched folders that have no extractable archives.
## They leave waiting without history or webhooks.
# skip_empty = false
####################
### Hook Payload ###
####################
# Extra IDs and custom event titles shared by every webhook and command hook.
[hooks]
## Nested [hooks.custom_ids] table, not an inline map.
## Webhooks get `customIDs` in JSON (`{{index .CustomIDs "url"}}` in templates).
## Command hooks get `UN_CUSTOM_ID_<key>` environment variables.
## Env: UN_HOOKS_CUSTOM_IDS_url=https://…
## [hooks.custom_ids]
## url = "https://unpackerr.example"
## Nested [hooks.titles] table with one field per extract event:
## waiting, queued, extracting, extractfailed, extracted, imported,
## deleting, deletefailed, deleted, extractednothing.
## Empty values keep the built-in English title. Built-in Discord, Slack,
## Telegram, Gotify, and Pushover templates use this string.
## Env: UN_HOOKS_TITLES_EXTRACTING=Archive Found
## [hooks.titles]
## extracting = "Archive Found"
################
### Webhooks ###
################
# Sends a webhook when an extraction queues, starts, finishes, and/or is deleted.
# Created to integrate with notifiarr.com.
# Also works natively with Discord.com, Telegram.org, Slack.com, ntfy, Apprise, and Mattermost webhooks.
# Can possibly be used with other services by providing a custom template_path.
###### Don't forget to uncomment [webhook.0] and url at a minimum !!!!
#[webhook.0]
## Notifiarr: https://notifiarr.com/api/v1/notification/unpackerr plus headers.X-Api-Key.
## A path API key in a pasted URL is moved to that header.
# url = "https://notifiarr.com/api/v1/notification/unpackerr"
## Provide an optional name to hide the URL in logs.
## If a name is not provided then the URL is used.
# name = ""
## Do not log success (less log spam).
# silent = false
## List of event ids to send notification for, [0] for all.
## The default is [0] and this is an example:
# events = [1, 4, 6]
## ===> Advanced Optional Webhook Configuration <===
## Discord, Slack, and Mattermost: bot/display name. Telegram: chat_id.
## Gotify, ntfy, and Apprise: optional title prefix. Unused by Notifiarr JSON.
# nickname = "Unpackerr"
## Also passed into templates. Slack and Mattermost optional channel. Pushover user key.
# channel = ""
## Passed into webhook templates. Pushover requires the application token. ntfy sends Authorization Bearer when set. Unused by Discord, Telegram, and Slack incoming webhooks.
# token = ""
## Dialect tokens skip every instance of that API. Any other value matches an instance name. None by default. This is an example:
# exclude = ["readarr", "lidarr"]
## Used when template is empty (automatic). A named template ignores this file.
# template_path = ''
## Override automatic template detection. Values: notifiarr, discord, telegram, gotify, pushover, slack, ntfy, apprise, mattermost. Empty uses the URL or template_path.
# template = ""
## Default on for Discord webhooks and Telegram sendMessage. Other templates ignore this. Set false to post a new message for every extract event.
# update = true
## Set this to true to ignore the SSL certificate on the server.
# ignore_ssl = false
## You can adjust how long to wait for a server response.
# timeout = "10s"
## If your custom template uses another MIME type, set this.
# content_type = "application/json"
## Nested [webhook.0.headers] table. Header names are letters, digits, underscore, or hyphen.
## Applied first; Content-Type and ntfy Authorization Bearer from token still win.
## Notifiarr client key: X-Api-Key. Env: UN_WEBHOOK_0_HEADERS_X-Api-Key=api_key_from_notifiarr_com
## [webhook.0.headers]
## X-Api-Key = "api_key_from_notifiarr_com"
#####################
### Command Hooks ###
#####################
# Executes a script or command when an extraction queues, starts, finishes, and/or is deleted.
# All data is passed in as environment variables. Try /usr/bin/env to see what variables are available.
###### Don't forget to uncomment [cmdhook.0] at a minimum !!!!
#[cmdhook.0]
# command = '/downloads/scripts/command.sh'
## Provide an optional name to hide the URL in logs.
## If a name is not provided the first word in the command is used.
# name = ""
## Runs the command inside /bin/sh ('nix) or cmd.exe (Windows).
# shell = false
## Do not log command's output.
# silent = false
## List of event ids to run command for, [0] for all.
## The default is [0] and this is an example:
# events = [1, 4, 7]
## ===> Optional Command Hook Configuration <===
## Dialect tokens skip every instance of that API. Any other value matches an instance name. None by default. This is an example:
# exclude = ["readarr", "lidarr"]
## You can adjust how long to wait for the command to run.
# timeout = "10s"
@@ -0,0 +1,8 @@
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_status_codes: []
method: GET
preferred_ip_protocol: ip4
@@ -8,14 +8,17 @@ services:
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
networks:
- default
- shared-prometheus-services
extra_hosts:
- "host.docker.internal:host-gateway"
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_USER: lucas
GF_SECURITY_ADMIN_PASSWORD: Mira2012
@@ -47,9 +50,9 @@ services:
volumes:
- '/:/host:ro,rslave'
- ./node_exporter/textfile_collector:/textfile:ro
ports:
- '9100:9100'
# ports:
# - '9100:9100'
network_mode: host
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
@@ -58,9 +61,65 @@ services:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /data:/data:ro
- /docker:/docker:ro
# - /data:/data:ro
# - /docker:/docker:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
- /dev/disk:/dev/disk:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- "--disable_metrics=percpu,tcp,udp,process,sched"
- "--housekeeping_interval=30s"
- "--housekeeping_interval=1m"
- "--docker_only=true"
cap_add:
- SYS_ADMIN
blackbox-exporter:
image: prom/blackbox-exporter:latest
container_name: blackbox-exporter
restart: unless-stopped
ports:
- "9115:9115"
volumes:
- ./blackbox.yml:/etc/blackbox_exporter/config.yml:ro
# build: listenarr-exporter
# container_name: listenarr-exporter
# restart: unless-stopped
# environment:
# LISTENARR_URL: http://listenarr:4545
# LISTENARR_APIKEY: FtKkg30FLbORoaJXXBx4oHJL2r1/3kPtZXKlxqSloWs
# ports:
# - "9712:9712"
# networks:
# - default
# - mediarr-services
loki:
image: grafana/loki:3.0.0
container_name: loki
restart: unless-stopped
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
alloy:
image: grafana/alloy:latest
container_name: alloy
restart: unless-stopped
ports:
- "12345:12345"
command: >
run /etc/alloy/config.alloy
--server.http.listen-addr=0.0.0.0:12345
volumes:
- ./alloy/config.alloy:/etc/alloy/config.alloy:ro
- /var/log:/var/log:ro
- /var/log/journal:/var/log/journal:ro
- /run/log/journal:/run/log/journal:ro
- /etc/machine-id:/etc/machine-id:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
volumes:
prometheus-data:
grafana-data:
@@ -68,3 +127,6 @@ networks:
default:
shared-proxy-services:
external: true
shared-prometheus-services:
external: true
@@ -0,0 +1,100 @@
#!/usr/bin/env python3
import os
import requests
from prometheus_client import start_http_server, Gauge
from time import sleep
from datetime import datetime
LISTENARR_URL = os.getenv("LISTENARR_URL", "http://localhost:4545")
API_KEY = os.getenv("LISTENARR_APIKEY", "")
HTTP_PORT = int(os.getenv("EXPORTER_PORT", "9712"))
HEADERS = {"X-Api-Key": API_KEY}
up = Gauge("listenarr_up", "Listenarr API reachable")
queue_items = Gauge("listenarr_queue_items", "Items in queue")
health_issues = Gauge("listenarr_health_issues", "Health issues")
books_total = Gauge("listenarr_books_total", "Total monitored books")
def log(msg):
print(
f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {msg}",
flush=True,
)
def fetch_json(endpoint):
url = f"{LISTENARR_URL}/api/v1/{endpoint}"
log(f"GET {url}")
response = requests.get(
url,
headers=HEADERS,
timeout=10,
)
log(f"Response: {response.status_code}")
response.raise_for_status()
return response.json()
def update_metrics():
reachable = False
try:
data = fetch_json("queue")
queue_items.set(len(data))
reachable = True
log(f"Queue items: {len(data)}")
except Exception as e:
queue_items.set(-1)
log(f"ERROR queue endpoint: {e}")
try:
data = fetch_json("health")
health_issues.set(len(data))
reachable = True
log(f"Health issues: {len(data)}")
except Exception as e:
health_issues.set(-1)
log(f"ERROR health endpoint: {e}")
try:
data = fetch_json("book")
books_total.set(len(data))
reachable = True
log(f"Books total: {len(data)}")
except Exception as e:
books_total.set(-1)
log(f"ERROR book endpoint: {e}")
up.set(1 if reachable else 0)
log(f"listenarr_up={1 if reachable else 0}")
if __name__ == "__main__":
log("Starting Listenarr exporter")
log(f"Listenarr URL: {LISTENARR_URL}")
log(f"Metrics port: {HTTP_PORT}")
log(f"API key configured: {'yes' if API_KEY else 'no'}")
start_http_server(HTTP_PORT)
log("Prometheus endpoint started")
while True:
try:
update_metrics()
except Exception as e:
log(f"FATAL ERROR: {e}")
sleep(60)
@@ -1,6 +1,6 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_interval: 30s
evaluation_interval: 30s
scrape_configs:
@@ -8,6 +8,31 @@ scrape_configs:
static_configs:
- targets:
- "prometheus:9090"
- job_name: blackbox_https
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://cloud.someoneslinux.selfhost.eu
- https://media.someoneslinux.selfhost.eu
- https://audiobooks.someoneslinux.selfhost.eu
# - https://login.someoneslinux.selfhost.eu
- https://auto.someoneslinux.selfhost.eu
- https://music.someoneslinux.selfhost.eu
- https://passwd.someoneslinux.selfhost.eu
- https://requests.someoneslinux.selfhost.eu
# - https://torrent.someoneslinux.selfhost.eu
- https://status.someoneslinux.selfhost.eu
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- job_name: "node-exporter"
static_configs:
@@ -16,22 +41,57 @@ scrape_configs:
labels:
host: serverhost
- targets:
- "node-exporter:9100"
- "192.168.0.4:9100"
labels:
host: "mediahost"
- targets:
- "192.168.0.39:9100"
labels:
host: "quiethost"
- job_name: "cadvisor"
static_configs:
- targets:
- "cadvisor:8080"
labels:
host: mediahost
- targets:
- "192.168.0.2:8081"
labels:
host: serverhost
- job_name: "smartctl"
static_configs:
- targets:
- "192.168.0.2:9633"
labels:
host: serverhost
- targets:
- "192.168.0.39:9633"
labels:
host: "quiethost"
- targets:
- "192.168.0.4:9633"
labels:
host: "mediahost"
- job_name: diun
metrics_path: /metrics
authorization:
credentials: "Qj#8C!@Uz3uRWm@mCd@KH6Bo7nfQ4K"
static_configs:
- targets:
- diun:9090
labels:
host: "mediahost"
- targets:
- "192.168.0.39:9090"
labels:
host: "quiethost"
- targets:
- "192.168.0.2:9090"
labels:
host: "serverhost"
- job_name: 'crowdsec'
static_configs:
- targets:
- host.docker.internal:6060
labels:
host: "mediahost"
@@ -23,6 +23,7 @@ services:
- /data/navidrome/music/kamerun:/kamerun:ro
- /data/navidrome/music/weihnachten:/weihnachten:ro
- /data/navidrome/music/playlists:/playlists:ro
- /data/navidrome/music/playlists-export:/playlists-export
networks:
- shared-proxy-services
- default
@@ -27,7 +27,8 @@ services:
- OVERWRITEPROTOCOL=https
- OVERWRITECLIURL=https://${NEXTCLOUD_DOMAIN}
- OVERWRITEHOST=${NEXTCLOUD_DOMAIN}
- TRUSTED_PROXIES=nginx 172.16.0.0/12
- TRUSTED_PROXIES=172.16.0.0/12
- DEFAULT_PHONE_REGION=AT
# SMTP
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
@@ -16,8 +16,11 @@ server {
music.someoneslinux.selfhost.eu
passwd.someoneslinux.selfhost.eu
requests.someoneslinux.selfhost.eu
torrent.someoneslinux.selfhost.eu
status.someoneslinux.selfhost.eu;
status.someoneslinux.selfhost.eu
fotos.someoneslinux.selfhost.eu
code.someoneslinux.selfhost.eu
aiapi.someoneslinux.selfhost.eu
ai.someoneslinux.selfhost.eu;
#ssl_conf_command Groups X25519:secp256r1:secp384r1;
# ssl_conf_command Groups X25519:prime256v1:secp384r1;
location /.well-known/acme-challenge/ {
@@ -27,12 +30,28 @@ server {
location / {
return 301 https://$host$request_uri;
}
listen 8080;
location /nginx_status {
stub_status;
allow 172.16.0.0/12;
deny all;
}
}
# Common SSL settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
server {
listen 443 ssl default_server;
server_name _;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
return 404;
}
###################
# NEXTCLOUD
@@ -51,6 +70,8 @@ server {
location / {
proxy_pass http://nextcloud:80;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -76,6 +97,8 @@ server {
location / {
proxy_pass http://jellyfin:8096;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -103,6 +126,8 @@ server {
location / {
proxy_pass http://audiobookshelf:80;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -112,40 +137,14 @@ server {
}
}
###################
# AUTHENTIK
###################
server {
listen 443 ssl;http2 on;
server_name login.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
location / {
proxy_pass http://authentik-server-1:9000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
####################
## HOME ASSISTANT
## AUTHENTIK
####################
#server {
# listen 443 ssl;http2 on;
# server_name auto.someoneslinux.selfhost.eu;
# server_name login.someoneslinux.selfhost.eu;
#
# add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self';" always;
# add_header Content-Security-Policy "frame-ancestors 'self';" always;
# add_header X-Frame-Options "SAMEORIGIN" always;
# add_header X-Content-Type-Options "nosniff" always;
# add_header Referrer-Policy "strict-origin-when-cross-origin" always;
@@ -155,17 +154,45 @@ server {
# ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
#
# location / {
# proxy_pass http://192.168.0.4:8123;
# proxy_pass http://authentik-server-1:9000;
# proxy_http_version 1.1;
#
# proxy_set_header Host $host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#
# proxy_set_header X-Forwarded-Proto https;
# proxy_set_header X-Forwarded-Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# }
#}
###################
# HOME ASSISTANT
###################
server {
listen 443 ssl;http2 on;
server_name auto.someoneslinux.selfhost.eu;
# add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
location / {
proxy_pass http://192.168.0.4:8123;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
###################
# NAVIDROME
###################
@@ -184,6 +211,8 @@ server {
location / {
proxy_pass http://navidrome:4533;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
@@ -208,6 +237,8 @@ server {
location / {
proxy_pass http://vaultwarden:80;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
@@ -216,6 +247,8 @@ server {
location /notifications/hub {
proxy_pass http://vaultwarden:3012;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@@ -240,6 +273,8 @@ server {
location / {
proxy_pass http://seerr:5055;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -249,33 +284,36 @@ server {
}
}
###################
# QBITTORRENT
###################
server {
listen 443 ssl;http2 on;
server_name torrent.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
# add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
location / {
proxy_pass http://192.168.0.2:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Proto https;
}
}
####################
## QBITTORRENT
####################
#server {
# listen 443 ssl;http2 on;
# server_name torrent.someoneslinux.selfhost.eu;
#
# add_header Content-Security-Policy "frame-ancestors 'self';" always;
## add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self';" always;
# add_header X-Frame-Options "SAMEORIGIN" always;
# add_header X-Content-Type-Options "nosniff" always;
# add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
#
# ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
# ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
#
# location / {
# proxy_pass http://192.168.0.2:8080;
# # Do not try another upstream on errors
# proxy_next_upstream off;
# proxy_http_version 1.1;
#
# proxy_set_header Host $host;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-Forwarded-Proto https;
# }
#
#}
###################
# GRFANA
@@ -294,6 +332,8 @@ server {
location / {
proxy_pass http://grafana:3000;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -302,3 +342,124 @@ server {
proxy_set_header X-Forwarded-Proto https;
}
}
###################
# GITEA
###################
server {
listen 443 ssl;http2 on;
server_name code.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
client_max_body_size 10G;
location / {
proxy_pass http://gitea:3000;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
###################
# IMMICH
###################
server {
listen 443 ssl;http2 on;
server_name fotos.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
client_max_body_size 10G;
location / {
proxy_pass http://immich_server:2283;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
###################
# OLLAMA
###################
server {
listen 443 ssl;http2 on;
server_name ai.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
client_max_body_size 10G;
location / {
proxy_pass http://192.168.0.39:3000;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
###################
# OLLAMA API
###################
server {
listen 443 ssl;http2 on;
server_name aiapi.someoneslinux.selfhost.eu;
add_header Content-Security-Policy "frame-ancestors 'self';" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/live/cloud.someoneslinux.selfhost.eu/privkey.pem;
client_max_body_size 10G;
location / {
proxy_pass http://192.168.0.39:11434;
# Do not try another upstream on errors
proxy_next_upstream off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
@@ -3,11 +3,9 @@ services:
image: nginx:stable
container_name: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./conf.d:/etc/nginx/conf.d
- ./certs:/etc/nginx/certs
@@ -15,8 +13,23 @@ services:
# Access and error logs
- ./logs:/var/log/nginx
networks:
- default
- shared-proxy-services
nginx-exporter:
image: nginx/nginx-prometheus-exporter:latest
container_name: nginx-exporter
restart: unless-stopped
command:
- --nginx.scrape-uri=http://nginx:8080/nginx_status
ports:
- "9113:9113"
depends_on:
- nginx
networks:
- default
- shared-proxy-services
crowdsec:
image: crowdsecurity/crowdsec:latest
container_name: crowdsec
@@ -29,7 +42,8 @@ services:
- crowdsec-db:/var/lib/crowdsec/data
- ./logs:/var/log/nginx:ro
- /etc/localtime:/etc/localtime:ro
networks:
- default
certbot:
image: certbot/certbot:latest
@@ -41,7 +55,9 @@ services:
- shared-proxy-services
networks:
default:
shared-proxy-services:
external: true
volumes:
crowdsec-db:
@@ -3,7 +3,7 @@ services:
image: redis:7
container_name: redis
restart: unless-stopped
command: redis-server --appendonly yes --requirepass PerCent7heStorySp0tInOrd3r
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
healthcheck:
test:
@@ -0,0 +1,13 @@
# Note: Do not edit this file directly.
# Your changes will be overwritten!
# Server
[Interface]
PrivateKey = 6CXCZMoH8bj7Ku//g0vyXms2IIffHR18K8RnOklzgnc=
Address = 10.8.0.1/24
ListenPort = 51820
PreUp =
PostUp = iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT;
PreDown =
PostDown = iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE; iptables -D INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT;
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
OUT=/docker/monitoring/node_exporter/textfile_collector/custom.prom
TS=$(date +%s%3N)
if [[ "$(hostname)" == "mediahost" ]]; then
DOCKER_CONTAINER_NUM=50
elif [[ "$(hostname)" == "serverhost" ]]; then
DOCKER_CONTAINER_NUM=4
elif [[ "$(hostname)" == "quiethost" ]]; then
DOCKER_CONTAINER_NUM=1
fi
{
# Docker container states
docker ps -a --format '{{.Names}}' | while read -r name; do
if docker inspect -f '{{.State.Running}}' "$name" 2>/dev/null | grep -q true; then
echo "docker_container_state{name=\"$name\"} 1"
else
echo "docker_container_state{name=\"$name\"} 0"
fi
done
echo docker_container_number $DOCKER_CONTAINER_NUM
docker ps -a --format '{{.Names}}' | grep -E '^qbittorrent' | while read -r qbit_host; do
IP_JSON=$(docker exec "$qbit_host" curl -fsSL http://ip-api.com/json) || continue
IP=$(jq -r '.query' <<<"$IP_JSON")
COUNTRY=$(jq -r '.country' <<<"$IP_JSON")
CITY=$(jq -r '.city' <<<"$IP_JSON")
ISP=$(jq -r '.isp' <<<"$IP_JSON" | sed 's/"/\\"/g')
COUNTRYCODE=$(jq -r '.countryCode' <<<"$IP_JSON")
LAT=$(jq -r '.lat' <<<"$IP_JSON")
LON=$(jq -r '.lon' <<<"$IP_JSON")
echo "public_ip_info{ip=\"$IP\",country=\"$COUNTRY\",city=\"$CITY\",isp=\"$ISP\",countrycode=\"$COUNTRYCODE\",lat=\"$LAT\",lon=\"$LON\",exported_host=\"$qbit_host\"} 1"
done
# Public IP information
IP_JSON=$(curl -fsSL http://ip-api.com/json)
IP=$(jq -r '.query' <<< "$IP_JSON")
COUNTRY=$(jq -r '.country' <<< "$IP_JSON")
CITY=$(jq -r '.city' <<< "$IP_JSON")
ISP=$(jq -r '.isp' <<< "$IP_JSON" | sed 's/"/\\"/g')
COUNTRYCODE=$(jq -r '.countryCode' <<< "$IP_JSON")
LAT=$(jq -r '.lat' <<< "$IP_JSON")
LON=$(jq -r '.lon' <<< "$IP_JSON")
echo "public_ip_info{ip=\"$IP\",country=\"$COUNTRY\",city=\"$CITY\",isp=\"$ISP\",countrycode=\"$COUNTRYCODE\",lat=\"$LAT\",lon=\"$LON\",exported_host=\"$(hostname)\"} 1"
if [ -f /var/run/reboot-required ]; then
# HELP reboot_required Reboot required
# TYPE reboot_required gauge
echo reboot_required 1
else
# HELP reboot_required Reboot required
# TYPE reboot_required gauge
echo reboot_required 0
fi
echo "custom_metrics_last_update_timestamp_seconds $(date +%s)"
} > "$OUT.$$"
mv "$OUT.$$" "$OUT"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
OUT="/docker/monitoring/node_exporter/textfile_collector/smart_selftest.prom"
> "$OUT"
for dev in $(smartctl --scan-open | awk '{print $1}'); do
name=$(basename "$dev")
LAST=0
if [[ "$dev" == *nvme* ]]; then
POWER_ON=$(smartctl -a "$dev" | awk -F': *' '/Power On Hours:/ {print $2}')
LAST=$(smartctl -l selftest "$dev" 2>/dev/null \
| grep "Completed" \
| head -1 \
| awk '{print $(NF-5)}')
elif [[ "$dev" == *sd* ]]; then
POWER_ON=$(smartctl -a "$dev" | awk '/Power_On_Hours/ {print $10}')
LAST=$(smartctl -l selftest "$dev" 2>/dev/null \
| grep "Completed" \
| head -1 \
| awk '{print $(NF-1)}')
MODEL=$(smartctl -i "$dev" | awk -F': *' '/Device Model/ {print $2}')
# ST2000LM003 self-test hour counter rolls over at 65536
if [[ "$MODEL" == "ST2000LM003 HN-M201RAD" ]] && \
[[ "$LAST" =~ ^[0-9]+$ ]] && \
[[ "$POWER_ON" =~ ^[0-9]+$ ]] && \
(( POWER_ON > 65535 && LAST < 65536 )); then
LAST=$((LAST + 65536))
fi
else
POWER_ON=99999999999
echo $dev
fi
# Skip devices without self-test history
echo $name: Last: ${LAST}, PowerOn: ${POWER_ON}
echo "smart_last_selftest_poweron_hours{device=\"$name\"} $LAST" >> "$OUT"
done
upgradable=$(apt update > /dev/null 2>&1 && apt list --upgradable 2>/dev/null | wc -l)
echo "apt_upgradable $upgradable" >> "$OUT"
+25
View File
@@ -0,0 +1,25 @@
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
*/5 * * * * /home/lucas/scripts/docker_compose/node-exporter-pubip-docker-states.sh && logger "CRON_SUCCESS smartmon" || logger "CRON_FAILURE smartmon"
*/1 * * * * /home/lucas/scripts/docker_compose/node-exporter-rocm-exporter.sh && logger "CRON_SUCCESS rocm" || logger "CRON_FAILURE rocm"
@@ -0,0 +1,41 @@
services:
diun:
image: crazymax/diun:latest
container_name: diun
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data:/data
environment:
TZ: Europe/Vienna
# General
DIUN_WATCH_WORKERS: 20
DIUN_WATCH_SCHEDULE: "0 0 * * *"
DIUN_PROVIDERS_DOCKER: "true"
DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT: "true"
# Metrics
DIUN_METRICS_ENABLED: "true"
DIUN_METRICS_ADDR: ":9090"
DIUN_METRICS_TOKEN: "Qj#8C!@Uz3uRWm@mCd@KH6Bo7nfQ4K"
# # Email notifications
# DIUN_NOTIF_MAIL_HOST: smtp.web.de
# DIUN_NOTIF_MAIL_PORT: 587
# DIUN_NOTIF_MAIL_USERNAME: ll_m@web.de
# DIUN_NOTIF_MAIL_PASSWORD: Mira2012
# DIUN_NOTIF_MAIL_FROM: ll_m@web.de
# DIUN_NOTIF_MAIL_TO: ll_m@web.de
# DIUN_NOTIF_MAIL_INSECURESKIPVERIFY: "false"
ports:
- 9090:9090
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
labels:
- diun.enable=false
+17
View File
@@ -0,0 +1,17 @@
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p2 during curtin installation
/dev/disk/by-uuid/7bc9c1f7-6d4b-431f-b213-9de3a98a7ab5 / ext4 defaults 0 1
/dev/disk/by-uuid/e75f0b67-c158-40e9-b155-f08af89a82a9 none swap sw 0 0
# /home was on /dev/nvme0n1p4 during curtin installation
/dev/disk/by-uuid/96ecc248-410d-4c34-a664-7bbefb2b5ec8 /home ext4 defaults 0 1
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/9F46-5BD7 /boot/efi vfat defaults 0 1
UUID=1729d425-17c9-4032-b8bd-98d60ca564ab /games ext4 defaults,nofail 0 2
UUID=C28E92B18E929E0B /data ntfs defaults 0 2
UUID=cc633125-60bc-4180-a53e-43015a4b6180 /stable ext4 defaults 0 2
@@ -0,0 +1,16 @@
services:
node-exporter:
container_name: node-exporter
image: prom/node-exporter:latest
restart: unless-stopped
pid: host
command:
- '--path.rootfs=/host'
- '--collector.textfile.directory=/textfile'
volumes:
- '/:/host:ro,rslave'
- ./node_exporter/textfile_collector:/textfile:ro
# ports:
# - '9100:9100'
network_mode: host
@@ -0,0 +1,45 @@
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434"
environment:
OLLAMA_HOST: 0.0.0.0:11434
OLLAMA_VULKAN: "1"
OLLAMA_KEEP_ALIVE: "10m"
devices:
- /dev/dri:/dev/dri
- /dev/kfd:/dev/kfd
group_add:
- "44"
- "990"
volumes:
- /stable/ollama:/root/.ollama
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
depends_on:
- ollama
ports:
- "3000:8080"
environment:
OLLAMA_BASE_URL: http://ollama:11434
WEBUI_SECRET_KEY: "eae4639d2f8d5d8afee8cf65fe4d4f3b970b32cfd6c68f0455c9721ccd04d324"
volumes:
- open_webui_data:/app/backend/data
volumes:
ollama_data:
open_webui_data:
+12
View File
@@ -0,0 +1,12 @@
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
*/5 * * * * /home/lucas/scripts/docker_compose/node-exporter-pubip-docker-states.sh
0 0 */2 * * /home/lucas/scripts/network/wg-randomize.sh /docker/qbittorrent/gluetun/ && /usr/bin/docker restart gluetun qbittorrent-public
@@ -16,15 +16,22 @@ services:
DIUN_WATCH_SCHEDULE: "0 0 * * *"
DIUN_PROVIDERS_DOCKER: "true"
DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT: "true"
# Metrics
DIUN_METRICS_ENABLED: "true"
DIUN_METRICS_ADDR: ":9090"
DIUN_METRICS_TOKEN: "Qj#8C!@Uz3uRWm@mCd@KH6Bo7nfQ4K"
# Email notifications
DIUN_NOTIF_MAIL_HOST: smtp.web.de
DIUN_NOTIF_MAIL_PORT: 587
DIUN_NOTIF_MAIL_USERNAME: ll_m@web.de
DIUN_NOTIF_MAIL_PASSWORD: Mira2012
DIUN_NOTIF_MAIL_FROM: ll_m@web.de
DIUN_NOTIF_MAIL_TO: ll_m@web.de
DIUN_NOTIF_MAIL_INSECURESKIPVERIFY: "false"
# # Email notifications
# DIUN_NOTIF_MAIL_HOST: smtp.web.de
# DIUN_NOTIF_MAIL_PORT: 587
# DIUN_NOTIF_MAIL_USERNAME: ll_m@web.de
# DIUN_NOTIF_MAIL_PASSWORD: Mira2012
# DIUN_NOTIF_MAIL_FROM: ll_m@web.de
# DIUN_NOTIF_MAIL_TO: ll_m@web.de
# DIUN_NOTIF_MAIL_INSECURESKIPVERIFY: "false"
ports:
- 9090:9090
logging:
driver: json-file
options:
+15
View File
@@ -0,0 +1,15 @@
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/torrent/qbittorrent-private/downloads 192.168.0.4(rw,sync,no_subtree_check)
/torrent/qbittorrent-public/downloads/ 192.168.0.4(rw,sync,no_subtree_check)
/special-torrent/torrent/ 192.168.0.4(rw,sync,no_subtree_check)
#/backup/homeassistant 192.168.0.4(rw,sync,no_subtree_check)
+18
View File
@@ -0,0 +1,18 @@
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb3 during curtin installation
/dev/disk/by-uuid/78ad42f7-ea96-4979-9d97-ebed17e8e794 / ext4 defaults 0 1
# /boot/efi was on /dev/sdb1 during curtin installation
/dev/disk/by-uuid/B2BA-82AA /boot/efi vfat defaults 0 1
# /docker was on /dev/sdb4 during curtin installation
/dev/disk/by-uuid/91e3f4d6-cb10-4627-9e3f-59382832b489 /docker ext4 defaults 0 1
# /data was on /dev/sdb5 during curtin installation
/dev/disk/by-uuid/97e0ba27-0cf7-4502-9f8d-d2fac39cc941 /special-torrent ext4 defaults 0 1
/swap.img none swap sw 0 0
/dev/disk/by-uuid/98695b57-1d90-484d-9347-c886c6395050 /torrent ext4 defaults 0 1
192.168.0.4:/data/torrent/qbittorrent/mediahost /torrent/qbittorrent/mediahost nfs defaults,nofail,x-systemd.automount,x-systemd.mount-timeout=30,_netdev 0 0
@@ -10,6 +10,19 @@ services:
volumes:
- '/:/host:ro,rslave'
- ./node_exporter/textfile_collector:/textfile:ro
# ports:
# - '9100:9100'
network_mode: host
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
restart: unless-stopped
ports:
- '9100:9100'
- "8081:8080"
volumes:
- /:/rootfs:ro
- /data:/data:ro
- /docker:/docker:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
Loaded 100 of 379 files, more files were not shown because too many files have changed in this diff. Show more