Compare commits
188 Commits
main
..
9297a84eea
| Author | SHA1 | Date | |
|---|---|---|---|
| 9297a84eea | |||
| 154cb48b77 | |||
| d462de8263 | |||
| cac6442b5b | |||
| ba3732af6b | |||
| 3feb780e16 | |||
| 593c03eb28 | |||
| 63a45e70e7 | |||
| b2d8dffbf4 | |||
| 850f05453c | |||
| bc193db50a | |||
| 1f8e6d3ce8 | |||
| 974b7bfad3 | |||
| 43702b0138 | |||
| ccad7ec9f4 | |||
| 5aa65ad4c1 | |||
| aea8fa6772 | |||
| 987126ecce | |||
| 7d5422b9f7 | |||
| 6b1532d8ad | |||
| c67ac593de | |||
| 5284dd2a43 | |||
| 76b020d5c0 | |||
| 3e3f3231be | |||
| 27d8ff6098 | |||
| 56f8133589 | |||
| a66c3bfdb6 | |||
| 6911892b89 | |||
| a87ba330b1 | |||
| 50d5fccd95 | |||
| 458f1fde2c | |||
| fb5ee7e4dd | |||
| b773c2aa1d | |||
| adbc5e51b5 | |||
| c0350644b9 | |||
| e99cdf1895 | |||
| d9969dfbe5 | |||
| 24955a956d | |||
| 0a9cf6969f | |||
| d00191324b | |||
| 38fc1778f7 | |||
| 654a77b8ba | |||
| 52f3106167 | |||
| 56879d2e8d | |||
| 16c783e1aa | |||
| 16443c8a45 | |||
| d7772df75d | |||
| f029d64e78 | |||
| d5f8c1a26c | |||
| b3cace8dbf | |||
| ac91d83c45 | |||
| cdb87b5759 | |||
| b8cccd0045 | |||
| 900faf773a | |||
| 46bd235afc | |||
| 7796587f16 | |||
| 57ffc40a95 | |||
| 4008e4eb47 | |||
| 17b3aeb94e | |||
| 7615cf0b47 | |||
| bcd85ce1de | |||
| ea096cb33c | |||
| 2cbbbd9a86 | |||
| affabd3720 | |||
| 4ca85f6482 | |||
| e4d54e98ed | |||
| bf72c40ae1 | |||
| 42eceea521 | |||
| 901b8a0b61 | |||
| 38a82706ce | |||
| 45b2272f1a | |||
| ed44d866df | |||
| e9a48fadaf | |||
| 168484b5d9 | |||
| 01766785b4 | |||
| 30b066ece8 | |||
| fbd439f318 | |||
| 3c694d06df | |||
| cc20dc8120 | |||
| ca2bd76572 | |||
| 7d6c154909 | |||
| 52ef155c7c | |||
| a957dfea73 | |||
| 9c0af285ea | |||
| 25d5339ada | |||
| 3e191a654e | |||
| b15af7c061 | |||
| a471de6422 | |||
| 9d789f302a | |||
| 1fb8dd85fb | |||
| 4897d3940c | |||
| 652731ae98 | |||
| f628fdac50 | |||
| 96839ac05b | |||
| e56cff43a9 | |||
| 5d79a34905 | |||
| 5d83d02d9f | |||
| f52befd4c4 | |||
| b5ca397d98 | |||
| 6378a9a4cb | |||
| c3875803ff | |||
| d75d9eb4c8 | |||
| 59bcb54492 | |||
| 241b097ea9 | |||
| e140a9fa8c | |||
| 5580d3be98 | |||
| 43dfdbf33e | |||
| 24b63d390a | |||
| 49fcca72af | |||
| ba91f83722 | |||
| 466e7a7a3d | |||
| e67c0d316d | |||
| 1da5ee3e34 | |||
| 4d377f3eb4 | |||
| df708485b5 | |||
| b6cac5efb4 | |||
| f38081649f | |||
| 5b41f728c5 | |||
| 7948dd298c | |||
| ee6603ffad | |||
| 93ed0e6eb2 | |||
| 778fabb2e5 | |||
| 5d8796404c | |||
| a2b9f3625c | |||
| 1e30f00b45 | |||
| 519b7a30ef | |||
| 3ae883326a | |||
| 46f415d778 | |||
| d473f296ff | |||
| e0bba8cbfc | |||
| 715dfbbc38 | |||
| 5cf869eaca | |||
| 3dd043689e | |||
| 882dad57e2 | |||
| 15f1a49378 | |||
| 871e39bba2 | |||
| d8a6b4c56d | |||
| 16e76d70c9 | |||
| 45a19c7a12 | |||
| 8af4da5a08 | |||
| c13ce5a50b | |||
| 190f6fe1a5 | |||
| 14162879c0 | |||
| e14599fa4d | |||
| 5576a92c5c | |||
| 70592d2825 | |||
| a095688d11 | |||
| aabb28ee06 | |||
| 3b66ca64f8 | |||
| 0f0cfffa7a | |||
| 6f6d4f1e58 | |||
| 275ded04b8 | |||
| e70c50ae87 | |||
| c23fbb53b7 | |||
| e0e89890fa | |||
| 40fa30b532 | |||
| f565f83aea | |||
| 6591c33caa | |||
| 5e6ec13c06 | |||
| 2cf523b8e3 | |||
| 7979b353aa | |||
| 2fdf54d2e6 | |||
| b93f5da8d7 | |||
| 5703a8d00a | |||
| ac4d77dddf | |||
| 3516ff8486 | |||
| 4c879d2485 | |||
| 1b07fa4f14 | |||
| 78ceb23a27 | |||
| fa6594b163 | |||
| 8e3c67565d | |||
| ac29c68de0 | |||
| c56b7bc13e | |||
| 05f29028f6 | |||
| 66184325d6 | |||
| 7204dbb65b | |||
| e1a87af16a | |||
| 3abb53fb8e | |||
| afca677b1c | |||
| 6836892907 | |||
| c3d1df42b0 | |||
| e3d890c071 | |||
| 23acea4773 | |||
| fe2ffbbe07 | |||
| 922d3e753d | |||
| 3957773854 | |||
| 3b293bb743 | |||
| 31d3e36597 |
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(ls /home/michael/ripster/*.sh)",
|
||||
"Bash(ls /home/michael/ripster/backend/*.sh)",
|
||||
"Bash(systemctl list-units --type=service)",
|
||||
"Bash(pip install -q -r requirements-docs.txt)",
|
||||
"Bash(mkdocs build --strict)",
|
||||
"Read(//mnt/external/media/**)",
|
||||
"WebFetch(domain:www.makemkv.com)",
|
||||
"Bash(node --check backend/src/services/pipelineService.js)",
|
||||
"Bash(wc -l /home/michael/ripster/debug/backend/data/logs/backend/*.log)",
|
||||
"Bash(find /home/michael/ripster -name *.db)",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/data/ripster.db \"SELECT key, category, label, type, default_value, options_json FROM settings_schema WHERE category=''Laufwerk'' ORDER BY order_index\")",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/services/diskDetectionService.js)",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/services/settingsService.js)",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/services/pipelineService.js)",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/db/database.js)",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/routes/settingsRoutes.js)",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/ripster.db \"SELECT key, value FROM settings_values WHERE key LIKE ''%drive%'' OR key LIKE ''%disc%'' ORDER BY key;\")",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/data/ripster.db \"SELECT key, value FROM settings_values WHERE key LIKE ''%drive%'' OR key LIKE ''%disc%'' ORDER BY key;\")",
|
||||
"Bash(lsblk -J -o NAME,PATH,TYPE,MOUNTPOINT,FSTYPE,LABEL,MODEL)",
|
||||
"Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); [print\\(e\\) for e in d.get\\(''''blockdevices'''',[]\\)]\")",
|
||||
"Bash(lsblk -o NAME,TYPE,MODEL)",
|
||||
"Bash(node --check /home/michael/ripster/backend/src/routes/pipelineRoutes.js)",
|
||||
"Bash(grep -n \"inferMediaProfile\" /home/michael/ripster/backend/src/services/*.js)",
|
||||
"Bash(grep -rn \"PROCESS_LOG\\\\|LOG_UPDATE\\\\|processLog\" /home/michael/ripster/backend/src --include=*.js)",
|
||||
"Bash(grep -n \"buildHandBrakeConfig\" /home/michael/ripster/backend/src/services/*.js)",
|
||||
"Bash(grep -n \"class.*Plugin\\\\|get id\\(\\)\\\\|get name\\(\\)\" /home/michael/ripster/backend/src/plugins/*.js)",
|
||||
"Bash(/home/michael/ripster/db/schema.sql:*)",
|
||||
"Read(//home/michael/**)",
|
||||
"Bash(find /home/michael/ripster/AddOns/klangkiste -name *.jsx -o -name *.js -o -name *.vue)",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/data/ripster.db \"SELECT key, label, order_index FROM settings_schema WHERE key LIKE ''converter%'' ORDER BY order_index\")",
|
||||
"Bash(find /home/michael/ripster/backend -name *.db)",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/data/ripster.db \"SELECT count\\(*\\) FROM settings_schema\")",
|
||||
"Bash(sqlite3 /home/michael/ripster/backend/data/ripster.db \"SELECT key FROM settings_schema WHERE key LIKE ''%converter%''\")",
|
||||
"Bash(grep -n \"renderMediaTree\\\\|renderMediaContent\\\\|activeSection === ''media''\" /home/michael/ripster/AddOns/klangkiste/gui/frontend/src/App.jsx)",
|
||||
"Bash(grep -n \"activeModal === ''new-folder''\" /home/michael/ripster/AddOns/klangkiste/gui/frontend/src/App.jsx)",
|
||||
"Bash(sqlite3 /home/michael/ripster_data/ripster.db \"SELECT id, status, last_state, encode_input_path FROM jobs WHERE id IN \\(212, 213\\) ORDER BY id;\")",
|
||||
"Bash(sqlite3 /opt/ripster_data/ripster.db \"SELECT id, status, last_state FROM jobs WHERE id IN \\(212, 213\\) ORDER BY id;\")",
|
||||
"Read(//opt/**)",
|
||||
"Bash(sqlite3 /home/michael/ripster/debug/backend/data/ripster.db \"SELECT id, status, last_state, encode_input_path, substr\\(encode_plan_json,1,500\\) as plan FROM jobs WHERE id IN \\(212, 213\\) ORDER BY id;\")",
|
||||
"Bash(sqlite3 /home/michael/ripster/debug/backend/data/ripster.db \"SELECT id, status, last_state FROM jobs ORDER BY id DESC LIMIT 10;\")",
|
||||
"Bash(sqlite3 /home/michael/ripster/debug/backend/data/ripster.db \"SELECT id, status, last_state, encode_input_path FROM jobs WHERE title LIKE ''%Kill%'' OR id IN \\(69, 212, 213\\) ORDER BY id DESC;\")",
|
||||
"Bash(find /home/michael/ripster -name *.log -newer /home/michael/ripster/debug/markus.log)",
|
||||
"Bash(pm2 logs:*)",
|
||||
"Bash(journalctl -u ripster --no-pager -n 50)",
|
||||
"Bash(pm2 list:*)",
|
||||
"Bash(journalctl -u ripster-smoketest-http --no-pager -n 40)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
# Suggested GitHub repository metadata
|
||||
|
||||
## Description
|
||||
|
||||
Local media workflow platform for Blu-ray, DVD and audio CD ripping, audiobook
|
||||
processing, metadata management, hardware-accelerated encoding and media
|
||||
archiving.
|
||||
|
||||
## Website
|
||||
|
||||
https://mboehmlaender.github.io/ripster/
|
||||
|
||||
## Topics
|
||||
|
||||
- media-ripping
|
||||
- blu-ray
|
||||
- dvd
|
||||
- audio-cd
|
||||
- audiobooks
|
||||
- media-archiving
|
||||
- media-workflow
|
||||
- ffmpeg
|
||||
- handbrake
|
||||
- makemkv
|
||||
- react
|
||||
- nodejs
|
||||
- self-hosted
|
||||
- media-converter
|
||||
- hardware-encoding
|
||||
|
||||
## German description
|
||||
|
||||
Lokales Medien-Workflow-System für Blu-ray-, DVD- und Audio-CD-Ripping,
|
||||
Hörbuchverarbeitung, Metadatenverwaltung, hardwarebeschleunigtes Encoding und
|
||||
Medienarchivierung.
|
||||
+1
-9
@@ -13,16 +13,9 @@ frontend/.vite/
|
||||
backend/dist/
|
||||
dist/
|
||||
build/
|
||||
.build/
|
||||
.venv-docs/
|
||||
.worktrees/
|
||||
site/
|
||||
.cache/
|
||||
coverage/
|
||||
*.tsbuildinfo
|
||||
third_party/handbrake/work/
|
||||
third_party/handbrake/build/
|
||||
!third_party/handbrake/source/*.tar.zst
|
||||
|
||||
# ----------------------------
|
||||
# Runtime state / PIDs / temp
|
||||
@@ -89,5 +82,4 @@ Thumbs.db
|
||||
/scripts/
|
||||
/release.sh
|
||||
/Audible_Tool
|
||||
/AddOns
|
||||
/oldignore
|
||||
/AddOns
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
python3
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/usr/bin/python3
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
python3
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
lib
|
||||
@@ -0,0 +1,5 @@
|
||||
home = /usr/bin
|
||||
include-system-site-packages = false
|
||||
version = 3.12.3
|
||||
executable = /usr/bin/python3.12
|
||||
command = /usr/bin/python3 -m venv /home/michael/ripster/.venv-docs
|
||||
Submodule
+1
Submodule .worktrees/main added at 190f6fe1a5
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,237 +1,257 @@
|
||||
# Ripster
|
||||
|
||||

|
||||
Ripster ist eine lokale Web-Anwendung für halbautomatisches Disc-Ripping, Audiobook-Verarbeitung und Datei-Konvertierung. Plugin-basierte Architektur mit MakeMKV + HandBrake + FFmpeg, inklusive Metadaten-Auswahl, Track-Review, Queue, Skripten/Ketten und Job-Historie.
|
||||
|
||||
Ripster ist eine lokale Web-Anwendung für Disc-Ripping, Audiobook-Verarbeitung und Datei-Konvertierung. Das System kombiniert MakeMKV, HandBrake, FFmpeg, `cdparanoia`, `mkvmerge`, SQLite und eine React-Oberfläche zu einer durchgehenden Pipeline mit Queue, Historie, Downloads, Skript-Automation und Echtzeitstatus per WebSocket.
|
||||
---
|
||||
|
||||
## ⚠️ Rechtlicher Hinweis
|
||||
## Was Ripster kann
|
||||
|
||||
Ripster ist ausschließlich für die Sicherung von Titeln gedacht, die dir selbst gehören oder für die du die erforderlichen Nutzungsrechte besitzt. Bitte prüfe vor der Nutzung die in deinem Land geltenden Urheberrechts-, Privatkopie- und Kopierschutzregelungen. Die Software ist nicht für Piraterie oder die Verarbeitung unberechtigt beschaffter Inhalte gedacht.
|
||||
### Disc-Ripping & Encoding
|
||||
- Disc-Erkennung mit Pipeline-Status in Echtzeit (WebSocket)
|
||||
- Medienprofil-Erkennung (Blu-ray/DVD/CD/Sonstiges) aus Device-/Filesystem-Heuristik
|
||||
- Metadaten-Suche und Zuordnung über OMDb
|
||||
- MakeMKV-Analyse und Rip (`mkv` oder `backup`) mit profilspezifischen Settings
|
||||
- HandBrake-Review und Encoding mit Track-Auswahl, User-Presets, Extra-Args
|
||||
- **Audio-CD-Ripping** mit cdparanoia + Encoding nach FLAC/MP3/Opus/Vorbis (experimentell)
|
||||
|
||||
## KI-unterstützte Entwicklung
|
||||
### Audiobook-Verarbeitung
|
||||
- **AAX/Audible-Dateien** verarbeiten (Activation Bytes, DRM-Handling)
|
||||
- FFmpeg-basiertes Kapitel-Splitting
|
||||
- Ausgabeformate: M4B, MP3, FLAC mit Metadaten
|
||||
- MusicBrainz-Metadaten-Lookup
|
||||
|
||||
Teile dieses Projekts, einschließlich Quellcode, Dokumentation, Tests und konzeptioneller Entwürfe, wurden mit Unterstützung generativer KI erstellt oder überarbeitet.
|
||||
### Datei-Converter
|
||||
- **Generische Audio/Video-Dateien** konvertieren (MKV, MP4, FLAC, MP3, u. v. m.)
|
||||
- Datei-Explorer mit Upload, Umbenennen, Verschieben, Löschen
|
||||
- Automatischer Verzeichnis-Scan (Polling konfigurierbar)
|
||||
|
||||
KI-Werkzeuge wurden insbesondere für Implementierungsvorschläge, Fehleranalyse, Refactoring, Dokumentation und die Ausarbeitung einzelner Funktionen eingesetzt. Auswahl, Anpassung, Integration und Freigabe der Ergebnisse lagen beim Projektverantwortlichen. Die technische und rechtliche Verantwortung für das veröffentlichte Projekt verbleibt beim menschlichen Maintainer.
|
||||
### Automatisierung & Verwaltung
|
||||
- Pre- und Post-Encode-Ausführungen (Skripte und/oder Skript-Ketten)
|
||||
- Pipeline-Queue mit Job- und Nicht-Job-Einträgen (`script`, `chain`, `wait`)
|
||||
- Cron-Jobs für Skripte/Ketten (inkl. Logs und manueller Auslösung)
|
||||
- **Aktivitäts-Tracking**: Laufende und abgeschlossene Aktionen in Echtzeit im Ripper
|
||||
- Download-Queue: Ausgabedateien als ZIP herunterladen
|
||||
- Historie mit Re-Encode, Review-Neustart, File-/Job-Löschung und Orphan-Import
|
||||
- Hardware-Monitoring (CPU/RAM/GPU/Storage) im Ripper
|
||||
|
||||
Trotz manueller Prüfung können Fehler oder unvollständige Annahmen enthalten sein. Entsprechende Hinweise, Issues und Pull Requests sind willkommen.
|
||||
## Tech-Stack
|
||||
|
||||
## 🎬 Funktionsumfang
|
||||
- Backend: Node.js, Express, SQLite, WebSocket (`ws`) – **Plugin-Architektur**
|
||||
- Frontend: React, Vite, PrimeReact
|
||||
- Externe Tools: `makemkvcon`, `HandBrakeCLI`, `mediainfo`, `ffmpeg`/`ffprobe`, `cdparanoia`
|
||||
|
||||
### 🎞️ Medien-Workflows
|
||||
- Blu-ray-Ripping und -Encoding
|
||||
- DVD-Ripping und -Encoding
|
||||
- Audio-CD-Ripping und -Encoding
|
||||
- Audiobook-Verarbeitung aus `.aax`
|
||||
- Datei-Converter für Audio-, Video- und ISO-Dateien
|
||||
## Dokumentation
|
||||
|
||||
### 📀 Video (Blu-ray / DVD)
|
||||
- automatische Disc-Erkennung, Rescan einzelner Laufwerke und Live-Status im Ripper
|
||||
- Metadaten-Suche über TMDB für Filme und Serien
|
||||
- HandBrake-Review mit Playlist-/Titel-Auswahl, Audio-/Untertitel-Track-Auswahl und Encode-Vorschau
|
||||
- MakeMKV-Rip mit profilspezifischen Modi und Zusatzargumenten
|
||||
- HandBrake-Encoding mit User-Presets, offiziellen HandBrake-Presets und Extra-Args
|
||||
- Serien-Workflows für DVD- und Blu-ray-Discs inkl. Episoden-Zuordnung und Batch-Encoding
|
||||
- Multipart-Movie-Workflows über mehrere Discs inkl. Merge-Job via `mkvmerge`
|
||||
- Re-Encode aus RAW, Review-Neustart, Encode-Neustart, Retry und Resume laufender/unterbrochener Jobs
|
||||
- Ausführliche Dokumentation: https://mboehmlaender.github.io/ripster/
|
||||
|
||||
### 🎵 Audio-CD
|
||||
- TOC-Analyse und Rip mit `cdparanoia`
|
||||
- MusicBrainz-Suche und Übernahme von Album-/Track-Metadaten
|
||||
- Track-Auswahl und Ausgabe als FLAC, WAV, MP3, Opus oder Ogg Vorbis
|
||||
- RAW-Wiederverwendung und CD-Review-/Encode-Neustart aus vorhandenen Daten
|
||||
## Voraussetzungen
|
||||
|
||||
### 🎧 Audiobooks
|
||||
- Debian 11/12 oder Ubuntu 22.04/24.04
|
||||
- root-Rechte + Internetzugang
|
||||
- optisches Laufwerk (oder gemountete Quelle) für Disc-Ripping
|
||||
- Netzwerk-Zugang für Audiobook-Upload und Datei-Converter optional
|
||||
|
||||
Diese Funktion ist für eine Archivierung von gekauften Titeln. Das System ermittelt keine Activation-Bytes und verweist dafür auf eine externe Seite
|
||||
## Schnellstart (`install.sh`)
|
||||
|
||||
- Upload und Verarbeitung von Audible-/AAX-Dateien
|
||||
- Metadaten- und Kapitelanreicherung über Audnex plus lokale Probe-Daten
|
||||
- Ausgabe als M4B, MP3 oder FLAC
|
||||
- Einzeldatei oder kapitelweises Splitten
|
||||
|
||||
### 🔄 Converter (Beta)
|
||||
- Dateibaum und Datei-Explorer für das Converter-RAW-Verzeichnis
|
||||
- Upload, Ordner anlegen, Umbenennen, Verschieben und Löschen
|
||||
- Jobs aus Dateiauswahl erzeugen, Dateien bestehenden Jobs zuweisen oder daraus entfernen
|
||||
- Audio-/Video-Erkennung und automatische RAW-Scans per Polling
|
||||
- TMDB-Metadatenzuordnung für passende Video-Jobs
|
||||
|
||||
Der Converter ist noch nicht vollständig entwickelt und auch noch nicht vollständig geprüft. Er kann verwendet werden, es funktionieren aber ggf. nicht alle Funktionen vollständig!
|
||||
|
||||
### 🛠️ Automation, Betrieb und Verwaltung
|
||||
- Queue mit normalen Jobs sowie zusätzlichen `script`-, `chain`- und `wait`-Einträgen
|
||||
- Pre-/Post-Encode-Skripte und Skript-Ketten
|
||||
- Cron-Jobs für Skripte und Ketten inkl. Validierung, Logs und manueller Auslösung
|
||||
- Download-Queue für ZIP-Archive aus Historienjobs
|
||||
- Historie mit Detailansicht, Re-Encode, Review-/Encode-Neustart, Retry und Löschfunktionen
|
||||
- `/database`-Ansicht für Orphan-RAW-Ordner (Import oder Löschen vorhandener RAW-Daten)
|
||||
- Hardware-Monitoring mit Live-Werten und Verlaufshistorie
|
||||
- Pushover-Benachrichtigungen für zentrale Pipeline-Ereignisse
|
||||
- MakeMKV-Betakey-Prüfung/-Übernahme und Cover-Art-Recovery
|
||||
|
||||
## 🖥️ Oberfläche
|
||||
|
||||
- `Ripper`: Disc-Erkennung, Pipeline-Status, Queue, Review-Dialoge und aktive Jobs
|
||||
- `Converter`: Dateibaum, Uploads und Converter-Jobs
|
||||
- `Audiobooks`: AAX-Uploads und Audiobook-Jobs
|
||||
- `Settings`: Pfade, Tools, Templates, Queue, Monitoring, Notifications, Scripts, Chains, Presets
|
||||
- `Historie`: abgeschlossene und fehlerhafte Jobs mit Folgeaktionen
|
||||
- `Downloads`: vorbereitete ZIP-Downloads
|
||||
- `Database`: Orphan-RAW-Verwaltung (im Expertenmodus)
|
||||
- Zusatzansichten: `Hardware` und `TMDB Migration`
|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
Der korrekte Bootstrap läuft über `setup.sh`. `setup.sh` lädt das passende `install.sh` aus dem gewünschten Branch und startet es mit denselben Parametern.
|
||||
|
||||
Unterstützte Systeme laut Installer:
|
||||
- Debian
|
||||
- Ubuntu
|
||||
|
||||
Standardinstallation:
|
||||
Auf Debian 11/12 oder Ubuntu 22.04/24.04 (root erforderlich):
|
||||
|
||||
```bash
|
||||
wget -qO setup.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/setup.sh
|
||||
bash setup.sh
|
||||
wget -qO install.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.sh
|
||||
sudo bash install.sh
|
||||
```
|
||||
|
||||
Es gibt 2 Branches: main und dev
|
||||
|
||||
main enthält das aktuelle stbale release
|
||||
dev enthält den aktuellen Stand der Weiterentwicklung
|
||||
|
||||
Hinweise:
|
||||
- `setup.sh` nutzt bei Bedarf `sudo`; root-Rechte und Internetzugang sind erforderlich.
|
||||
- Ohne `--branch` bietet `setup.sh` lokal eine Branch-Auswahl an.
|
||||
- Der eigentliche Installer ist `install.sh`; `setup.sh` ist der empfohlene Einstiegspunkt.
|
||||
|
||||
Wichtige Standardparameter für den Installationslauf:
|
||||
|
||||
Verfügbare Optionen:
|
||||
- `--branch <branch>`
|
||||
- `--dir <pfad>`
|
||||
- `--user <benutzer>`
|
||||
- `--port <port>`
|
||||
- `--host <hostname|ip>`
|
||||
- `--no-makemkv`
|
||||
- `--no-handbrake`
|
||||
- `--no-nginx`
|
||||
- `--no-system-deps`
|
||||
- `--accept-makemkv-eula`
|
||||
- `--force-license-prompts`
|
||||
- `--reinstall`
|
||||
- `--help`
|
||||
|
||||
Was der Installer typischerweise einrichtet:
|
||||
- Node.js 20
|
||||
- `ffmpeg`, `ffprobe`, `mediainfo`, `mkvtoolnix`
|
||||
- CD-Tools (`cdparanoia`, `flac`, `lame`, `opus-tools`, `vorbis-tools`)
|
||||
- optional MakeMKV
|
||||
- optional HandBrakeCLI
|
||||
- optional nginx
|
||||
- Repository-Checkout bzw. Update
|
||||
- npm-Abhängigkeiten, Frontend-Build und `ripster-backend`-systemd-Service
|
||||
|
||||
> [!NOTE]
|
||||
> Ripster orchestriert mehrere externe Medientools. Diese Tools bleiben ihren eigenen Lizenzen und Nutzungsbedingungen unterworfen. Siehe [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) für Details.
|
||||
|
||||
Mit `--force-license-prompts` werden die MakeMKV-EULA-Abfrage und die
|
||||
HandBrake-Drittanbieterhinweise auch dann erneut angezeigt, wenn die jeweiligen
|
||||
Tools bereits installiert sind. `--no-makemkv` und `--no-handbrake` überspringen
|
||||
weiterhin den jeweils abgewählten Hinweis.
|
||||
|
||||
## ♻️ Update
|
||||
|
||||
Standard-Update einer bestehenden Installation:
|
||||
Alternativ direkt per Pipe:
|
||||
|
||||
```bash
|
||||
sudo bash Pfad_zur_Installation/install.sh --reinstall
|
||||
curl -fsSL https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.sh | sudo bash
|
||||
```
|
||||
|
||||
Wenn die Installation mit abweichenden Kernparametern eingerichtet wurde, diese beim Update wieder mitgeben:
|
||||
`install.sh` übernimmt u. a.:
|
||||
|
||||
- Node.js 20 (falls nötig)
|
||||
- Basistools inkl. `mediainfo`, `ffmpeg`, `ffprobe`
|
||||
- CD-Ripping-Tools (`cdparanoia`, `flac`, `lame`, `opus-tools`, `vorbis-tools`)
|
||||
- MakeMKV
|
||||
- HandBrake CLI (Auswahl Standard/CPU oder GPU/NVDEC-Binary für HW-Encoding)
|
||||
- nginx
|
||||
- Repository-Checkout, npm-Install, Frontend-Build, systemd-Service (`ripster-backend`)
|
||||
|
||||
Danach ist Ripster unter `http://<Server-IP>` erreichbar.
|
||||
|
||||
Wichtige Optionen:
|
||||
|
||||
```bash
|
||||
sudo bash Pfad_zur_Installation/install.sh --reinstall --dir /opt/ripster --user ripster --port 3001 --host 192.168.1.10
|
||||
sudo bash install.sh --branch dev # Branch wählen (Default im Skript: dev)
|
||||
sudo bash install.sh --dir /opt/ripster # Installationspfad
|
||||
sudo bash install.sh --user ripster # Service-User
|
||||
sudo bash install.sh --port 3001 # Backend-Port
|
||||
sudo bash install.sh --host 192.168.1.10 # Host/IP für nginx/CORS
|
||||
sudo bash install.sh --no-makemkv # MakeMKV überspringen
|
||||
sudo bash install.sh --no-handbrake # HandBrake überspringen
|
||||
sudo bash install.sh --no-nginx # nginx-Setup überspringen
|
||||
sudo bash install.sh --reinstall # Update (Daten bleiben erhalten)
|
||||
sudo bash install.sh --help # Hilfe anzeigen
|
||||
```
|
||||
|
||||
Alternativ kann auch erneut über `setup.sh` gebootstrapped werden:
|
||||
## Konfiguration
|
||||
|
||||
```bash
|
||||
sudo bash Pfad_zur_Installation/setup.sh --reinstall
|
||||
### UI-Settings (empfohlen)
|
||||
|
||||
Die meisten Einstellungen werden in der App unter `Settings` gepflegt und in SQLite gespeichert:
|
||||
|
||||
- Pfade: `Raw Ausgabeordner`, `Film Ausgabeordner`, `Log Ordner` (jeweils mit Blu-ray/DVD/Audiobook-Varianten)
|
||||
- Pfade Converter: `Converter Raw-Ordner`, `Converter Ausgabe (Video)`, `Converter Ausgabe (Audio)`
|
||||
- Tools: `MakeMKV Kommando`, `HandBrake Kommando`, `Mediainfo Kommando`, `FFmpeg Kommando`, `FFprobe Kommando`
|
||||
- Profile: medientyp-spezifische Felder für Blu-ray/DVD/Sonstiges (z. B. Preset, Zusatzargumente, Ausgabeformat)
|
||||
- Audiobook: Output-Template, RAW-Template
|
||||
- Converter: erlaubte Endungen, Auto-Scan-Intervall, Output-Templates
|
||||
- Queue/Monitoring: `Parallele Jobs`, `Hardware Monitoring aktiviert`, `Hardware Monitoring Intervall (ms)`
|
||||
- Benachrichtigungen: PushOver
|
||||
|
||||
### Umgebungsvariablen
|
||||
|
||||
Backend (`backend/src/config.js`):
|
||||
|
||||
- `PORT` (Default: `3001`)
|
||||
- `DB_PATH` (Default: `backend/data/ripster.db`)
|
||||
- `LOG_DIR` (Default: `backend/logs`)
|
||||
- `CORS_ORIGIN` (Default: `*`)
|
||||
- `LOG_LEVEL` (`debug|info|warn|error`, Default: `info`)
|
||||
|
||||
Frontend (Vite):
|
||||
|
||||
- `VITE_API_BASE` (Default: `/api`)
|
||||
- `VITE_WS_URL` (optional, überschreibt automatische WS-URL)
|
||||
- optional für Remote-Dev: `VITE_PUBLIC_ORIGIN`, `VITE_ALLOWED_HOSTS`, `VITE_HMR_PROTOCOL`, `VITE_HMR_HOST`, `VITE_HMR_CLIENT_PORT`
|
||||
|
||||
## Logs und Daten
|
||||
|
||||
Log-Ziel ist primär der in den Settings gepflegte `log_dir`.
|
||||
|
||||
- Backend-Logs: `<log_dir>/backend/backend-latest.log` und Tagesdateien
|
||||
- Job-Logs: `<log_dir>/job-<id>.process.log`
|
||||
- DB: `backend/data/ripster.db`
|
||||
|
||||
Hinweis: Beim DB-Init wird das Schema geprüft und fehlende Elemente werden migriert.
|
||||
|
||||
## Projektstruktur
|
||||
|
||||
```text
|
||||
ripster/
|
||||
backend/
|
||||
src/
|
||||
plugins/ # Plugin-System (BluRay, DVD, CD, Audiobook, Converter)
|
||||
routes/
|
||||
services/
|
||||
db/
|
||||
utils/
|
||||
frontend/
|
||||
src/
|
||||
pages/ # Ripper, Settings, History, Converter, Downloads, Database
|
||||
components/
|
||||
api/
|
||||
db/schema.sql
|
||||
start.sh
|
||||
install.sh
|
||||
install-dev.sh
|
||||
```
|
||||
|
||||
`--reinstall` aktualisiert die Installation und behält die persistenten Daten der bestehenden Instanz bei.
|
||||
## API-Überblick
|
||||
|
||||
## 🧪 Entwicklung
|
||||
**Health**
|
||||
- `GET /api/health`
|
||||
|
||||
Schnellstart für lokale Entwicklung:
|
||||
**Pipeline**
|
||||
- `GET /api/pipeline/state`
|
||||
- `POST /api/pipeline/analyze`
|
||||
- `POST /api/pipeline/rescan-disc`
|
||||
- `POST /api/pipeline/select-metadata`
|
||||
- `POST /api/pipeline/start/:jobId`
|
||||
- `POST /api/pipeline/confirm-encode/:jobId`
|
||||
- `POST /api/pipeline/cancel`
|
||||
- `POST /api/pipeline/retry/:jobId`
|
||||
- `POST /api/pipeline/reencode/:jobId`
|
||||
- `POST /api/pipeline/restart-review/:jobId`
|
||||
- `POST /api/pipeline/restart-encode/:jobId`
|
||||
- `POST /api/pipeline/resume-ready/:jobId`
|
||||
- `GET /api/pipeline/queue`
|
||||
- `POST /api/pipeline/queue/reorder`
|
||||
- `POST /api/pipeline/queue/entry`
|
||||
- `DELETE /api/pipeline/queue/entry/:entryId`
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
```
|
||||
**Converter**
|
||||
- `GET /api/converter/tree`
|
||||
- `GET /api/converter/browse`
|
||||
- `POST /api/converter/scan`
|
||||
- `POST /api/converter/create-jobs`
|
||||
- `POST /api/converter/upload`
|
||||
- `POST /api/converter/jobs/from-selection`
|
||||
- `GET /api/converter/jobs`
|
||||
- `GET /api/converter/jobs/:jobId`
|
||||
- `POST /api/converter/jobs/:jobId/start`
|
||||
- `POST /api/converter/jobs/:jobId/cancel`
|
||||
- `DELETE /api/converter/jobs/:jobId`
|
||||
- `DELETE /api/converter/files`
|
||||
- `POST /api/converter/files/rename`
|
||||
- `POST /api/converter/files/move`
|
||||
- `POST /api/converter/files/folder`
|
||||
|
||||
`start.sh` prüft Node.js, installiert fehlende Abhängigkeiten und startet Backend und Frontend im Dev-Modus.
|
||||
**Downloads**
|
||||
- `GET /api/downloads`
|
||||
- `GET /api/downloads/summary`
|
||||
- `POST /api/downloads/history/:jobId`
|
||||
- `GET /api/downloads/:id/file`
|
||||
- `DELETE /api/downloads/:id`
|
||||
|
||||
Wichtige npm-Skripte:
|
||||
- `npm run dev`
|
||||
- `npm run dev:backend`
|
||||
- `npm run dev:frontend`
|
||||
- `npm run build:frontend`
|
||||
- `npm run start`
|
||||
**History**
|
||||
- `GET /api/history`
|
||||
- `GET /api/history/:id`
|
||||
- `GET /api/history/database`
|
||||
- `GET /api/history/orphan-raw`
|
||||
- `POST /api/history/orphan-raw/import`
|
||||
- `POST /api/history/:id/omdb/assign`
|
||||
- `POST /api/history/:id/delete-files`
|
||||
- `POST /api/history/:id/delete`
|
||||
|
||||
## ⚙️ Konfiguration
|
||||
**Settings**
|
||||
- `GET /api/settings`
|
||||
- `PUT /api/settings/:key`
|
||||
- `PUT /api/settings`
|
||||
- `GET/POST/PUT/DELETE /api/settings/scripts...`
|
||||
- `GET/POST/PUT/DELETE /api/settings/script-chains...`
|
||||
- `GET/POST/PUT/DELETE /api/settings/user-presets...`
|
||||
- `POST /api/settings/pushover/test`
|
||||
|
||||
Die meisten Einstellungen werden in der Weboberfläche unter `Settings` gepflegt und in SQLite gespeichert. Dazu gehören insbesondere:
|
||||
- Pfade und Output-Templates für Blu-ray, DVD, Serie, CD, Audiobook, Converter, Downloads und Logs
|
||||
- Tool-Kommandos für MakeMKV, HandBrake, MediaInfo, FFmpeg, FFprobe, `cdparanoia` und `mkvmerge`
|
||||
- Laufwerksmodus, Disc-Erkennung und Queue-/Parallelisierungsregeln
|
||||
- Hardware-Monitoring, Logging, Expert Mode und Cover-Art-Recovery
|
||||
- TMDB-Zugangsdaten, Pushover, Skripte, Skript-Ketten, User-Presets und Preset-Defaults
|
||||
**Cron-Jobs**
|
||||
- `GET /api/crons`
|
||||
- `POST /api/crons`
|
||||
- `GET /api/crons/:id`
|
||||
- `PUT /api/crons/:id`
|
||||
- `DELETE /api/crons/:id`
|
||||
- `GET /api/crons/:id/logs`
|
||||
- `POST /api/crons/:id/run`
|
||||
- `POST /api/crons/validate-expression`
|
||||
|
||||
Zusätzliche Bootstrap-/Override-Variablen:
|
||||
**Runtime-Aktivitäten**
|
||||
- `GET /api/activities`
|
||||
- `POST /api/activities/:id/cancel`
|
||||
- `POST /api/activities/:id/next-step`
|
||||
- `POST /api/activities/clear-recent`
|
||||
|
||||
Backend:
|
||||
- `PORT`
|
||||
- `DB_PATH`
|
||||
- `LOG_DIR`
|
||||
- `LOG_LEVEL`
|
||||
- `CORS_ORIGIN`
|
||||
- `DEFAULT_TEMP_DIR`
|
||||
- `DEFAULT_RAW_DIR`
|
||||
- `DEFAULT_MOVIE_DIR`
|
||||
- `DEFAULT_SERIES_DIR`
|
||||
- `DEFAULT_CD_DIR`
|
||||
- `DEFAULT_AUDIOBOOK_RAW_DIR`
|
||||
- `DEFAULT_AUDIOBOOK_DIR`
|
||||
- `DEFAULT_DOWNLOAD_DIR`
|
||||
- `DEFAULT_CONVERTER_RAW_DIR`
|
||||
- `DEFAULT_CONVERTER_MOVIE_DIR`
|
||||
- `DEFAULT_CONVERTER_AUDIO_DIR`
|
||||
## Troubleshooting
|
||||
|
||||
Frontend:
|
||||
- `VITE_API_BASE`
|
||||
- `VITE_WS_URL`
|
||||
- WebSocket verbindet nicht:
|
||||
- prüfen, ob Frontend über Vite-Proxy läuft (`/ws` -> Backend)
|
||||
- bei Reverse-Proxy Upgrade-Header für `/ws` setzen
|
||||
- Keine Disc erkannt:
|
||||
- in den Settings `Laufwerksmodus` auf `Explizites Device` stellen und `Device Pfad` setzen (z. B. `/dev/sr0`)
|
||||
- HandBrake/MakeMKV Fehler:
|
||||
- CLI-Binaries im `PATH` prüfen
|
||||
- Preset-Name mit `HandBrakeCLI -z` prüfen
|
||||
- Startfehler wegen Schema:
|
||||
- `db/schema.sql` vorhanden halten
|
||||
|
||||
## 🗂️ Daten, Logs und API
|
||||
## Sicherheit
|
||||
|
||||
- Standard-DB: `backend/data/ripster.db`
|
||||
- Standard-Logs: `backend/logs`
|
||||
- Standard-Outputs liegen relativ zum Datenverzeichnis, sofern in den Settings nichts anderes gesetzt ist.
|
||||
- Das Schema wird beim Start geprüft und fehlende DB-Elemente werden migriert.
|
||||
|
||||
## 📚 Dokumentation
|
||||
|
||||
Ausführlichere Dokumentation liegt in `docs/` und veröffentlicht unter:
|
||||
|
||||
https://mboehmlaender.github.io/ripster/
|
||||
|
||||
## Lizenz
|
||||
|
||||
Der von diesem Repository entwickelte Ripster-Quellcode steht unter der GNU General Public License Version 2 oder jeder späteren Version (`GPL-2.0-or-later`).
|
||||
|
||||
Ripster enthält eine separat ausführbare HandBrakeCLI-Version für hardwarebeschleunigtes Encoding. Diese mitgelieferte Drittanbieterkomponente bleibt unter der GNU General Public License Version 2 (`GPL-2.0-only`) lizenziert.
|
||||
|
||||
Der vollständige korrespondierende Quellcode, Buildskripte, Patches, Prüfsummen und Lizenzhinweise zur mitgelieferten HandBrakeCLI befinden sich unter [`third_party/handbrake/`](third_party/handbrake/).
|
||||
|
||||
Weitere Hinweise zu Drittanbieterkomponenten befinden sich in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
|
||||
- Keine echten Tokens/Passwörter ins Repository committen.
|
||||
- Lokale Secrets in `.env` oder in Settings pflegen, aber nicht versionieren.
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# Third-Party Notices
|
||||
|
||||
Ripster uses and orchestrates third-party software and services. These
|
||||
components remain subject to their own licenses, copyright notices and terms of
|
||||
use.
|
||||
|
||||
The Ripster license does not replace or modify the licenses of these
|
||||
third-party components.
|
||||
|
||||
## Bundled HandBrakeCLI
|
||||
|
||||
Ripster includes a separately executable build of HandBrakeCLI to provide
|
||||
hardware-accelerated video encoding on supported Linux systems.
|
||||
|
||||
HandBrakeCLI is an independent third-party program developed by the HandBrake
|
||||
project. It is not part of the original Ripster source code and is not licensed
|
||||
under Ripster's `GPL-2.0-or-later` license.
|
||||
|
||||
The bundled HandBrakeCLI executable is distributed under the GNU General Public
|
||||
License version 2 (`GPL-2.0-only`).
|
||||
|
||||
The corresponding license text, build information, checksums, build scripts,
|
||||
patches and corresponding source notes are provided under:
|
||||
|
||||
- `third_party/handbrake/COPYING`
|
||||
- `third_party/handbrake/BUILDINFO.md`
|
||||
- `third_party/handbrake/SHA256SUMS`
|
||||
- `third_party/handbrake/build-handbrake.sh`
|
||||
- `third_party/handbrake/patches/`
|
||||
- `third_party/handbrake/source/`
|
||||
|
||||
The currently bundled binary contains FDK-AAC related strings. Redistribution
|
||||
of this binary is marked as unresolved until a separate legal review is
|
||||
completed or the binary is replaced by a clean rebuild without FDK-AAC.
|
||||
|
||||
Ripster is not affiliated with or endorsed by the HandBrake project.
|
||||
|
||||
## External media tools
|
||||
|
||||
Depending on the selected workflow and system configuration, Ripster can invoke
|
||||
external tools including:
|
||||
|
||||
- MakeMKV
|
||||
- FFmpeg and FFprobe
|
||||
- MediaInfo
|
||||
- MKVToolNix / `mkvmerge`
|
||||
- cdparanoia
|
||||
- FLAC
|
||||
- LAME
|
||||
- Opus Tools
|
||||
- Vorbis Tools
|
||||
|
||||
These programs are not relicensed by Ripster. Users and distributors are
|
||||
responsible for complying with their respective licenses and usage conditions.
|
||||
MakeMKV is subject to its own license and registration terms.
|
||||
|
||||
## JavaScript dependencies
|
||||
|
||||
The frontend and backend use open-source packages distributed through the
|
||||
Node.js ecosystem. Their respective licenses and copyright notices remain
|
||||
applicable.
|
||||
|
||||
Dependency information can be found in the relevant `package.json` and lock
|
||||
files.
|
||||
|
||||
## External metadata and notification services
|
||||
|
||||
Ripster may integrate with external services such as:
|
||||
|
||||
- TMDB
|
||||
- MusicBrainz
|
||||
- Audnexus
|
||||
- Pushover
|
||||
|
||||
Use of these services is subject to their respective terms, API policies and
|
||||
data licenses.
|
||||
|
||||
### TMDB notice
|
||||
|
||||
This product uses the TMDB API but is not endorsed or certified by TMDB.
|
||||
Generated
+2
-3
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"name": "ripster-backend",
|
||||
"version": "1.0.0-1",
|
||||
"version": "0.13.1-6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ripster-backend",
|
||||
"version": "1.0.0-1",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"version": "0.13.1-6",
|
||||
"dependencies": {
|
||||
"archiver": "^7.0.1",
|
||||
"cors": "^2.8.5",
|
||||
|
||||
+1
-10
@@ -1,16 +1,7 @@
|
||||
{
|
||||
"name": "ripster-backend",
|
||||
"version": "1.0.0-1",
|
||||
"version": "0.13.1-6",
|
||||
"private": true,
|
||||
"license": "GPL-2.0-or-later",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mboehmlaender/ripster.git"
|
||||
},
|
||||
"homepage": "https://mboehmlaender.github.io/ripster/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mboehmlaender/ripster/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const rootDir = path.resolve(__dirname, '..');
|
||||
@@ -20,7 +18,6 @@ module.exports = {
|
||||
port: process.env.PORT ? Number(process.env.PORT) : 3001,
|
||||
dbPath: resolvedDbPath,
|
||||
dataDir,
|
||||
tempDir: resolveOutputPath(process.env.DEFAULT_TEMP_DIR, 'temp'),
|
||||
corsOrigin: process.env.CORS_ORIGIN || '*',
|
||||
logDir: path.isAbsolute(rawLogDir) ? rawLogDir : path.resolve(rootDir, rawLogDir),
|
||||
logLevel: process.env.LOG_LEVEL || 'info',
|
||||
|
||||
+20
-264
@@ -528,7 +528,6 @@ async function openAndPrepareDatabase() {
|
||||
await migrateLegacyProfiledToolSettings(dbInstance);
|
||||
await migrateOutputTemplates(dbInstance);
|
||||
await removeDeprecatedSettings(dbInstance);
|
||||
await migrateTmdbMigrationFlags(dbInstance);
|
||||
await migrateSettingsSchemaMetadata(dbInstance);
|
||||
await ensurePipelineStateRow(dbInstance);
|
||||
await backfillJobOutputFolders(dbInstance);
|
||||
@@ -771,8 +770,6 @@ async function migrateOutputTemplates(db) {
|
||||
async function removeDeprecatedSettings(db) {
|
||||
const deprecatedKeys = [
|
||||
'pushover_notify_disc_detected',
|
||||
'pushover_notify_cron_success',
|
||||
'pushover_notify_cron_error',
|
||||
'mediainfo_extra_args',
|
||||
'makemkv_rip_mode',
|
||||
'makemkv_analyze_extra_args',
|
||||
@@ -812,9 +809,7 @@ async function removeDeprecatedSettings(db) {
|
||||
'use_plugin_architecture_audiobook_analyze',
|
||||
'use_plugin_architecture_audiobook_encode',
|
||||
'dvd_series_plugin_enabled',
|
||||
'dvd_series_prescan_enabled',
|
||||
'dvd_series_reuse_disc_profiles',
|
||||
'musicbrainz_enabled'
|
||||
'dvd_series_prescan_enabled'
|
||||
];
|
||||
for (const key of deprecatedKeys) {
|
||||
const schemaResult = await db.run('DELETE FROM settings_schema WHERE key = ?', [key]);
|
||||
@@ -831,73 +826,9 @@ async function removeDeprecatedSettings(db) {
|
||||
);
|
||||
}
|
||||
|
||||
async function migrateTmdbMigrationFlags(db) {
|
||||
// Keep this migration idempotent. It helps initialize the new migrate_tmdb flag
|
||||
// for existing rows after OMDb -> TMDb transition.
|
||||
const nullableReset = await db.run(
|
||||
`
|
||||
UPDATE jobs
|
||||
SET migrate_tmdb = 0
|
||||
WHERE migrate_tmdb IS NULL
|
||||
`
|
||||
);
|
||||
|
||||
// Audio-only domains are outside TMDb migration scope.
|
||||
const nonVideoMarked = await db.run(
|
||||
`
|
||||
UPDATE jobs
|
||||
SET migrate_tmdb = 1
|
||||
WHERE COALESCE(migrate_tmdb, 0) = 0
|
||||
AND LOWER(TRIM(COALESCE(media_type, ''))) IN ('cd', 'audiobook')
|
||||
`
|
||||
);
|
||||
|
||||
// Rows with obvious TMDb assignment can be marked as migrated.
|
||||
const obviousTmdbMarked = await db.run(
|
||||
`
|
||||
UPDATE jobs
|
||||
SET migrate_tmdb = 1
|
||||
WHERE COALESCE(migrate_tmdb, 0) = 0
|
||||
AND (
|
||||
makemkv_info_json LIKE '%"metadataProvider":"tmdb"%'
|
||||
OR makemkv_info_json LIKE '%"tmdbId":%'
|
||||
OR encode_plan_json LIKE '%"metadataProvider":"tmdb"%'
|
||||
OR encode_plan_json LIKE '%"tmdbId":%'
|
||||
)
|
||||
`
|
||||
);
|
||||
|
||||
// Explicit OMDb footprints must stay pending for manual migration.
|
||||
const explicitOmdbPending = await db.run(
|
||||
`
|
||||
UPDATE jobs
|
||||
SET migrate_tmdb = 0
|
||||
WHERE (
|
||||
COALESCE(selected_from_omdb, 0) = 1
|
||||
OR (omdb_json IS NOT NULL AND TRIM(omdb_json) <> '')
|
||||
OR makemkv_info_json LIKE '%"metadataProvider":"omdb"%'
|
||||
OR encode_plan_json LIKE '%"metadataProvider":"omdb"%'
|
||||
)
|
||||
`
|
||||
);
|
||||
|
||||
logger.info('migrate:tmdb-flag:done', {
|
||||
nullableReset: Number(nullableReset?.changes || 0),
|
||||
nonVideoMarked: Number(nonVideoMarked?.changes || 0),
|
||||
obviousTmdbMarked: Number(obviousTmdbMarked?.changes || 0),
|
||||
explicitOmdbPending: Number(explicitOmdbPending?.changes || 0)
|
||||
});
|
||||
}
|
||||
|
||||
// Aktualisiert settings_schema-Metadaten (required, description, validation_json)
|
||||
// für bestehende Einträge, ohne user-konfigurierte Werte in settings_values anzutasten.
|
||||
const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
||||
{
|
||||
key: 'makemkv_registration_key',
|
||||
required: 0,
|
||||
description: 'Optionaler Registrierungsschlüssel. Wird beim Speichern nach ~/.MakeMKV/settings.conf synchronisiert. Darunter kann der aktuelle Betakey per API übernommen werden.',
|
||||
validation_json: '{}'
|
||||
},
|
||||
{
|
||||
key: 'handbrake_preset_bluray',
|
||||
required: 0,
|
||||
@@ -910,40 +841,16 @@ const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
||||
description: 'Preset Name für -Z (DVD). Leer = kein Preset, nur CLI-Parameter werden verwendet.',
|
||||
validation_json: '{}'
|
||||
},
|
||||
{
|
||||
key: 'dvd_series_language',
|
||||
required: 1,
|
||||
description: 'Bevorzugte TMDb-Sprache für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE oder en-US.',
|
||||
validation_json: '{"minLength":2}'
|
||||
},
|
||||
{
|
||||
key: 'dvd_series_fallback_languages',
|
||||
required: 1,
|
||||
description: 'Kommagetrennte TMDb-Fallback-Sprachen für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE,en-US,fr-FR.',
|
||||
validation_json: '{"minLength":2}'
|
||||
},
|
||||
{
|
||||
key: 'output_template_bluray_series_episode',
|
||||
required: 1,
|
||||
description: 'Template für einzelne Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.',
|
||||
validation_json: '{"minLength":1}'
|
||||
},
|
||||
{
|
||||
key: 'output_template_bluray_series_multi_episode',
|
||||
required: 1,
|
||||
description: 'Template für zusammengefasste Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.',
|
||||
validation_json: '{"minLength":1}'
|
||||
},
|
||||
{
|
||||
key: 'output_template_dvd_series_episode',
|
||||
required: 1,
|
||||
description: 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.',
|
||||
description: 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}. Alias: {seasonNo}/{episodeNo} entspricht {seasonNr}/{episodeNr}.',
|
||||
validation_json: '{"minLength":1}'
|
||||
},
|
||||
{
|
||||
key: 'output_template_dvd_series_multi_episode',
|
||||
required: 1,
|
||||
description: 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.',
|
||||
description: 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}. Alias: {seasonNo} entspricht {seasonNr}.',
|
||||
validation_json: '{"minLength":1}'
|
||||
}
|
||||
];
|
||||
@@ -952,8 +859,6 @@ const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
||||
const SETTINGS_CATEGORY_MOVES = [
|
||||
{ key: 'cd_output_template', category: 'Pfade' },
|
||||
{ key: 'output_template_bluray', category: 'Pfade' },
|
||||
{ key: 'output_template_bluray_series_episode', category: 'Pfade' },
|
||||
{ key: 'output_template_bluray_series_multi_episode', category: 'Pfade' },
|
||||
{ key: 'output_template_dvd', category: 'Pfade' },
|
||||
{ key: 'output_template_audiobook', category: 'Pfade' },
|
||||
{ key: 'output_chapter_template_audiobook', category: 'Pfade' },
|
||||
@@ -962,13 +867,7 @@ const SETTINGS_CATEGORY_MOVES = [
|
||||
{ key: 'converter_movie_dir', category: 'Pfade' },
|
||||
{ key: 'converter_audio_dir', category: 'Pfade' },
|
||||
{ key: 'converter_output_template_video', category: 'Pfade' },
|
||||
{ key: 'converter_output_template_audio', category: 'Pfade' },
|
||||
{ key: 'server_console_log_output_enabled', category: 'Logging' },
|
||||
{ key: 'server_console_log_http_enabled', category: 'Logging' },
|
||||
{ key: 'server_console_log_debug_enabled', category: 'Logging' },
|
||||
{ key: 'server_console_log_info_enabled', category: 'Logging' },
|
||||
{ key: 'server_console_log_warn_enabled', category: 'Logging' },
|
||||
{ key: 'server_console_log_error_enabled', category: 'Logging' }
|
||||
{ key: 'converter_output_template_audio', category: 'Pfade' }
|
||||
];
|
||||
|
||||
async function migrateSettingsSchemaMetadata(db) {
|
||||
@@ -1026,61 +925,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
});
|
||||
}
|
||||
|
||||
const metadataReadyNotifyLabel = 'Bei manueller Auswahl senden';
|
||||
const metadataReadyNotifyDescription = 'Sendet, wenn ein Job eine manuelle Auswahl/Entscheidung benötigt (z.B. Metadaten, Titel oder Playlist).';
|
||||
const metadataReadyNotifyResult = await db.run(
|
||||
`UPDATE settings_schema
|
||||
SET label = ?, description = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE key = 'pushover_notify_metadata_ready' AND (label != ? OR description != ?)`,
|
||||
[
|
||||
metadataReadyNotifyLabel,
|
||||
metadataReadyNotifyDescription,
|
||||
metadataReadyNotifyLabel,
|
||||
metadataReadyNotifyDescription
|
||||
]
|
||||
);
|
||||
if (metadataReadyNotifyResult?.changes > 0) {
|
||||
logger.info('migrate:settings-schema-metadata-ready-notify-updated', {
|
||||
key: 'pushover_notify_metadata_ready',
|
||||
label: metadataReadyNotifyLabel
|
||||
});
|
||||
}
|
||||
|
||||
const metadataLanguageLabel = 'Film-Sprache';
|
||||
const metadataLanguageDescription = 'Bevorzugte TMDb-Sprache für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE oder en-US.';
|
||||
const metadataLanguageResult = await db.run(
|
||||
`UPDATE settings_schema
|
||||
SET label = ?, description = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE key = 'dvd_series_language' AND (label != ? OR description != ?)`,
|
||||
[metadataLanguageLabel, metadataLanguageDescription, metadataLanguageLabel, metadataLanguageDescription]
|
||||
);
|
||||
if (metadataLanguageResult?.changes > 0) {
|
||||
logger.info('migrate:settings-schema-language-updated', {
|
||||
key: 'dvd_series_language',
|
||||
label: metadataLanguageLabel
|
||||
});
|
||||
}
|
||||
|
||||
const metadataFallbackLanguageLabel = 'Fallback Sprache';
|
||||
const metadataFallbackLanguageDescription = 'Kommagetrennte TMDb-Fallback-Sprachen für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE,en-US,fr-FR.';
|
||||
const metadataFallbackLanguageResult = await db.run(
|
||||
`UPDATE settings_schema
|
||||
SET label = ?, description = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE key = 'dvd_series_fallback_languages' AND (label != ? OR description != ?)`,
|
||||
[
|
||||
metadataFallbackLanguageLabel,
|
||||
metadataFallbackLanguageDescription,
|
||||
metadataFallbackLanguageLabel,
|
||||
metadataFallbackLanguageDescription
|
||||
]
|
||||
);
|
||||
if (metadataFallbackLanguageResult?.changes > 0) {
|
||||
logger.info('migrate:settings-schema-fallback-language-updated', {
|
||||
key: 'dvd_series_fallback_languages',
|
||||
label: metadataFallbackLanguageLabel
|
||||
});
|
||||
}
|
||||
|
||||
const dvdSeriesMultiEpisodeTemplateDefault = '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})';
|
||||
const legacyDvdSeriesMultiEpisodeTemplateDefaults = [
|
||||
'{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeRange}'
|
||||
@@ -1157,68 +1001,12 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('ffmpeg_command', 'ffmpeg')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('mkvmerge_command', 'Tools', 'mkvmerge Kommando', 'string', 1, 'Pfad oder Befehl für mkvmerge. Wird für Multipart-Movie-Merges genutzt.', 'mkvmerge', '[]', '{"minLength":1}', 2325)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('mkvmerge_command', 'mkvmerge')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('ffprobe_command', 'Tools', 'FFprobe Kommando', 'string', 1, 'Pfad oder Befehl für ffprobe. Wird für Audiobook-Metadaten und Kapitel genutzt.', 'ffprobe', '[]', '{"minLength":1}', 233)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('ffprobe_command', 'ffprobe')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('playlist_tmdb_runtime_subtract_percent', 'Tools', 'TMDb Runtime-Abzug für Playlistfilter (%)', 'number', 1, 'Zieht optional einen Prozentwert von der TMDb-Laufzeit ab, um kürzere alternative Filmfassungen weiterhin als Playlist-Kandidaten zuzulassen. Mindesttoleranz nach unten bleibt immer 2 Minuten.', '0', '[]', '{"min":0,"max":100}', 211)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('playlist_tmdb_runtime_subtract_percent', '0')`);
|
||||
|
||||
await db.run(`DELETE FROM settings_values WHERE key = 'series_playall_tolerance_lower_pct'`);
|
||||
await db.run(`DELETE FROM settings_schema WHERE key = 'series_playall_tolerance_lower_pct'`);
|
||||
await db.run(`DELETE FROM settings_values WHERE key = 'series_playall_tolerance_upper_pct'`);
|
||||
await db.run(`DELETE FROM settings_schema WHERE key = 'series_playall_tolerance_upper_pct'`);
|
||||
|
||||
await db.run(`DELETE FROM settings_values WHERE key = 'handbrake_pre_metadata_scan_enabled'`);
|
||||
await db.run(`DELETE FROM settings_schema WHERE key = 'handbrake_pre_metadata_scan_enabled'`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_output_enabled', 'Logging', 'Terminal-Ausgabe aktiv', 'boolean', 1, 'Master-Schalter für die Ausgabe der Server-Logs im Terminal (z.B. start.sh). Das Schreiben in Log-Dateien bleibt immer aktiv.', 'true', '[]', '{}', 150)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_output_enabled', 'true')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_http_enabled', 'Logging', 'HTTP-Logs im Terminal', 'boolean', 1, 'Steuert HTTP Request-Logs im Terminal (z.B. request:start). Dateilogs bleiben unverändert.', 'true', '[]', '{}', 151)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_http_enabled', 'true')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_debug_enabled', 'Logging', 'DEBUG im Terminal', 'boolean', 1, 'Steuert DEBUG-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 152)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_debug_enabled', 'true')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_info_enabled', 'Logging', 'INFO im Terminal', 'boolean', 1, 'Steuert INFO-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 153)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_info_enabled', 'true')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_warn_enabled', 'Logging', 'WARN im Terminal', 'boolean', 1, 'Steuert WARN-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 154)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_warn_enabled', 'true')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_error_enabled', 'Logging', 'ERROR im Terminal', 'boolean', 1, 'Steuert ERROR-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 155)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_error_enabled', 'true')`);
|
||||
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
@@ -1262,18 +1050,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('movie_dir_audiobook_owner', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_bluray_series', 'Pfade', 'RAW-Ordner (Blu-ray Serie)', 'path', 0, 'RAW-Zielpfad für Blu-ray-Serien. Leer = gleicher Pfad wie RAW-Ordner (Blu-ray).', NULL, '[]', '{}', 1011)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray_series', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_bluray_series_owner', 'Pfade', 'Eigentümer RAW-Ordner (Blu-ray Serie)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe für Blu-ray-Serien-RAW. Leer = Eigentümer Raw-Ordner (Blu-ray).', NULL, '[]', '{}', 1012)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray_series_owner', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_dvd_series', 'Pfade', 'RAW-Ordner (DVD Serie)', 'path', 0, 'RAW-Zielpfad für DVD-Serien. Leer = gleicher Pfad wie RAW-Ordner (DVD).', NULL, '[]', '{}', 1021)`
|
||||
@@ -1286,18 +1062,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_dvd_series_owner', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('series_dir_bluray', 'Pfade', 'Serien-Ordner (Blu-ray)', 'path', 0, 'Zielordner für Blu-ray-Serienfolgen. Leer = Standardpfad (data/output/series).', NULL, '[]', '{}', 110)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('series_dir_bluray', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('series_dir_bluray_owner', 'Pfade', 'Eigentümer Serien-Ordner (Blu-ray)', 'string', 0, 'Eigentümer der Blu-ray-Serienausgaben im Format user:gruppe. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1105)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('series_dir_bluray_owner', NULL)`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('series_dir_dvd', 'Pfade', 'Serien-Ordner (DVD)', 'path', 0, 'Zielordner für DVD-Serienfolgen. Leer = Standardpfad (data/output/series).', NULL, '[]', '{}', 113)`
|
||||
@@ -1312,25 +1076,13 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_bluray_series_episode', 'Pfade', 'Output Template (Blu-ray Serie, Episode)', 'string', 1, 'Template für einzelne Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 336)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_bluray_series_episode', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_bluray_series_multi_episode', 'Pfade', 'Output Template (Blu-ray Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 337)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_bluray_series_multi_episode', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_dvd_series_episode', 'Pfade', 'Output Template (DVD Serie, Episode)', 'string', 1, 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 536)`
|
||||
VALUES ('output_template_dvd_series_episode', 'Pfade', 'Output Template (DVD Serie, Episode)', 'string', 1, 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}. Alias: {seasonNo}/{episodeNo} entspricht {seasonNr}/{episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 536)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_dvd_series_episode', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_dvd_series_multi_episode', 'Pfade', 'Output Template (DVD Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 537)`
|
||||
VALUES ('output_template_dvd_series_multi_episode', 'Pfade', 'Output Template (DVD Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}. Alias: {seasonNo} entspricht {seasonNr}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 537)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_dvd_series_multi_episode', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})')`);
|
||||
|
||||
@@ -1342,20 +1094,30 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('dvd_series_language', 'Metadaten', 'Film-Sprache', 'string', 1, 'Bevorzugte TMDb-Sprache für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE oder en-US.', 'de-DE', '[]', '{"minLength":2}', 403)`
|
||||
VALUES ('dvd_series_language', 'Metadaten', 'DVD Serien-Sprache', 'string', 1, 'Bevorzugte Sprache für Serien-Metadaten im TMDb-Format, z.B. de-DE oder en-US.', 'de-DE', '[]', '{"minLength":2}', 403)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_language', 'de-DE')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('dvd_series_fallback_languages', 'Metadaten', 'Fallback Sprache', 'string', 1, 'Kommagetrennte TMDb-Fallback-Sprachen für Film- und Serienmetadaten (DVD/Blu-ray), z.B. de-DE,en-US,fr-FR.', 'de-DE,en-US', '[]', '{"minLength":2}', 404)`
|
||||
VALUES ('dvd_series_fallback_languages', 'Metadaten', 'DVD Serien-Fallback-Sprachen', 'string', 1, 'Kommagetrennte TMDb-Sprachen für Fallback-Titel, z.B. de-DE,en-US,fr-FR.', 'de-DE,en-US', '[]', '{"minLength":2}', 404)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_fallback_languages', 'de-DE,en-US')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('dvd_series_order_preference', 'Metadaten', 'DVD Serien-Ordnung', 'select', 1, 'Bevorzugte Episodenordnung für DVD-Serien. Episode Groups nutzen TMDb Alternate Orders, falls vorhanden.', 'episode_group', '[{"label":"Episode Group","value":"episode_group"},{"label":"Aired / Season","value":"aired"}]', '{}', 405)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_order_preference', 'episode_group')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('dvd_series_reuse_disc_profiles', 'Metadaten', 'DVD Disc-Profile wiederverwenden', 'boolean', 1, 'Verwendet zuvor bestätigte Disc-Profile erneut, um Episoden automatischer zuzuordnen.', 'true', '[]', '{}', 406)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_reuse_disc_profiles', 'true')`);
|
||||
|
||||
await db.run(`DELETE FROM settings_values WHERE key IN ('tvdb_api_key', 'tvdb_subscriber_pin')`);
|
||||
await db.run(`DELETE FROM settings_schema WHERE key IN ('tvdb_api_key', 'tvdb_subscriber_pin')`);
|
||||
await db.run(`DELETE FROM settings_values WHERE key = 'dvd_series_order_preference'`);
|
||||
await db.run(`DELETE FROM settings_schema WHERE key = 'dvd_series_order_preference'`);
|
||||
|
||||
// Converter-Pfade und Eigentümer
|
||||
await db.run(
|
||||
@@ -1448,12 +1210,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('coverart_recovery_interval_hours', '6')`);
|
||||
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('generate_nfo_after_encode', 'Metadaten', 'NFO nach Encode erzeugen', 'boolean', 1, 'Erstellt nach erfolgreichem Encode automatisch eine .nfo-Datei neben der Ausgabedatei.', 'false', '[]', '{}', 432)`
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('generate_nfo_after_encode', 'false')`);
|
||||
|
||||
await db.run(`
|
||||
CREATE TABLE IF NOT EXISTS user_prefs (
|
||||
key TEXT PRIMARY KEY,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
const http = require('http');
|
||||
@@ -18,64 +16,19 @@ const runtimeRoutes = require('./routes/runtimeRoutes');
|
||||
const converterRoutes = require('./routes/converterRoutes');
|
||||
const wsService = require('./services/websocketService');
|
||||
const pipelineService = require('./services/pipelineService');
|
||||
const settingsService = require('./services/settingsService');
|
||||
const converterScanService = require('./services/converterScanService');
|
||||
const cronService = require('./services/cronService');
|
||||
const downloadService = require('./services/downloadService');
|
||||
const diskDetectionService = require('./services/diskDetectionService');
|
||||
const hardwareMonitorService = require('./services/hardwareMonitorService');
|
||||
const coverArtRecoveryService = require('./services/coverArtRecoveryService');
|
||||
const tempCleanupService = require('./services/tempCleanupService');
|
||||
const { fetchCurrentBetaKey } = require('./services/makemkvKeyService');
|
||||
const logger = require('./services/logger').child('BOOT');
|
||||
const { errorToMeta } = require('./utils/errorMeta');
|
||||
const { getThumbnailsDir, migrateExistingThumbnails } = require('./services/thumbnailService');
|
||||
|
||||
function getDelayUntilNextBetaKeyCheck(now = new Date()) {
|
||||
const next = new Date(now);
|
||||
next.setHours(0, 1, 0, 0);
|
||||
if (next.getTime() <= now.getTime()) {
|
||||
next.setDate(next.getDate() + 1);
|
||||
}
|
||||
return Math.max(1000, next.getTime() - now.getTime());
|
||||
}
|
||||
|
||||
async function start() {
|
||||
logger.info('backend:start:init');
|
||||
await initDatabase();
|
||||
try {
|
||||
const runtimeSettings = await settingsService.applyRuntimeSettings();
|
||||
logger.info('backend:runtime-settings:applied', runtimeSettings);
|
||||
} catch (error) {
|
||||
logger.warn('backend:runtime-settings:apply-failed', { error: errorToMeta(error) });
|
||||
}
|
||||
let betaKeyRefreshTimer = null;
|
||||
const scheduleBetaKeyRefresh = () => {
|
||||
clearTimeout(betaKeyRefreshTimer);
|
||||
const delayMs = getDelayUntilNextBetaKeyCheck();
|
||||
betaKeyRefreshTimer = setTimeout(runBetaKeyRefresh, delayMs);
|
||||
betaKeyRefreshTimer.unref?.();
|
||||
logger.info('beta-key:daily-check:scheduled', {
|
||||
delayMs,
|
||||
nextRunAt: new Date(Date.now() + delayMs).toISOString()
|
||||
});
|
||||
};
|
||||
const runBetaKeyRefresh = async () => {
|
||||
try {
|
||||
const result = await fetchCurrentBetaKey({ forceRefresh: true });
|
||||
logger.info('beta-key:daily-check:done', {
|
||||
sourceUrl: result?.sourceUrl || null,
|
||||
validUntil: result?.validUntil || null,
|
||||
fetchedAt: result?.fetchedAt || null
|
||||
});
|
||||
} catch (error) {
|
||||
logger.warn('beta-key:daily-check:failed', { error: errorToMeta(error) });
|
||||
} finally {
|
||||
scheduleBetaKeyRefresh();
|
||||
}
|
||||
};
|
||||
scheduleBetaKeyRefresh();
|
||||
await tempCleanupService.init();
|
||||
await pipelineService.init();
|
||||
await converterScanService.startPolling();
|
||||
await cronService.init();
|
||||
@@ -142,8 +95,6 @@ async function start() {
|
||||
coverArtRecoveryService.stop();
|
||||
hardwareMonitorService.stop();
|
||||
cronService.stop();
|
||||
tempCleanupService.stop();
|
||||
clearTimeout(betaKeyRefreshTimer);
|
||||
server.close(() => {
|
||||
logger.warn('backend:shutdown:completed');
|
||||
process.exit(0);
|
||||
|
||||
@@ -26,7 +26,6 @@ function truncate(value, maxLen = 1500) {
|
||||
module.exports = function requestLogger(req, res, next) {
|
||||
const reqId = randomUUID();
|
||||
const startedAt = Date.now();
|
||||
let completionLogged = false;
|
||||
|
||||
req.reqId = reqId;
|
||||
|
||||
@@ -39,37 +38,15 @@ module.exports = function requestLogger(req, res, next) {
|
||||
body: truncate(req.body)
|
||||
});
|
||||
|
||||
const logCompletion = (kind) => {
|
||||
if (completionLogged) {
|
||||
return;
|
||||
}
|
||||
completionLogged = true;
|
||||
logger.info('request:end', {
|
||||
reqId,
|
||||
method: req.method,
|
||||
url: req.originalUrl,
|
||||
statusCode: res.statusCode,
|
||||
durationMs: Date.now() - startedAt,
|
||||
completion: kind
|
||||
});
|
||||
};
|
||||
|
||||
res.on('finish', () => {
|
||||
logCompletion('finish');
|
||||
});
|
||||
|
||||
res.on('close', () => {
|
||||
if (!res.writableEnded) {
|
||||
logger.warn('request:aborted', {
|
||||
reqId,
|
||||
method: req.method,
|
||||
url: req.originalUrl,
|
||||
statusCode: res.statusCode,
|
||||
durationMs: Date.now() - startedAt
|
||||
});
|
||||
return;
|
||||
}
|
||||
logCompletion('close');
|
||||
});
|
||||
|
||||
next();
|
||||
|
||||
@@ -4,7 +4,6 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { SourcePlugin } = require('./PluginBase');
|
||||
const { spawnTrackedProcess } = require('../services/processRunner');
|
||||
const { syncRegistrationKeyToConfig } = require('../services/makemkvKeyService');
|
||||
const { parseHandBrakeProgress, parseMakeMkvProgress } = require('../utils/progressParsers');
|
||||
const { ensureDir, sanitizeFileName, renderTemplate } = require('../utils/files');
|
||||
|
||||
@@ -237,7 +236,15 @@ class ConverterPlugin extends SourcePlugin {
|
||||
|
||||
const settings = await ctx.settings.getSettingsMap();
|
||||
const makemkvCmd = String(settings?.makemkv_command || 'makemkvcon').trim() || 'makemkvcon';
|
||||
await syncRegistrationKeyToConfig(settings?.makemkv_registration_key || '');
|
||||
const registrationKey = String(settings?.makemkv_registration_key || '').trim() || null;
|
||||
|
||||
if (registrationKey) {
|
||||
try {
|
||||
await this._runCaptured(makemkvCmd, ['reg', registrationKey], { jobId: job?.id });
|
||||
} catch (_err) {
|
||||
// Registrierung ist optional
|
||||
}
|
||||
}
|
||||
|
||||
const args = ['--noscan', '--decrypt', '-r', 'backup', `iso:${inputPath}`, rawJobDir];
|
||||
|
||||
|
||||
@@ -31,19 +31,11 @@ class DVDSeriesPlugin extends SourcePlugin {
|
||||
pluginFile: 'DVDSeriesPlugin.js'
|
||||
});
|
||||
|
||||
const fallbackSeriesLookupHint = dvdSeriesScanService.deriveSeriesLookupHint([
|
||||
{
|
||||
value: ctx.extra?.detectedTitle || '',
|
||||
source: 'detected_title'
|
||||
}
|
||||
]);
|
||||
|
||||
const scanText = String(ctx.extra?.scanText || '').trim();
|
||||
if (!scanText) {
|
||||
return {
|
||||
parsedScan: null,
|
||||
seriesAnalysis: null,
|
||||
seriesLookupHint: fallbackSeriesLookupHint,
|
||||
providerConfigured: await tmdbService.isConfigured()
|
||||
};
|
||||
}
|
||||
@@ -58,7 +50,7 @@ class DVDSeriesPlugin extends SourcePlugin {
|
||||
value: ctx.extra?.detectedTitle || '',
|
||||
source: 'detected_title'
|
||||
}
|
||||
]) || fallbackSeriesLookupHint;
|
||||
]);
|
||||
return {
|
||||
parsedScan: result.parsed,
|
||||
seriesAnalysis: result.analysis,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const path = require('path');
|
||||
const { SourcePlugin } = require('./PluginBase');
|
||||
const tmdbService = require('../services/tmdbService');
|
||||
const omdbService = require('../services/omdbService');
|
||||
const { spawnTrackedProcess } = require('../services/processRunner');
|
||||
const { parseMakeMkvProgress, parseHandBrakeProgress } = require('../utils/progressParsers');
|
||||
const { ensureDir } = require('../utils/files');
|
||||
@@ -11,7 +11,7 @@ const { ensureDir } = require('../utils/files');
|
||||
* Gemeinsame Basisklasse für Blu-ray und DVD Plugins.
|
||||
*
|
||||
* Implementiert die gemeinsame Pipeline-Logik für alle Video-Disc-Medien:
|
||||
* analyze() → TMDb-Suche + Disc-Metadaten vorbereiten
|
||||
* analyze() → OMDB-Suche + Disc-Metadaten vorbereiten
|
||||
* review() → HandBrake-Scan (liefert rohe Scandaten für den Orchestrator)
|
||||
* rip() → makemkvcon backup/mkv
|
||||
* encode() → HandBrakeCLI
|
||||
@@ -54,13 +54,13 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Führt eine TMDb-Suche für den erkannten Disc-Titel durch.
|
||||
* Gibt { detectedTitle, metadataCandidates } zurück.
|
||||
* Führt eine OMDB-Suche für den erkannten Disc-Titel durch.
|
||||
* Gibt { detectedTitle, omdbCandidates } zurück.
|
||||
*
|
||||
* @param {string} devicePath
|
||||
* @param {object} job - Vorbereiteter Job-Record (noch ohne Metadaten)
|
||||
* @param {PluginContext} ctx
|
||||
* @returns {Promise<{detectedTitle: string, metadataCandidates: Array}>}
|
||||
* @returns {Promise<{detectedTitle: string, omdbCandidates: Array}>}
|
||||
*/
|
||||
async analyze(devicePath, job, ctx) {
|
||||
ctx.markExecution('analyze', {
|
||||
@@ -76,8 +76,8 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
|
||||
ctx.logger.info(`${this.id}:analyze:start`, { devicePath, jobId: job?.id, detectedTitle });
|
||||
|
||||
const metadataCandidates = await tmdbService.searchMoviesWithDetails(detectedTitle).catch((error) => {
|
||||
ctx.logger.warn(`${this.id}:analyze:tmdb-failed`, {
|
||||
const omdbCandidates = await omdbService.search(detectedTitle).catch((error) => {
|
||||
ctx.logger.warn(`${this.id}:analyze:omdb-failed`, {
|
||||
jobId: job?.id,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
@@ -87,10 +87,10 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
ctx.logger.info(`${this.id}:analyze:done`, {
|
||||
jobId: job?.id,
|
||||
detectedTitle,
|
||||
metadataCandidates: metadataCandidates.length
|
||||
omdbCandidates: omdbCandidates.length
|
||||
});
|
||||
|
||||
return { detectedTitle, metadataCandidates };
|
||||
return { detectedTitle, omdbCandidates };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +147,6 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
});
|
||||
|
||||
const scanLines = [];
|
||||
const scanAnalysisLines = [];
|
||||
const runCommandFn = typeof ctx.extra?.runCommand === 'function' ? ctx.extra.runCommand : null;
|
||||
const reviewStage = String(ctx.extra?.reviewStage || 'MEDIAINFO_CHECK').trim().toUpperCase() || 'MEDIAINFO_CHECK';
|
||||
const reviewSource = String(ctx.extra?.reviewSource || 'HANDBRAKE_SCAN').trim().toUpperCase() || 'HANDBRAKE_SCAN';
|
||||
@@ -162,11 +161,9 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
cmd: scanConfig.cmd,
|
||||
args: scanConfig.args,
|
||||
collectLines: scanLines,
|
||||
// Keep JSON parsing stable by collecting only stdout in scanLines.
|
||||
// Stderr is still mirrored into scanAnalysisLines for heuristics.
|
||||
collectStderrLines: false,
|
||||
onStdoutLine: (line) => scanAnalysisLines.push(line),
|
||||
onStderrLine: (line) => scanAnalysisLines.push(line),
|
||||
// HandBrake scan details (duration/chapters/audio/subtitles) are often
|
||||
// emitted on stderr. Collect both streams for reliable disc heuristics.
|
||||
collectStderrLines: true,
|
||||
silent: reviewSilent
|
||||
});
|
||||
} catch (cmdError) {
|
||||
@@ -183,11 +180,8 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
runInfo = await _runCommandCaptured({
|
||||
cmd: scanConfig.cmd,
|
||||
args: scanConfig.args,
|
||||
onStdoutLine: (line) => {
|
||||
scanLines.push(line);
|
||||
scanAnalysisLines.push(line);
|
||||
},
|
||||
onStderrLine: (line) => scanAnalysisLines.push(line),
|
||||
onStdoutLine: (line) => scanLines.push(line),
|
||||
onStderrLine: (line) => scanLines.push(line),
|
||||
context: { jobId: job?.id, source: `${this.id}Plugin.review` }
|
||||
});
|
||||
}
|
||||
@@ -195,14 +189,13 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
ctx.logger.info(`${this.id}:review:scan-done`, {
|
||||
jobId: job?.id,
|
||||
exitCode: runInfo.exitCode,
|
||||
lineCount: scanAnalysisLines.length
|
||||
lineCount: scanLines.length
|
||||
});
|
||||
|
||||
// Return raw scan data — the Orchestrator (or legacy pipelineService)
|
||||
// processes this with buildDiscScanReview() / parseMediainfoJsonOutput().
|
||||
return {
|
||||
scanLines,
|
||||
scanAnalysisLines,
|
||||
runInfo,
|
||||
reviewMode,
|
||||
mediaProfile: this.mediaProfile,
|
||||
@@ -230,7 +223,6 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
selectedTitleId = null,
|
||||
backupOutputBase = null,
|
||||
disableMinLengthFilter = false,
|
||||
sourceArgOverride = null,
|
||||
isCancelled,
|
||||
onProcessHandle
|
||||
} = ctx.extra || {};
|
||||
@@ -250,8 +242,7 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
mediaProfile: this.mediaProfile,
|
||||
settingsMap: settings,
|
||||
backupOutputBase,
|
||||
disableMinLengthFilter,
|
||||
sourceArgOverride
|
||||
disableMinLengthFilter
|
||||
});
|
||||
|
||||
const ripMode = String(ripConfig.ripMode || settings.makemkv_rip_mode || 'mkv')
|
||||
@@ -264,8 +255,7 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
ripMode,
|
||||
rawJobDir,
|
||||
selectedTitleId,
|
||||
disableMinLengthFilter,
|
||||
sourceArgOverride: sourceArgOverride || null
|
||||
disableMinLengthFilter
|
||||
});
|
||||
|
||||
ctx.emitProgress(0, ripMode === 'backup'
|
||||
@@ -277,9 +267,6 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
// des PipelineService und liefert das volle runInfo (inkl. highlights, stdout-Log,
|
||||
// Prozess-Tracking, Cancellation). Fallback: _spawnAndWait für Standalone/Tests.
|
||||
const runCommandFn = typeof ctx.extra?.runCommand === 'function' ? ctx.extra.runCommand : null;
|
||||
const makeMkvLineFilter = typeof ctx.extra?.makeMkvLineFilter === 'function'
|
||||
? ctx.extra.makeMkvLineFilter
|
||||
: null;
|
||||
let runInfo;
|
||||
if (runCommandFn) {
|
||||
runInfo = await runCommandFn({
|
||||
@@ -288,8 +275,7 @@ class VideoDiscPlugin extends SourcePlugin {
|
||||
source: 'MAKEMKV_RIP',
|
||||
cmd: ripConfig.cmd,
|
||||
args: ripConfig.args,
|
||||
parser: parseMakeMkvProgress,
|
||||
lineFilter: makeMkvLineFilter
|
||||
parser: parseMakeMkvProgress
|
||||
});
|
||||
} else {
|
||||
runInfo = await _spawnAndWait({
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const multer = require('multer');
|
||||
const asyncHandler = require('../middleware/asyncHandler');
|
||||
@@ -9,7 +10,6 @@ const pipelineService = require('../services/pipelineService');
|
||||
const converterScanService = require('../services/converterScanService');
|
||||
const historyService = require('../services/historyService');
|
||||
const logger = require('../services/logger').child('CONVERTER_ROUTE');
|
||||
const { tempDir } = require('../config');
|
||||
|
||||
/** Pfadauflösung mit Traversal-Schutz (wie Klangkiste resolveMediaTarget) */
|
||||
function resolveTarget(rawDir, input) {
|
||||
@@ -20,11 +20,9 @@ function resolveTarget(rawDir, input) {
|
||||
}
|
||||
|
||||
const router = express.Router();
|
||||
const converterUploadDir = path.join(tempDir, 'ripster-converter-uploads');
|
||||
fs.mkdirSync(converterUploadDir, { recursive: true });
|
||||
|
||||
const converterUpload = multer({
|
||||
dest: converterUploadDir
|
||||
dest: path.join(os.tmpdir(), 'ripster-converter-uploads')
|
||||
});
|
||||
|
||||
// ── Scan ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -6,21 +6,6 @@ const logger = require('../services/logger').child('HISTORY_ROUTE');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
function parseSelectedJobIds(value, options = {}) {
|
||||
const { hasExplicitValue = true } = options;
|
||||
if (!hasExplicitValue) {
|
||||
return null;
|
||||
}
|
||||
const sourceValues = Array.isArray(value)
|
||||
? value
|
||||
: String(value || '')
|
||||
.split(',');
|
||||
return sourceValues
|
||||
.map((entry) => Number(entry))
|
||||
.filter((entry) => Number.isFinite(entry) && entry > 0)
|
||||
.map((entry) => Math.trunc(entry));
|
||||
}
|
||||
|
||||
router.get(
|
||||
'/',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -66,42 +51,6 @@ router.get(
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/tmdb-migration/pending',
|
||||
asyncHandler(async (req, res) => {
|
||||
const parsedLimit = Number(req.query.limit);
|
||||
const limit = Number.isFinite(parsedLimit) && parsedLimit > 0
|
||||
? Math.trunc(parsedLimit)
|
||||
: 500;
|
||||
logger.info('get:tmdb-migration:pending', {
|
||||
reqId: req.reqId,
|
||||
limit
|
||||
});
|
||||
const jobs = await historyService.getTmdbMigrationPendingJobs({
|
||||
limit,
|
||||
includeFsChecks: false
|
||||
});
|
||||
res.json({ jobs });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/:id/tmdb-migration',
|
||||
asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
const migrated = ['1', 'true', 'yes', 'on'].includes(
|
||||
String(req.body?.migrated ?? req.body?.migrateTMDB ?? '').trim().toLowerCase()
|
||||
);
|
||||
logger.info('post:tmdb-migration:flag', {
|
||||
reqId: req.reqId,
|
||||
id,
|
||||
migrated
|
||||
});
|
||||
const job = await historyService.setTmdbMigrationFlag(id, migrated);
|
||||
res.json({ job });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/orphan-raw/import',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -109,23 +58,11 @@ router.post(
|
||||
logger.info('post:orphan-raw:import', { reqId: req.reqId, rawPath });
|
||||
const importedJob = await historyService.importOrphanRawFolder(rawPath);
|
||||
const importedJobId = Number(importedJob?.id || 0);
|
||||
let activation = null;
|
||||
let activationError = null;
|
||||
if (Number.isFinite(importedJobId) && importedJobId > 0) {
|
||||
try {
|
||||
activation = await pipelineService.analyzeRawImportJob(importedJobId, {
|
||||
rawPath: importedJob?.raw_path || rawPath
|
||||
});
|
||||
} catch (error) {
|
||||
activationError = error?.message || String(error);
|
||||
logger.warn('post:orphan-raw:import:activation-failed', {
|
||||
reqId: req.reqId,
|
||||
jobId: importedJobId,
|
||||
rawPath,
|
||||
error: activationError
|
||||
});
|
||||
}
|
||||
}
|
||||
const activation = (Number.isFinite(importedJobId) && importedJobId > 0)
|
||||
? await pipelineService.analyzeRawImportJob(importedJobId, {
|
||||
rawPath: importedJob?.raw_path || rawPath
|
||||
})
|
||||
: null;
|
||||
|
||||
const refreshedJob = importedJobId > 0
|
||||
? await historyService.getJobById(importedJobId)
|
||||
@@ -133,28 +70,17 @@ router.post(
|
||||
|
||||
res.json({
|
||||
job: refreshedJob || importedJob,
|
||||
activation,
|
||||
...(activationError ? { activationError } : {})
|
||||
activation
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/orphan-raw/delete',
|
||||
asyncHandler(async (req, res) => {
|
||||
const rawPath = String(req.body?.rawPath || '').trim();
|
||||
logger.warn('post:orphan-raw:delete', { reqId: req.reqId, rawPath });
|
||||
const result = await historyService.deleteOrphanRawFolder(rawPath);
|
||||
res.json(result);
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/:id/metadata/assign',
|
||||
'/:id/omdb/assign',
|
||||
asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
const payload = req.body || {};
|
||||
logger.info('post:job:metadata:assign', {
|
||||
logger.info('post:job:omdb:assign', {
|
||||
reqId: req.reqId,
|
||||
id,
|
||||
imdbId: payload?.imdbId || null,
|
||||
@@ -162,11 +88,11 @@ router.post(
|
||||
hasYear: Boolean(payload?.year)
|
||||
});
|
||||
|
||||
const job = await historyService.assignMetadata(id, payload);
|
||||
const job = await historyService.assignOmdbMetadata(id, payload);
|
||||
|
||||
// Rename raw/output folders to reflect new metadata (best-effort, non-blocking)
|
||||
pipelineService.renameJobFolders(id).catch((err) => {
|
||||
logger.warn('post:job:metadata:assign:rename-failed', { id, error: err.message });
|
||||
logger.warn('post:job:omdb:assign:rename-failed', { id, error: err.message });
|
||||
});
|
||||
|
||||
res.json({ job });
|
||||
@@ -187,15 +113,7 @@ router.post(
|
||||
trackCount: Array.isArray(payload?.tracks) ? payload.tracks.length : 0
|
||||
});
|
||||
|
||||
const job = await pipelineService.selectCdMetadata({
|
||||
jobId: id,
|
||||
title: payload?.title,
|
||||
artist: payload?.artist,
|
||||
year: payload?.year,
|
||||
mbId: payload?.mbId,
|
||||
coverUrl: payload?.coverUrl,
|
||||
tracks: payload?.tracks
|
||||
});
|
||||
const job = await historyService.assignCdMetadata(id, payload);
|
||||
|
||||
// Rename raw/output folders to reflect new metadata (best-effort, non-blocking)
|
||||
pipelineService.renameJobFolders(id).catch((err) => {
|
||||
@@ -216,58 +134,19 @@ router.post(
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/:id/nfo/generate',
|
||||
asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
logger.info('post:job:nfo:generate', { reqId: req.reqId, id });
|
||||
const result = await historyService.generateJobNfo(id, {
|
||||
mode: 'manual',
|
||||
requireSettingDisabled: true,
|
||||
failIfExists: true,
|
||||
failIfOutputMissing: true
|
||||
});
|
||||
const job = await historyService.getJobWithLogs(id, { includeFsChecks: true });
|
||||
res.json({ result, job });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/:id/delete-files',
|
||||
asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
const target = String(req.body?.target || 'both');
|
||||
const includeRelated = ['1', 'true', 'yes'].includes(String(req.body?.includeRelated || 'false').toLowerCase());
|
||||
const selectedJobIds = parseSelectedJobIds(req.body?.selectedJobIds, {
|
||||
hasExplicitValue: Object.prototype.hasOwnProperty.call(req.body || {}, 'selectedJobIds')
|
||||
});
|
||||
const selectedRawPaths = Array.isArray(req.body?.selectedRawPaths)
|
||||
? req.body.selectedRawPaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
const selectedMoviePaths = Array.isArray(req.body?.selectedMoviePaths)
|
||||
? req.body.selectedMoviePaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
|
||||
logger.warn('post:delete-files', {
|
||||
reqId: req.reqId,
|
||||
id,
|
||||
target,
|
||||
includeRelated,
|
||||
selectedJobIdCount: selectedJobIds ? selectedJobIds.length : 0,
|
||||
selectedRawPathCount: selectedRawPaths ? selectedRawPaths.length : 0,
|
||||
selectedMoviePathCount: selectedMoviePaths ? selectedMoviePaths.length : 0
|
||||
target
|
||||
});
|
||||
|
||||
const result = await historyService.deleteJobFiles(id, target, {
|
||||
includeRelated,
|
||||
selectedJobIds,
|
||||
selectedRawPaths,
|
||||
selectedMoviePaths
|
||||
});
|
||||
const result = await historyService.deleteJobFiles(id, target);
|
||||
res.json(result);
|
||||
})
|
||||
);
|
||||
@@ -277,18 +156,14 @@ router.get(
|
||||
asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
const includeRelated = ['1', 'true', 'yes'].includes(String(req.query.includeRelated || '1').toLowerCase());
|
||||
const selectedJobIds = parseSelectedJobIds(req.query.selectedJobIds, {
|
||||
hasExplicitValue: Object.prototype.hasOwnProperty.call(req.query || {}, 'selectedJobIds')
|
||||
});
|
||||
|
||||
logger.info('get:delete-preview', {
|
||||
reqId: req.reqId,
|
||||
id,
|
||||
includeRelated,
|
||||
selectedJobIdCount: selectedJobIds ? selectedJobIds.length : 0
|
||||
includeRelated
|
||||
});
|
||||
|
||||
const preview = await historyService.getJobDeletePreview(id, { includeRelated, selectedJobIds });
|
||||
const preview = await historyService.getJobDeletePreview(id, { includeRelated });
|
||||
res.json({ preview });
|
||||
})
|
||||
);
|
||||
@@ -299,20 +174,10 @@ router.post(
|
||||
const id = Number(req.params.id);
|
||||
const target = String(req.body?.target || 'none');
|
||||
const includeRelated = ['1', 'true', 'yes'].includes(String(req.body?.includeRelated || 'false').toLowerCase());
|
||||
const selectedJobIds = parseSelectedJobIds(req.body?.selectedJobIds, {
|
||||
hasExplicitValue: Object.prototype.hasOwnProperty.call(req.body || {}, 'selectedJobIds')
|
||||
});
|
||||
const requestedResetDriveState = ['1', 'true', 'yes'].includes(String(req.body?.resetDriveState || 'false').toLowerCase());
|
||||
const preserveRawForImportJobs = ['1', 'true', 'yes'].includes(String(req.body?.preserveRawForImportJobs || 'false').toLowerCase());
|
||||
const hasRequestedKeepDetectedDevice = req.body?.keepDetectedDevice !== undefined;
|
||||
const requestedKeepDetectedDevice = hasRequestedKeepDetectedDevice
|
||||
const resetDriveState = ['1', 'true', 'yes'].includes(String(req.body?.resetDriveState || 'false').toLowerCase());
|
||||
const keepDetectedDevice = req.body?.keepDetectedDevice !== undefined
|
||||
? ['1', 'true', 'yes'].includes(String(req.body?.keepDetectedDevice || 'false').toLowerCase())
|
||||
: null;
|
||||
const selectedRawPaths = Array.isArray(req.body?.selectedRawPaths)
|
||||
? req.body.selectedRawPaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
: !resetDriveState;
|
||||
const selectedMoviePaths = Array.isArray(req.body?.selectedMoviePaths)
|
||||
? req.body.selectedMoviePaths
|
||||
.map((item) => String(item || '').trim())
|
||||
@@ -324,79 +189,20 @@ router.post(
|
||||
id,
|
||||
target,
|
||||
includeRelated,
|
||||
selectedJobIdCount: selectedJobIds ? selectedJobIds.length : 0,
|
||||
requestedResetDriveState,
|
||||
preserveRawForImportJobs,
|
||||
requestedKeepDetectedDevice,
|
||||
selectedRawPathCount: selectedRawPaths ? selectedRawPaths.length : 0,
|
||||
resetDriveState,
|
||||
keepDetectedDevice,
|
||||
selectedMoviePathCount: selectedMoviePaths ? selectedMoviePaths.length : 0
|
||||
});
|
||||
|
||||
const preview = await historyService.getJobDeletePreview(id, { includeRelated, selectedJobIds });
|
||||
const containsOrphanRawImportJob = Boolean(
|
||||
preview?.flags?.containsOrphanRawImportJob
|
||||
|| (Array.isArray(preview?.relatedJobs) && preview.relatedJobs.some(
|
||||
(row) => Boolean(row?.selected) && Boolean(row?.orphanRawImport)
|
||||
))
|
||||
);
|
||||
const selectedDeleteJobIds = Array.isArray(preview?.selectedJobIds)
|
||||
? preview.selectedJobIds
|
||||
: [id];
|
||||
const selectedDeleteJobs = await historyService.getJobsByIds(selectedDeleteJobIds).catch(() => []);
|
||||
const autoResetDriveStateForPhysicalCd = Array.isArray(selectedDeleteJobs) && selectedDeleteJobs.some((job) => {
|
||||
const mediaType = String(job?.media_type || job?.mediaType || '').trim().toLowerCase();
|
||||
const jobKind = String(job?.job_kind || job?.jobKind || '').trim().toLowerCase();
|
||||
const status = String(job?.status || '').trim().toUpperCase();
|
||||
const lastState = String(job?.last_state || '').trim().toUpperCase();
|
||||
const isCdJob = mediaType === 'cd'
|
||||
|| jobKind === 'cd'
|
||||
|| status.startsWith('CD_')
|
||||
|| lastState.startsWith('CD_');
|
||||
if (!isCdJob) {
|
||||
return false;
|
||||
}
|
||||
const discDevice = String(job?.disc_device || job?.discDevice || '').trim();
|
||||
return Boolean(discDevice) && !discDevice.startsWith('__virtual__');
|
||||
});
|
||||
|
||||
const requestedResetDriveStateEffective = requestedResetDriveState || autoResetDriveStateForPhysicalCd;
|
||||
const resetDriveState = containsOrphanRawImportJob
|
||||
? false
|
||||
: requestedResetDriveStateEffective;
|
||||
const keepDetectedDevice = containsOrphanRawImportJob
|
||||
? true
|
||||
: (hasRequestedKeepDetectedDevice
|
||||
? requestedKeepDetectedDevice
|
||||
: !requestedResetDriveStateEffective);
|
||||
|
||||
if (containsOrphanRawImportJob && requestedResetDriveState) {
|
||||
logger.info('post:delete-job:orphan-drive-reset-skipped', {
|
||||
reqId: req.reqId,
|
||||
id
|
||||
});
|
||||
}
|
||||
|
||||
if (autoResetDriveStateForPhysicalCd && !requestedResetDriveState) {
|
||||
logger.info('post:delete-job:auto-drive-reset-cd', {
|
||||
reqId: req.reqId,
|
||||
id,
|
||||
selectedJobIds: selectedDeleteJobIds
|
||||
});
|
||||
}
|
||||
|
||||
const preview = resetDriveState
|
||||
? await historyService.getJobDeletePreview(id, { includeRelated })
|
||||
: null;
|
||||
const relatedDevicePaths = Array.isArray(preview?.relatedJobs)
|
||||
? preview.relatedJobs
|
||||
.filter((row) => Boolean(row?.selected))
|
||||
.map((row) => String(row?.discDevice || '').trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
const result = await historyService.deleteJob(id, target, {
|
||||
includeRelated,
|
||||
selectedJobIds,
|
||||
selectedRawPaths,
|
||||
selectedMoviePaths,
|
||||
preserveRawForImportJobs
|
||||
});
|
||||
const result = await historyService.deleteJob(id, target, { includeRelated, selectedMoviePaths });
|
||||
await pipelineService.onJobsDeleted(result?.deletedJobIds || [id], {
|
||||
resetDriveState,
|
||||
devicePaths: relatedDevicePaths
|
||||
@@ -406,15 +212,7 @@ router.post(
|
||||
const uiReset = await pipelineService.resetFrontendState('history_delete', {
|
||||
keepDetectedDevice
|
||||
});
|
||||
res.json({
|
||||
...result,
|
||||
uiReset,
|
||||
safeguards: {
|
||||
containsOrphanRawImportJob,
|
||||
resetDriveStateApplied: resetDriveState,
|
||||
keepDetectedDeviceApplied: keepDetectedDevice
|
||||
}
|
||||
});
|
||||
res.json({ ...result, uiReset });
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const express = require('express');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const multer = require('multer');
|
||||
const asyncHandler = require('../middleware/asyncHandler');
|
||||
@@ -10,16 +11,86 @@ const hardwareMonitorService = require('../services/hardwareMonitorService');
|
||||
const settingsService = require('../services/settingsService');
|
||||
const logger = require('../services/logger').child('PIPELINE_ROUTE');
|
||||
const activationBytesService = require('../services/activationBytesService');
|
||||
const { tempDir } = require('../config');
|
||||
const { defaultAudiobookDir } = require('../config');
|
||||
const { getDb } = require('../db/database');
|
||||
|
||||
const router = express.Router();
|
||||
const audiobookUploadDir = path.join(tempDir, 'ripster-audiobook-uploads');
|
||||
fs.mkdirSync(audiobookUploadDir, { recursive: true });
|
||||
const audiobookUpload = multer({
|
||||
dest: audiobookUploadDir
|
||||
dest: path.join(os.tmpdir(), 'ripster-audiobook-uploads')
|
||||
});
|
||||
|
||||
const AUDIOBOOK_TREE_MAX_DEPTH = 8;
|
||||
|
||||
function buildAudiobookOutputTree(rootDir, relPath = '', depth = 0) {
|
||||
if (depth >= AUDIOBOOK_TREE_MAX_DEPTH) {
|
||||
return [];
|
||||
}
|
||||
const absDir = relPath ? path.join(rootDir, relPath) : rootDir;
|
||||
let dirents = [];
|
||||
try {
|
||||
dirents = fs.readdirSync(absDir, { withFileTypes: true });
|
||||
} catch (_error) {
|
||||
return [];
|
||||
}
|
||||
|
||||
dirents.sort((left, right) => {
|
||||
const leftOrder = left.isDirectory() ? 0 : 1;
|
||||
const rightOrder = right.isDirectory() ? 0 : 1;
|
||||
if (leftOrder !== rightOrder) {
|
||||
return leftOrder - rightOrder;
|
||||
}
|
||||
return left.name.localeCompare(right.name, undefined, { sensitivity: 'base' });
|
||||
});
|
||||
|
||||
const nodes = [];
|
||||
for (const dirent of dirents) {
|
||||
if (dirent.name.startsWith('.')) {
|
||||
continue;
|
||||
}
|
||||
const childRelPath = relPath ? `${relPath}/${dirent.name}` : dirent.name;
|
||||
const childAbsPath = path.join(rootDir, childRelPath);
|
||||
if (dirent.isDirectory()) {
|
||||
const children = buildAudiobookOutputTree(rootDir, childRelPath, depth + 1);
|
||||
const size = children.reduce((sum, item) => sum + Number(item?.size || 0), 0);
|
||||
let mtime = null;
|
||||
try {
|
||||
mtime = fs.statSync(childAbsPath).mtime.toISOString();
|
||||
} catch (_error) {
|
||||
mtime = null;
|
||||
}
|
||||
nodes.push({
|
||||
name: dirent.name,
|
||||
type: 'folder',
|
||||
path: childRelPath,
|
||||
size,
|
||||
mtime,
|
||||
children
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (dirent.isFile()) {
|
||||
let size = 0;
|
||||
let mtime = null;
|
||||
try {
|
||||
const stat = fs.statSync(childAbsPath);
|
||||
size = Number(stat?.size || 0);
|
||||
mtime = stat?.mtime ? stat.mtime.toISOString() : null;
|
||||
} catch (_error) {
|
||||
size = 0;
|
||||
mtime = null;
|
||||
}
|
||||
nodes.push({
|
||||
name: dirent.name,
|
||||
type: 'file',
|
||||
path: childRelPath,
|
||||
size,
|
||||
mtime
|
||||
});
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
router.get(
|
||||
'/state',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -31,68 +102,6 @@ router.get(
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/hardware/history',
|
||||
asyncHandler(async (req, res) => {
|
||||
const hoursRaw = Number(req.query?.hours);
|
||||
const maxPointsRaw = Number(req.query?.maxPoints);
|
||||
const hours = Number.isFinite(hoursRaw) ? Math.max(1, Math.min(96, Math.trunc(hoursRaw))) : 24;
|
||||
const maxPoints = Number.isFinite(maxPointsRaw) ? Math.max(120, Math.min(5000, Math.trunc(maxPointsRaw))) : 720;
|
||||
const sinceIso = new Date(Date.now() - (hours * 60 * 60 * 1000)).toISOString();
|
||||
const db = await getDb();
|
||||
const rows = await db.all(
|
||||
`
|
||||
SELECT
|
||||
captured_at,
|
||||
cpu_usage_percent,
|
||||
cpu_temperature_c,
|
||||
ram_usage_percent,
|
||||
ram_used_bytes,
|
||||
ram_total_bytes,
|
||||
gpu_usage_percent,
|
||||
gpu_temperature_c,
|
||||
vram_used_bytes,
|
||||
vram_total_bytes
|
||||
FROM hardware_metrics_history
|
||||
WHERE captured_at >= ?
|
||||
ORDER BY captured_at ASC
|
||||
`,
|
||||
[sinceIso]
|
||||
);
|
||||
|
||||
const stride = rows.length > maxPoints ? Math.ceil(rows.length / maxPoints) : 1;
|
||||
const sampled = [];
|
||||
for (let index = 0; index < rows.length; index += stride) {
|
||||
sampled.push(rows[index]);
|
||||
}
|
||||
if (rows.length > 0 && sampled[sampled.length - 1] !== rows[rows.length - 1]) {
|
||||
sampled.push(rows[rows.length - 1]);
|
||||
}
|
||||
|
||||
const points = sampled.map((row) => ({
|
||||
capturedAt: row.captured_at,
|
||||
cpuUsagePercent: row.cpu_usage_percent,
|
||||
cpuTemperatureC: row.cpu_temperature_c,
|
||||
ramUsagePercent: row.ram_usage_percent,
|
||||
ramUsedBytes: row.ram_used_bytes,
|
||||
ramTotalBytes: row.ram_total_bytes,
|
||||
gpuUsagePercent: row.gpu_usage_percent,
|
||||
gpuTemperatureC: row.gpu_temperature_c,
|
||||
vramUsedBytes: row.vram_used_bytes,
|
||||
vramTotalBytes: row.vram_total_bytes
|
||||
}));
|
||||
|
||||
res.json({
|
||||
history: {
|
||||
hours,
|
||||
maxPoints,
|
||||
totalPoints: rows.length,
|
||||
points
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/analyze',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -137,11 +146,11 @@ router.post(
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/tmdb/movie/search',
|
||||
'/omdb/search',
|
||||
asyncHandler(async (req, res) => {
|
||||
const query = req.query.q || '';
|
||||
logger.info('get:tmdb:movie-search', { reqId: req.reqId, query });
|
||||
const results = await pipelineService.searchTmdbMovies(String(query));
|
||||
logger.info('get:omdb:search', { reqId: req.reqId, query });
|
||||
const results = await pipelineService.searchOmdb(String(query));
|
||||
res.json({ results });
|
||||
})
|
||||
);
|
||||
@@ -161,12 +170,8 @@ router.get(
|
||||
'/cd/musicbrainz/search',
|
||||
asyncHandler(async (req, res) => {
|
||||
const query = req.query.q || '';
|
||||
const trackCountRaw = Number(req.query.trackCount);
|
||||
const trackCount = Number.isFinite(trackCountRaw) && trackCountRaw > 0
|
||||
? Math.trunc(trackCountRaw)
|
||||
: null;
|
||||
logger.info('get:cd:musicbrainz:search', { reqId: req.reqId, query, trackCount });
|
||||
const results = await pipelineService.searchMusicBrainz(String(query), { trackCount });
|
||||
logger.info('get:cd:musicbrainz:search', { reqId: req.reqId, query });
|
||||
const results = await pipelineService.searchMusicBrainz(String(query));
|
||||
res.json({ results });
|
||||
})
|
||||
);
|
||||
@@ -313,19 +318,47 @@ router.get(
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/audiobook/output-tree',
|
||||
asyncHandler(async (_req, res) => {
|
||||
const settings = await settingsService.getEffectiveSettingsMap('audiobook');
|
||||
const configuredOutputDir = String(settings?.movie_dir || '').trim();
|
||||
const rawOutputDir = configuredOutputDir || defaultAudiobookDir || null;
|
||||
const outputDir = rawOutputDir
|
||||
? (path.isAbsolute(rawOutputDir) ? rawOutputDir : path.resolve(process.cwd(), rawOutputDir))
|
||||
: null;
|
||||
|
||||
if (!outputDir || !fs.existsSync(outputDir)) {
|
||||
res.json({ outputDir, tree: null });
|
||||
return;
|
||||
}
|
||||
|
||||
const children = buildAudiobookOutputTree(outputDir, '', 0);
|
||||
const size = children.reduce((sum, item) => sum + Number(item?.size || 0), 0);
|
||||
res.json({
|
||||
outputDir,
|
||||
tree: {
|
||||
name: path.basename(outputDir) || 'audiobooks',
|
||||
type: 'folder',
|
||||
path: '',
|
||||
size,
|
||||
mtime: null,
|
||||
children
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/select-metadata',
|
||||
asyncHandler(async (req, res) => {
|
||||
const {
|
||||
jobId,
|
||||
title,
|
||||
artist,
|
||||
year,
|
||||
imdbId,
|
||||
poster,
|
||||
mbId,
|
||||
coverUrl,
|
||||
tracks,
|
||||
fromOmdb,
|
||||
selectedPlaylist,
|
||||
selectedHandBrakeTitleId,
|
||||
selectedHandBrakeTitleIds,
|
||||
@@ -338,10 +371,7 @@ router.post(
|
||||
seasonName,
|
||||
episodeCount,
|
||||
episodes,
|
||||
discNumber,
|
||||
duplicateAction,
|
||||
existingJobId,
|
||||
existingDiscNumber
|
||||
discNumber
|
||||
} = req.body;
|
||||
|
||||
if (!jobId) {
|
||||
@@ -354,13 +384,10 @@ router.post(
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
title,
|
||||
artist,
|
||||
year,
|
||||
imdbId,
|
||||
poster,
|
||||
mbId,
|
||||
coverUrl,
|
||||
trackCount: Array.isArray(tracks) ? tracks.length : null,
|
||||
fromOmdb,
|
||||
selectedPlaylist,
|
||||
selectedHandBrakeTitleId,
|
||||
selectedHandBrakeTitleIds: Array.isArray(selectedHandBrakeTitleIds) ? selectedHandBrakeTitleIds : null,
|
||||
@@ -369,43 +396,16 @@ router.post(
|
||||
tmdbId,
|
||||
workflowKind,
|
||||
seasonNumber,
|
||||
discNumber,
|
||||
duplicateAction,
|
||||
existingJobId,
|
||||
existingDiscNumber
|
||||
discNumber
|
||||
});
|
||||
|
||||
const looksLikeCdMetadataPayload = (
|
||||
artist !== undefined
|
||||
|| mbId !== undefined
|
||||
|| coverUrl !== undefined
|
||||
|| Array.isArray(tracks)
|
||||
);
|
||||
if (looksLikeCdMetadataPayload) {
|
||||
logger.warn('post:select-metadata:compat-cd-route', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
trackCount: Array.isArray(tracks) ? tracks.length : 0
|
||||
});
|
||||
const job = await pipelineService.selectCdMetadata({
|
||||
jobId: Number(jobId),
|
||||
title,
|
||||
artist,
|
||||
year,
|
||||
mbId,
|
||||
coverUrl: coverUrl || poster || null,
|
||||
tracks
|
||||
});
|
||||
res.json({ job });
|
||||
return;
|
||||
}
|
||||
|
||||
const job = await pipelineService.selectMetadata({
|
||||
jobId: Number(jobId),
|
||||
title,
|
||||
year,
|
||||
imdbId,
|
||||
poster,
|
||||
fromOmdb,
|
||||
selectedPlaylist,
|
||||
selectedHandBrakeTitleId,
|
||||
selectedHandBrakeTitleIds,
|
||||
@@ -418,27 +418,13 @@ router.post(
|
||||
seasonName,
|
||||
episodeCount,
|
||||
episodes,
|
||||
discNumber,
|
||||
duplicateAction,
|
||||
existingJobId,
|
||||
existingDiscNumber
|
||||
discNumber
|
||||
});
|
||||
|
||||
res.json({ job });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/jobs/:jobId/raw-decision',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
const { decision } = req.body;
|
||||
logger.info('post:raw-decision', { reqId: req.reqId, jobId, decision });
|
||||
const result = await pipelineService.submitRawDecision(jobId, decision);
|
||||
res.json({ result });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/start/:jobId',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -449,86 +435,10 @@ router.post(
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/multipart-merge/:jobId/reorder',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
const orderedSourceJobIds = Array.isArray(req.body?.orderedSourceJobIds)
|
||||
? req.body.orderedSourceJobIds
|
||||
: [];
|
||||
logger.info('post:multipart-merge:reorder', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
orderedCount: orderedSourceJobIds.length
|
||||
});
|
||||
const job = await pipelineService.updateMultipartMergeSourceOrder(jobId, orderedSourceJobIds);
|
||||
res.json({ job });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/multipart-merge/:jobId/settings',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
const deleteInputsAfterMerge = Boolean(req.body?.deleteInputsAfterMerge);
|
||||
logger.info('post:multipart-merge:settings', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
deleteInputsAfterMerge
|
||||
});
|
||||
const job = await pipelineService.updateMultipartMergeSettings(jobId, {
|
||||
deleteInputsAfterMerge
|
||||
});
|
||||
res.json({ job });
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/multipart-merge/:jobId/preview',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
logger.info('get:multipart-merge:preview', {
|
||||
reqId: req.reqId,
|
||||
jobId
|
||||
});
|
||||
const preview = await pipelineService.getMultipartMergePreview(jobId);
|
||||
res.json({ preview });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/multipart-merge/:containerJobId/restore',
|
||||
asyncHandler(async (req, res) => {
|
||||
const containerJobId = Number(req.params.containerJobId);
|
||||
logger.info('post:multipart-merge:restore', {
|
||||
reqId: req.reqId,
|
||||
containerJobId
|
||||
});
|
||||
const job = await pipelineService.restoreMultipartMergeJobForContainer(containerJobId);
|
||||
await pipelineService.emitQueueChanged().catch((error) => {
|
||||
logger.warn('post:multipart-merge:restore:queue-emit-failed', {
|
||||
reqId: req.reqId,
|
||||
containerJobId,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
});
|
||||
res.json({
|
||||
result: {
|
||||
restored: true,
|
||||
mergeJobId: Number(job?.id || 0) || null
|
||||
},
|
||||
job
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/confirm-encode/:jobId',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
const body = req.body && typeof req.body === 'object' ? req.body : {};
|
||||
const hasSelectedUserPresetId = Object.prototype.hasOwnProperty.call(body, 'selectedUserPresetId');
|
||||
const hasSelectedHandBrakePreset = Object.prototype.hasOwnProperty.call(body, 'selectedHandBrakePreset');
|
||||
const selectedEncodeTitleId = req.body?.selectedEncodeTitleId ?? null;
|
||||
const selectedEncodeTitleIds = req.body?.selectedEncodeTitleIds ?? null;
|
||||
const selectedTrackSelection = req.body?.selectedTrackSelection ?? null;
|
||||
@@ -538,12 +448,8 @@ router.post(
|
||||
const selectedPostEncodeChainIds = req.body?.selectedPostEncodeChainIds;
|
||||
const selectedPreEncodeChainIds = req.body?.selectedPreEncodeChainIds;
|
||||
const skipPipelineStateUpdate = Boolean(req.body?.skipPipelineStateUpdate);
|
||||
const selectedUserPresetId = hasSelectedUserPresetId
|
||||
? body.selectedUserPresetId
|
||||
: undefined;
|
||||
const selectedHandBrakePreset = hasSelectedHandBrakePreset
|
||||
? body.selectedHandBrakePreset
|
||||
: undefined;
|
||||
const selectedUserPresetId = req.body?.selectedUserPresetId ?? null;
|
||||
const selectedHandBrakePreset = req.body?.selectedHandBrakePreset ?? null;
|
||||
logger.info('post:confirm-encode', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
@@ -601,9 +507,8 @@ router.post(
|
||||
'/retry/:jobId',
|
||||
asyncHandler(async (req, res) => {
|
||||
const jobId = Number(req.params.jobId);
|
||||
const createNewJob = Boolean(req.body?.createNewJob);
|
||||
logger.info('post:retry', { reqId: req.reqId, jobId, createNewJob });
|
||||
const result = await pipelineService.retry(jobId, { createNewJob });
|
||||
logger.info('post:retry', { reqId: req.reqId, jobId });
|
||||
const result = await pipelineService.retry(jobId);
|
||||
res.json({ result });
|
||||
})
|
||||
);
|
||||
@@ -656,24 +561,15 @@ router.post(
|
||||
const jobId = Number(req.params.jobId);
|
||||
const keepBoth = Boolean(req.body?.keepBoth);
|
||||
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
||||
const createNewJob = Boolean(req.body?.createNewJob);
|
||||
const reuseCurrentJob = Object.prototype.hasOwnProperty.call(req.body || {}, 'reuseCurrentJob')
|
||||
? Boolean(req.body?.reuseCurrentJob)
|
||||
: !createNewJob;
|
||||
const reuseCurrentJob = Boolean(req.body?.reuseCurrentJob);
|
||||
logger.info('post:restart-review', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
keepBoth,
|
||||
createNewJob,
|
||||
reuseCurrentJob,
|
||||
deleteFolderCount: deleteFolders.length
|
||||
});
|
||||
const result = await pipelineService.restartReviewFromRaw(jobId, {
|
||||
keepBoth,
|
||||
deleteFolders,
|
||||
reuseCurrentJob,
|
||||
createNewJob
|
||||
});
|
||||
const result = await pipelineService.restartReviewFromRaw(jobId, { keepBoth, deleteFolders, reuseCurrentJob });
|
||||
res.json({ result });
|
||||
})
|
||||
);
|
||||
@@ -685,20 +581,17 @@ router.post(
|
||||
const keepBoth = Boolean(req.body?.keepBoth);
|
||||
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
||||
const restartMode = String(req.body?.restartMode || 'all').trim().toLowerCase() || 'all';
|
||||
const createNewJob = Boolean(req.body?.createNewJob);
|
||||
logger.info('post:restart-encode', {
|
||||
reqId: req.reqId,
|
||||
jobId,
|
||||
keepBoth,
|
||||
createNewJob,
|
||||
restartMode,
|
||||
deleteFolderCount: deleteFolders.length
|
||||
});
|
||||
const result = await pipelineService.restartEncodeWithLastSettings(jobId, {
|
||||
keepBoth,
|
||||
deleteFolders,
|
||||
restartMode,
|
||||
createNewJob
|
||||
restartMode
|
||||
});
|
||||
res.json({ result });
|
||||
})
|
||||
|
||||
@@ -8,11 +8,9 @@ const pipelineService = require('../services/pipelineService');
|
||||
const wsService = require('../services/websocketService');
|
||||
const hardwareMonitorService = require('../services/hardwareMonitorService');
|
||||
const userPresetService = require('../services/userPresetService');
|
||||
const userPresetDefaultsService = require('../services/userPresetDefaultsService');
|
||||
const activationBytesService = require('../services/activationBytesService');
|
||||
const diskDetectionService = require('../services/diskDetectionService');
|
||||
const coverArtRecoveryService = require('../services/coverArtRecoveryService');
|
||||
const { fetchCurrentBetaKey, getCachedBetaKey } = require('../services/makemkvKeyService');
|
||||
const logger = require('../services/logger').child('SETTINGS_ROUTE');
|
||||
|
||||
const { getDb } = require('../db/database');
|
||||
@@ -54,71 +52,6 @@ router.get(
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/makemkv/beta-key',
|
||||
asyncHandler(async (req, res) => {
|
||||
logger.debug('get:settings:makemkv:beta-key', { reqId: req.reqId });
|
||||
const currentSettings = await settingsService.getSettingsMap({ forceRefresh: false });
|
||||
const existingKey = String(currentSettings?.makemkv_registration_key || '').trim();
|
||||
const cached = await getCachedBetaKey({ allowExpired: true });
|
||||
|
||||
res.json({
|
||||
betaKey: cached?.key || '',
|
||||
sourceUrl: cached?.sourceUrl || null,
|
||||
validUntil: cached?.validUntil || null,
|
||||
fetchedAt: cached?.fetchedAt || null,
|
||||
cached: cached?.cached === true,
|
||||
stale: cached?.stale === true,
|
||||
appliedKey: existingKey || null,
|
||||
appliedMatchesCache: Boolean(cached?.key) && existingKey === cached.key
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/makemkv/beta-key/check',
|
||||
asyncHandler(async (req, res) => {
|
||||
logger.info('post:settings:makemkv:beta-key:check', { reqId: req.reqId });
|
||||
const betaKeyResult = await fetchCurrentBetaKey({ forceRefresh: true });
|
||||
res.json({
|
||||
betaKey: betaKeyResult.key,
|
||||
sourceUrl: betaKeyResult.sourceUrl,
|
||||
validUntil: betaKeyResult.validUntil || null,
|
||||
fetchedAt: betaKeyResult.fetchedAt || null,
|
||||
cached: betaKeyResult.cached === true,
|
||||
stale: betaKeyResult.stale === true
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/makemkv/beta-key/apply',
|
||||
asyncHandler(async (req, res) => {
|
||||
logger.info('post:settings:makemkv:beta-key:apply', { reqId: req.reqId });
|
||||
const requestedKey = String(req.body?.betaKey || '').trim();
|
||||
const cachedResult = requestedKey
|
||||
? { key: requestedKey }
|
||||
: await getCachedBetaKey({ allowExpired: true });
|
||||
const betaKey = String(cachedResult?.key || '').trim();
|
||||
|
||||
if (!betaKey) {
|
||||
const error = new Error('Kein geprüfter Betakey vorhanden. Bitte zuerst prüfen.');
|
||||
error.statusCode = 400;
|
||||
throw error;
|
||||
}
|
||||
|
||||
const updated = await settingsService.setSettingValue('makemkv_registration_key', betaKey);
|
||||
wsService.broadcast('SETTINGS_UPDATED', updated);
|
||||
|
||||
res.json({
|
||||
applied: true,
|
||||
setting: updated,
|
||||
betaKey,
|
||||
sourceUrl: String(cachedResult?.sourceUrl || '').trim() || null
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/scripts',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -174,26 +107,6 @@ router.put(
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/scripts/:id/favorite',
|
||||
asyncHandler(async (req, res) => {
|
||||
const scriptId = Number(req.params.id);
|
||||
const isFavorite = req.body?.isFavorite === true;
|
||||
logger.info('put:settings:scripts:favorite', {
|
||||
reqId: req.reqId,
|
||||
scriptId,
|
||||
isFavorite
|
||||
});
|
||||
const script = await scriptService.setScriptFavorite(scriptId, isFavorite);
|
||||
wsService.broadcast('SETTINGS_SCRIPTS_UPDATED', {
|
||||
action: 'favorite-updated',
|
||||
id: script.id,
|
||||
isFavorite: script.isFavorite === true
|
||||
});
|
||||
res.json({ script });
|
||||
})
|
||||
);
|
||||
|
||||
router.delete(
|
||||
'/scripts/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -287,22 +200,6 @@ router.put(
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/script-chains/:id/favorite',
|
||||
asyncHandler(async (req, res) => {
|
||||
const chainId = Number(req.params.id);
|
||||
const isFavorite = req.body?.isFavorite === true;
|
||||
logger.info('put:settings:script-chains:favorite', { reqId: req.reqId, chainId, isFavorite });
|
||||
const chain = await scriptChainService.setChainFavorite(chainId, isFavorite);
|
||||
wsService.broadcast('SETTINGS_SCRIPT_CHAINS_UPDATED', {
|
||||
action: 'favorite-updated',
|
||||
id: chain.id,
|
||||
isFavorite: chain.isFavorite === true
|
||||
});
|
||||
res.json({ chain });
|
||||
})
|
||||
);
|
||||
|
||||
router.delete(
|
||||
'/script-chains/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -330,72 +227,6 @@ router.post(
|
||||
})
|
||||
);
|
||||
|
||||
// ── User Presets ──────────────────────────────────────────────────────────────
|
||||
|
||||
router.get(
|
||||
'/user-presets',
|
||||
asyncHandler(async (req, res) => {
|
||||
const mediaType = req.query.media_type || null;
|
||||
logger.debug('get:user-presets', { reqId: req.reqId, mediaType });
|
||||
const presets = await userPresetService.listPresets(mediaType);
|
||||
res.json({ presets });
|
||||
})
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/user-preset-defaults',
|
||||
asyncHandler(async (req, res) => {
|
||||
logger.debug('get:user-preset-defaults', { reqId: req.reqId });
|
||||
const defaults = await userPresetDefaultsService.listDefaults();
|
||||
res.json({ defaults });
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/user-preset-defaults',
|
||||
asyncHandler(async (req, res) => {
|
||||
const payload = req.body || {};
|
||||
logger.info('put:user-preset-defaults:update', { reqId: req.reqId });
|
||||
const defaults = await userPresetDefaultsService.updateDefaults(payload);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'defaults-updated' });
|
||||
res.json({ defaults });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/user-presets',
|
||||
asyncHandler(async (req, res) => {
|
||||
const payload = req.body || {};
|
||||
logger.info('post:user-presets:create', { reqId: req.reqId, name: payload?.name });
|
||||
const preset = await userPresetService.createPreset(payload);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'created', id: preset.id });
|
||||
res.status(201).json({ preset });
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/user-presets/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
const presetId = Number(req.params.id);
|
||||
const payload = req.body || {};
|
||||
logger.info('put:user-presets:update', { reqId: req.reqId, presetId });
|
||||
const preset = await userPresetService.updatePreset(presetId, payload);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'updated', id: preset.id });
|
||||
res.json({ preset });
|
||||
})
|
||||
);
|
||||
|
||||
router.delete(
|
||||
'/user-presets/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
const presetId = Number(req.params.id);
|
||||
logger.info('delete:user-presets', { reqId: req.reqId, presetId });
|
||||
const removed = await userPresetService.deletePreset(presetId);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'deleted', id: removed.id });
|
||||
res.json({ removed });
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/:key',
|
||||
asyncHandler(async (req, res) => {
|
||||
@@ -527,6 +358,52 @@ router.put(
|
||||
})
|
||||
);
|
||||
|
||||
// ── User Presets ──────────────────────────────────────────────────────────────
|
||||
|
||||
router.get(
|
||||
'/user-presets',
|
||||
asyncHandler(async (req, res) => {
|
||||
const mediaType = req.query.media_type || null;
|
||||
logger.debug('get:user-presets', { reqId: req.reqId, mediaType });
|
||||
const presets = await userPresetService.listPresets(mediaType);
|
||||
res.json({ presets });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/user-presets',
|
||||
asyncHandler(async (req, res) => {
|
||||
const payload = req.body || {};
|
||||
logger.info('post:user-presets:create', { reqId: req.reqId, name: payload?.name });
|
||||
const preset = await userPresetService.createPreset(payload);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'created', id: preset.id });
|
||||
res.status(201).json({ preset });
|
||||
})
|
||||
);
|
||||
|
||||
router.put(
|
||||
'/user-presets/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
const presetId = Number(req.params.id);
|
||||
const payload = req.body || {};
|
||||
logger.info('put:user-presets:update', { reqId: req.reqId, presetId });
|
||||
const preset = await userPresetService.updatePreset(presetId, payload);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'updated', id: preset.id });
|
||||
res.json({ preset });
|
||||
})
|
||||
);
|
||||
|
||||
router.delete(
|
||||
'/user-presets/:id',
|
||||
asyncHandler(async (req, res) => {
|
||||
const presetId = Number(req.params.id);
|
||||
logger.info('delete:user-presets', { reqId: req.reqId, presetId });
|
||||
const removed = await userPresetService.deletePreset(presetId);
|
||||
wsService.broadcast('USER_PRESETS_UPDATED', { action: 'deleted', id: removed.id });
|
||||
res.json({ removed });
|
||||
})
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/pushover/test',
|
||||
asyncHandler(async (req, res) => {
|
||||
|
||||
@@ -130,6 +130,12 @@ function collectCoverCandidates(row) {
|
||||
push(deriveCoverArtArchiveUrl(mbId), 'musicbrainz.coverartarchive');
|
||||
}
|
||||
|
||||
const omdbInfo = parseJsonSafe(row?.omdb_json, {});
|
||||
const omdbPoster = String(omdbInfo?.Poster || '').trim();
|
||||
if (omdbPoster && omdbPoster.toUpperCase() !== 'N/A') {
|
||||
push(omdbPoster, 'omdb_json.Poster');
|
||||
}
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
@@ -274,7 +280,8 @@ class CoverArtRecoveryService {
|
||||
status,
|
||||
poster_url,
|
||||
imdb_id,
|
||||
makemkv_info_json
|
||||
makemkv_info_json,
|
||||
omdb_json
|
||||
FROM jobs
|
||||
ORDER BY COALESCE(updated_at, created_at) DESC, id DESC
|
||||
`
|
||||
|
||||
@@ -69,8 +69,6 @@ function normalizeLanguageCode(rawCode, fallbackLabel = null) {
|
||||
function normalizeSeriesLookupTitle(rawValue) {
|
||||
return String(rawValue || '')
|
||||
.replace(/[_./]+/g, ' ')
|
||||
.replace(/\bs\d{1,2}\s*d\d{1,2}\b/gi, ' ')
|
||||
.replace(/\bs(?:taffel|eason)?\s*\d{1,2}\s*(?:disc|dvd|cd|d)\s*\d{1,2}\b/gi, ' ')
|
||||
.replace(/\b(?:disc|dvd|cd)\s*\d+\b/gi, ' ')
|
||||
.replace(/\b(?:s(?:taffel|eason)?|season)\s*\d+\b/gi, ' ')
|
||||
.replace(/\b\d{1,2}x\b/gi, ' ')
|
||||
@@ -101,12 +99,7 @@ function deriveSeriesLookupHint(inputs = []) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const compactSeasonDiscMatch = compactValue.match(
|
||||
/(?:^|\s)s(?:taffel|eason)?\s*0?(\d{1,2})\s*(?:d|disc|dvd|cd)\s*0?(\d{1,2})(?=\s|$)/i
|
||||
);
|
||||
const seasonMatch = compactSeasonDiscMatch
|
||||
|| compactValue.match(/(?:^|\s)(?:s(?:taffel|eason)?|season)\s*(\d{1,2})(?=\s|$)/i)
|
||||
|| compactValue.match(/(?:^|\s)s\s*0?(\d{1,2})(?=\s|$)/i)
|
||||
const seasonMatch = compactValue.match(/(?:^|\s)(?:s(?:taffel|eason)?|season)\s*(\d{1,2})(?=\s|$)/i)
|
||||
|| compactValue.match(/(?:^|\s)(\d{1,2})x(?=\s|$)/i);
|
||||
if (!seasonMatch) {
|
||||
continue;
|
||||
@@ -117,11 +110,9 @@ function deriveSeriesLookupHint(inputs = []) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const discMatch = compactSeasonDiscMatch
|
||||
|| compactValue.match(/(?:^|\s)(?:disc|dvd|cd|d)\s*0?(\d{1,2})(?=\s|$)/i);
|
||||
const compactDiscToken = compactSeasonDiscMatch ? compactSeasonDiscMatch[2] : null;
|
||||
const discMatch = compactValue.match(/(?:^|\s)(?:disc|dvd|cd)\s*(\d{1,2})(?=\s|$)/i);
|
||||
const discNumber = discMatch
|
||||
? Number(compactDiscToken || discMatch[1] || 0) || null
|
||||
? Number(discMatch[1] || 0) || null
|
||||
: null;
|
||||
|
||||
const baseTitle = normalizeSeriesLookupTitle(compactValue);
|
||||
@@ -394,22 +385,12 @@ function parseHandBrakeScanText(rawOutput) {
|
||||
parsed.titleCount = Number(match[1] || 0);
|
||||
continue;
|
||||
}
|
||||
match = line.match(/scan:\s+(?:BD|Blu-?ray)\s+has\s+(\d+)\s+title/i);
|
||||
if (match) {
|
||||
parsed.titleCount = Number(match[1] || 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = line.match(/scan:\s+scanning title\s+(\d+)/i);
|
||||
if (match) {
|
||||
ensureCurrentTitle(match[1]);
|
||||
continue;
|
||||
}
|
||||
match = line.match(/^\s*\+\s+title\s+(\d+):/i);
|
||||
if (match) {
|
||||
ensureCurrentTitle(match[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = line.match(/scan:\s+duration is\s+(\d{1,2}:\d{2}:\d{2})/i);
|
||||
if (match && currentTitle) {
|
||||
@@ -417,12 +398,6 @@ function parseHandBrakeScanText(rawOutput) {
|
||||
currentTitle.durationSeconds = parseDurationToSeconds(match[1]);
|
||||
continue;
|
||||
}
|
||||
match = line.match(/^\s*\+\s+duration:\s+(\d{1,2}:\d{2}:\d{2})/i);
|
||||
if (match && currentTitle) {
|
||||
currentTitle.durationLabel = match[1];
|
||||
currentTitle.durationSeconds = parseDurationToSeconds(match[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = line.match(/scan:\s+title\s+(\d+)\s+has\s+(\d+)\s+chapters/i);
|
||||
if (match) {
|
||||
@@ -432,11 +407,6 @@ function parseHandBrakeScanText(rawOutput) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match = line.match(/^\s*\+\s+chapters:\s+(\d+)/i);
|
||||
if (match && currentTitle) {
|
||||
currentTitle.chapterCount = Number(match[1] || 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
match = line.match(/scan:\s+chap\s+\d+,\s+(\d+)\s+ms/i);
|
||||
if (match && currentTitle) {
|
||||
|
||||
@@ -7,14 +7,12 @@ const settingsService = require('./settingsService');
|
||||
const wsService = require('./websocketService');
|
||||
const logger = require('./logger').child('HWMON');
|
||||
const { errorToMeta } = require('../utils/errorMeta');
|
||||
const { getDb } = require('../db/database');
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
const DEFAULT_INTERVAL_MS = 5000;
|
||||
const MIN_INTERVAL_MS = 1000;
|
||||
const MAX_INTERVAL_MS = 60000;
|
||||
const HISTORY_RETENTION_PREVIOUS_DAYS = 3;
|
||||
const DF_TIMEOUT_MS = 1800;
|
||||
const SENSORS_TIMEOUT_MS = 1800;
|
||||
const NVIDIA_SMI_TIMEOUT_MS = 1800;
|
||||
@@ -36,27 +34,6 @@ function nowIso() {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
function toLocalDayKey(inputDate = new Date()) {
|
||||
const date = inputDate instanceof Date ? inputDate : new Date(inputDate);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
function addLocalDays(inputDate, deltaDays) {
|
||||
const date = inputDate instanceof Date ? new Date(inputDate.getTime()) : new Date(inputDate);
|
||||
date.setDate(date.getDate() + Number(deltaDays || 0));
|
||||
return date;
|
||||
}
|
||||
|
||||
function isAbortError(error) {
|
||||
if (!error || typeof error !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return error.name === 'AbortError' || error.code === 'ABORT_ERR';
|
||||
}
|
||||
|
||||
function toBoolean(value) {
|
||||
if (typeof value === 'boolean') {
|
||||
return value;
|
||||
@@ -360,8 +337,6 @@ class HardwareMonitorService {
|
||||
this.running = false;
|
||||
this.timer = null;
|
||||
this.pollInFlight = false;
|
||||
this.activePollAbortController = null;
|
||||
this.reloadSettingsSeq = 0;
|
||||
this.lastCpuTimes = null;
|
||||
this.sensorsCommandAvailable = null;
|
||||
this.nvidiaSmiAvailable = null;
|
||||
@@ -372,7 +347,6 @@ class HardwareMonitorService {
|
||||
sample: null,
|
||||
error: null
|
||||
};
|
||||
this.lastHistoryCleanupDayKey = null;
|
||||
}
|
||||
|
||||
async init() {
|
||||
@@ -416,8 +390,6 @@ class HardwareMonitorService {
|
||||
}
|
||||
|
||||
async reloadFromSettings(options = {}) {
|
||||
const requestSeq = this.reloadSettingsSeq + 1;
|
||||
this.reloadSettingsSeq = requestSeq;
|
||||
const forceBroadcast = Boolean(options?.forceBroadcast);
|
||||
const forceImmediatePoll = Boolean(options?.forceImmediatePoll);
|
||||
let settingsMap = {};
|
||||
@@ -427,9 +399,6 @@ class HardwareMonitorService {
|
||||
logger.warn('settings:load:failed', { error: errorToMeta(error) });
|
||||
return this.getSnapshot();
|
||||
}
|
||||
if (requestSeq !== this.reloadSettingsSeq) {
|
||||
return this.getSnapshot();
|
||||
}
|
||||
|
||||
const nextEnabled = toBoolean(settingsMap.hardware_monitoring_enabled);
|
||||
const nextIntervalMs = clampIntervalMs(settingsMap.hardware_monitoring_interval_ms);
|
||||
@@ -449,19 +418,11 @@ class HardwareMonitorService {
|
||||
|
||||
if (!this.enabled) {
|
||||
this.stopPolling();
|
||||
let storage = [];
|
||||
try {
|
||||
storage = await this.collectStorageMetrics();
|
||||
} catch (error) {
|
||||
logger.debug('storage:collect:disabled-mode:failed', { error: errorToMeta(error) });
|
||||
}
|
||||
this.lastSnapshot = {
|
||||
enabled: false,
|
||||
intervalMs: this.intervalMs,
|
||||
updatedAt: nowIso(),
|
||||
sample: {
|
||||
storage
|
||||
},
|
||||
sample: null,
|
||||
error: null
|
||||
};
|
||||
this.broadcastUpdate();
|
||||
@@ -560,14 +521,6 @@ class HardwareMonitorService {
|
||||
this.running = false;
|
||||
this.pollInFlight = false;
|
||||
this.lastCpuTimes = null;
|
||||
if (this.activePollAbortController) {
|
||||
try {
|
||||
this.activePollAbortController.abort();
|
||||
} catch (_error) {
|
||||
// ignore abort errors
|
||||
}
|
||||
this.activePollAbortController = null;
|
||||
}
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
@@ -600,15 +553,8 @@ class HardwareMonitorService {
|
||||
return;
|
||||
}
|
||||
this.pollInFlight = true;
|
||||
const pollAbortController = new AbortController();
|
||||
this.activePollAbortController = pollAbortController;
|
||||
try {
|
||||
const sample = await this.collectSample(pollAbortController.signal);
|
||||
try {
|
||||
await this.persistHistorySample(sample);
|
||||
} catch (historyError) {
|
||||
logger.warn('history:write:failed', { error: errorToMeta(historyError) });
|
||||
}
|
||||
const sample = await this.collectSample();
|
||||
this.lastSnapshot = {
|
||||
enabled: true,
|
||||
intervalMs: this.intervalMs,
|
||||
@@ -618,10 +564,6 @@ class HardwareMonitorService {
|
||||
};
|
||||
this.broadcastUpdate();
|
||||
} catch (error) {
|
||||
if (isAbortError(error)) {
|
||||
logger.debug('poll:aborted');
|
||||
return;
|
||||
}
|
||||
logger.warn('poll:failed', { error: errorToMeta(error) });
|
||||
this.lastSnapshot = {
|
||||
...this.lastSnapshot,
|
||||
@@ -632,9 +574,6 @@ class HardwareMonitorService {
|
||||
};
|
||||
this.broadcastUpdate();
|
||||
} finally {
|
||||
if (this.activePollAbortController === pollAbortController) {
|
||||
this.activePollAbortController = null;
|
||||
}
|
||||
this.pollInFlight = false;
|
||||
if (this.running && this.enabled) {
|
||||
this.scheduleNext(this.intervalMs);
|
||||
@@ -642,107 +581,16 @@ class HardwareMonitorService {
|
||||
}
|
||||
}
|
||||
|
||||
buildHistoryRecord(sample = {}) {
|
||||
const cpu = sample?.cpu && typeof sample.cpu === 'object' ? sample.cpu : {};
|
||||
const memory = sample?.memory && typeof sample.memory === 'object' ? sample.memory : {};
|
||||
const gpu = sample?.gpu && typeof sample.gpu === 'object' ? sample.gpu : {};
|
||||
const gpuDevices = Array.isArray(gpu.devices) ? gpu.devices : [];
|
||||
const primaryGpu = gpuDevices[0] || null;
|
||||
const capturedAt = new Date();
|
||||
|
||||
return {
|
||||
capturedAtIso: capturedAt.toISOString(),
|
||||
dayKey: toLocalDayKey(capturedAt),
|
||||
cpuUsagePercent: roundNumber(cpu?.overallUsagePercent, 1),
|
||||
cpuTemperatureC: roundNumber(cpu?.overallTemperatureC, 1),
|
||||
ramUsagePercent: roundNumber(memory?.usagePercent, 1),
|
||||
ramUsedBytes: Number.isFinite(Number(memory?.usedBytes)) ? Math.max(0, Math.round(Number(memory.usedBytes))) : null,
|
||||
ramTotalBytes: Number.isFinite(Number(memory?.totalBytes)) ? Math.max(0, Math.round(Number(memory.totalBytes))) : null,
|
||||
gpuUsagePercent: roundNumber(primaryGpu?.utilizationPercent, 1),
|
||||
gpuTemperatureC: roundNumber(primaryGpu?.temperatureC, 1),
|
||||
vramUsedBytes: Number.isFinite(Number(primaryGpu?.memoryUsedBytes)) ? Math.max(0, Math.round(Number(primaryGpu.memoryUsedBytes))) : null,
|
||||
vramTotalBytes: Number.isFinite(Number(primaryGpu?.memoryTotalBytes)) ? Math.max(0, Math.round(Number(primaryGpu.memoryTotalBytes))) : null
|
||||
};
|
||||
}
|
||||
|
||||
async cleanupHistoryForDay(currentDayKey, referenceDate = new Date()) {
|
||||
const dayKey = String(currentDayKey || '').trim();
|
||||
if (!dayKey || this.lastHistoryCleanupDayKey === dayKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cutoffDayKey = toLocalDayKey(addLocalDays(referenceDate, -HISTORY_RETENTION_PREVIOUS_DAYS));
|
||||
const db = await getDb();
|
||||
const result = await db.run(
|
||||
`
|
||||
DELETE FROM hardware_metrics_history
|
||||
WHERE day_key < ?
|
||||
`,
|
||||
[cutoffDayKey]
|
||||
);
|
||||
this.lastHistoryCleanupDayKey = dayKey;
|
||||
logger.info('history:cleanup', {
|
||||
dayKey,
|
||||
cutoffDayKey,
|
||||
deletedRows: Number(result?.changes || 0)
|
||||
});
|
||||
}
|
||||
|
||||
async persistHistorySample(sample = {}) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
const record = this.buildHistoryRecord(sample);
|
||||
if (!record.dayKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.cleanupHistoryForDay(record.dayKey, new Date(record.capturedAtIso));
|
||||
|
||||
const db = await getDb();
|
||||
await db.run(
|
||||
`
|
||||
INSERT INTO hardware_metrics_history (
|
||||
captured_at,
|
||||
day_key,
|
||||
cpu_usage_percent,
|
||||
cpu_temperature_c,
|
||||
ram_usage_percent,
|
||||
ram_used_bytes,
|
||||
ram_total_bytes,
|
||||
gpu_usage_percent,
|
||||
gpu_temperature_c,
|
||||
vram_used_bytes,
|
||||
vram_total_bytes
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`,
|
||||
[
|
||||
record.capturedAtIso,
|
||||
record.dayKey,
|
||||
record.cpuUsagePercent,
|
||||
record.cpuTemperatureC,
|
||||
record.ramUsagePercent,
|
||||
record.ramUsedBytes,
|
||||
record.ramTotalBytes,
|
||||
record.gpuUsagePercent,
|
||||
record.gpuTemperatureC,
|
||||
record.vramUsedBytes,
|
||||
record.vramTotalBytes
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
broadcastUpdate() {
|
||||
wsService.broadcast('HARDWARE_MONITOR_UPDATE', this.getSnapshot());
|
||||
}
|
||||
|
||||
async collectSample(signal) {
|
||||
async collectSample() {
|
||||
const memory = this.collectMemoryMetrics();
|
||||
const [cpu, gpu, storage] = await Promise.all([
|
||||
this.collectCpuMetrics(signal),
|
||||
this.collectGpuMetrics(signal),
|
||||
this.collectStorageMetrics(signal)
|
||||
this.collectCpuMetrics(),
|
||||
this.collectGpuMetrics(),
|
||||
this.collectStorageMetrics()
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -817,13 +665,13 @@ class HardwareMonitorService {
|
||||
};
|
||||
}
|
||||
|
||||
async collectCpuMetrics(signal) {
|
||||
async collectCpuMetrics() {
|
||||
const cpus = os.cpus() || [];
|
||||
const currentTimes = this.getCpuTimes();
|
||||
const usage = this.calculateCpuUsage(currentTimes, this.lastCpuTimes || []);
|
||||
this.lastCpuTimes = currentTimes;
|
||||
|
||||
const tempMetrics = await this.collectCpuTemperatures(signal);
|
||||
const tempMetrics = await this.collectCpuTemperatures();
|
||||
const tempByCoreIndex = new Map(
|
||||
(tempMetrics.perCore || []).map((item) => [Number(item.index), item.temperatureC])
|
||||
);
|
||||
@@ -860,8 +708,8 @@ class HardwareMonitorService {
|
||||
};
|
||||
}
|
||||
|
||||
async collectCpuTemperatures(signal) {
|
||||
const sensors = await this.collectTempsViaSensors(signal);
|
||||
async collectCpuTemperatures() {
|
||||
const sensors = await this.collectTempsViaSensors();
|
||||
if (sensors.available) {
|
||||
return sensors;
|
||||
}
|
||||
@@ -884,7 +732,7 @@ class HardwareMonitorService {
|
||||
};
|
||||
}
|
||||
|
||||
async collectTempsViaSensors(signal) {
|
||||
async collectTempsViaSensors() {
|
||||
if (this.sensorsCommandAvailable === false) {
|
||||
return {
|
||||
source: 'sensors',
|
||||
@@ -897,8 +745,7 @@ class HardwareMonitorService {
|
||||
try {
|
||||
const { stdout } = await execFileAsync('sensors', ['-j'], {
|
||||
timeout: SENSORS_TIMEOUT_MS,
|
||||
maxBuffer: 2 * 1024 * 1024,
|
||||
signal
|
||||
maxBuffer: 2 * 1024 * 1024
|
||||
});
|
||||
this.sensorsCommandAvailable = true;
|
||||
const parsed = JSON.parse(String(stdout || '{}'));
|
||||
@@ -909,9 +756,6 @@ class HardwareMonitorService {
|
||||
...mapTemperatureCandidates(preferred)
|
||||
};
|
||||
} catch (error) {
|
||||
if (isAbortError(error)) {
|
||||
throw error;
|
||||
}
|
||||
if (isCommandMissingError(error)) {
|
||||
this.sensorsCommandAvailable = false;
|
||||
}
|
||||
@@ -1019,7 +863,7 @@ class HardwareMonitorService {
|
||||
};
|
||||
}
|
||||
|
||||
async collectGpuMetrics(signal) {
|
||||
async collectGpuMetrics() {
|
||||
if (this.nvidiaSmiAvailable === false) {
|
||||
return {
|
||||
source: 'nvidia-smi',
|
||||
@@ -1038,8 +882,7 @@ class HardwareMonitorService {
|
||||
],
|
||||
{
|
||||
timeout: NVIDIA_SMI_TIMEOUT_MS,
|
||||
maxBuffer: 1024 * 1024,
|
||||
signal
|
||||
maxBuffer: 1024 * 1024
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1052,10 +895,6 @@ class HardwareMonitorService {
|
||||
.filter(Boolean);
|
||||
|
||||
if (devices.length === 0) {
|
||||
const fallback = this.getLastKnownGpuMetrics();
|
||||
if (fallback) {
|
||||
return fallback;
|
||||
}
|
||||
return {
|
||||
source: 'nvidia-smi',
|
||||
available: false,
|
||||
@@ -1071,47 +910,26 @@ class HardwareMonitorService {
|
||||
message: null
|
||||
};
|
||||
} catch (error) {
|
||||
if (isAbortError(error)) {
|
||||
throw error;
|
||||
}
|
||||
const commandMissing = isCommandMissingError(error);
|
||||
if (commandMissing) {
|
||||
this.nvidiaSmiAvailable = false;
|
||||
}
|
||||
logger.debug('gpu:nvidia-smi:failed', { error: errorToMeta(error) });
|
||||
const fallback = this.getLastKnownGpuMetrics();
|
||||
if (fallback) {
|
||||
return fallback;
|
||||
}
|
||||
return {
|
||||
source: 'nvidia-smi',
|
||||
available: false,
|
||||
devices: [],
|
||||
message: commandMissing
|
||||
? 'nvidia-smi ist nicht verfuegbar.'
|
||||
: 'GPU-Daten derzeit nicht verfuegbar.'
|
||||
: (String(error?.stderr || error?.message || 'GPU-Abfrage fehlgeschlagen').trim().slice(0, 220))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
getLastKnownGpuMetrics() {
|
||||
const previousGpu = this.lastSnapshot?.sample?.gpu;
|
||||
if (!previousGpu || typeof previousGpu !== 'object') {
|
||||
return null;
|
||||
}
|
||||
if (!Array.isArray(previousGpu.devices) || previousGpu.devices.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
...previousGpu,
|
||||
message: null
|
||||
};
|
||||
}
|
||||
|
||||
async collectStorageMetrics(signal) {
|
||||
async collectStorageMetrics() {
|
||||
const list = [];
|
||||
for (const entry of this.monitoredPaths) {
|
||||
const metric = await this.collectStorageForPath(entry, signal);
|
||||
const metric = await this.collectStorageForPath(entry);
|
||||
if (metric && !metric.hidden) {
|
||||
list.push(metric);
|
||||
}
|
||||
@@ -1141,7 +959,7 @@ class HardwareMonitorService {
|
||||
return null;
|
||||
}
|
||||
|
||||
async collectStorageForPath(entry, signal) {
|
||||
async collectStorageForPath(entry) {
|
||||
const key = String(entry?.key || '');
|
||||
const label = String(entry?.label || key || 'Pfad');
|
||||
const rawPath = String(entry?.path || '').trim();
|
||||
@@ -1210,8 +1028,7 @@ class HardwareMonitorService {
|
||||
try {
|
||||
const { stdout } = await execFileAsync('df', ['-Pk', queryPath], {
|
||||
timeout: DF_TIMEOUT_MS,
|
||||
maxBuffer: 256 * 1024,
|
||||
signal
|
||||
maxBuffer: 256 * 1024
|
||||
});
|
||||
const parsed = parseDfStats(stdout);
|
||||
if (!parsed) {
|
||||
@@ -1239,9 +1056,7 @@ class HardwareMonitorService {
|
||||
}
|
||||
const mountPoint = parsed?.mountPoint ? path.resolve(parsed.mountPoint) : parsed.mountPoint;
|
||||
const hasDedicatedMount = Boolean(mountPoint) && !isRootPath(mountPoint);
|
||||
// External storage entries must only be visible when a dedicated filesystem
|
||||
// mount is present. Existing directories alone are not enough.
|
||||
const shouldShowExternal = hasDedicatedMount;
|
||||
const shouldShowExternal = exists || hasDedicatedMount;
|
||||
if (hideWhenUnavailable && requireDedicatedMount && !shouldShowExternal) {
|
||||
return hiddenResult({
|
||||
path: resolvedPath,
|
||||
@@ -1262,9 +1077,6 @@ class HardwareMonitorService {
|
||||
error: null
|
||||
};
|
||||
} catch (error) {
|
||||
if (isAbortError(error)) {
|
||||
throw error;
|
||||
}
|
||||
if (hideWhenUnavailable) {
|
||||
return hiddenResult({
|
||||
path: resolvedPath,
|
||||
|
||||
+399
-2532
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { logLevel } = require('../config');
|
||||
const { getBackendLogDir, getFallbackLogRootDir } = require('./logPathService');
|
||||
const { getServerTimestamp } = require('../utils/serverTime');
|
||||
|
||||
const LEVELS = {
|
||||
debug: 10,
|
||||
@@ -12,23 +11,6 @@ const LEVELS = {
|
||||
};
|
||||
|
||||
const ACTIVE_LEVEL = LEVELS[String(logLevel || 'info').toLowerCase()] || LEVELS.info;
|
||||
let consoleConfig = {
|
||||
enabled: true,
|
||||
levels: {
|
||||
debug: true,
|
||||
info: true,
|
||||
warn: true,
|
||||
error: true
|
||||
},
|
||||
http: true
|
||||
};
|
||||
|
||||
function normalizeBoolean(value, fallback = true) {
|
||||
if (value === null || value === undefined) {
|
||||
return fallback;
|
||||
}
|
||||
return Boolean(value);
|
||||
}
|
||||
|
||||
function ensureLogDir(logDirPath) {
|
||||
try {
|
||||
@@ -124,7 +106,7 @@ function emit(level, scope, message, meta = null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timestamp = getServerTimestamp();
|
||||
const timestamp = new Date().toISOString();
|
||||
const payload = {
|
||||
timestamp,
|
||||
level: normLevel,
|
||||
@@ -136,10 +118,6 @@ function emit(level, scope, message, meta = null) {
|
||||
const line = safeJson(payload);
|
||||
writeLine(line);
|
||||
|
||||
if (!shouldEmitToConsole(normLevel, scope)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const print = `[${timestamp}] [${normLevel.toUpperCase()}] [${scope}] ${message}`;
|
||||
if (normLevel === 'error') {
|
||||
console.error(print, payload.meta ? payload.meta : '');
|
||||
@@ -150,24 +128,6 @@ function emit(level, scope, message, meta = null) {
|
||||
}
|
||||
}
|
||||
|
||||
function shouldEmitToConsole(level, scope) {
|
||||
if (!consoleConfig.enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const normalizedLevel = String(level || 'info').toLowerCase();
|
||||
if (consoleConfig.levels[normalizedLevel] === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const normalizedScope = String(scope || '').trim().toUpperCase();
|
||||
if (normalizedScope === 'HTTP' && !consoleConfig.http) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function child(scope) {
|
||||
return {
|
||||
debug(message, meta) {
|
||||
@@ -185,55 +145,7 @@ function child(scope) {
|
||||
};
|
||||
}
|
||||
|
||||
function setConsoleOutputEnabled(enabled) {
|
||||
consoleConfig.enabled = Boolean(enabled);
|
||||
return consoleConfig.enabled;
|
||||
}
|
||||
|
||||
function isConsoleOutputEnabled() {
|
||||
return consoleConfig.enabled;
|
||||
}
|
||||
|
||||
function configureConsoleOutput(options = {}) {
|
||||
const opts = options && typeof options === 'object' ? options : {};
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'enabled')) {
|
||||
consoleConfig.enabled = normalizeBoolean(opts.enabled, true);
|
||||
}
|
||||
|
||||
if (opts.levels && typeof opts.levels === 'object') {
|
||||
const sourceLevels = opts.levels;
|
||||
for (const level of Object.keys(LEVELS)) {
|
||||
if (Object.prototype.hasOwnProperty.call(sourceLevels, level)) {
|
||||
consoleConfig.levels[level] = normalizeBoolean(sourceLevels[level], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(opts, 'http')) {
|
||||
consoleConfig.http = normalizeBoolean(opts.http, true);
|
||||
}
|
||||
|
||||
return getConsoleOutputConfig();
|
||||
}
|
||||
|
||||
function getConsoleOutputConfig() {
|
||||
return {
|
||||
enabled: Boolean(consoleConfig.enabled),
|
||||
levels: {
|
||||
debug: Boolean(consoleConfig.levels.debug),
|
||||
info: Boolean(consoleConfig.levels.info),
|
||||
warn: Boolean(consoleConfig.levels.warn),
|
||||
error: Boolean(consoleConfig.levels.error)
|
||||
},
|
||||
http: Boolean(consoleConfig.http)
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
child,
|
||||
emit,
|
||||
setConsoleOutputEnabled,
|
||||
isConsoleOutputEnabled,
|
||||
configureConsoleOutput,
|
||||
getConsoleOutputConfig
|
||||
emit
|
||||
};
|
||||
|
||||
@@ -1,423 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { execFile } = require('child_process');
|
||||
const { getDb } = require('../db/database');
|
||||
const logger = require('./logger').child('MAKEMKV_KEY');
|
||||
const backendPackage = require('../../package.json');
|
||||
|
||||
const MAKEMKV_BETA_KEY_API_URL = 'https://cable.ayra.ch/makemkv/api.php?json';
|
||||
const MAKEMKV_BETA_KEY_CACHE_PREF_KEY = 'makemkv_beta_key_cache_v1';
|
||||
const MAKEMKV_BETA_KEY_EXPIRY_GUARD_MS = 1000;
|
||||
const MAKEMKV_BETA_KEY_FALLBACK_VALIDITY_HOURS = Math.max(
|
||||
1,
|
||||
Number(process.env.MAKEMKV_BETA_KEY_FALLBACK_VALIDITY_HOURS || 24)
|
||||
);
|
||||
|
||||
const RIPSTER_VERSION = String(backendPackage?.version || 'dev').trim() || 'dev';
|
||||
const DEFAULT_USER_AGENT = `Ripster/MakeMKVKey-${RIPSTER_VERSION} (linux/manual; Node/manual) +https://github.com/mboehmlaender/ripster`;
|
||||
const MAKEMKV_BETA_KEY_API_USER_AGENT = process.env.MAKEMKV_BETA_KEY_API_USER_AGENT
|
||||
|| DEFAULT_USER_AGENT;
|
||||
const MAKEMKV_BETA_KEY_API_TIMEOUT_MS = Math.max(
|
||||
1000,
|
||||
Number(process.env.MAKEMKV_BETA_KEY_API_TIMEOUT_MS || 15000)
|
||||
);
|
||||
const MAKEMKV_BETA_KEY_BACKOFF_DEFAULT_MS = Math.max(
|
||||
30 * 1000,
|
||||
Number(process.env.MAKEMKV_BETA_KEY_BACKOFF_DEFAULT_MS || (15 * 60 * 1000))
|
||||
);
|
||||
|
||||
let cachedBetaKeyEntry = null;
|
||||
let blockedUntilMs = 0;
|
||||
|
||||
function parseBetaKeyCandidate(value, invalidMessage = 'Betakey-Antwort ist ungültig.') {
|
||||
const betaKey = String(value || '').trim();
|
||||
if (!/^[A-Za-z0-9][A-Za-z0-9_-]{15,}$/.test(betaKey)) {
|
||||
const error = new Error(invalidMessage);
|
||||
error.statusCode = 502;
|
||||
throw error;
|
||||
}
|
||||
return betaKey;
|
||||
}
|
||||
|
||||
|
||||
function normalizeCacheEntry(rawEntry) {
|
||||
if (!rawEntry || typeof rawEntry !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
let key = '';
|
||||
try {
|
||||
key = parseBetaKeyCandidate(rawEntry.key || rawEntry.betaKey || '', 'Betakey-Cache ist ungültig.');
|
||||
} catch (_error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sourceUrl = String(rawEntry.sourceUrl || MAKEMKV_BETA_KEY_API_URL).trim() || MAKEMKV_BETA_KEY_API_URL;
|
||||
const validUntilIsoRaw = String(rawEntry.validUntil || rawEntry.validUntilIso || '').trim();
|
||||
const validUntilMs = Date.parse(validUntilIsoRaw);
|
||||
|
||||
if (!Number.isFinite(validUntilMs)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const fetchedAtIsoRaw = String(rawEntry.fetchedAt || rawEntry.fetchedAtIso || '').trim();
|
||||
const fetchedAtMs = Date.parse(fetchedAtIsoRaw);
|
||||
|
||||
return {
|
||||
key,
|
||||
sourceUrl,
|
||||
validUntil: new Date(validUntilMs).toISOString(),
|
||||
validUntilMs,
|
||||
fetchedAt: Number.isFinite(fetchedAtMs) ? new Date(fetchedAtMs).toISOString() : null,
|
||||
fetchedAtMs: Number.isFinite(fetchedAtMs) ? fetchedAtMs : null
|
||||
};
|
||||
}
|
||||
|
||||
function isCacheEntryValid(entry, nowMs = Date.now()) {
|
||||
return Boolean(
|
||||
entry
|
||||
&& typeof entry === 'object'
|
||||
&& typeof entry.key === 'string'
|
||||
&& entry.key.length >= 16
|
||||
&& Number.isFinite(entry.validUntilMs)
|
||||
&& entry.validUntilMs > (nowMs + MAKEMKV_BETA_KEY_EXPIRY_GUARD_MS)
|
||||
);
|
||||
}
|
||||
|
||||
function buildPublicResult(entry, options = {}) {
|
||||
return {
|
||||
key: entry.key,
|
||||
sourceUrl: entry.sourceUrl,
|
||||
validUntil: entry.validUntil,
|
||||
fetchedAt: entry.fetchedAt || null,
|
||||
cached: options.cached === true,
|
||||
stale: options.stale === true
|
||||
};
|
||||
}
|
||||
|
||||
function setInMemoryCache(entry) {
|
||||
cachedBetaKeyEntry = normalizeCacheEntry(entry);
|
||||
}
|
||||
|
||||
async function readPersistentCacheEntry() {
|
||||
try {
|
||||
const db = await getDb();
|
||||
const row = await db.get('SELECT value FROM user_prefs WHERE key = ? LIMIT 1', [MAKEMKV_BETA_KEY_CACHE_PREF_KEY]);
|
||||
if (!row?.value) {
|
||||
return null;
|
||||
}
|
||||
const parsed = JSON.parse(String(row.value));
|
||||
return normalizeCacheEntry(parsed);
|
||||
} catch (error) {
|
||||
logger.warn('beta-key:cache-db-read-failed', {
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function persistCacheEntry(entry) {
|
||||
const normalized = normalizeCacheEntry(entry);
|
||||
if (!normalized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = JSON.stringify({
|
||||
key: normalized.key,
|
||||
sourceUrl: normalized.sourceUrl,
|
||||
validUntil: normalized.validUntil,
|
||||
fetchedAt: normalized.fetchedAt || new Date().toISOString()
|
||||
});
|
||||
|
||||
try {
|
||||
const db = await getDb();
|
||||
await db.run(
|
||||
`INSERT INTO user_prefs (key, value, updated_at) VALUES (?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at`,
|
||||
[MAKEMKV_BETA_KEY_CACHE_PREF_KEY, payload]
|
||||
);
|
||||
} catch (error) {
|
||||
logger.warn('beta-key:cache-db-write-failed', {
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function tryUsePersistentCache(nowMs = Date.now()) {
|
||||
const persistent = await readPersistentCacheEntry();
|
||||
if (!isCacheEntryValid(persistent, nowMs)) {
|
||||
return null;
|
||||
}
|
||||
setInMemoryCache(persistent);
|
||||
return buildPublicResult(persistent, { cached: true, stale: false });
|
||||
}
|
||||
|
||||
async function getCachedBetaKey(options = {}) {
|
||||
const nowMs = Date.now();
|
||||
const allowExpired = options?.allowExpired !== false;
|
||||
|
||||
if (cachedBetaKeyEntry) {
|
||||
const stale = !isCacheEntryValid(cachedBetaKeyEntry, nowMs);
|
||||
if (!stale || allowExpired) {
|
||||
return buildPublicResult(cachedBetaKeyEntry, { cached: true, stale });
|
||||
}
|
||||
}
|
||||
|
||||
const persistent = await readPersistentCacheEntry();
|
||||
if (!persistent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
setInMemoryCache(persistent);
|
||||
const stale = !isCacheEntryValid(persistent, nowMs);
|
||||
if (stale && !allowExpired) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return buildPublicResult(persistent, { cached: true, stale });
|
||||
}
|
||||
|
||||
function createRateLimitError(retryAfterMs = 0) {
|
||||
const parsedRetryMs = Number(retryAfterMs || 0);
|
||||
const waitMs = parsedRetryMs > 0 ? parsedRetryMs : MAKEMKV_BETA_KEY_BACKOFF_DEFAULT_MS;
|
||||
blockedUntilMs = Math.max(blockedUntilMs, Date.now() + waitMs);
|
||||
|
||||
const retryAtIso = new Date(blockedUntilMs).toISOString();
|
||||
const error = new Error(`Betakey-API limitiert Anfragen. Neuer Versuch nach ${retryAtIso}.`);
|
||||
error.statusCode = 429;
|
||||
error.retryAt = retryAtIso;
|
||||
error.retryAfterMs = Math.max(1000, blockedUntilMs - Date.now());
|
||||
return error;
|
||||
}
|
||||
|
||||
function buildExistingBackoffError() {
|
||||
const retryAtMs = Math.max(Date.now() + 1000, Number(blockedUntilMs || 0));
|
||||
const retryAtIso = new Date(retryAtMs).toISOString();
|
||||
const error = new Error(`Betakey-API limitiert Anfragen. Neuer Versuch nach ${retryAtIso}.`);
|
||||
error.statusCode = 429;
|
||||
error.retryAt = retryAtIso;
|
||||
error.retryAfterMs = Math.max(1000, retryAtMs - Date.now());
|
||||
return error;
|
||||
}
|
||||
|
||||
function resolveValidityOrFallback(validUntilIso, sourceUrl) {
|
||||
const parsedMs = Date.parse(String(validUntilIso || '').trim());
|
||||
if (Number.isFinite(parsedMs)) {
|
||||
return new Date(parsedMs).toISOString();
|
||||
}
|
||||
|
||||
const fallbackIso = new Date(Date.now() + MAKEMKV_BETA_KEY_FALLBACK_VALIDITY_HOURS * 60 * 60 * 1000).toISOString();
|
||||
logger.warn('beta-key:validity-parse-fallback', {
|
||||
sourceUrl: sourceUrl || null,
|
||||
fallbackIso
|
||||
});
|
||||
return fallbackIso;
|
||||
}
|
||||
|
||||
function normalizeRegistrationKey(rawValue) {
|
||||
return String(rawValue || '').trim();
|
||||
}
|
||||
|
||||
function getMakeMKVConfigDir(homeDir = os.homedir()) {
|
||||
return path.join(String(homeDir || '').trim() || os.homedir(), '.MakeMKV');
|
||||
}
|
||||
|
||||
function getMakeMKVSettingsFilePath(homeDir = os.homedir()) {
|
||||
return path.join(getMakeMKVConfigDir(homeDir), 'settings.conf');
|
||||
}
|
||||
|
||||
function escapeKeyForSettingsFile(value) {
|
||||
return String(value || '')
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/"/g, '\\"');
|
||||
}
|
||||
|
||||
function buildUpdatedSettingsContent(currentContent, registrationKey) {
|
||||
const existingLines = String(currentContent || '')
|
||||
.split(/\r?\n/)
|
||||
.filter((line) => !/^\s*app_Key\s*=/.test(line));
|
||||
const normalizedKey = normalizeRegistrationKey(registrationKey);
|
||||
|
||||
while (existingLines.length > 0 && existingLines[existingLines.length - 1] === '') {
|
||||
existingLines.pop();
|
||||
}
|
||||
|
||||
if (normalizedKey) {
|
||||
existingLines.push(`app_Key = "${escapeKeyForSettingsFile(normalizedKey)}"`);
|
||||
}
|
||||
|
||||
return existingLines.length > 0 ? `${existingLines.join('\n')}\n` : '';
|
||||
}
|
||||
|
||||
async function syncRegistrationKeyToConfig(rawValue, options = {}) {
|
||||
const normalizedKey = normalizeRegistrationKey(rawValue);
|
||||
const homeDir = String(options?.homeDir || '').trim() || os.homedir();
|
||||
const configDir = getMakeMKVConfigDir(homeDir);
|
||||
const settingsFilePath = getMakeMKVSettingsFilePath(homeDir);
|
||||
const fileExists = fs.existsSync(settingsFilePath);
|
||||
const currentContent = fileExists
|
||||
? await fs.promises.readFile(settingsFilePath, 'utf8')
|
||||
: '';
|
||||
const nextContent = buildUpdatedSettingsContent(currentContent, normalizedKey);
|
||||
|
||||
if (!normalizedKey && !fileExists) {
|
||||
return {
|
||||
changed: false,
|
||||
path: settingsFilePath,
|
||||
hasKey: false
|
||||
};
|
||||
}
|
||||
|
||||
await fs.promises.mkdir(configDir, { recursive: true });
|
||||
|
||||
if (nextContent) {
|
||||
await fs.promises.writeFile(settingsFilePath, nextContent, 'utf8');
|
||||
await fs.promises.chmod(settingsFilePath, 0o600).catch(() => {});
|
||||
logger.info('settings-conf:key-synced', {
|
||||
path: settingsFilePath,
|
||||
hasKey: true
|
||||
});
|
||||
} else {
|
||||
await fs.promises.writeFile(settingsFilePath, '', 'utf8');
|
||||
await fs.promises.chmod(settingsFilePath, 0o600).catch(() => {});
|
||||
logger.info('settings-conf:key-cleared', {
|
||||
path: settingsFilePath,
|
||||
hasKey: false
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
changed: currentContent !== nextContent,
|
||||
path: settingsFilePath,
|
||||
hasKey: Boolean(normalizedKey)
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchCurrentBetaKey(options = {}) {
|
||||
const forceRefresh = options?.forceRefresh === true;
|
||||
const now = Date.now();
|
||||
|
||||
if (!forceRefresh && isCacheEntryValid(cachedBetaKeyEntry, now)) {
|
||||
return buildPublicResult(cachedBetaKeyEntry, { cached: true, stale: false });
|
||||
}
|
||||
|
||||
if (!forceRefresh) {
|
||||
const persistentCacheHit = await tryUsePersistentCache(now);
|
||||
if (persistentCacheHit) {
|
||||
return persistentCacheHit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!forceRefresh && blockedUntilMs > now) {
|
||||
throw buildExistingBackoffError();
|
||||
}
|
||||
|
||||
try {
|
||||
const apiResult = await fetchCurrentBetaKeyViaCurl();
|
||||
const normalized = normalizeCacheEntry({
|
||||
...apiResult,
|
||||
fetchedAt: new Date().toISOString()
|
||||
});
|
||||
|
||||
if (!normalized) {
|
||||
const error = new Error('API-curl-Betakey konnte nicht normalisiert werden.');
|
||||
error.statusCode = 502;
|
||||
throw error;
|
||||
}
|
||||
|
||||
blockedUntilMs = 0;
|
||||
setInMemoryCache(normalized);
|
||||
await persistCacheEntry(normalized);
|
||||
return buildPublicResult(normalized, { cached: false, stale: false });
|
||||
} catch (error) {
|
||||
logger.warn('beta-key:fetch-failed', {
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
if (Number(error?.httpStatus || error?.statusCode || error?.status || 0) === 429) {
|
||||
throw createRateLimitError(Number(error?.retryAfterMs || 0));
|
||||
}
|
||||
const resolved = new Error(`Betakey konnte nicht geladen werden. Details: ${error?.message || String(error)}`);
|
||||
resolved.statusCode = Number(error?.httpStatus || error?.statusCode || error?.status || 502) || 502;
|
||||
throw resolved;
|
||||
}
|
||||
}
|
||||
|
||||
function parseBetaKeyResponse(rawBody) {
|
||||
let payload = null;
|
||||
try {
|
||||
payload = JSON.parse(String(rawBody || '{}'));
|
||||
} catch (_error) {
|
||||
const error = new Error('Betakey-Antwort ist kein gültiges JSON.');
|
||||
error.statusCode = 502;
|
||||
throw error;
|
||||
}
|
||||
|
||||
const betaKey = parseBetaKeyCandidate(String(payload?.key || '').trim(), 'Betakey-Antwort ist ungültig.');
|
||||
|
||||
let validUntil = null;
|
||||
const unixExpiry = Number(payload?.keydate || payload?.expires || payload?.valid_until_unix || 0);
|
||||
if (Number.isFinite(unixExpiry) && unixExpiry > 0) {
|
||||
validUntil = new Date(unixExpiry * 1000).toISOString();
|
||||
}
|
||||
|
||||
const resolvedValidUntil = resolveValidityOrFallback(validUntil, MAKEMKV_BETA_KEY_API_URL);
|
||||
|
||||
return {
|
||||
key: betaKey,
|
||||
sourceUrl: MAKEMKV_BETA_KEY_API_URL,
|
||||
validUntil: resolvedValidUntil
|
||||
};
|
||||
}
|
||||
|
||||
function fetchCurrentBetaKeyViaCurl() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const curlArgs = [
|
||||
'-fsSL',
|
||||
'--max-time', String(Math.ceil(MAKEMKV_BETA_KEY_API_TIMEOUT_MS / 1000)),
|
||||
'-A', MAKEMKV_BETA_KEY_API_USER_AGENT,
|
||||
MAKEMKV_BETA_KEY_API_URL
|
||||
];
|
||||
|
||||
execFile(
|
||||
'curl',
|
||||
curlArgs,
|
||||
{
|
||||
timeout: MAKEMKV_BETA_KEY_API_TIMEOUT_MS,
|
||||
maxBuffer: 1024 * 1024
|
||||
},
|
||||
(error, stdout, stderr) => {
|
||||
if (error) {
|
||||
const resolvedError = new Error(
|
||||
`curl fehlgeschlagen (${error.code || 'unknown'}): ${String(stderr || error.message || '').trim() || 'keine Details'}`
|
||||
);
|
||||
resolvedError.statusCode = 502;
|
||||
if (/\b429\b/.test(String(stderr || ''))) {
|
||||
resolvedError.httpStatus = 429;
|
||||
}
|
||||
if (/\b403\b/.test(String(stderr || ''))) {
|
||||
resolvedError.httpStatus = 403;
|
||||
}
|
||||
reject(resolvedError);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
resolve(parseBetaKeyResponse(stdout));
|
||||
} catch (parseError) {
|
||||
reject(parseError);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
MAKEMKV_BETA_KEY_API_URL,
|
||||
fetchCurrentBetaKey,
|
||||
getCachedBetaKey,
|
||||
getMakeMKVConfigDir,
|
||||
getMakeMKVSettingsFilePath,
|
||||
normalizeRegistrationKey,
|
||||
syncRegistrationKeyToConfig
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
const settingsService = require('./settingsService');
|
||||
const logger = require('./logger').child('MUSICBRAINZ');
|
||||
|
||||
const MB_BASE = 'https://musicbrainz.org/ws/2';
|
||||
@@ -73,17 +74,6 @@ function normalizeRelease(release) {
|
||||
artist: artistFromTrack || artistFromRecording || artistCredit || null
|
||||
};
|
||||
});
|
||||
const rawReleaseTrackCount = Number(release['track-count']);
|
||||
const mediaTrackCount = media.reduce((sum, medium) => {
|
||||
const mediumCount = Number(medium?.['track-count'] ?? medium?.trackCount);
|
||||
if (!Number.isFinite(mediumCount) || mediumCount <= 0) {
|
||||
return sum;
|
||||
}
|
||||
return sum + Math.trunc(mediumCount);
|
||||
}, 0);
|
||||
const trackCount = Number.isFinite(rawReleaseTrackCount) && rawReleaseTrackCount > 0
|
||||
? Math.trunc(rawReleaseTrackCount)
|
||||
: (mediaTrackCount > 0 ? mediaTrackCount : normalizedTracks.length);
|
||||
|
||||
// Always generate the CAA URL when an id is present; the browser/onError
|
||||
// handles 404s for releases that have no front cover.
|
||||
@@ -102,21 +92,27 @@ function normalizeRelease(release) {
|
||||
? release['label-info'].map((li) => li?.label?.name).filter(Boolean).join(', ') || null
|
||||
: null,
|
||||
coverArtUrl,
|
||||
tracks: normalizedTracks,
|
||||
trackCount
|
||||
tracks: normalizedTracks
|
||||
};
|
||||
}
|
||||
|
||||
class MusicBrainzService {
|
||||
async searchByTitle(query, options = {}) {
|
||||
async isEnabled() {
|
||||
const settings = await settingsService.getSettingsMap();
|
||||
return settings.musicbrainz_enabled !== 'false';
|
||||
}
|
||||
|
||||
async searchByTitle(query) {
|
||||
const q = String(query || '').trim();
|
||||
if (!q) {
|
||||
return [];
|
||||
}
|
||||
const expectedTrackCountRaw = Number(options?.trackCount);
|
||||
const expectedTrackCount = Number.isFinite(expectedTrackCountRaw) && expectedTrackCountRaw > 0
|
||||
? Math.trunc(expectedTrackCountRaw)
|
||||
: null;
|
||||
|
||||
const enabled = await this.isEnabled();
|
||||
if (!enabled) {
|
||||
return [];
|
||||
}
|
||||
|
||||
logger.info('search:start', { query: q });
|
||||
|
||||
const url = new URL(`${MB_BASE}/release`);
|
||||
@@ -128,23 +124,11 @@ class MusicBrainzService {
|
||||
try {
|
||||
const data = await mbFetch(url.toString());
|
||||
const releases = Array.isArray(data.releases) ? data.releases : [];
|
||||
const normalizedReleases = releases.map(normalizeRelease).filter(Boolean);
|
||||
const results = expectedTrackCount
|
||||
? normalizedReleases.filter((release) => Number(release?.trackCount || 0) === expectedTrackCount)
|
||||
: normalizedReleases;
|
||||
logger.info('search:done', {
|
||||
query: q,
|
||||
expectedTrackCount,
|
||||
sourceCount: normalizedReleases.length,
|
||||
count: results.length
|
||||
});
|
||||
const results = releases.map(normalizeRelease).filter(Boolean);
|
||||
logger.info('search:done', { query: q, count: results.length });
|
||||
return results;
|
||||
} catch (error) {
|
||||
logger.warn('search:failed', {
|
||||
query: q,
|
||||
expectedTrackCount,
|
||||
error: String(error?.message || error)
|
||||
});
|
||||
logger.warn('search:failed', { query: q, error: String(error?.message || error) });
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -159,6 +143,11 @@ class MusicBrainzService {
|
||||
return null;
|
||||
}
|
||||
|
||||
const enabled = await this.isEnabled();
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.info('getById:start', { mbId: id });
|
||||
|
||||
const url = new URL(`${MB_BASE}/release/${id}`);
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
const settingsService = require('./settingsService');
|
||||
const logger = require('./logger').child('OMDB');
|
||||
|
||||
const OMDB_BASE_URL = 'https://www.omdbapi.com/';
|
||||
const OMDB_TIMEOUT_MS = 10000;
|
||||
const OMDB_MAX_ATTEMPTS = 2;
|
||||
const OMDB_RETRY_BASE_DELAY_MS = 300;
|
||||
|
||||
function normalizeOmdbTimeoutMs(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return OMDB_TIMEOUT_MS;
|
||||
}
|
||||
return Math.max(1000, Math.trunc(parsed));
|
||||
}
|
||||
|
||||
function isRetryableOmdbError(error, aborted = false) {
|
||||
if (aborted) {
|
||||
return true;
|
||||
}
|
||||
const code = String(error?.code || '').trim().toUpperCase();
|
||||
if (code === 'ETIMEDOUT' || code === 'ECONNRESET' || code === 'ECONNABORTED') {
|
||||
return true;
|
||||
}
|
||||
const causeCode = String(error?.cause?.code || '').trim().toUpperCase();
|
||||
if (causeCode === 'UND_ERR_CONNECT_TIMEOUT' || causeCode === 'UND_ERR_HEADERS_TIMEOUT' || causeCode === 'UND_ERR_SOCKET') {
|
||||
return true;
|
||||
}
|
||||
const message = String(error?.message || '').toLowerCase();
|
||||
return message.includes('timed out') || message.includes('timeout');
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
class OmdbService {
|
||||
mapSearchResults(data) {
|
||||
if (!data || typeof data !== 'object') {
|
||||
return [];
|
||||
}
|
||||
if (data.Response === 'False' || !Array.isArray(data.Search)) {
|
||||
return [];
|
||||
}
|
||||
return data.Search.map((item) => ({
|
||||
title: item.Title,
|
||||
year: item.Year,
|
||||
imdbId: item.imdbID,
|
||||
type: item.Type,
|
||||
poster: item.Poster
|
||||
}));
|
||||
}
|
||||
|
||||
async requestJson(url, meta = {}, options = {}) {
|
||||
const timeoutMs = normalizeOmdbTimeoutMs(options?.timeoutMs);
|
||||
const maxAttempts = Math.max(1, Math.trunc(Number(options?.maxAttempts || OMDB_MAX_ATTEMPTS)));
|
||||
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'Ripster/1.0'
|
||||
},
|
||||
signal: controller.signal
|
||||
});
|
||||
if (!response.ok) {
|
||||
logger.warn('request:http-failed', {
|
||||
...meta,
|
||||
status: response.status,
|
||||
attempt,
|
||||
maxAttempts
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
const aborted = error?.name === 'AbortError';
|
||||
const retryable = isRetryableOmdbError(error, aborted);
|
||||
const willRetry = retryable && attempt < maxAttempts;
|
||||
logger[willRetry ? 'info' : 'warn']('request:failed', {
|
||||
...meta,
|
||||
timeoutMs,
|
||||
aborted,
|
||||
retryable,
|
||||
attempt,
|
||||
maxAttempts,
|
||||
willRetry,
|
||||
message: error?.message || String(error)
|
||||
});
|
||||
if (willRetry) {
|
||||
await sleep(OMDB_RETRY_BASE_DELAY_MS * attempt);
|
||||
continue;
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async search(query) {
|
||||
const normalizedQuery = String(query || '').trim();
|
||||
if (!normalizedQuery) {
|
||||
return [];
|
||||
}
|
||||
logger.info('search:start', { query: normalizedQuery });
|
||||
|
||||
// Allow direct IMDb-ID lookups in the search field (useful for History remapping).
|
||||
const imdbLike = normalizedQuery.toLowerCase();
|
||||
if (/^tt\d{6,12}$/.test(imdbLike)) {
|
||||
const byId = await this.fetchByImdbId(imdbLike);
|
||||
return byId
|
||||
? [{
|
||||
title: byId.title,
|
||||
year: byId.year != null ? String(byId.year) : null,
|
||||
imdbId: byId.imdbId,
|
||||
type: byId.type,
|
||||
poster: byId.poster
|
||||
}]
|
||||
: [];
|
||||
}
|
||||
|
||||
const settings = await settingsService.getSettingsMap();
|
||||
const apiKey = settings.omdb_api_key;
|
||||
if (!apiKey) {
|
||||
return [];
|
||||
}
|
||||
const timeoutMs = normalizeOmdbTimeoutMs(settings.omdb_timeout_ms);
|
||||
|
||||
const configuredType = String(settings.omdb_default_type || 'movie').trim().toLowerCase() || 'movie';
|
||||
const requestSearch = async (type = null) => {
|
||||
const url = new URL(OMDB_BASE_URL);
|
||||
url.searchParams.set('apikey', apiKey);
|
||||
url.searchParams.set('s', normalizedQuery);
|
||||
if (type) {
|
||||
url.searchParams.set('type', type);
|
||||
}
|
||||
const data = await this.requestJson(
|
||||
url,
|
||||
{ query: normalizedQuery, action: 'search', type: type || null },
|
||||
{ timeoutMs }
|
||||
);
|
||||
return {
|
||||
data,
|
||||
results: this.mapSearchResults(data)
|
||||
};
|
||||
};
|
||||
|
||||
let { data, results } = await requestSearch(configuredType);
|
||||
if (results.length === 0 && configuredType) {
|
||||
logger.info('search:fallback-no-type', {
|
||||
query: normalizedQuery,
|
||||
configuredType,
|
||||
response: data?.Response || null,
|
||||
error: data?.Error || null
|
||||
});
|
||||
({ data, results } = await requestSearch(null));
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
logger.warn('search:no-results', {
|
||||
query: normalizedQuery,
|
||||
response: data?.Response || null,
|
||||
error: data?.Error || null,
|
||||
configuredType
|
||||
});
|
||||
return [];
|
||||
}
|
||||
|
||||
logger.info('search:done', { query: normalizedQuery, count: results.length, configuredType });
|
||||
return results;
|
||||
}
|
||||
|
||||
async fetchByImdbId(imdbId) {
|
||||
const normalizedId = String(imdbId || '').trim().toLowerCase();
|
||||
if (!/^tt\d{6,12}$/.test(normalizedId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.info('fetchByImdbId:start', { imdbId: normalizedId });
|
||||
const settings = await settingsService.getSettingsMap();
|
||||
const apiKey = settings.omdb_api_key;
|
||||
if (!apiKey) {
|
||||
return null;
|
||||
}
|
||||
const timeoutMs = normalizeOmdbTimeoutMs(settings.omdb_timeout_ms);
|
||||
|
||||
const url = new URL(OMDB_BASE_URL);
|
||||
url.searchParams.set('apikey', apiKey);
|
||||
url.searchParams.set('i', normalizedId);
|
||||
url.searchParams.set('plot', 'full');
|
||||
|
||||
const data = await this.requestJson(url, { imdbId: normalizedId, action: 'fetchByImdbId' }, { timeoutMs });
|
||||
if (!data || typeof data !== 'object') {
|
||||
return null;
|
||||
}
|
||||
if (data.Response === 'False') {
|
||||
logger.warn('fetchByImdbId:not-found', { imdbId: normalizedId, error: data.Error });
|
||||
return null;
|
||||
}
|
||||
|
||||
const yearMatch = String(data.Year || '').match(/\b(19|20)\d{2}\b/);
|
||||
const year = yearMatch ? Number(yearMatch[0]) : null;
|
||||
const poster = data.Poster && data.Poster !== 'N/A' ? data.Poster : null;
|
||||
|
||||
const result = {
|
||||
title: data.Title || null,
|
||||
year: Number.isFinite(year) ? year : null,
|
||||
imdbId: String(data.imdbID || normalizedId),
|
||||
type: data.Type || null,
|
||||
poster,
|
||||
raw: data
|
||||
};
|
||||
logger.info('fetchByImdbId:done', { imdbId: result.imdbId, title: result.title });
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new OmdbService();
|
||||
+1241
-10030
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@ const { spawnTrackedProcess } = require('./processRunner');
|
||||
const { errorToMeta } = require('../utils/errorMeta');
|
||||
|
||||
const CHAIN_NAME_MAX_LENGTH = 120;
|
||||
const CHAIN_DESCRIPTION_MAX_LENGTH = 50;
|
||||
const STEP_TYPE_SCRIPT = 'script';
|
||||
const STEP_TYPE_WAIT = 'wait';
|
||||
const VALID_STEP_TYPES = new Set([STEP_TYPE_SCRIPT, STEP_TYPE_WAIT]);
|
||||
@@ -27,31 +26,6 @@ function createValidationError(message, details = null) {
|
||||
return error;
|
||||
}
|
||||
|
||||
function normalizeFavoriteFlag(rawValue, fallback = 0) {
|
||||
if (typeof rawValue === 'boolean') {
|
||||
return rawValue ? 1 : 0;
|
||||
}
|
||||
const parsed = Number(rawValue);
|
||||
if (Number.isFinite(parsed)) {
|
||||
return parsed !== 0 ? 1 : 0;
|
||||
}
|
||||
const normalized = String(rawValue || '').trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return fallback ? 1 : 0;
|
||||
}
|
||||
if (['true', 'yes', 'on', '1'].includes(normalized)) {
|
||||
return 1;
|
||||
}
|
||||
if (['false', 'no', 'off', '0'].includes(normalized)) {
|
||||
return 0;
|
||||
}
|
||||
return fallback ? 1 : 0;
|
||||
}
|
||||
|
||||
function normalizeChainDescription(rawValue) {
|
||||
return String(rawValue || '').trim();
|
||||
}
|
||||
|
||||
function mapChainRow(row, steps = []) {
|
||||
if (!row) {
|
||||
return null;
|
||||
@@ -59,8 +33,6 @@ function mapChainRow(row, steps = []) {
|
||||
return {
|
||||
id: Number(row.id),
|
||||
name: String(row.name || ''),
|
||||
description: normalizeChainDescription(row.description),
|
||||
isFavorite: normalizeFavoriteFlag(row.is_favorite, 0) === 1,
|
||||
orderIndex: Number(row.order_index || 0),
|
||||
steps: steps.map(mapStepRow),
|
||||
createdAt: row.created_at,
|
||||
@@ -84,27 +56,24 @@ function mapStepRow(row) {
|
||||
|
||||
function terminateChildProcess(child, { immediate = false } = {}) {
|
||||
if (!child) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
const signal = immediate ? 'SIGKILL' : 'SIGTERM';
|
||||
const pid = Number(child.pid);
|
||||
let signaled = false;
|
||||
if (Number.isFinite(pid) && pid > 0) {
|
||||
try {
|
||||
// For detached children this targets the full process group.
|
||||
process.kill(-pid, signal);
|
||||
signaled = true;
|
||||
return;
|
||||
} catch (_error) {
|
||||
// ignore and continue with direct child signal
|
||||
// Fall through to direct child signal.
|
||||
}
|
||||
}
|
||||
try {
|
||||
child.kill(signal);
|
||||
signaled = true;
|
||||
} catch (_error) {
|
||||
// ignore
|
||||
return;
|
||||
}
|
||||
return signaled;
|
||||
}
|
||||
|
||||
function appendTailText(currentValue, nextChunk, maxChars = 12000) {
|
||||
@@ -192,7 +161,7 @@ class ScriptChainService {
|
||||
const db = await getDb();
|
||||
const rows = await db.all(
|
||||
`
|
||||
SELECT id, name, description, is_favorite, order_index, created_at, updated_at
|
||||
SELECT id, name, order_index, created_at, updated_at
|
||||
FROM script_chains
|
||||
ORDER BY order_index ASC, id ASC
|
||||
`
|
||||
@@ -241,7 +210,7 @@ class ScriptChainService {
|
||||
}
|
||||
const db = await getDb();
|
||||
const row = await db.get(
|
||||
`SELECT id, name, description, is_favorite, order_index, created_at, updated_at FROM script_chains WHERE id = ?`,
|
||||
`SELECT id, name, order_index, created_at, updated_at FROM script_chains WHERE id = ?`,
|
||||
[normalizedId]
|
||||
);
|
||||
if (!row) {
|
||||
@@ -263,7 +232,7 @@ class ScriptChainService {
|
||||
const db = await getDb();
|
||||
const placeholders = ids.map(() => '?').join(', ');
|
||||
const rows = await db.all(
|
||||
`SELECT id, name, description, is_favorite, order_index, created_at, updated_at FROM script_chains WHERE id IN (${placeholders})`,
|
||||
`SELECT id, name, order_index, created_at, updated_at FROM script_chains WHERE id IN (${placeholders})`,
|
||||
ids
|
||||
);
|
||||
const stepRows = await db.all(
|
||||
@@ -296,16 +265,12 @@ class ScriptChainService {
|
||||
async createChain(payload = {}) {
|
||||
const body = payload && typeof payload === 'object' ? payload : {};
|
||||
const name = String(body.name || '').trim();
|
||||
const description = normalizeChainDescription(body.description);
|
||||
if (!name) {
|
||||
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
||||
}
|
||||
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
||||
throw createValidationError('Skriptkettenname zu lang.', [{ field: 'name', message: `Maximal ${CHAIN_NAME_MAX_LENGTH} Zeichen.` }]);
|
||||
}
|
||||
if (description.length > CHAIN_DESCRIPTION_MAX_LENGTH) {
|
||||
throw createValidationError('Beschreibung zu lang.', [{ field: 'description', message: `Maximal ${CHAIN_DESCRIPTION_MAX_LENGTH} Zeichen.` }]);
|
||||
}
|
||||
const steps = validateSteps(body.steps);
|
||||
|
||||
const db = await getDb();
|
||||
@@ -313,10 +278,10 @@ class ScriptChainService {
|
||||
const nextOrderIndex = await this._getNextOrderIndex(db);
|
||||
const result = await db.run(
|
||||
`
|
||||
INSERT INTO script_chains (name, description, is_favorite, order_index, created_at, updated_at)
|
||||
VALUES (?, ?, 0, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
INSERT INTO script_chains (name, order_index, created_at, updated_at)
|
||||
VALUES (?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
`,
|
||||
[name, description || null, nextOrderIndex]
|
||||
[name, nextOrderIndex]
|
||||
);
|
||||
const chainId = result.lastID;
|
||||
await this._saveSteps(db, chainId, steps);
|
||||
@@ -336,16 +301,12 @@ class ScriptChainService {
|
||||
}
|
||||
const body = payload && typeof payload === 'object' ? payload : {};
|
||||
const name = String(body.name || '').trim();
|
||||
const description = normalizeChainDescription(body.description);
|
||||
if (!name) {
|
||||
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
||||
}
|
||||
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
||||
throw createValidationError('Skriptkettenname zu lang.', [{ field: 'name', message: `Maximal ${CHAIN_NAME_MAX_LENGTH} Zeichen.` }]);
|
||||
}
|
||||
if (description.length > CHAIN_DESCRIPTION_MAX_LENGTH) {
|
||||
throw createValidationError('Beschreibung zu lang.', [{ field: 'description', message: `Maximal ${CHAIN_DESCRIPTION_MAX_LENGTH} Zeichen.` }]);
|
||||
}
|
||||
const steps = validateSteps(body.steps);
|
||||
|
||||
await this.getChainById(normalizedId);
|
||||
@@ -353,8 +314,8 @@ class ScriptChainService {
|
||||
const db = await getDb();
|
||||
try {
|
||||
await db.run(
|
||||
`UPDATE script_chains SET name = ?, description = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?`,
|
||||
[name, description || null, normalizedId]
|
||||
`UPDATE script_chains SET name = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?`,
|
||||
[name, normalizedId]
|
||||
);
|
||||
await db.run(`DELETE FROM script_chain_steps WHERE chain_id = ?`, [normalizedId]);
|
||||
await this._saveSteps(db, normalizedId, steps);
|
||||
@@ -378,25 +339,6 @@ class ScriptChainService {
|
||||
return existing;
|
||||
}
|
||||
|
||||
async setChainFavorite(chainId, isFavorite) {
|
||||
const normalizedId = normalizeChainId(chainId);
|
||||
if (!normalizedId) {
|
||||
throw createValidationError('Ungültige chainId.');
|
||||
}
|
||||
const favoriteFlag = normalizeFavoriteFlag(isFavorite, 0);
|
||||
const db = await getDb();
|
||||
await this.getChainById(normalizedId);
|
||||
await db.run(
|
||||
`
|
||||
UPDATE script_chains
|
||||
SET is_favorite = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
`,
|
||||
[favoriteFlag, normalizedId]
|
||||
);
|
||||
return this.getChainById(normalizedId);
|
||||
}
|
||||
|
||||
async reorderChains(orderedIds = []) {
|
||||
const providedIds = Array.isArray(orderedIds)
|
||||
? orderedIds.map(normalizeChainId).filter(Boolean)
|
||||
@@ -501,7 +443,6 @@ class ScriptChainService {
|
||||
currentStepType: null,
|
||||
activeWaitResolve: null,
|
||||
activeChild: null,
|
||||
activeProcessHandle: null,
|
||||
activeChildTermination: null
|
||||
};
|
||||
const emitRuntimeStep = (payload = {}) => {
|
||||
@@ -528,23 +469,6 @@ class ScriptChainService {
|
||||
message: 'Abbruch angefordert',
|
||||
currentStep: controlState.currentStepType ? `Abbruch läuft (${controlState.currentStepType})` : 'Abbruch angefordert'
|
||||
});
|
||||
if (controlState.currentStepType === STEP_TYPE_WAIT && typeof controlState.activeWaitResolve === 'function') {
|
||||
controlState.activeWaitResolve('cancel');
|
||||
} else if (controlState.currentStepType === STEP_TYPE_SCRIPT && controlState.activeChild) {
|
||||
controlState.activeChildTermination = 'cancel';
|
||||
let handleCancelled = false;
|
||||
if (typeof controlState.activeProcessHandle?.cancel === 'function') {
|
||||
controlState.activeProcessHandle.cancel();
|
||||
handleCancelled = true;
|
||||
}
|
||||
const signaled = terminateChildProcess(controlState.activeChild, { immediate: true });
|
||||
if (!handleCancelled && !signaled) {
|
||||
logger.warn('chain:cancel:no-signal-sent', {
|
||||
chainId,
|
||||
scriptPid: Number(controlState.activeChild?.pid || 0) || null
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof appendLog === 'function') {
|
||||
try {
|
||||
await appendLog('SYSTEM', `Kette "${chain.name}" - Abbruch angefordert.`);
|
||||
@@ -552,6 +476,12 @@ class ScriptChainService {
|
||||
// ignore appendLog failures for control actions
|
||||
}
|
||||
}
|
||||
if (controlState.currentStepType === STEP_TYPE_WAIT && typeof controlState.activeWaitResolve === 'function') {
|
||||
controlState.activeWaitResolve('cancel');
|
||||
} else if (controlState.currentStepType === STEP_TYPE_SCRIPT && controlState.activeChild) {
|
||||
controlState.activeChildTermination = 'cancel';
|
||||
terminateChildProcess(controlState.activeChild, { immediate: true });
|
||||
}
|
||||
return { accepted: true, message: 'Abbruch angefordert.' };
|
||||
};
|
||||
const requestNextStep = async () => {
|
||||
@@ -732,7 +662,6 @@ class ScriptChainService {
|
||||
runtimeActivityService.appendActivityOutput(scriptActivityId, { stderr: line });
|
||||
}
|
||||
});
|
||||
controlState.activeProcessHandle = processHandle;
|
||||
let runError = null;
|
||||
let exitCode = 0;
|
||||
let signal = null;
|
||||
@@ -747,7 +676,6 @@ class ScriptChainService {
|
||||
}
|
||||
const termination = controlState.activeChildTermination;
|
||||
controlState.activeChild = null;
|
||||
controlState.activeProcessHandle = null;
|
||||
controlState.activeChildTermination = null;
|
||||
if (runError && exitCode === null && !termination) {
|
||||
throw runError;
|
||||
@@ -901,7 +829,6 @@ class ScriptChainService {
|
||||
break;
|
||||
} finally {
|
||||
controlState.activeChild = null;
|
||||
controlState.activeProcessHandle = null;
|
||||
controlState.activeChildTermination = null;
|
||||
if (prepared?.cleanup) {
|
||||
await prepared.cleanup();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
const { getDb } = require('../db/database');
|
||||
@@ -7,7 +8,6 @@ const settingsService = require('./settingsService');
|
||||
const runtimeActivityService = require('./runtimeActivityService');
|
||||
const { streamLines } = require('./processRunner');
|
||||
const { errorToMeta } = require('../utils/errorMeta');
|
||||
const { tempDir } = require('../config');
|
||||
|
||||
const SCRIPT_NAME_MAX_LENGTH = 120;
|
||||
const SCRIPT_BODY_MAX_LENGTH = 200000;
|
||||
@@ -72,27 +72,6 @@ function normalizeScriptBody(rawValue) {
|
||||
return String(rawValue || '').replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
||||
}
|
||||
|
||||
function normalizeFavoriteFlag(rawValue, fallback = 0) {
|
||||
if (typeof rawValue === 'boolean') {
|
||||
return rawValue ? 1 : 0;
|
||||
}
|
||||
const parsed = Number(rawValue);
|
||||
if (Number.isFinite(parsed)) {
|
||||
return parsed !== 0 ? 1 : 0;
|
||||
}
|
||||
const normalized = String(rawValue || '').trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return fallback ? 1 : 0;
|
||||
}
|
||||
if (['true', 'yes', 'on', '1'].includes(normalized)) {
|
||||
return 1;
|
||||
}
|
||||
if (['false', 'no', 'off', '0'].includes(normalized)) {
|
||||
return 0;
|
||||
}
|
||||
return fallback ? 1 : 0;
|
||||
}
|
||||
|
||||
function createValidationError(message, details = null) {
|
||||
const error = new Error(message);
|
||||
error.statusCode = 400;
|
||||
@@ -146,7 +125,6 @@ function mapScriptRow(row) {
|
||||
id: Number(row.id),
|
||||
name: String(row.name || ''),
|
||||
scriptBody: String(row.script_body || ''),
|
||||
isFavorite: normalizeFavoriteFlag(row.is_favorite, 0) === 1,
|
||||
orderIndex: Number(row.order_index || 0),
|
||||
createdAt: row.created_at,
|
||||
updatedAt: row.updated_at
|
||||
@@ -347,7 +325,7 @@ class ScriptService {
|
||||
const db = await getDb();
|
||||
const rows = await db.all(
|
||||
`
|
||||
SELECT id, name, script_body, is_favorite, order_index, created_at, updated_at
|
||||
SELECT id, name, script_body, order_index, created_at, updated_at
|
||||
FROM scripts
|
||||
ORDER BY order_index ASC, id ASC
|
||||
`
|
||||
@@ -363,7 +341,7 @@ class ScriptService {
|
||||
const db = await getDb();
|
||||
const row = await db.get(
|
||||
`
|
||||
SELECT id, name, script_body, is_favorite, order_index, created_at, updated_at
|
||||
SELECT id, name, script_body, order_index, created_at, updated_at
|
||||
FROM scripts
|
||||
WHERE id = ?
|
||||
`,
|
||||
@@ -384,8 +362,8 @@ class ScriptService {
|
||||
const nextOrderIndex = await this._getNextOrderIndex(db);
|
||||
const result = await db.run(
|
||||
`
|
||||
INSERT INTO scripts (name, script_body, is_favorite, order_index, created_at, updated_at)
|
||||
VALUES (?, ?, 0, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
INSERT INTO scripts (name, script_body, order_index, created_at, updated_at)
|
||||
VALUES (?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
`,
|
||||
[normalized.name, normalized.scriptBody, nextOrderIndex]
|
||||
);
|
||||
@@ -442,25 +420,6 @@ class ScriptService {
|
||||
return existing;
|
||||
}
|
||||
|
||||
async setScriptFavorite(scriptId, isFavorite) {
|
||||
const normalizedId = normalizeScriptId(scriptId);
|
||||
if (!normalizedId) {
|
||||
throw createValidationError('Ungültige scriptId.');
|
||||
}
|
||||
const favoriteFlag = normalizeFavoriteFlag(isFavorite, 0);
|
||||
const db = await getDb();
|
||||
await this.getScriptById(normalizedId);
|
||||
await db.run(
|
||||
`
|
||||
UPDATE scripts
|
||||
SET is_favorite = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
`,
|
||||
[favoriteFlag, normalizedId]
|
||||
);
|
||||
return this.getScriptById(normalizedId);
|
||||
}
|
||||
|
||||
async getScriptsByIds(rawIds = []) {
|
||||
const ids = normalizeScriptIdList(rawIds);
|
||||
if (ids.length === 0) {
|
||||
@@ -470,7 +429,7 @@ class ScriptService {
|
||||
const placeholders = ids.map(() => '?').join(', ');
|
||||
const rows = await db.all(
|
||||
`
|
||||
SELECT id, name, script_body, is_favorite, order_index, created_at, updated_at
|
||||
SELECT id, name, script_body, order_index, created_at, updated_at
|
||||
FROM scripts
|
||||
WHERE id IN (${placeholders})
|
||||
`,
|
||||
@@ -573,9 +532,8 @@ class ScriptService {
|
||||
async createExecutableScriptFile(script, context = {}) {
|
||||
const name = String(script?.name || '').trim() || `script-${script?.id || 'unknown'}`;
|
||||
const scriptBody = normalizeScriptBody(script?.scriptBody);
|
||||
fs.mkdirSync(tempDir, { recursive: true });
|
||||
const scriptTempDir = await fs.promises.mkdtemp(path.join(tempDir, 'ripster-script-'));
|
||||
const scriptPath = path.join(scriptTempDir, 'script.sh');
|
||||
const tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'ripster-script-'));
|
||||
const scriptPath = path.join(tempDir, 'script.sh');
|
||||
const wrapped = buildScriptWrapper(scriptBody, {
|
||||
...context,
|
||||
scriptId: script?.id ?? context?.scriptId ?? '',
|
||||
@@ -590,19 +548,19 @@ class ScriptService {
|
||||
|
||||
const cleanup = async () => {
|
||||
try {
|
||||
await fs.promises.rm(scriptTempDir, { recursive: true, force: true });
|
||||
await fs.promises.rm(tempDir, { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
logger.warn('script:temp-cleanup-failed', {
|
||||
scriptId: script?.id ?? null,
|
||||
scriptName: name,
|
||||
tempDir: scriptTempDir,
|
||||
tempDir,
|
||||
error: errorToMeta(error)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
tempDir: scriptTempDir,
|
||||
tempDir,
|
||||
scriptPath,
|
||||
cmd: '/usr/bin/env',
|
||||
args: ['bash', scriptPath],
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { spawn, spawnSync } = require('child_process');
|
||||
const { getDb } = require('../db/database');
|
||||
const loggerService = require('./logger');
|
||||
const logger = loggerService.child('SETTINGS');
|
||||
const logger = require('./logger').child('SETTINGS');
|
||||
const {
|
||||
parseJson,
|
||||
normalizeValueByType,
|
||||
serializeValueByType,
|
||||
validateSetting,
|
||||
toBoolean
|
||||
validateSetting
|
||||
} = require('../utils/validators');
|
||||
const { splitArgs } = require('../utils/commandLine');
|
||||
const { setLogRootDir } = require('./logPathService');
|
||||
const {
|
||||
syncRegistrationKeyToConfig,
|
||||
normalizeRegistrationKey
|
||||
} = require('./makemkvKeyService');
|
||||
|
||||
const {
|
||||
defaultRawDir: DEFAULT_RAW_DIR,
|
||||
@@ -28,8 +23,7 @@ const {
|
||||
defaultDownloadDir: DEFAULT_DOWNLOAD_DIR,
|
||||
defaultConverterRawDir: DEFAULT_CONVERTER_RAW_DIR,
|
||||
defaultConverterMovieDir: DEFAULT_CONVERTER_MOVIE_DIR,
|
||||
defaultConverterAudioDir: DEFAULT_CONVERTER_AUDIO_DIR,
|
||||
tempDir: DEFAULT_TEMP_DIR
|
||||
defaultConverterAudioDir: DEFAULT_CONVERTER_AUDIO_DIR
|
||||
} = require('../config');
|
||||
|
||||
const DEFAULT_AUDIO_COPY_MASK = ['copy:aac', 'copy:ac3', 'copy:eac3', 'copy:truehd', 'copy:dts', 'copy:dtshd', 'copy:mp3', 'copy:flac'];
|
||||
@@ -44,24 +38,11 @@ const HANDBRAKE_PRESET_RELEVANT_SETTING_KEYS = new Set([
|
||||
]);
|
||||
const SENSITIVE_SETTING_KEYS = new Set([
|
||||
'makemkv_registration_key',
|
||||
'omdb_api_key',
|
||||
'tmdb_api_read_access_token',
|
||||
'pushover_token',
|
||||
'pushover_user'
|
||||
]);
|
||||
const LEGACY_HIDDEN_SETTING_KEYS = new Set([
|
||||
'omdb_api_key',
|
||||
'omdb_default_type',
|
||||
'omdb_timeout_ms'
|
||||
]);
|
||||
const IMMUTABLE_SETTING_KEYS = new Set([
|
||||
'makemkv_command',
|
||||
'mediainfo_command',
|
||||
'handbrake_command',
|
||||
'ffmpeg_command',
|
||||
'ffprobe_command',
|
||||
'cdparanoia_command',
|
||||
'mkvmerge_command'
|
||||
]);
|
||||
const AUDIO_SELECTION_KEYS_WITH_VALUE = new Set(['-a', '--audio', '--audio-lang-list']);
|
||||
const AUDIO_SELECTION_KEYS_FLAG_ONLY = new Set(['--all-audio', '--first-audio']);
|
||||
const SUBTITLE_SELECTION_KEYS_WITH_VALUE = new Set(['-s', '--subtitle', '--subtitle-lang-list']);
|
||||
@@ -69,21 +50,6 @@ const SUBTITLE_SELECTION_KEYS_FLAG_ONLY = new Set(['--all-subtitles', '--first-s
|
||||
const SUBTITLE_FLAG_KEYS_WITH_VALUE = new Set(['--subtitle-burned', '--subtitle-default', '--subtitle-forced']);
|
||||
const TITLE_SELECTION_KEYS_WITH_VALUE = new Set(['-t', '--title']);
|
||||
const LOG_DIR_SETTING_KEY = 'log_dir';
|
||||
const SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY = 'server_console_log_output_enabled';
|
||||
const SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY = 'server_console_log_http_enabled';
|
||||
const SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY = 'server_console_log_debug_enabled';
|
||||
const SERVER_CONSOLE_LOG_INFO_ENABLED_KEY = 'server_console_log_info_enabled';
|
||||
const SERVER_CONSOLE_LOG_WARN_ENABLED_KEY = 'server_console_log_warn_enabled';
|
||||
const SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY = 'server_console_log_error_enabled';
|
||||
const SERVER_CONSOLE_LOG_SETTING_KEYS = new Set([
|
||||
SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY,
|
||||
SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY,
|
||||
SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY,
|
||||
SERVER_CONSOLE_LOG_INFO_ENABLED_KEY,
|
||||
SERVER_CONSOLE_LOG_WARN_ENABLED_KEY,
|
||||
SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY
|
||||
]);
|
||||
const MAKEMKV_REGISTRATION_KEY_SETTING_KEY = 'makemkv_registration_key';
|
||||
const MEDIA_PROFILES = ['bluray', 'dvd', 'cd', 'audiobook'];
|
||||
const PROFILED_SETTINGS = {
|
||||
raw_dir: {
|
||||
@@ -99,11 +65,9 @@ const PROFILED_SETTINGS = {
|
||||
audiobook: 'raw_dir_audiobook_owner'
|
||||
},
|
||||
series_raw_dir: {
|
||||
bluray: 'raw_dir_bluray_series',
|
||||
dvd: 'raw_dir_dvd_series'
|
||||
},
|
||||
series_raw_dir_owner: {
|
||||
bluray: 'raw_dir_bluray_series_owner',
|
||||
dvd: 'raw_dir_dvd_series_owner'
|
||||
},
|
||||
movie_dir: {
|
||||
@@ -113,7 +77,6 @@ const PROFILED_SETTINGS = {
|
||||
audiobook: 'movie_dir_audiobook'
|
||||
},
|
||||
series_dir: {
|
||||
bluray: 'series_dir_bluray',
|
||||
dvd: 'series_dir_dvd'
|
||||
},
|
||||
movie_dir_owner: {
|
||||
@@ -123,7 +86,6 @@ const PROFILED_SETTINGS = {
|
||||
audiobook: 'movie_dir_audiobook_owner'
|
||||
},
|
||||
series_dir_owner: {
|
||||
bluray: 'series_dir_bluray_owner',
|
||||
dvd: 'series_dir_dvd_owner'
|
||||
},
|
||||
mediainfo_extra_args: {
|
||||
@@ -150,14 +112,6 @@ const PROFILED_SETTINGS = {
|
||||
bluray: 'handbrake_extra_args_bluray',
|
||||
dvd: 'handbrake_extra_args_dvd'
|
||||
},
|
||||
handbrake_review_audio_languages: {
|
||||
bluray: 'handbrake_review_audio_languages_bluray',
|
||||
dvd: 'handbrake_review_audio_languages_dvd'
|
||||
},
|
||||
handbrake_review_subtitle_languages: {
|
||||
bluray: 'handbrake_review_subtitle_languages_bluray',
|
||||
dvd: 'handbrake_review_subtitle_languages_dvd'
|
||||
},
|
||||
output_extension: {
|
||||
bluray: 'output_extension_bluray',
|
||||
dvd: 'output_extension_dvd'
|
||||
@@ -201,44 +155,6 @@ function applyRuntimeLogDirSetting(rawValue) {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeBooleanSetting(rawValue, fallback = true) {
|
||||
const normalizedRaw = typeof rawValue === 'string' ? rawValue.trim() : rawValue;
|
||||
if (normalizedRaw === null || normalizedRaw === undefined || normalizedRaw === '') {
|
||||
return fallback;
|
||||
}
|
||||
return toBoolean(normalizedRaw);
|
||||
}
|
||||
|
||||
function isHiddenSettingKey(key) {
|
||||
const normalized = String(key || '').trim().toLowerCase();
|
||||
return LEGACY_HIDDEN_SETTING_KEYS.has(normalized);
|
||||
}
|
||||
|
||||
function applyRuntimeServerConsoleLoggingSettingsFromMap(settingsMap = {}) {
|
||||
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
|
||||
const enabled = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY], true);
|
||||
const http = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY], true);
|
||||
const debug = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY], true);
|
||||
const info = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_INFO_ENABLED_KEY], true);
|
||||
const warn = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_WARN_ENABLED_KEY], true);
|
||||
const error = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY], true);
|
||||
const applied = loggerService.configureConsoleOutput({
|
||||
enabled,
|
||||
http,
|
||||
levels: {
|
||||
debug,
|
||||
info,
|
||||
warn,
|
||||
error
|
||||
}
|
||||
});
|
||||
return applied;
|
||||
}
|
||||
|
||||
function isImmutableSettingKey(key) {
|
||||
return IMMUTABLE_SETTING_KEYS.has(String(key || '').trim().toLowerCase());
|
||||
}
|
||||
|
||||
function normalizeTrackIds(rawList) {
|
||||
const list = Array.isArray(rawList) ? rawList : [];
|
||||
const seen = new Set();
|
||||
@@ -316,38 +232,12 @@ function removeSelectionArgs(extraArgs) {
|
||||
|
||||
const isAudioWithValue = AUDIO_SELECTION_KEYS_WITH_VALUE.has(key);
|
||||
const isAudioFlagOnly = AUDIO_SELECTION_KEYS_FLAG_ONLY.has(key);
|
||||
const isSubtitleSelectionWithValue = SUBTITLE_SELECTION_KEYS_WITH_VALUE.has(key);
|
||||
const isSubtitleFlagWithValue = SUBTITLE_FLAG_KEYS_WITH_VALUE.has(key);
|
||||
const isSubtitleWithValue = isSubtitleSelectionWithValue || isSubtitleFlagWithValue;
|
||||
const isSubtitleWithValue = SUBTITLE_SELECTION_KEYS_WITH_VALUE.has(key)
|
||||
|| SUBTITLE_FLAG_KEYS_WITH_VALUE.has(key);
|
||||
const isSubtitleFlagOnly = SUBTITLE_SELECTION_KEYS_FLAG_ONLY.has(key);
|
||||
const isTitleWithValue = TITLE_SELECTION_KEYS_WITH_VALUE.has(key);
|
||||
const skip = isAudioWithValue || isAudioFlagOnly || isSubtitleWithValue || isSubtitleFlagOnly || isTitleWithValue;
|
||||
|
||||
if (isSubtitleFlagWithValue) {
|
||||
const inlineValue = token.includes('=')
|
||||
? token.slice(token.indexOf('=') + 1)
|
||||
: '';
|
||||
const hasAttachedValue = token.includes('=');
|
||||
const nextToken = String(args[i + 1] || '');
|
||||
const hasSeparateValue = !hasAttachedValue && nextToken && !nextToken.startsWith('-');
|
||||
const candidateValue = String(
|
||||
hasAttachedValue
|
||||
? inlineValue
|
||||
: (hasSeparateValue ? nextToken : '')
|
||||
).trim().toLowerCase();
|
||||
|
||||
// Keep explicit "none" subtitle flags from extra args.
|
||||
// This allows users to intentionally clear subtitle burn/default/forced behavior.
|
||||
if (candidateValue === 'none') {
|
||||
filtered.push(token);
|
||||
if (hasSeparateValue) {
|
||||
filtered.push(nextToken);
|
||||
i += 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
filtered.push(token);
|
||||
continue;
|
||||
@@ -899,8 +789,7 @@ class SettingsService {
|
||||
|
||||
async getSchemaRows() {
|
||||
const db = await getDb();
|
||||
const rows = await db.all('SELECT * FROM settings_schema ORDER BY category ASC, order_index ASC');
|
||||
return rows.filter((row) => !isHiddenSettingKey(row?.key));
|
||||
return db.all('SELECT * FROM settings_schema ORDER BY category ASC, order_index ASC');
|
||||
}
|
||||
|
||||
async getSettingsMap(options = {}) {
|
||||
@@ -908,21 +797,6 @@ class SettingsService {
|
||||
return { ...(snapshot?.map || {}) };
|
||||
}
|
||||
|
||||
applyRuntimeSettingsFromMap(settingsMap = {}) {
|
||||
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
|
||||
const logDir = applyRuntimeLogDirSetting(source[LOG_DIR_SETTING_KEY]);
|
||||
const consoleLogConfig = applyRuntimeServerConsoleLoggingSettingsFromMap(source);
|
||||
return {
|
||||
logDir,
|
||||
serverConsoleLogConfig: consoleLogConfig
|
||||
};
|
||||
}
|
||||
|
||||
async applyRuntimeSettings() {
|
||||
const map = await this.getSettingsMap();
|
||||
return this.applyRuntimeSettingsFromMap(map);
|
||||
}
|
||||
|
||||
normalizeMediaProfile(value) {
|
||||
return normalizeMediaProfileValue(value);
|
||||
}
|
||||
@@ -1003,12 +877,7 @@ class SettingsService {
|
||||
const cd = this.resolveEffectiveToolSettings(map, 'cd');
|
||||
const audiobook = this.resolveEffectiveToolSettings(map, 'audiobook');
|
||||
return {
|
||||
bluray: {
|
||||
raw: bluray.raw_dir,
|
||||
seriesRaw: bluray.series_raw_dir || bluray.raw_dir,
|
||||
movies: bluray.movie_dir,
|
||||
series: bluray.series_dir
|
||||
},
|
||||
bluray: { raw: bluray.raw_dir, movies: bluray.movie_dir },
|
||||
dvd: { raw: dvd.raw_dir, seriesRaw: dvd.series_raw_dir || dvd.raw_dir, movies: dvd.movie_dir, series: dvd.series_dir },
|
||||
cd: { raw: cd.raw_dir, movies: cd.movie_dir },
|
||||
audiobook: { raw: audiobook.raw_dir, movies: audiobook.movie_dir },
|
||||
@@ -1056,9 +925,7 @@ class SettingsService {
|
||||
`
|
||||
);
|
||||
|
||||
return rows
|
||||
.filter((row) => !isHiddenSettingKey(row?.key))
|
||||
.map((row) => ({
|
||||
return rows.map((row) => ({
|
||||
key: row.key,
|
||||
category: row.category,
|
||||
label: row.label,
|
||||
@@ -1071,7 +938,7 @@ class SettingsService {
|
||||
value: normalizeValueByType(row.type, row.current_value ?? row.default_value),
|
||||
orderIndex: row.order_index,
|
||||
depends_on: row.depends_on ?? null
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
async getFlatSettings(options = {}) {
|
||||
@@ -1085,12 +952,6 @@ class SettingsService {
|
||||
}
|
||||
|
||||
async setSettingValue(key, rawValue) {
|
||||
if (isImmutableSettingKey(key)) {
|
||||
const error = new Error(`Setting ${key} ist schreibgeschützt und kann nicht geändert werden.`);
|
||||
error.statusCode = 403;
|
||||
throw error;
|
||||
}
|
||||
|
||||
const db = await getDb();
|
||||
const schema = await db.get('SELECT * FROM settings_schema WHERE key = ?', [key]);
|
||||
if (!schema) {
|
||||
@@ -1107,39 +968,24 @@ class SettingsService {
|
||||
}
|
||||
|
||||
const serializedValue = serializeValueByType(schema.type, result.normalized);
|
||||
const normalizedKey = String(key || '').trim().toLowerCase();
|
||||
|
||||
try {
|
||||
await db.exec('BEGIN');
|
||||
await db.run(
|
||||
`
|
||||
INSERT INTO settings_values (key, value, updated_at)
|
||||
VALUES (?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT(key) DO UPDATE SET
|
||||
value = excluded.value,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
`,
|
||||
[key, serializedValue]
|
||||
);
|
||||
if (normalizedKey === MAKEMKV_REGISTRATION_KEY_SETTING_KEY) {
|
||||
await syncRegistrationKeyToConfig(result.normalized);
|
||||
}
|
||||
await db.exec('COMMIT');
|
||||
} catch (error) {
|
||||
await db.exec('ROLLBACK');
|
||||
throw error;
|
||||
}
|
||||
await db.run(
|
||||
`
|
||||
INSERT INTO settings_values (key, value, updated_at)
|
||||
VALUES (?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT(key) DO UPDATE SET
|
||||
value = excluded.value,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
`,
|
||||
[key, serializedValue]
|
||||
);
|
||||
logger.info('setting:updated', {
|
||||
key,
|
||||
value: SENSITIVE_SETTING_KEYS.has(String(key || '').trim().toLowerCase()) ? '[redacted]' : result.normalized
|
||||
});
|
||||
if (normalizedKey === LOG_DIR_SETTING_KEY) {
|
||||
if (String(key || '').trim().toLowerCase() === LOG_DIR_SETTING_KEY) {
|
||||
applyRuntimeLogDirSetting(result.normalized);
|
||||
}
|
||||
if (SERVER_CONSOLE_LOG_SETTING_KEYS.has(normalizedKey)) {
|
||||
const map = await this.getSettingsMap({ forceRefresh: true });
|
||||
applyRuntimeServerConsoleLoggingSettingsFromMap(map);
|
||||
}
|
||||
this.invalidateSettingsCache([key]);
|
||||
|
||||
return {
|
||||
@@ -1167,14 +1013,6 @@ class SettingsService {
|
||||
const validationErrors = [];
|
||||
|
||||
for (const [key, rawValue] of entries) {
|
||||
if (isImmutableSettingKey(key)) {
|
||||
validationErrors.push({
|
||||
key,
|
||||
message: 'Dieses Setting ist schreibgeschützt und kann nicht geändert werden.'
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
const schema = schemaByKey.get(key);
|
||||
if (!schema) {
|
||||
const error = new Error(`Setting ${key} existiert nicht.`);
|
||||
@@ -1200,9 +1038,7 @@ class SettingsService {
|
||||
|
||||
if (validationErrors.length > 0) {
|
||||
const error = new Error('Mindestens ein Setting ist ungültig.');
|
||||
error.statusCode = validationErrors.some((item) => String(item?.message || '').includes('schreibgeschützt'))
|
||||
? 403
|
||||
: 400;
|
||||
error.statusCode = 400;
|
||||
error.details = validationErrors;
|
||||
throw error;
|
||||
}
|
||||
@@ -1221,12 +1057,6 @@ class SettingsService {
|
||||
[item.key, item.serializedValue]
|
||||
);
|
||||
}
|
||||
const makemkvKeyChange = normalizedEntries.find(
|
||||
(item) => String(item?.key || '').trim().toLowerCase() === MAKEMKV_REGISTRATION_KEY_SETTING_KEY
|
||||
);
|
||||
if (makemkvKeyChange) {
|
||||
await syncRegistrationKeyToConfig(makemkvKeyChange.value);
|
||||
}
|
||||
await db.exec('COMMIT');
|
||||
} catch (error) {
|
||||
await db.exec('ROLLBACK');
|
||||
@@ -1239,13 +1069,6 @@ class SettingsService {
|
||||
if (logDirChange) {
|
||||
applyRuntimeLogDirSetting(logDirChange.value);
|
||||
}
|
||||
const consoleOutputChange = normalizedEntries.find(
|
||||
(item) => SERVER_CONSOLE_LOG_SETTING_KEYS.has(String(item?.key || '').trim().toLowerCase())
|
||||
);
|
||||
if (consoleOutputChange) {
|
||||
const map = await this.getSettingsMap({ forceRefresh: true });
|
||||
applyRuntimeServerConsoleLoggingSettingsFromMap(map);
|
||||
}
|
||||
|
||||
this.invalidateSettingsCache(normalizedEntries.map((item) => item.key));
|
||||
logger.info('settings:bulk-updated', { count: normalizedEntries.length });
|
||||
@@ -1263,17 +1086,16 @@ class SettingsService {
|
||||
);
|
||||
const cmd = map.makemkv_command;
|
||||
const extraArgs = splitArgs(map.makemkv_analyze_extra_args);
|
||||
const disableMinLengthFilter = Boolean(options?.disableMinLengthFilter);
|
||||
const hasExplicitMinLength = extraArgs.some((arg) => /^--minlength(?:=|$)/i.test(String(arg || '').trim()));
|
||||
const minLengthMinutes = Number(map.makemkv_min_length_minutes || 0);
|
||||
const minLengthSeconds = Number.isFinite(minLengthMinutes) && minLengthMinutes > 0
|
||||
? Math.round(minLengthMinutes * 60)
|
||||
: 0;
|
||||
const minLengthArgs = (!disableMinLengthFilter && !hasExplicitMinLength && minLengthSeconds > 0)
|
||||
const minLengthArgs = (!hasExplicitMinLength && minLengthSeconds > 0)
|
||||
? [`--minlength=${minLengthSeconds}`]
|
||||
: [];
|
||||
const args = ['-r', ...minLengthArgs, ...extraArgs, 'info', this.resolveSourceArg(map, deviceInfo)];
|
||||
logger.debug('cli:makemkv:analyze', { cmd, args, deviceInfo, disableMinLengthFilter });
|
||||
logger.debug('cli:makemkv:analyze', { cmd, args, deviceInfo });
|
||||
return { cmd, args };
|
||||
}
|
||||
|
||||
@@ -1283,13 +1105,12 @@ class SettingsService {
|
||||
const cmd = map.makemkv_command;
|
||||
const sourceArg = `file:${sourcePath}`;
|
||||
const extraArgs = splitArgs(map.makemkv_analyze_extra_args);
|
||||
const disableMinLengthFilter = Boolean(options?.disableMinLengthFilter);
|
||||
const hasExplicitMinLength = extraArgs.some((arg) => /^--minlength(?:=|$)/i.test(String(arg || '').trim()));
|
||||
const minLengthMinutes = Number(map.makemkv_min_length_minutes || 0);
|
||||
const minLengthSeconds = Number.isFinite(minLengthMinutes) && minLengthMinutes > 0
|
||||
? Math.round(minLengthMinutes * 60)
|
||||
: 0;
|
||||
const minLengthArgs = (!disableMinLengthFilter && !hasExplicitMinLength && minLengthSeconds > 0)
|
||||
const minLengthArgs = (!hasExplicitMinLength && minLengthSeconds > 0)
|
||||
? [`--minlength=${minLengthSeconds}`]
|
||||
: [];
|
||||
const args = ['-r', ...minLengthArgs, ...extraArgs, 'info', sourceArg];
|
||||
@@ -1299,7 +1120,6 @@ class SettingsService {
|
||||
cmd,
|
||||
args,
|
||||
sourcePath,
|
||||
disableMinLengthFilter,
|
||||
requestedTitleId: Number.isFinite(titleIdRaw) && titleIdRaw >= 0 ? Math.trunc(titleIdRaw) : null
|
||||
});
|
||||
return { cmd, args, sourceArg };
|
||||
@@ -1315,8 +1135,7 @@ class SettingsService {
|
||||
const ripMode = String(map.makemkv_rip_mode || 'mkv').trim().toLowerCase() === 'backup'
|
||||
? 'backup'
|
||||
: 'mkv';
|
||||
const sourceArgOverride = String(options?.sourceArgOverride || '').trim();
|
||||
const sourceArg = sourceArgOverride || this.resolveSourceArg(map, deviceInfo);
|
||||
const sourceArg = this.resolveSourceArg(map, deviceInfo);
|
||||
const rawSelectedTitleId = normalizeNonNegativeInteger(options?.selectedTitleId);
|
||||
const disableMinLengthFilter = Boolean(options?.disableMinLengthFilter);
|
||||
const parsedExtra = splitArgs(map.makemkv_rip_extra_args);
|
||||
@@ -1350,7 +1169,6 @@ class SettingsService {
|
||||
if (hasExplicitTitle) {
|
||||
baseArgs = [
|
||||
'-r', '--progress=-same',
|
||||
'--decrypt',
|
||||
'mkv',
|
||||
sourceArg,
|
||||
targetTitle,
|
||||
@@ -1362,7 +1180,6 @@ class SettingsService {
|
||||
: [];
|
||||
baseArgs = [
|
||||
'-r', '--progress=-same',
|
||||
'--decrypt',
|
||||
...minLengthArgs,
|
||||
'mkv',
|
||||
sourceArg,
|
||||
@@ -1385,15 +1202,20 @@ class SettingsService {
|
||||
return { cmd, args: [...baseArgs, ...extra] };
|
||||
}
|
||||
|
||||
async syncMakeMKVRegistrationKeyFromSettings(options = {}) {
|
||||
const map = options?.settingsMap || await this.getSettingsMap();
|
||||
const registrationKey = normalizeRegistrationKey(map?.makemkv_registration_key);
|
||||
const fileInfo = await syncRegistrationKeyToConfig(registrationKey, options);
|
||||
async buildMakeMKVRegisterConfig() {
|
||||
const map = await this.getSettingsMap();
|
||||
const registrationKey = String(map.makemkv_registration_key || '').trim();
|
||||
if (!registrationKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const cmd = map.makemkv_command || 'makemkvcon';
|
||||
const args = ['reg', registrationKey];
|
||||
logger.debug('cli:makemkv:register', { cmd, args: ['reg', '<redacted>'] });
|
||||
return {
|
||||
applied: Boolean(registrationKey),
|
||||
key: registrationKey || null,
|
||||
path: fileInfo?.path || null,
|
||||
changed: Boolean(fileInfo?.changed)
|
||||
cmd,
|
||||
args,
|
||||
argsForLog: ['reg', '<redacted>']
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1550,7 +1372,7 @@ class SettingsService {
|
||||
const cmd = map.handbrake_command || 'HandBrakeCLI';
|
||||
const sourceArg = this.resolveHandBrakeSourceArg(map, deviceInfo);
|
||||
// Match legacy rip.sh behavior: scan all titles, then decide in app logic.
|
||||
const args = ['--scan', '--json', '-i', sourceArg];
|
||||
const args = ['--scan', '--json', '-i', sourceArg, '-t', '0'];
|
||||
logger.debug('cli:handbrake:scan', {
|
||||
cmd,
|
||||
args,
|
||||
@@ -1600,8 +1422,7 @@ class SettingsService {
|
||||
}
|
||||
|
||||
const exportName = `ripster-export-${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
||||
fs.mkdirSync(DEFAULT_TEMP_DIR, { recursive: true });
|
||||
const exportFile = path.join(DEFAULT_TEMP_DIR, `${exportName}.json`);
|
||||
const exportFile = path.join(os.tmpdir(), `${exportName}.json`);
|
||||
const args = [
|
||||
'--scan',
|
||||
'-i',
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const logger = require('./logger').child('TEMP_CLEANUP');
|
||||
const { tempDir } = require('../config');
|
||||
|
||||
const TMP_ROOT = tempDir;
|
||||
const SWEEP_INTERVAL_MS = 60 * 60 * 1000;
|
||||
const STALE_ENTRY_MIN_AGE_MS = 12 * 60 * 60 * 1000;
|
||||
|
||||
const TOP_LEVEL_PREFIXES = [
|
||||
'ripster-merge-',
|
||||
'ripster-script-',
|
||||
'ripster-export-'
|
||||
];
|
||||
|
||||
const MANAGED_UPLOAD_DIRS = [
|
||||
'ripster-converter-uploads',
|
||||
'ripster-audiobook-uploads'
|
||||
];
|
||||
|
||||
function getEntryAgeMs(stats) {
|
||||
const referenceTime = Math.max(
|
||||
Number(stats?.mtimeMs) || 0,
|
||||
Number(stats?.ctimeMs) || 0,
|
||||
Number(stats?.birthtimeMs) || 0
|
||||
);
|
||||
return Date.now() - referenceTime;
|
||||
}
|
||||
|
||||
function isStale(stats, minAgeMs = STALE_ENTRY_MIN_AGE_MS) {
|
||||
return getEntryAgeMs(stats) >= minAgeMs;
|
||||
}
|
||||
|
||||
function removeEntry(targetPath, stats) {
|
||||
const isDirectory = stats?.isDirectory?.() || false;
|
||||
fs.rmSync(targetPath, {
|
||||
recursive: isDirectory,
|
||||
force: true
|
||||
});
|
||||
}
|
||||
|
||||
class TempCleanupService {
|
||||
constructor() {
|
||||
this.interval = null;
|
||||
}
|
||||
|
||||
async init() {
|
||||
await this.runSweep('startup');
|
||||
|
||||
if (!this.interval) {
|
||||
this.interval = setInterval(() => {
|
||||
this.runSweep('interval').catch((error) => {
|
||||
logger.warn('temp:sweep:interval-failed', { error: error?.message || String(error) });
|
||||
});
|
||||
}, SWEEP_INTERVAL_MS);
|
||||
this.interval.unref?.();
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
|
||||
async runSweep(reason = 'manual') {
|
||||
fs.mkdirSync(TMP_ROOT, { recursive: true });
|
||||
const deleted = [];
|
||||
const skipped = [];
|
||||
const failed = [];
|
||||
|
||||
let topLevelEntries = [];
|
||||
try {
|
||||
topLevelEntries = fs.readdirSync(TMP_ROOT, { withFileTypes: true });
|
||||
} catch (error) {
|
||||
logger.warn('temp:sweep:readdir-failed', {
|
||||
reason,
|
||||
tmpRoot: TMP_ROOT,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return { deleted, skipped, failed };
|
||||
}
|
||||
|
||||
for (const entry of topLevelEntries) {
|
||||
const entryName = String(entry?.name || '').trim();
|
||||
if (!entryName || !TOP_LEVEL_PREFIXES.some((prefix) => entryName.startsWith(prefix))) {
|
||||
continue;
|
||||
}
|
||||
const targetPath = path.join(TMP_ROOT, entryName);
|
||||
try {
|
||||
const stats = fs.lstatSync(targetPath);
|
||||
if (!isStale(stats)) {
|
||||
skipped.push({ path: targetPath, reason: 'fresh-top-level-entry' });
|
||||
continue;
|
||||
}
|
||||
removeEntry(targetPath, stats);
|
||||
deleted.push(targetPath);
|
||||
} catch (error) {
|
||||
failed.push({
|
||||
path: targetPath,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const dirName of MANAGED_UPLOAD_DIRS) {
|
||||
const uploadDir = path.join(TMP_ROOT, dirName);
|
||||
if (!fs.existsSync(uploadDir)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let uploadEntries = [];
|
||||
try {
|
||||
uploadEntries = fs.readdirSync(uploadDir, { withFileTypes: true });
|
||||
} catch (error) {
|
||||
failed.push({
|
||||
path: uploadDir,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const entry of uploadEntries) {
|
||||
const targetPath = path.join(uploadDir, entry.name);
|
||||
try {
|
||||
const stats = fs.lstatSync(targetPath);
|
||||
if (!isStale(stats)) {
|
||||
skipped.push({ path: targetPath, reason: 'fresh-upload-entry' });
|
||||
continue;
|
||||
}
|
||||
removeEntry(targetPath, stats);
|
||||
deleted.push(targetPath);
|
||||
} catch (error) {
|
||||
failed.push({
|
||||
path: targetPath,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info('temp:sweep:completed', {
|
||||
reason,
|
||||
tmpRoot: TMP_ROOT,
|
||||
deletedCount: deleted.length,
|
||||
skippedCount: skipped.length,
|
||||
failedCount: failed.length,
|
||||
deleted: deleted.slice(0, 50),
|
||||
failed: failed.slice(0, 20)
|
||||
});
|
||||
|
||||
return { deleted, skipped, failed };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new TempCleanupService();
|
||||
@@ -5,101 +5,9 @@ const logger = require('./logger').child('TMDB');
|
||||
|
||||
const TMDB_BASE_URL = 'https://api.themoviedb.org/3';
|
||||
const TMDB_IMAGE_BASE_URL = 'https://image.tmdb.org/t/p';
|
||||
const TMDB_TIMEOUT_MS = 15000;
|
||||
const TMDB_TIMEOUT_MS = 10000;
|
||||
|
||||
class TmdbService {
|
||||
hasCreditsPayload(details = null) {
|
||||
const credits = details?.credits && typeof details.credits === 'object'
|
||||
? details.credits
|
||||
: null;
|
||||
if (!credits) {
|
||||
return false;
|
||||
}
|
||||
const crew = Array.isArray(credits.crew) ? credits.crew : [];
|
||||
const cast = Array.isArray(credits.cast) ? credits.cast : [];
|
||||
return crew.length > 0 || cast.length > 0;
|
||||
}
|
||||
|
||||
mergeCreditsIntoDetails(details = null, credits = null) {
|
||||
const sourceDetails = details && typeof details === 'object' ? details : {};
|
||||
const sourceCredits = credits && typeof credits === 'object' ? credits : null;
|
||||
if (!sourceCredits) {
|
||||
return sourceDetails;
|
||||
}
|
||||
return {
|
||||
...sourceDetails,
|
||||
credits: {
|
||||
...(sourceDetails?.credits && typeof sourceDetails.credits === 'object' ? sourceDetails.credits : {}),
|
||||
...(sourceCredits && typeof sourceCredits === 'object' ? sourceCredits : {})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
extractDirectorNames(crewValues = []) {
|
||||
const crew = Array.isArray(crewValues) ? crewValues : [];
|
||||
const byJob = this.normalizeNameList(
|
||||
crew.filter((member) => String(member?.job || '').trim().toLowerCase() === 'director'),
|
||||
{ maxItems: 5 }
|
||||
);
|
||||
if (byJob.length > 0) {
|
||||
return byJob;
|
||||
}
|
||||
// Fallback for edge cases where "Director" job is missing in localized/partial payloads.
|
||||
return this.normalizeNameList(
|
||||
crew.filter((member) => String(member?.department || '').trim().toLowerCase() === 'directing'),
|
||||
{ maxItems: 5 }
|
||||
);
|
||||
}
|
||||
|
||||
isAbortError(error) {
|
||||
const name = String(error?.name || '').trim().toLowerCase();
|
||||
const message = String(error?.message || '').trim().toLowerCase();
|
||||
return name === 'aborterror' || message.includes('aborted');
|
||||
}
|
||||
|
||||
classifyRequestError(error) {
|
||||
if (this.isAbortError(error)) {
|
||||
return 'timeout';
|
||||
}
|
||||
const statusCode = Number(error?.statusCode || 0) || null;
|
||||
if (statusCode === 401 || statusCode === 403) {
|
||||
return 'auth';
|
||||
}
|
||||
if (statusCode >= 500) {
|
||||
return 'upstream';
|
||||
}
|
||||
if (statusCode >= 400) {
|
||||
return 'request_failed';
|
||||
}
|
||||
return 'network';
|
||||
}
|
||||
|
||||
readFailureCode(rows) {
|
||||
const value = rows && typeof rows.tmdbFailureCode === 'string'
|
||||
? rows.tmdbFailureCode
|
||||
: '';
|
||||
const normalized = String(value || '').trim().toLowerCase();
|
||||
return normalized || null;
|
||||
}
|
||||
|
||||
attachFailureCode(rows, failureCode = null) {
|
||||
const output = Array.isArray(rows) ? rows : [];
|
||||
const normalized = String(failureCode || '').trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return output;
|
||||
}
|
||||
try {
|
||||
Object.defineProperty(output, 'tmdbFailureCode', {
|
||||
value: normalized,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
} catch (_error) {
|
||||
output.tmdbFailureCode = normalized;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
normalizeNameList(values = [], options = {}) {
|
||||
const maxItems = Math.max(1, Number(options.maxItems || 10));
|
||||
const source = Array.isArray(values) ? values : [];
|
||||
@@ -146,11 +54,9 @@ class TmdbService {
|
||||
|
||||
async getConfig() {
|
||||
const settings = await settingsService.getSettingsMap();
|
||||
const fallbackLanguages = this.parseLanguageList(settings.dvd_series_fallback_languages);
|
||||
return {
|
||||
readAccessToken: String(settings.tmdb_api_read_access_token || '').trim() || null,
|
||||
language: String(settings.dvd_series_language || 'de-DE').trim() || 'de-DE',
|
||||
fallbackLanguages
|
||||
language: String(settings.dvd_series_language || 'de-DE').trim() || 'de-DE'
|
||||
};
|
||||
}
|
||||
|
||||
@@ -164,45 +70,6 @@ class TmdbService {
|
||||
return String(explicitLanguage || config.language || 'de-DE').trim() || 'de-DE';
|
||||
}
|
||||
|
||||
parseLanguageList(value) {
|
||||
const source = Array.isArray(value)
|
||||
? value
|
||||
: String(value || '').split(',');
|
||||
const normalized = [];
|
||||
const seen = new Set();
|
||||
for (const item of source) {
|
||||
const lang = String(item || '').trim();
|
||||
if (!lang) {
|
||||
continue;
|
||||
}
|
||||
const dedupeKey = lang.toLowerCase();
|
||||
if (seen.has(dedupeKey)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(dedupeKey);
|
||||
normalized.push(lang);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
buildLanguageCandidates(primaryLanguage = null, fallbackLanguages = []) {
|
||||
const preferred = String(primaryLanguage || '').trim() || 'de-DE';
|
||||
const fallback = this.parseLanguageList(fallbackLanguages);
|
||||
const combined = [preferred, ...fallback];
|
||||
return this.parseLanguageList(combined);
|
||||
}
|
||||
|
||||
async resolveLanguageCandidates(options = {}) {
|
||||
const config = await this.getConfig();
|
||||
const explicitLanguage = String(options.language || '').trim() || null;
|
||||
const explicitFallbackLanguages = options.fallbackLanguages !== undefined
|
||||
? this.parseLanguageList(options.fallbackLanguages)
|
||||
: null;
|
||||
const primaryLanguage = explicitLanguage || String(config.language || '').trim() || 'de-DE';
|
||||
const fallbackLanguages = explicitFallbackLanguages ?? config.fallbackLanguages;
|
||||
return this.buildLanguageCandidates(primaryLanguage, fallbackLanguages);
|
||||
}
|
||||
|
||||
async request(pathName, options = {}) {
|
||||
const config = await this.getConfig();
|
||||
if (!config.readAccessToken) {
|
||||
@@ -261,135 +128,40 @@ class TmdbService {
|
||||
if (!normalizedQuery || !(await this.isConfigured())) {
|
||||
return [];
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
let lastFailureCode = null;
|
||||
let lastFailureStatusCode = null;
|
||||
let lastFailureMessage = null;
|
||||
const language = await this.resolveLanguage(options.language);
|
||||
|
||||
for (const language of languageCandidates) {
|
||||
let data = null;
|
||||
try {
|
||||
data = await this.request('/search/tv', {
|
||||
query: {
|
||||
query: normalizedQuery,
|
||||
first_air_date_year: options.year || undefined,
|
||||
language,
|
||||
page: options.page || 1,
|
||||
include_adult: false
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
const failureCode = this.classifyRequestError(error);
|
||||
lastFailureCode = failureCode;
|
||||
lastFailureStatusCode = Number(error?.statusCode || 0) || null;
|
||||
lastFailureMessage = error?.message || String(error);
|
||||
logger.warn('search:failed', {
|
||||
query: normalizedQuery,
|
||||
language,
|
||||
error: lastFailureMessage,
|
||||
failureCode,
|
||||
statusCode: lastFailureStatusCode
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
const rows = Array.isArray(data?.results) ? data.results : [];
|
||||
const normalizedRows = rows
|
||||
.map((row) => ({
|
||||
id: Number(row?.id || 0) || null,
|
||||
title: String(row?.name || row?.original_name || '').trim() || null,
|
||||
originalTitle: String(row?.original_name || '').trim() || null,
|
||||
year: Number(String(row?.first_air_date || '').slice(0, 4)) || null,
|
||||
overview: String(row?.overview || '').trim() || null,
|
||||
posterPath: String(row?.poster_path || '').trim() || null,
|
||||
poster: this.buildImageUrl(row?.poster_path, 'w342'),
|
||||
backdropPath: String(row?.backdrop_path || '').trim() || null,
|
||||
backdrop: this.buildImageUrl(row?.backdrop_path, 'w780'),
|
||||
originalLanguage: String(row?.original_language || '').trim() || null,
|
||||
popularity: Number(row?.popularity || 0) || 0
|
||||
}))
|
||||
.filter((row) => row.id && row.title);
|
||||
if (normalizedRows.length > 0) {
|
||||
return this.attachFailureCode(normalizedRows, null);
|
||||
}
|
||||
}
|
||||
if (lastFailureCode) {
|
||||
logger.warn('search:failed:all-languages', {
|
||||
const data = await this.request('/search/tv', {
|
||||
query: {
|
||||
query: normalizedQuery,
|
||||
error: lastFailureMessage,
|
||||
failureCode: lastFailureCode,
|
||||
statusCode: lastFailureStatusCode
|
||||
});
|
||||
}
|
||||
return this.attachFailureCode([], lastFailureCode);
|
||||
}
|
||||
|
||||
async searchMovies(query, options = {}) {
|
||||
const normalizedQuery = String(query || '').trim();
|
||||
if (!normalizedQuery || !(await this.isConfigured())) {
|
||||
return [];
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
let lastFailureCode = null;
|
||||
let lastFailureStatusCode = null;
|
||||
let lastFailureMessage = null;
|
||||
|
||||
for (const language of languageCandidates) {
|
||||
let data = null;
|
||||
try {
|
||||
data = await this.request('/search/movie', {
|
||||
query: {
|
||||
query: normalizedQuery,
|
||||
year: options.year || undefined,
|
||||
language,
|
||||
page: options.page || 1,
|
||||
include_adult: false
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
const failureCode = this.classifyRequestError(error);
|
||||
lastFailureCode = failureCode;
|
||||
lastFailureStatusCode = Number(error?.statusCode || 0) || null;
|
||||
lastFailureMessage = error?.message || String(error);
|
||||
logger.warn('movie:search:failed', {
|
||||
query: normalizedQuery,
|
||||
language,
|
||||
error: lastFailureMessage,
|
||||
failureCode,
|
||||
statusCode: lastFailureStatusCode
|
||||
});
|
||||
continue;
|
||||
first_air_date_year: options.year || undefined,
|
||||
language,
|
||||
page: options.page || 1,
|
||||
include_adult: false
|
||||
}
|
||||
|
||||
const rows = Array.isArray(data?.results) ? data.results : [];
|
||||
const normalizedRows = rows
|
||||
.map((row) => ({
|
||||
id: Number(row?.id || 0) || null,
|
||||
title: String(row?.title || row?.original_title || '').trim() || null,
|
||||
originalTitle: String(row?.original_title || '').trim() || null,
|
||||
year: Number(String(row?.release_date || '').slice(0, 4)) || null,
|
||||
overview: String(row?.overview || '').trim() || null,
|
||||
posterPath: String(row?.poster_path || '').trim() || null,
|
||||
poster: this.buildImageUrl(row?.poster_path, 'w342'),
|
||||
backdropPath: String(row?.backdrop_path || '').trim() || null,
|
||||
backdrop: this.buildImageUrl(row?.backdrop_path, 'w780'),
|
||||
originalLanguage: String(row?.original_language || '').trim() || null,
|
||||
popularity: Number(row?.popularity || 0) || 0
|
||||
}))
|
||||
.filter((row) => row.id && row.title);
|
||||
if (normalizedRows.length > 0) {
|
||||
return this.attachFailureCode(normalizedRows, null);
|
||||
}
|
||||
}
|
||||
if (lastFailureCode) {
|
||||
logger.warn('movie:search:failed:all-languages', {
|
||||
}).catch((error) => {
|
||||
logger.warn('search:failed', {
|
||||
query: normalizedQuery,
|
||||
error: lastFailureMessage,
|
||||
failureCode: lastFailureCode,
|
||||
statusCode: lastFailureStatusCode
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
}
|
||||
return this.attachFailureCode([], lastFailureCode);
|
||||
return null;
|
||||
});
|
||||
|
||||
const rows = Array.isArray(data?.results) ? data.results : [];
|
||||
return rows
|
||||
.map((row) => ({
|
||||
id: Number(row?.id || 0) || null,
|
||||
title: String(row?.name || row?.original_name || '').trim() || null,
|
||||
originalTitle: String(row?.original_name || '').trim() || null,
|
||||
year: Number(String(row?.first_air_date || '').slice(0, 4)) || null,
|
||||
overview: String(row?.overview || '').trim() || null,
|
||||
posterPath: String(row?.poster_path || '').trim() || null,
|
||||
poster: this.buildImageUrl(row?.poster_path, 'w342'),
|
||||
backdropPath: String(row?.backdrop_path || '').trim() || null,
|
||||
backdrop: this.buildImageUrl(row?.backdrop_path, 'w780'),
|
||||
originalLanguage: String(row?.original_language || '').trim() || null,
|
||||
popularity: Number(row?.popularity || 0) || 0
|
||||
}))
|
||||
.filter((row) => row.id && row.title);
|
||||
}
|
||||
|
||||
async getSeriesDetails(seriesId, options = {}) {
|
||||
@@ -397,111 +169,24 @@ class TmdbService {
|
||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||
return null;
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
const appendToResponse = Array.isArray(options.appendToResponse)
|
||||
? options.appendToResponse.map((item) => String(item || '').trim()).filter(Boolean)
|
||||
: [];
|
||||
let fallbackDetails = null;
|
||||
for (const language of languageCandidates) {
|
||||
const details = await this.request(`/tv/${Math.trunc(id)}`, {
|
||||
query: {
|
||||
language,
|
||||
append_to_response: appendToResponse.length > 0 ? appendToResponse.join(',') : undefined
|
||||
}
|
||||
}).catch((error) => {
|
||||
logger.warn('series:details:failed', {
|
||||
seriesId: Math.trunc(id),
|
||||
language,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return null;
|
||||
});
|
||||
if (!details) {
|
||||
continue;
|
||||
}
|
||||
const hasLocalizedPayload = Boolean(
|
||||
String(details?.name || '').trim()
|
||||
|| String(details?.overview || '').trim()
|
||||
);
|
||||
if (hasLocalizedPayload) {
|
||||
return details;
|
||||
}
|
||||
fallbackDetails = fallbackDetails || details;
|
||||
}
|
||||
return fallbackDetails;
|
||||
}
|
||||
|
||||
async getMovieDetails(movieId, options = {}) {
|
||||
const id = Number(movieId);
|
||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||
return null;
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
const appendToResponse = Array.isArray(options.appendToResponse)
|
||||
? options.appendToResponse.map((item) => String(item || '').trim()).filter(Boolean)
|
||||
: [];
|
||||
let fallbackDetails = null;
|
||||
for (const language of languageCandidates) {
|
||||
const details = await this.request(`/movie/${Math.trunc(id)}`, {
|
||||
query: {
|
||||
language,
|
||||
append_to_response: appendToResponse.length > 0 ? appendToResponse.join(',') : undefined
|
||||
}
|
||||
}).catch((error) => {
|
||||
logger.warn('movie:details:failed', {
|
||||
movieId: Math.trunc(id),
|
||||
language,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return null;
|
||||
});
|
||||
if (!details) {
|
||||
continue;
|
||||
}
|
||||
const hasLocalizedPayload = Boolean(
|
||||
String(details?.title || '').trim()
|
||||
|| String(details?.overview || '').trim()
|
||||
);
|
||||
if (hasLocalizedPayload) {
|
||||
return details;
|
||||
}
|
||||
fallbackDetails = fallbackDetails || details;
|
||||
}
|
||||
return fallbackDetails;
|
||||
}
|
||||
|
||||
async getMovieCredits(movieId, options = {}) {
|
||||
const id = Number(movieId);
|
||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||
return null;
|
||||
}
|
||||
const language = await this.resolveLanguage(options.language);
|
||||
return this.request(`/movie/${Math.trunc(id)}/credits`, {
|
||||
const appendToResponse = Array.isArray(options.appendToResponse)
|
||||
? options.appendToResponse.map((item) => String(item || '').trim()).filter(Boolean)
|
||||
: [];
|
||||
return this.request(`/tv/${Math.trunc(id)}`, {
|
||||
query: {
|
||||
language
|
||||
language,
|
||||
append_to_response: appendToResponse.length > 0 ? appendToResponse.join(',') : undefined
|
||||
}
|
||||
}).catch((error) => {
|
||||
logger.warn('movie:credits:failed', {
|
||||
movieId: Math.trunc(id),
|
||||
logger.warn('series:details:failed', {
|
||||
seriesId: Math.trunc(id),
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
async getMovieDetailsWithCredits(movieId, options = {}) {
|
||||
const details = await this.getMovieDetails(movieId, options);
|
||||
if (!details) {
|
||||
return null;
|
||||
}
|
||||
const ensureCredits = options?.ensureCredits === true;
|
||||
if (!ensureCredits || this.hasCreditsPayload(details)) {
|
||||
return details;
|
||||
}
|
||||
const credits = await this.getMovieCredits(movieId, options);
|
||||
return this.mergeCreditsIntoDetails(details, credits);
|
||||
}
|
||||
|
||||
async getEpisodeGroups(seriesId) {
|
||||
const id = Number(seriesId);
|
||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||
@@ -522,31 +207,18 @@ class TmdbService {
|
||||
if (!normalizedId || !(await this.isConfigured())) {
|
||||
return null;
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
let fallbackDetails = null;
|
||||
for (const language of languageCandidates) {
|
||||
const details = await this.request(`/tv/episode_group/${normalizedId}`, {
|
||||
query: {
|
||||
language
|
||||
}
|
||||
}).catch((error) => {
|
||||
logger.warn('episode-group:details:failed', {
|
||||
groupId: normalizedId,
|
||||
language,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
return null;
|
||||
const language = await this.resolveLanguage(options.language);
|
||||
return this.request(`/tv/episode_group/${normalizedId}`, {
|
||||
query: {
|
||||
language
|
||||
}
|
||||
}).catch((error) => {
|
||||
logger.warn('episode-group:details:failed', {
|
||||
groupId: normalizedId,
|
||||
error: error?.message || String(error)
|
||||
});
|
||||
if (!details) {
|
||||
continue;
|
||||
}
|
||||
const hasLocalizedPayload = Boolean(String(details?.name || '').trim() || String(details?.description || '').trim());
|
||||
if (hasLocalizedPayload) {
|
||||
return details;
|
||||
}
|
||||
fallbackDetails = fallbackDetails || details;
|
||||
}
|
||||
return fallbackDetails;
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
async getSeasonDetails(seriesId, seasonNumber, options = {}) {
|
||||
@@ -555,28 +227,12 @@ class TmdbService {
|
||||
if (!Number.isFinite(id) || id <= 0 || !Number.isFinite(season) || season < 0 || !(await this.isConfigured())) {
|
||||
return null;
|
||||
}
|
||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
||||
let fallbackDetails = null;
|
||||
for (const language of languageCandidates) {
|
||||
const details = await this.request(`/tv/${Math.trunc(id)}/season/${Math.trunc(season)}`, {
|
||||
query: {
|
||||
language
|
||||
}
|
||||
}).catch(() => null);
|
||||
if (!details) {
|
||||
continue;
|
||||
const language = await this.resolveLanguage(options.language);
|
||||
return this.request(`/tv/${Math.trunc(id)}/season/${Math.trunc(season)}`, {
|
||||
query: {
|
||||
language
|
||||
}
|
||||
const hasLocalizedPayload = Boolean(
|
||||
String(details?.name || '').trim()
|
||||
|| String(details?.overview || '').trim()
|
||||
|| (Array.isArray(details?.episodes) && details.episodes.length > 0)
|
||||
);
|
||||
if (hasLocalizedPayload) {
|
||||
return details;
|
||||
}
|
||||
fallbackDetails = fallbackDetails || details;
|
||||
}
|
||||
return fallbackDetails;
|
||||
}).catch(() => null);
|
||||
}
|
||||
|
||||
async getSeasonCredits(seriesId, seasonNumber, options = {}) {
|
||||
@@ -631,7 +287,10 @@ class TmdbService {
|
||||
const creators = Array.isArray(details?.created_by) ? details.created_by : [];
|
||||
const genres = Array.isArray(details?.genres) ? details.genres : [];
|
||||
const runtimeLabel = this.formatRuntimeLabel(details?.episode_run_time);
|
||||
const directorNames = this.extractDirectorNames(crew);
|
||||
const directorNames = this.normalizeNameList(
|
||||
crew.filter((member) => String(member?.job || '').trim().toLowerCase() === 'director'),
|
||||
{ maxItems: 5 }
|
||||
);
|
||||
const creatorNames = this.normalizeNameList(creators, { maxItems: 5 });
|
||||
const actorNames = this.normalizeNameList(cast, { maxItems: 10 });
|
||||
const genreNames = this.normalizeNameList(genres, { maxItems: 10 });
|
||||
@@ -660,39 +319,6 @@ class TmdbService {
|
||||
};
|
||||
}
|
||||
|
||||
buildMovieDetailsSummary(movieDetails = null) {
|
||||
const details = movieDetails && typeof movieDetails === 'object' ? movieDetails : {};
|
||||
const crew = Array.isArray(details?.credits?.crew) ? details.credits.crew : [];
|
||||
const cast = Array.isArray(details?.credits?.cast) ? details.credits.cast : [];
|
||||
const genres = Array.isArray(details?.genres) ? details.genres : [];
|
||||
const directorNames = this.extractDirectorNames(crew);
|
||||
const actorNames = this.normalizeNameList(cast, { maxItems: 10 });
|
||||
const genreNames = this.normalizeNameList(genres, { maxItems: 10 });
|
||||
const voteAverageRaw = Number(details?.vote_average || 0);
|
||||
const voteAverage = Number.isFinite(voteAverageRaw) && voteAverageRaw > 0
|
||||
? Number(voteAverageRaw.toFixed(1))
|
||||
: null;
|
||||
const voteCount = Number(details?.vote_count || 0);
|
||||
const imdbId = String(details?.external_ids?.imdb_id || details?.imdb_id || '').trim() || null;
|
||||
const releaseDate = String(details?.release_date || '').trim() || null;
|
||||
const runtime = this.formatRuntimeLabel(details?.runtime);
|
||||
|
||||
return {
|
||||
director: directorNames.length > 0 ? directorNames.join(', ') : null,
|
||||
actors: actorNames.length > 0 ? actorNames.join(', ') : null,
|
||||
runtime,
|
||||
runtimeLabel: runtime,
|
||||
genre: genreNames.length > 0 ? genreNames.join(', ') : null,
|
||||
imdbRating: voteAverage !== null ? voteAverage.toFixed(1) : null,
|
||||
voteAverage,
|
||||
voteCount: Number.isFinite(voteCount) && voteCount > 0 ? Math.trunc(voteCount) : null,
|
||||
rottenTomatoes: null,
|
||||
imdbId,
|
||||
tmdbId: Number(details?.id || 0) || null,
|
||||
releaseDate
|
||||
};
|
||||
}
|
||||
|
||||
buildSeriesMetadataCandidate(series = {}, options = {}) {
|
||||
const season = series?.season && typeof series.season === 'object'
|
||||
? series.season
|
||||
@@ -722,35 +348,6 @@ class TmdbService {
|
||||
};
|
||||
}
|
||||
|
||||
buildMovieMetadataCandidate(movie = {}, options = {}) {
|
||||
const detailsSummary = options?.detailsSummary && typeof options.detailsSummary === 'object'
|
||||
? options.detailsSummary
|
||||
: null;
|
||||
const tmdbId = Number(movie?.id || movie?.tmdbId || 0) || null;
|
||||
const releaseDate = String(movie?.releaseDate || detailsSummary?.releaseDate || '').trim() || null;
|
||||
const year = Number(movie?.year || Number(String(releaseDate || '').slice(0, 4)) || 0) || null;
|
||||
const imdbId = String(movie?.imdbId || detailsSummary?.imdbId || '').trim() || null;
|
||||
const providerId = tmdbId !== null ? `tmdb:${tmdbId}` : null;
|
||||
|
||||
return {
|
||||
provider: 'tmdb',
|
||||
providerId,
|
||||
metadataKind: 'movie',
|
||||
workflowKind: 'film',
|
||||
tmdbId,
|
||||
imdbId,
|
||||
title: String(movie?.title || movie?.originalTitle || '').trim() || null,
|
||||
originalTitle: String(movie?.originalTitle || '').trim() || null,
|
||||
year,
|
||||
overview: String(movie?.overview || '').trim() || null,
|
||||
poster: movie?.poster || this.buildImageUrl(movie?.posterPath, 'w342'),
|
||||
backdrop: movie?.backdrop || this.buildImageUrl(movie?.backdropPath, 'w780'),
|
||||
runtime: detailsSummary?.runtime || null,
|
||||
genre: detailsSummary?.genre || null,
|
||||
voteAverage: detailsSummary?.voteAverage ?? null
|
||||
};
|
||||
}
|
||||
|
||||
buildSeasonSummariesFromSeriesDetails(seriesDetails = null) {
|
||||
const details = seriesDetails && typeof seriesDetails === 'object' ? seriesDetails : {};
|
||||
const seasons = Array.isArray(details.seasons) ? details.seasons : [];
|
||||
@@ -769,9 +366,8 @@ class TmdbService {
|
||||
|
||||
async searchSeriesWithSeasons(query, options = {}) {
|
||||
const candidates = await this.searchSeries(query, options);
|
||||
const failureCode = this.readFailureCode(candidates);
|
||||
if (candidates.length === 0) {
|
||||
return this.attachFailureCode([], failureCode);
|
||||
return [];
|
||||
}
|
||||
|
||||
const limit = Math.max(1, Math.min(10, Number(options.limit || 5)));
|
||||
@@ -791,8 +387,7 @@ class TmdbService {
|
||||
}));
|
||||
}));
|
||||
|
||||
const normalized = expanded.flat().filter((item) => item?.tmdbId && item?.title);
|
||||
return this.attachFailureCode(normalized, failureCode);
|
||||
return expanded.flat().filter((item) => item?.tmdbId && item?.title);
|
||||
}
|
||||
|
||||
async searchSeriesWithSeason(query, seasonNumber, options = {}) {
|
||||
@@ -802,9 +397,8 @@ class TmdbService {
|
||||
}
|
||||
|
||||
const candidates = await this.searchSeries(query, options);
|
||||
const failureCode = this.readFailureCode(candidates);
|
||||
if (candidates.length === 0) {
|
||||
return this.attachFailureCode([], failureCode);
|
||||
return [];
|
||||
}
|
||||
|
||||
const limit = Math.max(1, Math.min(10, Number(options.limit || 5)));
|
||||
@@ -823,48 +417,11 @@ class TmdbService {
|
||||
};
|
||||
}));
|
||||
|
||||
const normalized = withSeasons
|
||||
return withSeasons
|
||||
.filter((candidate) => candidate.season && candidate.season.episodeCount > 0)
|
||||
.map((candidate) => this.buildSeriesMetadataCandidate(candidate, {
|
||||
seasonNumber: normalizedSeason
|
||||
}));
|
||||
return this.attachFailureCode(normalized, failureCode);
|
||||
}
|
||||
|
||||
async searchMoviesWithDetails(query, options = {}) {
|
||||
const candidates = await this.searchMovies(query, options);
|
||||
const failureCode = this.readFailureCode(candidates);
|
||||
if (candidates.length === 0) {
|
||||
return this.attachFailureCode([], failureCode);
|
||||
}
|
||||
|
||||
const limit = Math.max(1, Math.min(15, Number(options.limit || 8)));
|
||||
const selectedCandidates = candidates.slice(0, limit);
|
||||
const language = await this.resolveLanguage(options.language);
|
||||
|
||||
const expanded = await Promise.all(selectedCandidates.map(async (candidate) => {
|
||||
const details = await this.getMovieDetailsWithCredits(candidate.id, {
|
||||
language,
|
||||
appendToResponse: ['credits', 'external_ids'],
|
||||
ensureCredits: true
|
||||
});
|
||||
const summary = this.buildMovieDetailsSummary(details);
|
||||
const normalized = this.buildMovieMetadataCandidate({
|
||||
...candidate,
|
||||
releaseDate: details?.release_date || null,
|
||||
imdbId: summary?.imdbId || null,
|
||||
posterPath: details?.poster_path || candidate?.posterPath || null
|
||||
}, {
|
||||
detailsSummary: summary
|
||||
});
|
||||
return {
|
||||
...normalized,
|
||||
tmdbDetails: summary && typeof summary === 'object' ? summary : null
|
||||
};
|
||||
}));
|
||||
|
||||
const normalized = expanded.filter((item) => item?.tmdbId && item?.title);
|
||||
return this.attachFailureCode(normalized, failureCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
const { getDb } = require('../db/database');
|
||||
const logger = require('./logger').child('USER_PRESET_DEFAULTS');
|
||||
|
||||
const SLOT_KEYS = Object.freeze([
|
||||
'bluray_movie',
|
||||
'bluray_series',
|
||||
'dvd_movie',
|
||||
'dvd_series'
|
||||
]);
|
||||
const SLOT_KEY_SET = new Set(SLOT_KEYS);
|
||||
const SLOT_ALLOWED_MEDIA_TYPES = Object.freeze({
|
||||
bluray_movie: new Set(['bluray', 'all']),
|
||||
bluray_series: new Set(['bluray', 'all']),
|
||||
dvd_movie: new Set(['dvd', 'all']),
|
||||
dvd_series: new Set(['dvd', 'all'])
|
||||
});
|
||||
|
||||
function normalizePresetId(value) {
|
||||
if (value === null || value === undefined) {
|
||||
return null;
|
||||
}
|
||||
if (typeof value === 'string' && value.trim() === '') {
|
||||
return null;
|
||||
}
|
||||
const numeric = Number(value);
|
||||
if (!Number.isFinite(numeric) || numeric <= 0) {
|
||||
return null;
|
||||
}
|
||||
return Math.trunc(numeric);
|
||||
}
|
||||
|
||||
function buildDefaultsMap(rows = []) {
|
||||
const map = Object.fromEntries(SLOT_KEYS.map((key) => [key, null]));
|
||||
for (const row of rows) {
|
||||
const slotKey = String(row?.slot_key || '').trim();
|
||||
if (!SLOT_KEY_SET.has(slotKey)) {
|
||||
continue;
|
||||
}
|
||||
const presetId = normalizePresetId(row?.preset_id);
|
||||
map[slotKey] = presetId;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
async function listDefaults() {
|
||||
const db = await getDb();
|
||||
const rows = await db.all(
|
||||
`
|
||||
SELECT slot_key, preset_id
|
||||
FROM user_preset_defaults
|
||||
WHERE slot_key IN (${SLOT_KEYS.map(() => '?').join(', ')})
|
||||
ORDER BY slot_key ASC
|
||||
`,
|
||||
SLOT_KEYS
|
||||
);
|
||||
return buildDefaultsMap(rows);
|
||||
}
|
||||
|
||||
async function updateDefaults(payload = {}) {
|
||||
const defaults = payload && typeof payload === 'object'
|
||||
? (payload.defaults && typeof payload.defaults === 'object' ? payload.defaults : payload)
|
||||
: {};
|
||||
const updates = [];
|
||||
|
||||
for (const [slotKey, rawPresetId] of Object.entries(defaults)) {
|
||||
if (!SLOT_KEY_SET.has(slotKey)) {
|
||||
const error = new Error(`Ungültiger Slot: ${slotKey}`);
|
||||
error.statusCode = 400;
|
||||
throw error;
|
||||
}
|
||||
updates.push({ slotKey, presetId: normalizePresetId(rawPresetId) });
|
||||
}
|
||||
|
||||
if (updates.length === 0) {
|
||||
return listDefaults();
|
||||
}
|
||||
|
||||
const db = await getDb();
|
||||
for (const update of updates) {
|
||||
if (update.presetId === null) {
|
||||
continue;
|
||||
}
|
||||
const exists = await db.get(
|
||||
`SELECT id, media_type FROM user_presets WHERE id = ? LIMIT 1`,
|
||||
[update.presetId]
|
||||
);
|
||||
if (!exists) {
|
||||
const error = new Error(`Preset ${update.presetId} nicht gefunden.`);
|
||||
error.statusCode = 404;
|
||||
throw error;
|
||||
}
|
||||
const mediaType = String(exists.media_type || '').trim().toLowerCase();
|
||||
const allowedMediaTypes = SLOT_ALLOWED_MEDIA_TYPES[update.slotKey] || new Set(['all']);
|
||||
if (!allowedMediaTypes.has(mediaType)) {
|
||||
const error = new Error(
|
||||
`Preset ${update.presetId} (${mediaType || 'unbekannt'}) ist für ${update.slotKey} nicht zulässig.`
|
||||
);
|
||||
error.statusCode = 400;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
await db.exec('BEGIN');
|
||||
try {
|
||||
for (const update of updates) {
|
||||
await db.run(
|
||||
`
|
||||
INSERT INTO user_preset_defaults (slot_key, preset_id)
|
||||
VALUES (?, ?)
|
||||
ON CONFLICT(slot_key) DO UPDATE SET preset_id = excluded.preset_id
|
||||
`,
|
||||
[update.slotKey, update.presetId]
|
||||
);
|
||||
}
|
||||
await db.exec('COMMIT');
|
||||
} catch (error) {
|
||||
await db.exec('ROLLBACK');
|
||||
throw error;
|
||||
}
|
||||
|
||||
logger.info('update', {
|
||||
updates: updates.map((entry) => ({
|
||||
slotKey: entry.slotKey,
|
||||
presetId: entry.presetId
|
||||
}))
|
||||
});
|
||||
return listDefaults();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
SLOT_KEYS,
|
||||
listDefaults,
|
||||
updateDefaults
|
||||
};
|
||||
@@ -33,7 +33,6 @@ const ISO2_TO_3_LANGUAGE = {
|
||||
ro: 'ron',
|
||||
uk: 'ukr',
|
||||
ja: 'jpn',
|
||||
jp: 'jpn',
|
||||
ko: 'kor',
|
||||
zh: 'zho',
|
||||
ar: 'ara'
|
||||
@@ -874,29 +873,6 @@ function normalizeBurnBehavior(raw) {
|
||||
return 'none';
|
||||
}
|
||||
|
||||
function hasConfiguredLanguageSelection(rawValue) {
|
||||
return parseList(rawValue, normalizeSelectionLanguage)
|
||||
.filter((item) => item !== 'none' && item !== 'any')
|
||||
.length > 0;
|
||||
}
|
||||
|
||||
function hasExplicitPresetTrackSelection(profile = {}, trackType = 'audio') {
|
||||
const source = String(profile?.source || '').trim().toLowerCase();
|
||||
if (source !== 'preset-export') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (trackType === 'audio') {
|
||||
const behavior = String(profile?.audioTrackSelectionBehavior || '').trim().toLowerCase();
|
||||
const languages = Array.isArray(profile?.audioLanguages) ? profile.audioLanguages : [];
|
||||
return behavior === 'all' || behavior === 'language' || behavior === 'none' || languages.length > 0;
|
||||
}
|
||||
|
||||
const behavior = String(profile?.subtitleTrackSelectionBehavior || '').trim().toLowerCase();
|
||||
const languages = Array.isArray(profile?.subtitleLanguages) ? profile.subtitleLanguages : [];
|
||||
return behavior === 'all' || behavior === 'language' || behavior === 'first' || languages.length > 0;
|
||||
}
|
||||
|
||||
function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||
const profile = presetProfile && typeof presetProfile === 'object' ? presetProfile : {};
|
||||
const audioLanguages = Array.isArray(profile.audioLanguages)
|
||||
@@ -905,14 +881,6 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||
const subtitleLanguages = Array.isArray(profile.subtitleLanguages)
|
||||
? profile.subtitleLanguages.map((item) => normalizeSelectionLanguage(item)).filter(Boolean)
|
||||
: [];
|
||||
const configuredAudioLanguages = parseList(settings?.handbrake_review_audio_languages, normalizeSelectionLanguage)
|
||||
.filter((item) => item !== 'none' && item !== 'any');
|
||||
const configuredSubtitleLanguages = parseList(settings?.handbrake_review_subtitle_languages, normalizeSelectionLanguage)
|
||||
.filter((item) => item !== 'none' && item !== 'any');
|
||||
const useConfiguredAudioLanguages = configuredAudioLanguages.length > 0 && !hasExplicitPresetTrackSelection(profile, 'audio');
|
||||
const useConfiguredSubtitleLanguages = configuredSubtitleLanguages.length > 0 && !hasExplicitPresetTrackSelection(profile, 'subtitle');
|
||||
const effectiveAudioLanguages = useConfiguredAudioLanguages ? configuredAudioLanguages : audioLanguages;
|
||||
const effectiveSubtitleLanguages = useConfiguredSubtitleLanguages ? configuredSubtitleLanguages : subtitleLanguages;
|
||||
const audioEncoders = Array.isArray(profile.audioEncoders)
|
||||
? profile.audioEncoders.map((item) => String(item || '').trim().toLowerCase()).filter(Boolean)
|
||||
: [];
|
||||
@@ -928,18 +896,6 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||
|
||||
const baseAudioMode = normalizeTrackSelectionMode(profile.audioTrackSelectionBehavior, 'audio');
|
||||
const baseSubtitleMode = normalizeTrackSelectionMode(profile.subtitleTrackSelectionBehavior, 'subtitle');
|
||||
const effectiveAudioMode = useConfiguredAudioLanguages && !hasConfiguredLanguageSelection(profile?.audioLanguages)
|
||||
? 'language'
|
||||
: baseAudioMode;
|
||||
const effectiveSubtitleMode = useConfiguredSubtitleLanguages && !hasConfiguredLanguageSelection(profile?.subtitleLanguages)
|
||||
? 'language'
|
||||
: baseSubtitleMode;
|
||||
const audioSelectionSource = useConfiguredAudioLanguages
|
||||
? 'settings'
|
||||
: (profile.source === 'preset-export' ? 'preset' : 'default');
|
||||
const subtitleSelectionSource = useConfiguredSubtitleLanguages
|
||||
? 'settings'
|
||||
: (profile.source === 'preset-export' ? 'preset' : 'default');
|
||||
|
||||
return {
|
||||
preset: settings?.handbrake_preset || null,
|
||||
@@ -947,11 +903,11 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||
presetProfileSource: profile.source || 'fallback',
|
||||
presetProfileMessage: profile.message || null,
|
||||
audio: {
|
||||
mode: effectiveAudioMode,
|
||||
languages: effectiveAudioLanguages.filter((item) => item !== 'none'),
|
||||
mode: baseAudioMode,
|
||||
languages: audioLanguages.filter((item) => item !== 'none'),
|
||||
explicitIds: [],
|
||||
firstOnly: effectiveAudioMode === 'first',
|
||||
selectionSource: audioSelectionSource,
|
||||
firstOnly: baseAudioMode === 'first',
|
||||
selectionSource: profile.source === 'preset-export' ? 'preset' : 'default',
|
||||
encoders: audioEncoders,
|
||||
encoderSource: audioEncoders.length > 0 ? (profile.source === 'preset-export' ? 'preset' : 'default') : 'default',
|
||||
copyMask: normalizedCopyMask.length > 0 ? normalizedCopyMask : [...DEFAULT_AUDIO_COPY_MASK],
|
||||
@@ -960,11 +916,11 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||
fallbackSource: profile.audioFallback ? (profile.source === 'preset-export' ? 'preset' : 'default') : 'default'
|
||||
},
|
||||
subtitle: {
|
||||
mode: effectiveSubtitleMode,
|
||||
languages: effectiveSubtitleLanguages.filter((item) => item !== 'none'),
|
||||
mode: baseSubtitleMode,
|
||||
languages: subtitleLanguages.filter((item) => item !== 'none'),
|
||||
explicitIds: [],
|
||||
firstOnly: effectiveSubtitleMode === 'first',
|
||||
selectionSource: subtitleSelectionSource,
|
||||
firstOnly: baseSubtitleMode === 'first',
|
||||
selectionSource: profile.source === 'preset-export' ? 'preset' : 'default',
|
||||
// Do not auto-burn subtitle tracks from exported preset metadata.
|
||||
// Burn-in should only be activated via explicit CLI args/selection.
|
||||
burnBehavior: 'none',
|
||||
@@ -1287,66 +1243,6 @@ function computeAudioTrackActions(track, selectedIndex, selector) {
|
||||
};
|
||||
}
|
||||
|
||||
function refreshAudioTrackActionsForPlanTitles(titles, settings = {}, presetProfile = null) {
|
||||
const sourceTitles = Array.isArray(titles) ? titles : [];
|
||||
if (sourceTitles.length === 0) {
|
||||
return sourceTitles;
|
||||
}
|
||||
|
||||
const selectors = buildTrackSelectors(settings || {}, presetProfile || null);
|
||||
const audioSelector = selectors?.audio && typeof selectors.audio === 'object'
|
||||
? selectors.audio
|
||||
: {};
|
||||
|
||||
return sourceTitles.map((title) => {
|
||||
const audioTracks = Array.isArray(title?.audioTracks) ? title.audioTracks : [];
|
||||
if (audioTracks.length === 0) {
|
||||
return title;
|
||||
}
|
||||
|
||||
const selectedTracks = audioTracks.filter((track) => Boolean(track?.selectedForEncode));
|
||||
const selectedIndexById = new Map(
|
||||
selectedTracks
|
||||
.map((track, index) => {
|
||||
const trackId = Number(track?.id);
|
||||
if (!Number.isFinite(trackId)) {
|
||||
return null;
|
||||
}
|
||||
return [Math.trunc(trackId), index];
|
||||
})
|
||||
.filter(Boolean)
|
||||
);
|
||||
|
||||
const nextAudioTracks = audioTracks.map((track) => {
|
||||
if (!track?.selectedForEncode) {
|
||||
return {
|
||||
...track,
|
||||
encodeActions: [],
|
||||
encodeActionSummary: 'Nicht übernommen'
|
||||
};
|
||||
}
|
||||
const numericTrackId = Number(track?.id);
|
||||
const normalizedTrackId = Number.isFinite(numericTrackId) ? Math.trunc(numericTrackId) : null;
|
||||
const selectedIndex = (normalizedTrackId !== null && selectedIndexById.has(normalizedTrackId))
|
||||
? selectedIndexById.get(normalizedTrackId)
|
||||
: 0;
|
||||
const actions = computeAudioTrackActions(track, selectedIndex, audioSelector);
|
||||
return {
|
||||
...track,
|
||||
encodePreviewActions: actions.actions,
|
||||
encodePreviewSummary: actions.summary,
|
||||
encodeActions: actions.actions,
|
||||
encodeActionSummary: actions.summary
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
...title,
|
||||
audioTracks: nextAudioTracks
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function computeSubtitleFlags(trackId, selectedTrackIds, selector) {
|
||||
const selected = selectedTrackIds.includes(trackId);
|
||||
if (!selected) {
|
||||
@@ -1630,6 +1526,5 @@ function buildMediainfoReview({
|
||||
|
||||
module.exports = {
|
||||
parseDurationSeconds,
|
||||
buildMediainfoReview,
|
||||
refreshAudioTrackActionsForPlanTitles
|
||||
buildMediainfoReview
|
||||
};
|
||||
|
||||
@@ -2,8 +2,6 @@ const LARGE_JUMP_THRESHOLD = 20;
|
||||
const DEFAULT_DURATION_SIMILARITY_SECONDS = 90;
|
||||
const RAW_MIRROR_DURATION_TOLERANCE_SECONDS = 2;
|
||||
const RAW_MIRROR_SIZE_TOLERANCE_BYTES = 64 * 1024 * 1024;
|
||||
const BRANCHING_OVERLAP_THRESHOLD = 0.6;
|
||||
const BRANCHING_AUDIO_SIMILARITY_THRESHOLD = 0.75;
|
||||
|
||||
function parseDurationSeconds(raw) {
|
||||
const text = String(raw || '').trim();
|
||||
@@ -137,83 +135,6 @@ function extractPlaylistMapping(line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function extractPlaylistEqualityMapping(line) {
|
||||
const raw = String(line || '');
|
||||
if (!raw) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Robot output often ends with explicit args:
|
||||
// ..., "00100.mpls","00091.mpls"
|
||||
if (/^MSG:3309,/i.test(raw)) {
|
||||
const quoted = [];
|
||||
const regex = /"([^"]*)"/g;
|
||||
let match = regex.exec(raw);
|
||||
while (match) {
|
||||
quoted.push(String(match[1] || '').trim());
|
||||
match = regex.exec(raw);
|
||||
}
|
||||
if (quoted.length >= 2) {
|
||||
const aliasId = normalizePlaylistId(quoted[quoted.length - 2]);
|
||||
const canonicalId = normalizePlaylistId(quoted[quoted.length - 1]);
|
||||
if (aliasId && canonicalId && aliasId !== canonicalId) {
|
||||
return {
|
||||
aliasId,
|
||||
canonicalId
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Text fallback:
|
||||
// "Title 00100.mpls is equal to title 00091.mpls and was skipped"
|
||||
const textMatch = raw.match(/title\s+(\d{5}\.mpls)\s+is equal to title\s+(\d{5}\.mpls)/i);
|
||||
if (textMatch) {
|
||||
const aliasId = normalizePlaylistId(textMatch[1]);
|
||||
const canonicalId = normalizePlaylistId(textMatch[2]);
|
||||
if (aliasId && canonicalId && aliasId !== canonicalId) {
|
||||
return {
|
||||
aliasId,
|
||||
canonicalId
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function buildPlaylistAliasMap(lines) {
|
||||
const aliasMap = new Map();
|
||||
for (const line of lines || []) {
|
||||
const mapping = extractPlaylistEqualityMapping(line);
|
||||
if (!mapping) {
|
||||
continue;
|
||||
}
|
||||
const canonicalId = normalizePlaylistId(mapping.canonicalId);
|
||||
const aliasId = normalizePlaylistId(mapping.aliasId);
|
||||
if (!canonicalId || !aliasId || canonicalId === aliasId) {
|
||||
continue;
|
||||
}
|
||||
if (!aliasMap.has(canonicalId)) {
|
||||
aliasMap.set(canonicalId, new Set());
|
||||
}
|
||||
aliasMap.get(canonicalId).add(aliasId);
|
||||
}
|
||||
|
||||
const normalized = {};
|
||||
for (const [canonicalId, aliasSet] of aliasMap.entries()) {
|
||||
const aliases = Array.from(aliasSet)
|
||||
.map((value) => normalizePlaylistId(value))
|
||||
.filter(Boolean)
|
||||
.filter((value) => value !== canonicalId)
|
||||
.sort();
|
||||
if (aliases.length > 0) {
|
||||
normalized[canonicalId] = aliases;
|
||||
}
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function parseAnalyzeTitles(lines) {
|
||||
const titleMap = new Map();
|
||||
|
||||
@@ -550,330 +471,7 @@ function buildSimilarityGroups(candidates, durationSimilaritySeconds) {
|
||||
);
|
||||
}
|
||||
|
||||
function clamp01(value) {
|
||||
const numeric = Number(value || 0);
|
||||
if (!Number.isFinite(numeric)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(1, Math.max(0, numeric));
|
||||
}
|
||||
|
||||
function normalizeTrackSignaturePart(value, fallback = 'na') {
|
||||
const text = String(value || '').trim().toLowerCase();
|
||||
return text || fallback;
|
||||
}
|
||||
|
||||
function buildAudioSignatureTokens(title) {
|
||||
const audioTracks = Array.isArray(title?.audioTracks) ? title.audioTracks : [];
|
||||
if (audioTracks.length === 0) {
|
||||
const count = Number(title?.audioTrackCount || 0);
|
||||
return count > 0 ? [`count:${count}`] : [];
|
||||
}
|
||||
return uniqueOrdered(audioTracks.map((track) => (
|
||||
`${normalizeTrackSignaturePart(track?.language || track?.languageLabel || 'und', 'und')}`
|
||||
+ `|${normalizeTrackSignaturePart(track?.format)}`
|
||||
+ `|${normalizeTrackSignaturePart(track?.channels)}`
|
||||
)));
|
||||
}
|
||||
|
||||
function computeTokenJaccardSimilarity(leftTokens, rightTokens) {
|
||||
const left = new Set((Array.isArray(leftTokens) ? leftTokens : []).map((value) => String(value || '').trim()).filter(Boolean));
|
||||
const right = new Set((Array.isArray(rightTokens) ? rightTokens : []).map((value) => String(value || '').trim()).filter(Boolean));
|
||||
if (left.size === 0 && right.size === 0) {
|
||||
return 1;
|
||||
}
|
||||
if (left.size === 0 || right.size === 0) {
|
||||
return 0;
|
||||
}
|
||||
let shared = 0;
|
||||
for (const token of left) {
|
||||
if (right.has(token)) {
|
||||
shared += 1;
|
||||
}
|
||||
}
|
||||
const unionSize = new Set([...left, ...right]).size;
|
||||
return unionSize > 0 ? Number((shared / unionSize).toFixed(4)) : 0;
|
||||
}
|
||||
|
||||
function computeSegmentOverlapInfo(leftSegments, rightSegments) {
|
||||
const leftNumbers = Array.isArray(leftSegments)
|
||||
? leftSegments.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
const rightNumbers = Array.isArray(rightSegments)
|
||||
? rightSegments.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
const leftSet = new Set(leftNumbers);
|
||||
const rightSet = new Set(rightNumbers);
|
||||
if (leftSet.size === 0 || rightSet.size === 0) {
|
||||
return {
|
||||
sharedCount: 0,
|
||||
ratioToSmaller: 0,
|
||||
ratioToLarger: 0,
|
||||
jaccard: 0
|
||||
};
|
||||
}
|
||||
let sharedCount = 0;
|
||||
for (const value of leftSet) {
|
||||
if (rightSet.has(value)) {
|
||||
sharedCount += 1;
|
||||
}
|
||||
}
|
||||
const smaller = Math.max(1, Math.min(leftSet.size, rightSet.size));
|
||||
const larger = Math.max(1, Math.max(leftSet.size, rightSet.size));
|
||||
const unionSize = new Set([...leftSet, ...rightSet]).size;
|
||||
return {
|
||||
sharedCount,
|
||||
ratioToSmaller: Number((sharedCount / smaller).toFixed(4)),
|
||||
ratioToLarger: Number((sharedCount / larger).toFixed(4)),
|
||||
jaccard: unionSize > 0 ? Number((sharedCount / unionSize).toFixed(4)) : 0
|
||||
};
|
||||
}
|
||||
|
||||
function buildDisjointSet(size) {
|
||||
const parent = Array.from({ length: Math.max(0, Number(size || 0)) }, (_, index) => index);
|
||||
const rank = Array.from({ length: parent.length }, () => 0);
|
||||
const find = (value) => {
|
||||
if (parent[value] !== value) {
|
||||
parent[value] = find(parent[value]);
|
||||
}
|
||||
return parent[value];
|
||||
};
|
||||
const union = (left, right) => {
|
||||
const rootLeft = find(left);
|
||||
const rootRight = find(right);
|
||||
if (rootLeft === rootRight) {
|
||||
return;
|
||||
}
|
||||
if (rank[rootLeft] < rank[rootRight]) {
|
||||
parent[rootLeft] = rootRight;
|
||||
return;
|
||||
}
|
||||
if (rank[rootLeft] > rank[rootRight]) {
|
||||
parent[rootRight] = rootLeft;
|
||||
return;
|
||||
}
|
||||
parent[rootRight] = rootLeft;
|
||||
rank[rootLeft] += 1;
|
||||
};
|
||||
return { find, union };
|
||||
}
|
||||
|
||||
function longestCommonSubsequence(leftValues, rightValues) {
|
||||
const left = Array.isArray(leftValues) ? leftValues : [];
|
||||
const right = Array.isArray(rightValues) ? rightValues : [];
|
||||
if (left.length === 0 || right.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const dp = Array.from({ length: left.length + 1 }, () => Array(right.length + 1).fill(0));
|
||||
for (let i = left.length - 1; i >= 0; i -= 1) {
|
||||
for (let j = right.length - 1; j >= 0; j -= 1) {
|
||||
if (left[i] === right[j]) {
|
||||
dp[i][j] = dp[i + 1][j + 1] + 1;
|
||||
} else {
|
||||
dp[i][j] = Math.max(dp[i + 1][j], dp[i][j + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
const output = [];
|
||||
let i = 0;
|
||||
let j = 0;
|
||||
while (i < left.length && j < right.length) {
|
||||
if (left[i] === right[j]) {
|
||||
output.push(left[i]);
|
||||
i += 1;
|
||||
j += 1;
|
||||
} else if (dp[i + 1][j] >= dp[i][j + 1]) {
|
||||
i += 1;
|
||||
} else {
|
||||
j += 1;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function buildFallbackCoreSequence(clusterTitles) {
|
||||
const titles = Array.isArray(clusterTitles) ? clusterTitles : [];
|
||||
const minimumFrequency = Math.max(2, Math.ceil(titles.length * 0.75));
|
||||
const frequencyMap = new Map();
|
||||
const positionMap = new Map();
|
||||
for (const title of titles) {
|
||||
const numbers = Array.isArray(title?.segmentNumbers) ? title.segmentNumbers : [];
|
||||
const seenInTitle = new Set();
|
||||
numbers.forEach((segment, index) => {
|
||||
if (!Number.isFinite(segment)) {
|
||||
return;
|
||||
}
|
||||
const normalized = Math.trunc(segment);
|
||||
if (!frequencyMap.has(normalized)) {
|
||||
frequencyMap.set(normalized, 0);
|
||||
positionMap.set(normalized, []);
|
||||
}
|
||||
if (!seenInTitle.has(normalized)) {
|
||||
frequencyMap.set(normalized, Number(frequencyMap.get(normalized) || 0) + 1);
|
||||
seenInTitle.add(normalized);
|
||||
}
|
||||
positionMap.get(normalized).push(index);
|
||||
});
|
||||
}
|
||||
|
||||
return Array.from(frequencyMap.entries())
|
||||
.filter(([, frequency]) => Number(frequency || 0) >= minimumFrequency)
|
||||
.map(([segment]) => {
|
||||
const positions = positionMap.get(segment) || [];
|
||||
const averagePosition = positions.length > 0
|
||||
? positions.reduce((sum, value) => sum + Number(value || 0), 0) / positions.length
|
||||
: Number.MAX_SAFE_INTEGER;
|
||||
return {
|
||||
segment,
|
||||
averagePosition
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.averagePosition - b.averagePosition || a.segment - b.segment)
|
||||
.map((entry) => entry.segment);
|
||||
}
|
||||
|
||||
function buildClusterCoreSequence(clusterTitles) {
|
||||
const titles = Array.isArray(clusterTitles) ? clusterTitles : [];
|
||||
const sequences = titles
|
||||
.map((title) => Array.isArray(title?.segmentNumbers) ? title.segmentNumbers : [])
|
||||
.filter((sequence) => sequence.length > 0);
|
||||
if (sequences.length === 0) {
|
||||
return [];
|
||||
}
|
||||
let coreSequence = sequences[0].slice();
|
||||
for (let index = 1; index < sequences.length; index += 1) {
|
||||
coreSequence = longestCommonSubsequence(coreSequence, sequences[index]);
|
||||
if (coreSequence.length === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (coreSequence.length >= Math.max(2, Math.floor(sequences[0].length / 3))) {
|
||||
return coreSequence;
|
||||
}
|
||||
return buildFallbackCoreSequence(clusterTitles);
|
||||
}
|
||||
|
||||
function makeVariantBoundaryKey(beforeSegment, afterSegment) {
|
||||
const before = Number.isFinite(Number(beforeSegment)) ? String(Math.trunc(Number(beforeSegment))).padStart(5, '0') : 'START';
|
||||
const after = Number.isFinite(Number(afterSegment)) ? String(Math.trunc(Number(afterSegment))).padStart(5, '0') : 'END';
|
||||
return `${before}->${after}`;
|
||||
}
|
||||
|
||||
function formatVariantSpanLabel(span) {
|
||||
if (!span || !Array.isArray(span.segments) || span.segments.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const before = Number.isFinite(Number(span.beforeSegment))
|
||||
? String(Math.trunc(Number(span.beforeSegment))).padStart(5, '0')
|
||||
: 'START';
|
||||
const after = Number.isFinite(Number(span.afterSegment))
|
||||
? String(Math.trunc(Number(span.afterSegment))).padStart(5, '0')
|
||||
: 'END';
|
||||
const segmentList = span.segments
|
||||
.map((segment) => String(Math.trunc(Number(segment))).padStart(5, '0'))
|
||||
.join(', ');
|
||||
return `${before}->${after}: [${segmentList}]`;
|
||||
}
|
||||
|
||||
function extractVariantSpansForTitle(segmentNumbers, coreSequence) {
|
||||
const numbers = Array.isArray(segmentNumbers)
|
||||
? segmentNumbers.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
const core = Array.isArray(coreSequence)
|
||||
? coreSequence.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
if (numbers.length === 0 || core.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const coreIndexBySegment = new Map(core.map((segment, index) => [segment, index]));
|
||||
const spans = [];
|
||||
let matchedCoreIndex = -1;
|
||||
let currentSpan = [];
|
||||
|
||||
const flushCurrentSpan = (afterSegment = null) => {
|
||||
if (currentSpan.length === 0) {
|
||||
return;
|
||||
}
|
||||
spans.push({
|
||||
beforeSegment: matchedCoreIndex >= 0 ? core[matchedCoreIndex] : null,
|
||||
afterSegment,
|
||||
segments: currentSpan.slice(),
|
||||
boundaryKey: makeVariantBoundaryKey(
|
||||
matchedCoreIndex >= 0 ? core[matchedCoreIndex] : null,
|
||||
afterSegment
|
||||
)
|
||||
});
|
||||
currentSpan = [];
|
||||
};
|
||||
|
||||
for (const segment of numbers) {
|
||||
const coreIndex = coreIndexBySegment.has(segment) ? coreIndexBySegment.get(segment) : -1;
|
||||
const expectedCoreIndex = matchedCoreIndex + 1;
|
||||
if (coreIndex === expectedCoreIndex) {
|
||||
flushCurrentSpan(segment);
|
||||
matchedCoreIndex = coreIndex;
|
||||
continue;
|
||||
}
|
||||
if (coreIndex > expectedCoreIndex) {
|
||||
flushCurrentSpan(core[expectedCoreIndex] ?? segment);
|
||||
matchedCoreIndex = coreIndex;
|
||||
continue;
|
||||
}
|
||||
currentSpan.push(segment);
|
||||
}
|
||||
|
||||
flushCurrentSpan(matchedCoreIndex + 1 < core.length ? core[matchedCoreIndex + 1] : null);
|
||||
return spans;
|
||||
}
|
||||
|
||||
function buildClusterCommonRuns(coreSequence, titleSpanRows) {
|
||||
const core = Array.isArray(coreSequence)
|
||||
? coreSequence.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
if (core.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const boundaries = new Set();
|
||||
for (const row of titleSpanRows || []) {
|
||||
for (const span of row?.variantSpans || []) {
|
||||
if (!Number.isFinite(Number(span?.beforeSegment)) || !Number.isFinite(Number(span?.afterSegment))) {
|
||||
continue;
|
||||
}
|
||||
boundaries.add(makeVariantBoundaryKey(span.beforeSegment, span.afterSegment));
|
||||
}
|
||||
}
|
||||
const runs = [];
|
||||
let startIndex = 0;
|
||||
for (let index = 0; index < core.length - 1; index += 1) {
|
||||
const boundaryKey = makeVariantBoundaryKey(core[index], core[index + 1]);
|
||||
if (!boundaries.has(boundaryKey)) {
|
||||
continue;
|
||||
}
|
||||
const runSegments = core.slice(startIndex, index + 1);
|
||||
if (runSegments.length > 0) {
|
||||
runs.push({
|
||||
startSegment: runSegments[0],
|
||||
endSegment: runSegments[runSegments.length - 1],
|
||||
length: runSegments.length,
|
||||
segments: runSegments
|
||||
});
|
||||
}
|
||||
startIndex = index + 1;
|
||||
}
|
||||
const tailSegments = core.slice(startIndex);
|
||||
if (tailSegments.length > 0) {
|
||||
runs.push({
|
||||
startSegment: tailSegments[0],
|
||||
endSegment: tailSegments[tailSegments.length - 1],
|
||||
length: tailSegments.length,
|
||||
segments: tailSegments
|
||||
});
|
||||
}
|
||||
return runs;
|
||||
}
|
||||
|
||||
function computeLegacySegmentMetrics(segmentNumbers) {
|
||||
function computeSegmentMetrics(segmentNumbers) {
|
||||
const numbers = Array.isArray(segmentNumbers)
|
||||
? segmentNumbers.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
||||
: [];
|
||||
@@ -952,368 +550,29 @@ function computeLegacySegmentMetrics(segmentNumbers) {
|
||||
};
|
||||
}
|
||||
|
||||
function computeStandaloneSegmentMetrics(title) {
|
||||
const legacyMetrics = computeLegacySegmentMetrics(title?.segmentNumbers);
|
||||
const transitions = Math.max(1, legacyMetrics.segmentCount - 1);
|
||||
const directRatio = legacyMetrics.directSequenceSteps / transitions;
|
||||
const nonBackwardRatio = 1 - (legacyMetrics.backwardJumps / transitions);
|
||||
const boundedJumpRatio = 1 - (legacyMetrics.largeJumps / transitions);
|
||||
const antiAlternatingRatio = 1 - legacyMetrics.alternatingRatio;
|
||||
const correctedCoherence = clamp01(
|
||||
(directRatio * 0.18)
|
||||
+ (clamp01(nonBackwardRatio) * 0.34)
|
||||
+ (clamp01(boundedJumpRatio) * 0.34)
|
||||
+ (clamp01(antiAlternatingRatio) * 0.14)
|
||||
);
|
||||
return {
|
||||
...legacyMetrics,
|
||||
clusterId: null,
|
||||
clusterSize: 1,
|
||||
averageSegmentOverlap: 0,
|
||||
commonRuns: [],
|
||||
commonRunCount: 0,
|
||||
sharedCoreCount: 0,
|
||||
sharedCoreRatio: 0,
|
||||
sharedAdjacencyRatio: 0,
|
||||
variantSpans: [],
|
||||
variantSpanCount: 0,
|
||||
variantSegmentCount: 0,
|
||||
singleSegmentVariantSpans: 0,
|
||||
multiSegmentVariantSpans: 0,
|
||||
variantComplexity: 0,
|
||||
legacySequenceCoherence: legacyMetrics.sequenceCoherence,
|
||||
legacyStructureScore: legacyMetrics.score,
|
||||
correctedCoherence: Number(correctedCoherence.toFixed(4)),
|
||||
sequenceCoherence: Number(correctedCoherence.toFixed(4)),
|
||||
score: Number((correctedCoherence * 35).toFixed(4)),
|
||||
coherenceMode: 'standalone',
|
||||
positionReason: 'Einzelkandidat oder kein Branching-Cluster erkannt.'
|
||||
};
|
||||
}
|
||||
|
||||
function buildClusterContexts(titles, options = {}) {
|
||||
const rows = (Array.isArray(titles) ? titles : []).map((title, index) => ({
|
||||
...title,
|
||||
_clusterIndex: index,
|
||||
_audioSignatureTokens: buildAudioSignatureTokens(title)
|
||||
}));
|
||||
if (rows.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const durationTolerance = Math.max(
|
||||
0,
|
||||
Math.round(Number(options.durationSimilaritySeconds || DEFAULT_DURATION_SIMILARITY_SECONDS))
|
||||
);
|
||||
const dsu = buildDisjointSet(rows.length);
|
||||
for (let leftIndex = 0; leftIndex < rows.length; leftIndex += 1) {
|
||||
for (let rightIndex = leftIndex + 1; rightIndex < rows.length; rightIndex += 1) {
|
||||
const left = rows[leftIndex];
|
||||
const right = rows[rightIndex];
|
||||
const durationClose = Math.abs(Number(left?.durationSeconds || 0) - Number(right?.durationSeconds || 0)) <= durationTolerance;
|
||||
if (!durationClose) {
|
||||
continue;
|
||||
}
|
||||
const audioSimilarity = computeTokenJaccardSimilarity(left._audioSignatureTokens, right._audioSignatureTokens);
|
||||
if (audioSimilarity < BRANCHING_AUDIO_SIMILARITY_THRESHOLD) {
|
||||
continue;
|
||||
}
|
||||
const overlapInfo = computeSegmentOverlapInfo(left?.segmentNumbers, right?.segmentNumbers);
|
||||
if (overlapInfo.ratioToSmaller < BRANCHING_OVERLAP_THRESHOLD) {
|
||||
continue;
|
||||
}
|
||||
dsu.union(leftIndex, rightIndex);
|
||||
}
|
||||
}
|
||||
|
||||
const grouped = new Map();
|
||||
rows.forEach((row, index) => {
|
||||
const root = dsu.find(index);
|
||||
if (!grouped.has(root)) {
|
||||
grouped.set(root, []);
|
||||
}
|
||||
grouped.get(root).push(row);
|
||||
});
|
||||
|
||||
return Array.from(grouped.values())
|
||||
.filter((clusterRows) => clusterRows.length > 1)
|
||||
.sort((left, right) => right.length - left.length)
|
||||
.map((clusterRows, clusterIndex) => {
|
||||
const clusterId = `branching-${clusterIndex + 1}`;
|
||||
const pairwiseOverlap = {};
|
||||
for (const row of clusterRows) {
|
||||
const playlistId = normalizePlaylistId(row?.playlistId);
|
||||
if (!playlistId) {
|
||||
continue;
|
||||
}
|
||||
pairwiseOverlap[playlistId] = {};
|
||||
}
|
||||
for (let i = 0; i < clusterRows.length; i += 1) {
|
||||
for (let j = i + 1; j < clusterRows.length; j += 1) {
|
||||
const left = clusterRows[i];
|
||||
const right = clusterRows[j];
|
||||
const leftPlaylistId = normalizePlaylistId(left?.playlistId);
|
||||
const rightPlaylistId = normalizePlaylistId(right?.playlistId);
|
||||
const overlapInfo = computeSegmentOverlapInfo(left?.segmentNumbers, right?.segmentNumbers);
|
||||
if (leftPlaylistId && rightPlaylistId) {
|
||||
pairwiseOverlap[leftPlaylistId][rightPlaylistId] = overlapInfo;
|
||||
pairwiseOverlap[rightPlaylistId][leftPlaylistId] = overlapInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const coreSequence = buildClusterCoreSequence(clusterRows);
|
||||
const titleSpanRows = clusterRows.map((row) => {
|
||||
const variantSpans = extractVariantSpansForTitle(row?.segmentNumbers, coreSequence);
|
||||
const variantSegmentCount = variantSpans.reduce((sum, span) => sum + span.segments.length, 0);
|
||||
const singleSegmentVariantSpans = variantSpans.filter((span) => span.segments.length === 1).length;
|
||||
const multiSegmentVariantSpans = variantSpans.filter((span) => span.segments.length > 1).length;
|
||||
const variantComplexity = variantSpans.reduce((sum, span) => sum + (span.segments.length ** 2), 0);
|
||||
const playlistId = normalizePlaylistId(row?.playlistId);
|
||||
const overlapEntries = playlistId && pairwiseOverlap[playlistId]
|
||||
? Object.entries(pairwiseOverlap[playlistId]).map(([otherPlaylistId, info]) => ({
|
||||
otherPlaylistId,
|
||||
ratioToSmaller: Number(info?.ratioToSmaller || 0),
|
||||
sharedCount: Number(info?.sharedCount || 0)
|
||||
}))
|
||||
: [];
|
||||
const averageSegmentOverlap = overlapEntries.length > 0
|
||||
? overlapEntries.reduce((sum, entry) => sum + Number(entry.ratioToSmaller || 0), 0) / overlapEntries.length
|
||||
: 0;
|
||||
return {
|
||||
row,
|
||||
variantSpans,
|
||||
variantSegmentCount,
|
||||
singleSegmentVariantSpans,
|
||||
multiSegmentVariantSpans,
|
||||
variantComplexity,
|
||||
overlapEntries,
|
||||
averageSegmentOverlap: Number(averageSegmentOverlap.toFixed(4))
|
||||
};
|
||||
});
|
||||
|
||||
const commonRuns = buildClusterCommonRuns(coreSequence, titleSpanRows);
|
||||
const maxVariantComplexity = titleSpanRows.reduce((max, row) => Math.max(max, Number(row.variantComplexity || 0)), 0);
|
||||
const maxVariantSegmentCount = titleSpanRows.reduce((max, row) => Math.max(max, Number(row.variantSegmentCount || 0)), 0);
|
||||
const maxVariantSpanCount = titleSpanRows.reduce((max, row) => Math.max(max, Number(row.variantSpans.length || 0)), 0);
|
||||
const legacyStructureScores = titleSpanRows.map((row) => Number(computeLegacySegmentMetrics(row.row?.segmentNumbers).score || 0));
|
||||
const minLegacyStructureScore = legacyStructureScores.length > 0 ? Math.min(...legacyStructureScores) : 0;
|
||||
const maxLegacyStructureScore = legacyStructureScores.length > 0 ? Math.max(...legacyStructureScores) : 0;
|
||||
|
||||
const titlesWithMetrics = titleSpanRows.map((spanRow, index) => {
|
||||
const legacyMetrics = computeLegacySegmentMetrics(spanRow.row?.segmentNumbers);
|
||||
const sharedCoreCount = coreSequence.length;
|
||||
const segmentCount = Math.max(1, Number(legacyMetrics.segmentCount || 0));
|
||||
const sharedCoreRatio = sharedCoreCount > 0 ? sharedCoreCount / segmentCount : 0;
|
||||
const variantSpanCount = spanRow.variantSpans.length;
|
||||
const variantComplexityNorm = maxVariantComplexity > 0
|
||||
? Number(spanRow.variantComplexity || 0) / maxVariantComplexity
|
||||
: 0;
|
||||
const variantSegmentNorm = maxVariantSegmentCount > 0
|
||||
? Number(spanRow.variantSegmentCount || 0) / maxVariantSegmentCount
|
||||
: 0;
|
||||
const variantSpanNorm = maxVariantSpanCount > 0
|
||||
? Number(variantSpanCount || 0) / maxVariantSpanCount
|
||||
: 0;
|
||||
const singleSegmentVariantRatio = variantSpanCount > 0
|
||||
? spanRow.singleSegmentVariantSpans / variantSpanCount
|
||||
: 1;
|
||||
const multiSegmentPenalty = variantSpanCount > 0
|
||||
? spanRow.multiSegmentVariantSpans / variantSpanCount
|
||||
: 0;
|
||||
const legacyRange = maxLegacyStructureScore - minLegacyStructureScore;
|
||||
const legacyTieHint = legacyRange > 0
|
||||
? clamp01((Number(legacyMetrics.score || 0) - minLegacyStructureScore) / legacyRange)
|
||||
: 0;
|
||||
const correctedCoherence = clamp01(
|
||||
(sharedCoreRatio * 0.38)
|
||||
+ (spanRow.averageSegmentOverlap * 0.12)
|
||||
+ (singleSegmentVariantRatio * 0.22)
|
||||
+ ((1 - variantComplexityNorm) * 0.16)
|
||||
+ ((1 - variantSegmentNorm) * 0.08)
|
||||
+ ((1 - variantSpanNorm) * 0.04)
|
||||
+ (legacyTieHint * 0.02)
|
||||
- (multiSegmentPenalty * 0.08)
|
||||
);
|
||||
|
||||
let positionReason = 'nahe Branching-Variante';
|
||||
if (spanRow.multiSegmentVariantSpans === 0 && spanRow.variantSegmentCount <= Math.max(1, variantSpanCount)) {
|
||||
positionReason = 'strukturell einfachster Basis-/Referenzpfad im Cluster';
|
||||
} else if (spanRow.multiSegmentVariantSpans > 0) {
|
||||
positionReason = 'Variante mit zusätzlichen Mehrsegment-Branches';
|
||||
}
|
||||
|
||||
return {
|
||||
...spanRow.row,
|
||||
...legacyMetrics,
|
||||
clusterId,
|
||||
clusterSize: clusterRows.length,
|
||||
averageSegmentOverlap: spanRow.averageSegmentOverlap,
|
||||
overlapEntries: spanRow.overlapEntries,
|
||||
commonRuns,
|
||||
commonRunCount: commonRuns.length,
|
||||
sharedCoreCount,
|
||||
sharedCoreRatio: Number(sharedCoreRatio.toFixed(4)),
|
||||
sharedAdjacencyRatio: coreSequence.length > 1 ? 1 : 0,
|
||||
variantSpans: spanRow.variantSpans,
|
||||
variantSpanCount,
|
||||
variantSegmentCount: spanRow.variantSegmentCount,
|
||||
singleSegmentVariantSpans: spanRow.singleSegmentVariantSpans,
|
||||
multiSegmentVariantSpans: spanRow.multiSegmentVariantSpans,
|
||||
variantComplexity: spanRow.variantComplexity,
|
||||
legacySequenceCoherence: legacyMetrics.sequenceCoherence,
|
||||
legacyStructureScore: legacyMetrics.score,
|
||||
correctedCoherence: Number(correctedCoherence.toFixed(4)),
|
||||
sequenceCoherence: Number(correctedCoherence.toFixed(4)),
|
||||
score: Number((((correctedCoherence * 60) + Math.min(18, (clusterRows.length - 1) * 9))).toFixed(4)),
|
||||
coherenceMode: 'cluster_relative',
|
||||
positionReason,
|
||||
_legacyTieHint: legacyTieHint,
|
||||
_clusterSortIndex: index
|
||||
};
|
||||
});
|
||||
|
||||
const variantBoundaries = uniqueOrdered(
|
||||
titleSpanRows
|
||||
.flatMap((row) => row.variantSpans.map((span) => formatVariantSpanLabel(span)))
|
||||
.filter(Boolean)
|
||||
);
|
||||
|
||||
return {
|
||||
id: clusterId,
|
||||
size: clusterRows.length,
|
||||
coreSequence,
|
||||
commonRuns,
|
||||
variantBoundaries,
|
||||
pairwiseOverlap,
|
||||
titles: titlesWithMetrics
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function computeSegmentMetrics(title, clusterMetricsByPlaylist = null) {
|
||||
const playlistId = normalizePlaylistId(title?.playlistId);
|
||||
if (playlistId && clusterMetricsByPlaylist && clusterMetricsByPlaylist[playlistId]) {
|
||||
return clusterMetricsByPlaylist[playlistId];
|
||||
}
|
||||
return computeStandaloneSegmentMetrics(title);
|
||||
}
|
||||
|
||||
function buildEvaluationLabel(metrics) {
|
||||
if (!metrics || metrics.segmentCount === 0) {
|
||||
return 'Keine Segmentliste aus TINFO:26 verfügbar';
|
||||
}
|
||||
if (String(metrics?.coherenceMode || '') === 'cluster_relative' && Number(metrics?.clusterSize || 0) > 1) {
|
||||
if (metrics.multiSegmentVariantSpans === 0 && metrics.variantSegmentCount <= Math.max(1, Number(metrics.variantSpanCount || 0))) {
|
||||
return 'strukturell sauberster Basis-/Referenzpfad im Branching-Cluster';
|
||||
}
|
||||
if (metrics.correctedCoherence >= 0.6) {
|
||||
return 'nahe Branching-Variante mit plausibler Segmentstruktur';
|
||||
}
|
||||
return 'komplexere Branching-Variante - Sichtprüfung empfohlen';
|
||||
}
|
||||
if (metrics.alternatingRatio >= 0.55 && metrics.alternatingPairs >= 3) {
|
||||
return 'Auffällige Segmentstruktur - Sichtprüfung empfohlen';
|
||||
return 'Fake-Struktur (alternierendes Sprungmuster)';
|
||||
}
|
||||
if (metrics.correctedCoherence < 0.45) {
|
||||
return 'unklare Segmentstruktur - Sichtprüfung empfohlen';
|
||||
if (metrics.backwardJumps > 0 || metrics.largeJumps > 0) {
|
||||
return 'Auffällige Segmentreihenfolge';
|
||||
}
|
||||
return 'wahrscheinlich konsistente Segmentstruktur';
|
||||
return 'wahrscheinlich korrekt (lineare Segmentfolge)';
|
||||
}
|
||||
|
||||
function normalizeRelativeScore(value, maxValue) {
|
||||
const numericValue = Number(value || 0);
|
||||
const numericMax = Number(maxValue || 0);
|
||||
if (!Number.isFinite(numericValue) || numericValue <= 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!Number.isFinite(numericMax) || numericMax <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(1, Math.max(0, numericValue / numericMax));
|
||||
}
|
||||
|
||||
function scoreCandidates(groupTitles, options = {}) {
|
||||
function scoreCandidates(groupTitles) {
|
||||
const titles = Array.isArray(groupTitles) ? groupTitles : [];
|
||||
if (titles.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const maxDurationSeconds = titles.reduce(
|
||||
(max, title) => Math.max(max, Number(title?.durationSeconds || 0)),
|
||||
0
|
||||
);
|
||||
const maxAudioTrackCount = titles.reduce(
|
||||
(max, title) => Math.max(max, Number(title?.audioTrackCount || 0)),
|
||||
0
|
||||
);
|
||||
const maxChapterCount = titles.reduce(
|
||||
(max, title) => Math.max(max, Number(title?.chapters || 0)),
|
||||
0
|
||||
);
|
||||
const clusterContexts = buildClusterContexts(titles, options);
|
||||
const clusterMetricsByPlaylist = {};
|
||||
const clusterSummaryRows = [];
|
||||
for (const clusterContext of clusterContexts) {
|
||||
const playlistIds = [];
|
||||
for (const metrics of clusterContext.titles || []) {
|
||||
const playlistId = normalizePlaylistId(metrics?.playlistId);
|
||||
if (playlistId) {
|
||||
clusterMetricsByPlaylist[playlistId] = metrics;
|
||||
playlistIds.push(playlistId);
|
||||
}
|
||||
}
|
||||
clusterSummaryRows.push({
|
||||
id: clusterContext.id,
|
||||
size: clusterContext.size,
|
||||
playlistIds: uniqueOrdered(playlistIds),
|
||||
commonRuns: clusterContext.commonRuns,
|
||||
variantBoundaries: clusterContext.variantBoundaries
|
||||
});
|
||||
}
|
||||
|
||||
return titles
|
||||
.map((title) => {
|
||||
const metrics = computeSegmentMetrics(title, clusterMetricsByPlaylist);
|
||||
const structureScore = Number(metrics.score || 0);
|
||||
const durationScore = normalizeRelativeScore(title.durationSeconds, maxDurationSeconds) * 20;
|
||||
const audioScore = normalizeRelativeScore(title.audioTrackCount, maxAudioTrackCount) * 4;
|
||||
const chapterScore = normalizeRelativeScore(title.chapters, maxChapterCount) * 6;
|
||||
const totalScore = structureScore + durationScore + audioScore + chapterScore;
|
||||
const overlapSummary = Array.isArray(metrics?.overlapEntries)
|
||||
? metrics.overlapEntries
|
||||
.map((entry) => `${entry.otherPlaylistId}:${Number(entry.ratioToSmaller || 0).toFixed(3)}`)
|
||||
.join(', ')
|
||||
: '';
|
||||
const commonRunsSummary = Array.isArray(metrics?.commonRuns)
|
||||
? metrics.commonRuns
|
||||
.map((run) => `${String(run.startSegment).padStart(5, '0')}-${String(run.endSegment).padStart(5, '0')}`)
|
||||
.join(' | ')
|
||||
: '';
|
||||
const variantSummary = Array.isArray(metrics?.variantSpans)
|
||||
? metrics.variantSpans
|
||||
.map((span) => formatVariantSpanLabel(span))
|
||||
.filter(Boolean)
|
||||
.join(' | ')
|
||||
: '';
|
||||
const metrics = computeSegmentMetrics(title.segmentNumbers);
|
||||
const reasons = [
|
||||
`structure_score=${structureScore.toFixed(2)}`,
|
||||
`duration_score=${durationScore.toFixed(2)}`,
|
||||
`audio_score=${audioScore.toFixed(2)}`,
|
||||
`chapter_score=${chapterScore.toFixed(2)}`,
|
||||
`legacy_structure_score=${Number(metrics.legacyStructureScore || 0).toFixed(2)}`,
|
||||
`legacy_sequence_coherence=${Number(metrics.legacySequenceCoherence || 0).toFixed(3)}`,
|
||||
`corrected_coherence=${Number(metrics.correctedCoherence || 0).toFixed(3)}`,
|
||||
`cluster=${metrics.clusterId || 'standalone'}${metrics.clusterSize > 1 ? `(${metrics.clusterSize})` : ''}`,
|
||||
`avg_segment_overlap=${Number(metrics.averageSegmentOverlap || 0).toFixed(3)}`,
|
||||
`core_coverage=${Number(metrics.sharedCoreRatio || 0).toFixed(3)}`,
|
||||
`variant_spans=${Number(metrics.variantSpanCount || 0)}`,
|
||||
`variant_segments=${Number(metrics.variantSegmentCount || 0)}`,
|
||||
`single_segment_spans=${Number(metrics.singleSegmentVariantSpans || 0)}`,
|
||||
`multi_segment_spans=${Number(metrics.multiSegmentVariantSpans || 0)}`,
|
||||
`common_runs=${commonRunsSummary || '-'}`,
|
||||
`variant_boundaries=${variantSummary || '-'}`,
|
||||
`segment_overlap_map=${overlapSummary || '-'}`,
|
||||
`position_reason=${metrics.positionReason || '-'}`,
|
||||
`sequence_steps=${metrics.directSequenceSteps}`,
|
||||
`sequence_coherence=${metrics.sequenceCoherence.toFixed(3)}`,
|
||||
`backward_jumps=${metrics.backwardJumps}`,
|
||||
@@ -1323,34 +582,22 @@ function scoreCandidates(groupTitles, options = {}) {
|
||||
|
||||
return {
|
||||
...title,
|
||||
score: Number(totalScore.toFixed(4)),
|
||||
score: Number(metrics.score || 0),
|
||||
reasons,
|
||||
structuralMetrics: metrics,
|
||||
evaluationLabel: buildEvaluationLabel(metrics),
|
||||
correctedCoherence: Number(metrics.correctedCoherence || 0),
|
||||
legacySequenceCoherence: Number(metrics.legacySequenceCoherence || 0),
|
||||
legacyStructureScore: Number(metrics.legacyStructureScore || 0),
|
||||
clusterId: metrics.clusterId || null,
|
||||
clusterSize: Number(metrics.clusterSize || 1),
|
||||
averageSegmentOverlap: Number(metrics.averageSegmentOverlap || 0),
|
||||
commonRuns: Array.isArray(metrics.commonRuns) ? metrics.commonRuns : [],
|
||||
variantSpans: Array.isArray(metrics.variantSpans) ? metrics.variantSpans : [],
|
||||
overlapEntries: Array.isArray(metrics.overlapEntries) ? metrics.overlapEntries : [],
|
||||
positionReason: metrics.positionReason || null
|
||||
evaluationLabel: buildEvaluationLabel(metrics)
|
||||
};
|
||||
})
|
||||
.sort((a, b) =>
|
||||
b.score - a.score
|
||||
|| b.structuralMetrics.sequenceCoherence - a.structuralMetrics.sequenceCoherence
|
||||
|| b.legacyStructureScore - a.legacyStructureScore
|
||||
|| b.durationSeconds - a.durationSeconds
|
||||
|| b.sizeBytes - a.sizeBytes
|
||||
|| a.titleId - b.titleId
|
||||
)
|
||||
.map((item, index) => ({
|
||||
...item,
|
||||
recommended: index === 0,
|
||||
clusterSummary: clusterSummaryRows.find((row) => row.id === item.clusterId) || null
|
||||
recommended: index === 0
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1415,18 +662,6 @@ function extractPlaylistMismatchWarnings(titles) {
|
||||
|
||||
function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {}) {
|
||||
const parsedTitles = parseAnalyzeTitles(lines);
|
||||
const playlistAliasMap = buildPlaylistAliasMap(lines);
|
||||
const parsedTitlesWithAliases = parsedTitles.map((item) => {
|
||||
const playlistId = normalizePlaylistId(item?.playlistId);
|
||||
const aliasesRaw = playlistId && Array.isArray(playlistAliasMap?.[playlistId])
|
||||
? playlistAliasMap[playlistId]
|
||||
: [];
|
||||
const playlistAliases = uniqueOrdered(aliasesRaw.map((value) => normalizePlaylistId(value)).filter(Boolean));
|
||||
return {
|
||||
...item,
|
||||
playlistAliases
|
||||
};
|
||||
});
|
||||
const reportedTitleCount = parseReportedTitleCount(lines);
|
||||
const minSeconds = Math.max(0, Math.round(Number(minLengthMinutes || 0) * 60));
|
||||
const durationSimilaritySeconds = Math.max(
|
||||
@@ -1434,7 +669,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
Math.round(Number(options.durationSimilaritySeconds || DEFAULT_DURATION_SIMILARITY_SECONDS))
|
||||
);
|
||||
|
||||
const candidatesRaw = parsedTitlesWithAliases
|
||||
const candidatesRaw = parsedTitles
|
||||
.filter((item) => Number(item.durationSeconds || 0) >= minSeconds)
|
||||
.sort((a, b) => b.durationSeconds - a.durationSeconds || b.sizeBytes - a.sizeBytes || a.titleId - b.titleId);
|
||||
const candidates = suppressRawMirrorCandidates(candidatesRaw)
|
||||
@@ -1451,24 +686,11 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
const multipleCandidatesDetected = candidatePlaylistsAll.length > 1;
|
||||
const manualDecisionRequired = multipleCandidatesDetected;
|
||||
const decisionPool = manualDecisionRequired ? playlistBackedCandidates : [];
|
||||
const evaluatedCandidates = decisionPool.length > 0
|
||||
? scoreCandidates(decisionPool, { durationSimilaritySeconds })
|
||||
: [];
|
||||
const evaluatedCandidates = decisionPool.length > 0 ? scoreCandidates(decisionPool) : [];
|
||||
const recommendation = evaluatedCandidates[0] || null;
|
||||
const rankedCandidatePlaylists = uniqueOrdered(
|
||||
evaluatedCandidates.map((item) => normalizePlaylistId(item?.playlistId)).filter(Boolean)
|
||||
);
|
||||
const candidatePlaylists = manualDecisionRequired
|
||||
? uniqueOrdered([...rankedCandidatePlaylists, ...candidatePlaylistsAll])
|
||||
: [];
|
||||
const candidatePlaylists = manualDecisionRequired ? candidatePlaylistsAll : [];
|
||||
const playlistSegments = buildPlaylistSegmentMap(decisionPool);
|
||||
const playlistToTitleId = buildPlaylistToTitleIdMap(parsedTitlesWithAliases);
|
||||
const branchingClusters = uniqueOrdered(
|
||||
evaluatedCandidates
|
||||
.map((item) => item?.clusterSummary)
|
||||
.filter((value) => value && typeof value === 'object')
|
||||
.map((value) => JSON.stringify(value))
|
||||
).map((value) => JSON.parse(value));
|
||||
const playlistToTitleId = buildPlaylistToTitleIdMap(parsedTitles);
|
||||
|
||||
return {
|
||||
generatedAt: new Date().toISOString(),
|
||||
@@ -1476,7 +698,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
minLengthMinutes: Number(minLengthMinutes || 0),
|
||||
minLengthSeconds: minSeconds,
|
||||
durationSimilaritySeconds,
|
||||
titles: parsedTitlesWithAliases,
|
||||
titles: parsedTitles,
|
||||
candidates,
|
||||
duplicateDurationGroups: similarityGroups,
|
||||
obfuscationDetected,
|
||||
@@ -1487,7 +709,6 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
candidatePlaylists,
|
||||
candidatePlaylistFiles: candidatePlaylists.map((item) => `${item}.mpls`),
|
||||
playlistToTitleId,
|
||||
playlistAliasMap,
|
||||
recommendation: recommendation
|
||||
? {
|
||||
titleId: recommendation.titleId,
|
||||
@@ -1500,7 +721,6 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
: null,
|
||||
evaluatedCandidates,
|
||||
playlistSegments,
|
||||
branchingClusters,
|
||||
structuralAnalysis: {
|
||||
method: 'makemkv_tinfo_26',
|
||||
sourceCommand: 'makemkvcon -r info disc:0 --robot',
|
||||
@@ -1511,7 +731,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
||||
...(reportedTitleCount !== null && reportedTitleCount !== parsedTitles.length
|
||||
? [`Titel-Anzahl abweichend: TCOUNT=${reportedTitleCount}, geparst=${parsedTitles.length}`]
|
||||
: []),
|
||||
...extractPlaylistMismatchWarnings(parsedTitlesWithAliases)
|
||||
...extractPlaylistMismatchWarnings(parsedTitles)
|
||||
].slice(0, 60)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -93,34 +93,8 @@ function parseCdParanoiaProgress(line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseMkvmergeProgress(line) {
|
||||
const normalized = String(line || '').replace(/\s+/g, ' ').trim();
|
||||
if (!normalized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Common mkvmerge output examples:
|
||||
// "Progress: 42%"
|
||||
// "#GUI#progress 42%"
|
||||
const explicitMatch = normalized.match(/(?:^|\s)(?:progress:?|#GUI#progress)\s*(\d{1,3}(?:\.\d+)?)\s*%/i);
|
||||
if (explicitMatch) {
|
||||
return {
|
||||
percent: clampPercent(Number(explicitMatch[1])),
|
||||
eta: null
|
||||
};
|
||||
}
|
||||
|
||||
const percent = parseGenericPercent(normalized);
|
||||
if (percent !== null) {
|
||||
return { percent, eta: null };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parseMakeMkvProgress,
|
||||
parseHandBrakeProgress,
|
||||
parseCdParanoiaProgress,
|
||||
parseMkvmergeProgress
|
||||
parseCdParanoiaProgress
|
||||
};
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
function padNumber(value, length = 2) {
|
||||
return String(value).padStart(length, '0');
|
||||
}
|
||||
|
||||
function formatTimezoneOffset(offsetMinutes) {
|
||||
const sign = offsetMinutes >= 0 ? '+' : '-';
|
||||
const absoluteMinutes = Math.abs(offsetMinutes);
|
||||
const hours = Math.floor(absoluteMinutes / 60);
|
||||
const minutes = absoluteMinutes % 60;
|
||||
return `${sign}${padNumber(hours)}:${padNumber(minutes)}`;
|
||||
}
|
||||
|
||||
function getServerTimestamp(input = new Date()) {
|
||||
const date = input instanceof Date ? input : new Date(input);
|
||||
|
||||
return `${date.getFullYear()}-${padNumber(date.getMonth() + 1)}-${padNumber(date.getDate())}`
|
||||
+ `T${padNumber(date.getHours())}:${padNumber(date.getMinutes())}:${padNumber(date.getSeconds())}`
|
||||
+ `.${padNumber(date.getMilliseconds(), 3)}${formatTimezoneOffset(-date.getTimezoneOffset())}`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getServerTimestamp
|
||||
};
|
||||
@@ -1,100 +0,0 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { analyzePlaylistObfuscation } = require('../src/utils/playlistAnalysis');
|
||||
|
||||
function buildTitleLines({
|
||||
titleId,
|
||||
playlistId,
|
||||
duration = '01:34:41',
|
||||
chapters = 20,
|
||||
audioTrackCount = 3,
|
||||
subtitleTrackCount = 2,
|
||||
segmentNumbers = []
|
||||
}) {
|
||||
const lines = [
|
||||
`MSG:3016,0,0,"${playlistId}.mpls","${titleId}"`,
|
||||
`TINFO:${titleId},16,0,"${playlistId}.mpls"`,
|
||||
`TINFO:${titleId},9,0,"${duration}"`,
|
||||
`TINFO:${titleId},8,0,"${chapters}"`,
|
||||
`TINFO:${titleId},26,0,"${segmentNumbers.join(', ')}"`
|
||||
];
|
||||
|
||||
for (let index = 0; index < audioTrackCount; index += 1) {
|
||||
lines.push(`SINFO:${titleId},${index},1,0,"Audio"`);
|
||||
lines.push(`SINFO:${titleId},${index},3,0,"eng"`);
|
||||
lines.push(`SINFO:${titleId},${index},4,0,"English"`);
|
||||
lines.push(`SINFO:${titleId},${index},6,0,"DTS-HD MA"`);
|
||||
lines.push(`SINFO:${titleId},${index},40,0,"5.1 ch"`);
|
||||
}
|
||||
|
||||
for (let index = 0; index < subtitleTrackCount; index += 1) {
|
||||
const streamIndex = audioTrackCount + index;
|
||||
lines.push(`SINFO:${titleId},${streamIndex},1,0,"Subtitle"`);
|
||||
lines.push(`SINFO:${titleId},${streamIndex},3,0,"eng"`);
|
||||
lines.push(`SINFO:${titleId},${streamIndex},4,0,"English"`);
|
||||
lines.push(`SINFO:${titleId},${streamIndex},6,0,"PGS"`);
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
test('branching cluster prefers the structurally simplest reference playlist', () => {
|
||||
const lines = [
|
||||
...buildTitleLines({
|
||||
titleId: 0,
|
||||
playlistId: '00802',
|
||||
segmentNumbers: [
|
||||
866, 868, 829, 848, 830, 849, 831, 850, 832, 851,
|
||||
833, 852, 834, 853, 835, 854, 869, 870, 872, 855,
|
||||
837, 856, 838, 857, 839, 858, 840, 859, 841, 860,
|
||||
842, 861, 843, 862, 844, 863, 845, 864, 846
|
||||
]
|
||||
}),
|
||||
...buildTitleLines({
|
||||
titleId: 1,
|
||||
playlistId: '00800',
|
||||
segmentNumbers: [
|
||||
847, 829, 848, 830, 849, 831, 850, 832, 851, 833,
|
||||
852, 834, 853, 835, 854, 836, 855, 837, 856, 838,
|
||||
857, 839, 858, 840, 859, 841, 860, 842, 861, 843,
|
||||
862, 844, 863, 845, 864, 846
|
||||
]
|
||||
}),
|
||||
...buildTitleLines({
|
||||
titleId: 3,
|
||||
playlistId: '00804',
|
||||
segmentNumbers: [
|
||||
867, 868, 829, 848, 830, 849, 831, 850, 832, 851,
|
||||
833, 852, 834, 853, 835, 854, 869, 871, 872, 855,
|
||||
837, 856, 838, 857, 839, 858, 840, 859, 841, 860,
|
||||
842, 861, 843, 862, 844, 863, 845, 864, 846
|
||||
]
|
||||
})
|
||||
];
|
||||
|
||||
const analysis = analyzePlaylistObfuscation(lines, 60, {
|
||||
durationSimilaritySeconds: 90
|
||||
});
|
||||
|
||||
assert.equal(analysis?.recommendation?.playlistId, '00800');
|
||||
assert.deepEqual(
|
||||
(analysis?.evaluatedCandidates || []).map((item) => item.playlistId),
|
||||
['00800', '00804', '00802']
|
||||
);
|
||||
assert.deepEqual(analysis?.candidatePlaylists || [], ['00800', '00804', '00802']);
|
||||
|
||||
const preferred = (analysis?.evaluatedCandidates || [])[0];
|
||||
assert.equal(preferred?.recommended, true);
|
||||
assert.equal(preferred?.evaluationLabel, 'strukturell sauberster Basis-/Referenzpfad im Branching-Cluster');
|
||||
|
||||
const variantSummary = (preferred?.variantSpans || []).map((span) => ({
|
||||
before: span.beforeSegment,
|
||||
after: span.afterSegment,
|
||||
segments: span.segments
|
||||
}));
|
||||
assert.deepEqual(variantSummary, [
|
||||
{ before: null, after: 829, segments: [847] },
|
||||
{ before: 854, after: 855, segments: [836] }
|
||||
]);
|
||||
});
|
||||
+11
-182
@@ -32,7 +32,6 @@ CREATE TABLE jobs (
|
||||
poster_url TEXT,
|
||||
omdb_json TEXT,
|
||||
selected_from_omdb INTEGER DEFAULT 0,
|
||||
migrate_tmdb INTEGER NOT NULL DEFAULT 0,
|
||||
start_time TEXT,
|
||||
end_time TEXT,
|
||||
status TEXT NOT NULL,
|
||||
@@ -52,9 +51,6 @@ CREATE TABLE jobs (
|
||||
aax_checksum TEXT,
|
||||
media_type TEXT,
|
||||
job_kind TEXT,
|
||||
is_multipart_movie INTEGER NOT NULL DEFAULT 0,
|
||||
disc_number INTEGER,
|
||||
metadata_fingerprint TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (parent_job_id) REFERENCES jobs(id) ON DELETE SET NULL
|
||||
@@ -64,8 +60,6 @@ CREATE INDEX idx_jobs_status ON jobs(status);
|
||||
CREATE INDEX idx_jobs_created_at ON jobs(created_at DESC);
|
||||
CREATE INDEX idx_jobs_parent_job_id ON jobs(parent_job_id);
|
||||
CREATE INDEX idx_jobs_job_kind ON jobs(job_kind);
|
||||
CREATE INDEX idx_jobs_disc_number ON jobs(disc_number);
|
||||
CREATE INDEX idx_jobs_metadata_fingerprint ON jobs(metadata_fingerprint);
|
||||
|
||||
CREATE TABLE job_lineage_artifacts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -99,7 +93,6 @@ CREATE TABLE scripts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
script_body TEXT NOT NULL,
|
||||
is_favorite INTEGER NOT NULL DEFAULT 0,
|
||||
order_index INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
@@ -111,8 +104,6 @@ CREATE INDEX idx_scripts_order_index ON scripts(order_index, id);
|
||||
CREATE TABLE script_chains (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
description TEXT,
|
||||
is_favorite INTEGER NOT NULL DEFAULT 0,
|
||||
order_index INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
@@ -135,25 +126,6 @@ CREATE TABLE script_chain_steps (
|
||||
|
||||
CREATE INDEX idx_script_chain_steps_chain ON script_chain_steps(chain_id, position);
|
||||
|
||||
CREATE TABLE hardware_metrics_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
captured_at TEXT NOT NULL,
|
||||
day_key TEXT NOT NULL,
|
||||
cpu_usage_percent REAL,
|
||||
cpu_temperature_c REAL,
|
||||
ram_usage_percent REAL,
|
||||
ram_used_bytes INTEGER,
|
||||
ram_total_bytes INTEGER,
|
||||
gpu_usage_percent REAL,
|
||||
gpu_temperature_c REAL,
|
||||
vram_used_bytes INTEGER,
|
||||
vram_total_bytes INTEGER,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_hardware_metrics_history_captured_at ON hardware_metrics_history(captured_at);
|
||||
CREATE INDEX idx_hardware_metrics_history_day_key ON hardware_metrics_history(day_key);
|
||||
|
||||
CREATE TABLE pipeline_state (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||
state TEXT NOT NULL,
|
||||
@@ -209,25 +181,12 @@ CREATE TABLE user_presets (
|
||||
|
||||
CREATE INDEX idx_user_presets_media_type ON user_presets(media_type);
|
||||
|
||||
CREATE TABLE user_preset_defaults (
|
||||
slot_key TEXT PRIMARY KEY,
|
||||
preset_id INTEGER,
|
||||
FOREIGN KEY (preset_id) REFERENCES user_presets(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_preset_defaults_preset_id ON user_preset_defaults(preset_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS aax_activation_bytes (
|
||||
checksum TEXT PRIMARY KEY,
|
||||
activation_bytes TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO user_preset_defaults (slot_key, preset_id) VALUES ('bluray_movie', NULL);
|
||||
INSERT OR IGNORE INTO user_preset_defaults (slot_key, preset_id) VALUES ('bluray_series', NULL);
|
||||
INSERT OR IGNORE INTO user_preset_defaults (slot_key, preset_id) VALUES ('dvd_movie', NULL);
|
||||
INSERT OR IGNORE INTO user_preset_defaults (slot_key, preset_id) VALUES ('dvd_series', NULL);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_prefs (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT,
|
||||
@@ -303,10 +262,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('raw_dir_bluray_owner', 'Pfade', 'Eigentümer Raw-Ordner (Blu-ray)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe. Nur aktiv wenn ein Pfad gesetzt ist. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1015);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray_owner', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_bluray_series_owner', 'Pfade', 'Eigentümer RAW-Ordner (Blu-ray Serie)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe für Blu-ray-Serien-RAW. Leer = Eigentümer Raw-Ordner (Blu-ray).', NULL, '[]', '{}', 1012);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray_series_owner', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_dvd_owner', 'Pfade', 'Eigentümer Raw-Ordner (DVD)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe. Nur aktiv wenn ein Pfad gesetzt ist. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1025);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_dvd_owner', NULL);
|
||||
@@ -319,10 +274,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('movie_dir_bluray_owner', 'Pfade', 'Eigentümer Film-Ordner (Blu-ray)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe. Nur aktiv wenn ein Pfad gesetzt ist. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1115);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('movie_dir_bluray_owner', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('series_dir_bluray_owner', 'Pfade', 'Eigentümer Serien-Ordner (Blu-ray)', 'string', 0, 'Eigentümer der Blu-ray-Serienausgaben im Format user:gruppe. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1105);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('series_dir_bluray_owner', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('movie_dir_dvd_owner', 'Pfade', 'Eigentümer Film-Ordner (DVD)', 'string', 0, 'Eigentümer der Dateien im Format user:gruppe. Nur aktiv wenn ein Pfad gesetzt ist. Leer = Standardbenutzer des Dienstes.', NULL, '[]', '{}', 1125);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('movie_dir_dvd_owner', NULL);
|
||||
@@ -357,10 +308,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('raw_dir_bluray', 'Pfade', 'Raw-Ordner (Blu-ray)', 'path', 0, 'RAW-Zielpfad für Blu-ray. Leer = Standardpfad (data/output/raw).', NULL, '[]', '{}', 101);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_bluray_series', 'Pfade', 'RAW-Ordner (Blu-ray Serie)', 'path', 0, 'RAW-Zielpfad für Blu-ray-Serien. Leer = gleicher Pfad wie RAW-Ordner (Blu-ray).', NULL, '[]', '{}', 1011);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_bluray_series', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('raw_dir_dvd', 'Pfade', 'Raw-Ordner (DVD)', 'path', 0, 'RAW-Zielpfad für DVD. Leer = Standardpfad (data/output/raw).', NULL, '[]', '{}', 102);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('raw_dir_dvd', NULL);
|
||||
@@ -373,10 +320,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('movie_dir_bluray', 'Pfade', 'Film-Ordner (Blu-ray)', 'path', 0, 'Encode-Zielpfad für Blu-ray. Leer = Standardpfad (data/output/movies).', NULL, '[]', '{}', 111);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('movie_dir_bluray', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('series_dir_bluray', 'Pfade', 'Serien-Ordner (Blu-ray)', 'path', 0, 'Zielordner für Blu-ray-Serienfolgen. Leer = Standardpfad (data/output/series).', NULL, '[]', '{}', 110);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('series_dir_bluray', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('movie_dir_dvd', 'Pfade', 'Film-Ordner (DVD)', 'path', 0, 'Encode-Zielpfad für DVD. Leer = Standardpfad (data/output/movies).', NULL, '[]', '{}', 112);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('movie_dir_dvd', NULL);
|
||||
@@ -402,38 +345,13 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('hardware_monitoring_interval_ms', 'Monitoring', 'Hardware Monitoring Intervall (ms)', 'number', 1, 'Polling-Intervall für CPU/RAM/GPU/Storage-Metriken.', '5000', '[]', '{"min":1000,"max":60000}', 140);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('hardware_monitoring_interval_ms', '5000');
|
||||
|
||||
-- Logging
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_output_enabled', 'Logging', 'Terminal-Ausgabe aktiv', 'boolean', 1, 'Master-Schalter für die Ausgabe der Server-Logs im Terminal (z.B. start.sh). Das Schreiben in Log-Dateien bleibt immer aktiv.', 'true', '[]', '{}', 150);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_output_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_http_enabled', 'Logging', 'HTTP-Logs im Terminal', 'boolean', 1, 'Steuert HTTP Request-Logs im Terminal (z.B. request:start). Dateilogs bleiben unverändert.', 'true', '[]', '{}', 151);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_http_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_debug_enabled', 'Logging', 'DEBUG im Terminal', 'boolean', 1, 'Steuert DEBUG-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 152);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_debug_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_info_enabled', 'Logging', 'INFO im Terminal', 'boolean', 1, 'Steuert INFO-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 153);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_info_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_warn_enabled', 'Logging', 'WARN im Terminal', 'boolean', 1, 'Steuert WARN-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 154);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_warn_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('server_console_log_error_enabled', 'Logging', 'ERROR im Terminal', 'boolean', 1, 'Steuert ERROR-Meldungen in der Terminal-Ausgabe. Dateilogs bleiben unverändert.', 'true', '[]', '{}', 155);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('server_console_log_error_enabled', 'true');
|
||||
|
||||
-- Tools
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('makemkv_command', 'Tools', 'MakeMKV Kommando', 'string', 1, 'Pfad oder Befehl für makemkvcon.', 'makemkvcon', '[]', '{"minLength":1}', 200);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('makemkv_command', 'makemkvcon');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('makemkv_registration_key', 'Tools', 'MakeMKV Key', 'string', 0, 'Optionaler Registrierungsschlüssel. Wird beim Speichern nach ~/.MakeMKV/settings.conf synchronisiert. Darunter kann der aktuelle Betakey per API übernommen werden.', NULL, '[]', '{}', 202);
|
||||
VALUES ('makemkv_registration_key', 'Tools', 'MakeMKV Key', 'string', 0, 'Optionaler Registrierungsschlüssel. Wird vor Analyze/Rip automatisch per "makemkvcon reg" gesetzt.', NULL, '[]', '{}', 202);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('makemkv_registration_key', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
@@ -444,10 +362,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('makemkv_min_length_minutes', 'Tools', 'Minimale Titellänge (Minuten)', 'number', 1, 'Filtert kurze Titel beim Rip.', '60', '[]', '{"min":1,"max":1000}', 210);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('makemkv_min_length_minutes', '60');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('playlist_tmdb_runtime_subtract_percent', 'Tools', 'TMDb Runtime-Abzug für Playlistfilter (%)', 'number', 1, 'Zieht optional einen Prozentwert von der TMDb-Laufzeit ab, um kürzere alternative Filmfassungen weiterhin als Playlist-Kandidaten zuzulassen. Mindesttoleranz nach unten bleibt immer 2 Minuten.', '0', '[]', '{"min":0,"max":100}', 211);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('playlist_tmdb_runtime_subtract_percent', '0');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_command', 'Tools', 'HandBrake Kommando', 'string', 1, 'Pfad oder Befehl für HandBrakeCLI.', 'HandBrakeCLI', '[]', '{"minLength":1}', 215);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_command', 'HandBrakeCLI');
|
||||
@@ -506,62 +420,14 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('handbrake_extra_args_bluray', 'Tools', 'HandBrake Extra Args', 'string', 0, 'Zusätzliche CLI-Argumente (Blu-ray).', NULL, '[]', '{}', 325);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_extra_args_bluray', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_audio_languages_bluray_movie', 'Tools', 'Review Audio-Sprachen (Blu-ray Film)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Audio-Spuren bei Blu-ray-Filmen. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Audio-Auswahl vorgeben.', NULL, '[]', '{}', 326);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_audio_languages_bluray_movie', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_subtitle_languages_bluray_movie', 'Tools', 'Review UT-Sprachen (Blu-ray Film)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Untertiteln bei Blu-ray-Filmen. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Subtitle-Auswahl vorgeben.', NULL, '[]', '{}', 327);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_subtitle_languages_bluray_movie', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_audio_languages_bluray_series', 'Tools', 'Review Audio-Sprachen (Blu-ray Serie)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Audio-Spuren bei Blu-ray-Serien. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Audio-Auswahl vorgeben.', NULL, '[]', '{}', 328);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_audio_languages_bluray_series', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_subtitle_languages_bluray_series', 'Tools', 'Review UT-Sprachen (Blu-ray Serie)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Untertiteln bei Blu-ray-Serien. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Subtitle-Auswahl vorgeben.', NULL, '[]', '{}', 329);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_subtitle_languages_bluray_series', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_extension_bluray', 'Tools', 'Ausgabeformat', 'select', 1, 'Dateiendung für finale Datei (Blu-ray).', 'mkv', '[{"label":"MKV","value":"mkv"},{"label":"MP4","value":"mp4"}]', '{}', 330);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_extension_bluray', 'mkv');
|
||||
|
||||
UPDATE settings_values
|
||||
SET value = (SELECT legacy.value FROM settings_values legacy WHERE legacy.key = 'handbrake_review_audio_languages_bluray')
|
||||
WHERE key IN ('handbrake_review_audio_languages_bluray_movie', 'handbrake_review_audio_languages_bluray_series')
|
||||
AND (value IS NULL OR TRIM(value) = '')
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM settings_values legacy
|
||||
WHERE legacy.key = 'handbrake_review_audio_languages_bluray'
|
||||
AND legacy.value IS NOT NULL
|
||||
AND TRIM(legacy.value) <> ''
|
||||
);
|
||||
|
||||
UPDATE settings_values
|
||||
SET value = (SELECT legacy.value FROM settings_values legacy WHERE legacy.key = 'handbrake_review_subtitle_languages_bluray')
|
||||
WHERE key IN ('handbrake_review_subtitle_languages_bluray_movie', 'handbrake_review_subtitle_languages_bluray_series')
|
||||
AND (value IS NULL OR TRIM(value) = '')
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM settings_values legacy
|
||||
WHERE legacy.key = 'handbrake_review_subtitle_languages_bluray'
|
||||
AND legacy.value IS NOT NULL
|
||||
AND TRIM(legacy.value) <> ''
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_bluray', 'Pfade', 'Output Template (Blu-ray)', 'string', 1, 'Template für Ordner und Dateiname. Platzhalter: ${title}, ${year}, ${imdbId}. Unterordner über "/" möglich – alles nach dem letzten "/" ist der Dateiname. Die Endung wird über das gewählte Ausgabeformat gesetzt.', '${title} (${year})/${title} (${year})', '[]', '{"minLength":1}', 335);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_bluray', '${title} (${year})/${title} (${year})');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_bluray_series_episode', 'Pfade', 'Output Template (Blu-ray Serie, Episode)', 'string', 1, 'Template für einzelne Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 336);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_bluray_series_episode', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_bluray_series_multi_episode', 'Pfade', 'Output Template (Blu-ray Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste Blu-ray-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 337);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_bluray_series_multi_episode', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})');
|
||||
|
||||
-- Tools – DVD
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('mediainfo_extra_args_dvd', 'Tools', 'Mediainfo Extra Args', 'string', 0, 'Zusätzliche CLI-Parameter für mediainfo (DVD).', NULL, '[]', '{}', 500);
|
||||
@@ -589,60 +455,20 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('handbrake_extra_args_dvd', 'Tools', 'HandBrake Extra Args', 'string', 0, 'Zusätzliche CLI-Argumente (DVD).', NULL, '[]', '{}', 525);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_extra_args_dvd', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_audio_languages_dvd_movie', 'Tools', 'Review Audio-Sprachen (DVD Film)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Audio-Spuren bei DVD-Filmen. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Audio-Auswahl vorgeben.', NULL, '[]', '{}', 526);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_audio_languages_dvd_movie', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_subtitle_languages_dvd_movie', 'Tools', 'Review UT-Sprachen (DVD Film)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Untertiteln bei DVD-Filmen. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Subtitle-Auswahl vorgeben.', NULL, '[]', '{}', 527);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_subtitle_languages_dvd_movie', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_audio_languages_dvd_series', 'Tools', 'Review Audio-Sprachen (DVD Serie)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Audio-Spuren bei DVD-Serien. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Audio-Auswahl vorgeben.', NULL, '[]', '{}', 528);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_audio_languages_dvd_series', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('handbrake_review_subtitle_languages_dvd_series', 'Tools', 'Review UT-Sprachen (DVD Serie)', 'string', 0, 'Kommagetrennte Sprachliste für die Review-Vorauswahl von Untertiteln bei DVD-Serien. Beispiel: de,en,jp. Greift nur, wenn Preset/Extra Args keine Subtitle-Auswahl vorgeben.', NULL, '[]', '{}', 529);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_review_subtitle_languages_dvd_series', NULL);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_extension_dvd', 'Tools', 'Ausgabeformat', 'select', 1, 'Dateiendung für finale Datei (DVD).', 'mkv', '[{"label":"MKV","value":"mkv"},{"label":"MP4","value":"mp4"}]', '{}', 530);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_extension_dvd', 'mkv');
|
||||
|
||||
UPDATE settings_values
|
||||
SET value = (SELECT legacy.value FROM settings_values legacy WHERE legacy.key = 'handbrake_review_audio_languages_dvd')
|
||||
WHERE key IN ('handbrake_review_audio_languages_dvd_movie', 'handbrake_review_audio_languages_dvd_series')
|
||||
AND (value IS NULL OR TRIM(value) = '')
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM settings_values legacy
|
||||
WHERE legacy.key = 'handbrake_review_audio_languages_dvd'
|
||||
AND legacy.value IS NOT NULL
|
||||
AND TRIM(legacy.value) <> ''
|
||||
);
|
||||
|
||||
UPDATE settings_values
|
||||
SET value = (SELECT legacy.value FROM settings_values legacy WHERE legacy.key = 'handbrake_review_subtitle_languages_dvd')
|
||||
WHERE key IN ('handbrake_review_subtitle_languages_dvd_movie', 'handbrake_review_subtitle_languages_dvd_series')
|
||||
AND (value IS NULL OR TRIM(value) = '')
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM settings_values legacy
|
||||
WHERE legacy.key = 'handbrake_review_subtitle_languages_dvd'
|
||||
AND legacy.value IS NOT NULL
|
||||
AND TRIM(legacy.value) <> ''
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_dvd', 'Pfade', 'Output Template (DVD)', 'string', 1, 'Template für Ordner und Dateiname. Platzhalter: ${title}, ${year}, ${imdbId}. Unterordner über "/" möglich – alles nach dem letzten "/" ist der Dateiname. Die Endung wird über das gewählte Ausgabeformat gesetzt.', '${title} (${year})/${title} (${year})', '[]', '{"minLength":1}', 535);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_dvd', '${title} (${year})/${title} (${year})');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_dvd_series_episode', 'Pfade', 'Output Template (DVD Serie, Episode)', 'string', 1, 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 536);
|
||||
VALUES ('output_template_dvd_series_episode', 'Pfade', 'Output Template (DVD Serie, Episode)', 'string', 1, 'Template für einzelne DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNr}, {episodeTitle}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNr}. Alias: {seasonNo}/{episodeNo} entspricht {seasonNr}/{episodeNr}.', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}', '[]', '{"minLength":1}', 536);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_dvd_series_episode', '{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeNr} - {episodeTitle}');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('output_template_dvd_series_multi_episode', 'Pfade', 'Output Template (DVD Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 537);
|
||||
VALUES ('output_template_dvd_series_multi_episode', 'Pfade', 'Output Template (DVD Serie, Multi-Episode)', 'string', 1, 'Template für zusammengefasste DVD-Serienepisoden ohne Dateiendung. Platzhalter: {seriesTitle}, {seasonNr}, {episodeNoStart}, {episodeNoEnd}, {episodeRange}, {episodeTitle}, {parts}, {discNr}, {year}, {language}. Optional mit führender Null: {0:seasonNr}, {0:episodeNoStart}, {0:episodeNoEnd}. Alias: {seasonNo} entspricht {seasonNr}.', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})', '[]', '{"minLength":1}', 537);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('output_template_dvd_series_multi_episode', '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})');
|
||||
|
||||
-- Tools – CD
|
||||
@@ -738,11 +564,18 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('dvd_series_order_preference', 'Metadaten', 'DVD Serien-Ordnung', 'select', 1, 'Bevorzugte Episodenordnung für DVD-Serien. Episode Groups nutzen TMDb Alternate Orders, falls vorhanden.', 'episode_group', '[{"label":"Episode Group","value":"episode_group"},{"label":"Aired / Season","value":"aired"}]', '{}', 405);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_order_preference', 'episode_group');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('dvd_series_reuse_disc_profiles', 'Metadaten', 'DVD Disc-Profile wiederverwenden', 'boolean', 1, 'Verwendet zuvor bestätigte Disc-Profile erneut, um Episoden automatischer zuzuordnen.', 'true', '[]', '{}', 406);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('dvd_series_reuse_disc_profiles', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('omdb_default_type', 'Metadaten', 'OMDb Typ', 'select', 1, 'Vorauswahl für Suche.', 'movie', '[{"label":"Movie","value":"movie"},{"label":"Series","value":"series"},{"label":"Episode","value":"episode"}]', '{}', 410);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('omdb_default_type', 'movie');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('musicbrainz_enabled', 'Metadaten', 'MusicBrainz aktiviert', 'boolean', 1, 'MusicBrainz-Metadatensuche für CDs aktivieren.', 'true', '[]', '{}', 420);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('musicbrainz_enabled', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('coverart_recovery_enabled', 'Metadaten', 'Coverart-Nachladen aktiv', 'boolean', 1, 'Wenn aktiv, werden fehlende Coverarts automatisch in Intervallen geprüft und nachgeladen.', 'true', '[]', '{}', 430);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('coverart_recovery_enabled', 'true');
|
||||
@@ -751,10 +584,6 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
||||
VALUES ('coverart_recovery_interval_hours', 'Metadaten', 'Coverart-Prüfintervall (Stunden)', 'number', 1, 'Intervall für automatische Prüfung fehlender Coverarts in Stunden.', '6', '[]', '{"min":1,"max":168}', 431);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('coverart_recovery_interval_hours', '6');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('generate_nfo_after_encode', 'Metadaten', 'NFO nach Encode erzeugen', 'boolean', 1, 'Erstellt nach erfolgreichem Encode automatisch eine .nfo-Datei neben der Ausgabedatei.', 'false', '[]', '{}', 432);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('generate_nfo_after_encode', 'false');
|
||||
|
||||
-- Benachrichtigungen
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('ui_expert_mode', 'Benachrichtigungen', 'Expertenmodus', 'boolean', 1, 'Schaltet erweiterte Einstellungen in der UI ein.', 'false', '[]', '{}', 495);
|
||||
@@ -789,7 +618,7 @@ VALUES ('pushover_timeout_ms', 'Benachrichtigungen', 'PushOver Timeout (ms)', 'n
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('pushover_timeout_ms', '7000');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
VALUES ('pushover_notify_metadata_ready', 'Benachrichtigungen', 'Bei manueller Auswahl senden', 'boolean', 1, 'Sendet, wenn ein Job eine manuelle Auswahl/Entscheidung benötigt (z.B. Metadaten, Titel oder Playlist).', 'true', '[]', '{}', 570);
|
||||
VALUES ('pushover_notify_metadata_ready', 'Benachrichtigungen', 'Bei Metadaten-Auswahl senden', 'boolean', 1, 'Sendet wenn Metadaten zur Auswahl bereitstehen.', 'true', '[]', '{}', 570);
|
||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('pushover_notify_metadata_ready', 'true');
|
||||
|
||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||
|
||||
+68
-76
@@ -1,31 +1,27 @@
|
||||
# History API
|
||||
|
||||
Endpunkte für Job-Historie, Metadaten-Nachpflege, Orphan-Import und Löschoperationen.
|
||||
Endpunkte für Job-Historie, Orphan-Import und Löschoperationen.
|
||||
|
||||
---
|
||||
|
||||
## GET /api/history
|
||||
|
||||
Liefert Jobs mit optionalen Filtern.
|
||||
Liefert Jobs (optionale Filter).
|
||||
|
||||
**Query-Parameter:**
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
|----------|-----|-------------|
|
||||
| `status` | string | Einzelstatus-Filter (legacy-kompatibel). |
|
||||
| `statuses` | string | Mehrfachstatus als CSV, z. B. `FINISHED,ERROR`. |
|
||||
| `search` | string | Suche in Titel-/IMDb-Feldern. |
|
||||
| `limit` | number | Maximale Anzahl Ergebnisse. |
|
||||
| `lite` | bool | Ohne Dateisystem-Checks (schneller). |
|
||||
| `includeChildren` | bool | Child-Jobs (z. B. Serien-/Multipart-Kinder) explizit einbeziehen. |
|
||||
| `status` | string | Filter nach Job-Status |
|
||||
| `search` | string | Suche in Titel-Feldern |
|
||||
|
||||
**Beispiel:**
|
||||
|
||||
```text
|
||||
GET /api/history?statuses=FINISHED,ERROR&search=Inception&limit=50&lite=1
|
||||
GET /api/history?status=FINISHED&search=Inception
|
||||
```
|
||||
|
||||
**Response (Beispiel):**
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -34,7 +30,6 @@ GET /api/history?statuses=FINISHED,ERROR&search=Inception&limit=50&lite=1
|
||||
"id": 42,
|
||||
"status": "FINISHED",
|
||||
"title": "Inception",
|
||||
"job_kind": "bluray",
|
||||
"raw_path": "/mnt/raw/Inception - RAW - job-42",
|
||||
"output_path": "/mnt/movies/Inception (2010)/Inception (2010).mkv",
|
||||
"mediaType": "bluray",
|
||||
@@ -57,13 +52,12 @@ Liefert Job-Detail.
|
||||
|
||||
| Parameter | Typ | Standard | Beschreibung |
|
||||
|----------|-----|---------|-------------|
|
||||
| `includeLogs` | bool | `false` | Prozesslog laden. |
|
||||
| `includeLiveLog` | bool | `false` | Live-/Tail-Log laden. |
|
||||
| `includeAllLogs` | bool | `false` | vollständiges Log statt Tail. |
|
||||
| `logTailLines` | number | `800` | Tail-Länge falls nicht `includeAllLogs`. |
|
||||
| `lite` | bool | `false` | Detailantwort ohne FS-Checks. |
|
||||
| `includeLogs` | bool | `false` | Prozesslog laden |
|
||||
| `includeLiveLog` | bool | `false` | alias-artig ebenfalls Prozesslog laden |
|
||||
| `includeAllLogs` | bool | `false` | vollständiges Log statt Tail |
|
||||
| `logTailLines` | number | `800` | Tail-Länge falls nicht `includeAllLogs` |
|
||||
|
||||
**Response (Beispiel):**
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -92,9 +86,33 @@ Liefert Job-Detail.
|
||||
|
||||
Sucht RAW-Ordner ohne zugehörigen Job.
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"rawDir": "/mnt/raw",
|
||||
"rawDirs": ["/mnt/raw", "/mnt/raw-bluray"],
|
||||
"rows": [
|
||||
{
|
||||
"rawPath": "/mnt/raw/Inception (2010) [tt1375666] - RAW - job-99",
|
||||
"folderName": "Inception (2010) [tt1375666] - RAW - job-99",
|
||||
"title": "Inception",
|
||||
"year": 2010,
|
||||
"imdbId": "tt1375666",
|
||||
"folderJobId": 99,
|
||||
"entryCount": 4,
|
||||
"hasBlurayStructure": true,
|
||||
"lastModifiedAt": "2026-03-10T09:00:00.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## POST /api/history/orphan-raw/import
|
||||
|
||||
Importiert einen RAW-Ordner als Job und triggert optional die Analyse des Imports.
|
||||
Importiert RAW-Ordner als FINISHED-Job.
|
||||
|
||||
**Request:**
|
||||
|
||||
@@ -102,57 +120,39 @@ Importiert einen RAW-Ordner als Job und triggert optional die Analyse des Import
|
||||
{ "rawPath": "/mnt/raw/Inception (2010) [tt1375666] - RAW - job-99" }
|
||||
```
|
||||
|
||||
**Response (Beispiel):**
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"job": { "id": 77, "status": "FINISHED" },
|
||||
"activation": { "started": true },
|
||||
"activationError": null
|
||||
"uiReset": { "reset": true, "state": "IDLE" }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## POST /api/history/:id/metadata/assign
|
||||
## POST /api/history/:id/omdb/assign
|
||||
|
||||
Weist TMDb-Metadaten nachträglich zu oder aktualisiert bestehende Film-/Serien-Metadaten eines Jobs.
|
||||
Weist OMDb-/Metadaten nachträglich zu.
|
||||
|
||||
## POST /api/history/:id/cd/assign
|
||||
|
||||
Weist CD-Metadaten (z. B. MusicBrainz) nachträglich zu.
|
||||
|
||||
## POST /api/history/:id/error/ack
|
||||
|
||||
Quittiert einen Fehlerzustand im Historieneintrag.
|
||||
|
||||
---
|
||||
|
||||
## GET /api/history/:id/delete-preview
|
||||
|
||||
Liefert eine Vorschau der löschbaren Pfade (inkl. Scope auf verknüpfte Jobs).
|
||||
|
||||
**Query-Parameter:**
|
||||
|
||||
| Parameter | Typ | Standard | Beschreibung |
|
||||
|----------|-----|---------|-------------|
|
||||
| `includeRelated` | bool | `true` | Verknüpfte Jobs in die Vorschau einbeziehen. |
|
||||
|
||||
**Response (Beispiel):**
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"preview": {
|
||||
"jobId": 42,
|
||||
"relatedJobs": [{ "id": 42 }, { "id": 73 }],
|
||||
"pathCandidates": {
|
||||
"raw": [{ "path": "/mnt/raw/...", "exists": true, "isDirectory": true }],
|
||||
"movie": [{ "path": "/mnt/movies/...", "exists": true, "isDirectory": true }]
|
||||
}
|
||||
}
|
||||
"imdbId": "tt1375666",
|
||||
"title": "Inception",
|
||||
"year": 2010,
|
||||
"poster": "https://...",
|
||||
"fromOmdb": true
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "job": { "id": 42, "imdb_id": "tt1375666" } }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## POST /api/history/:id/delete-files
|
||||
@@ -162,17 +162,23 @@ Löscht Dateien eines Jobs, behält DB-Eintrag.
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"target": "both",
|
||||
"includeRelated": true,
|
||||
"selectedRawPaths": ["/mnt/raw/Inception - RAW - Disc1"],
|
||||
"selectedMoviePaths": ["/mnt/movies/Inception (2010)"]
|
||||
}
|
||||
{ "target": "both" }
|
||||
```
|
||||
|
||||
`target`: `raw` | `movie` | `both`
|
||||
|
||||
`selectedRawPaths` / `selectedMoviePaths` sind optional und begrenzen die Löschung auf ausgewählte Pfade aus der Vorschau.
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"summary": {
|
||||
"target": "both",
|
||||
"raw": { "attempted": true, "deleted": true, "filesDeleted": 12, "dirsRemoved": 3, "reason": null },
|
||||
"movie": { "attempted": true, "deleted": false, "filesDeleted": 0, "dirsRemoved": 0, "reason": "Movie-Datei/Pfad existiert nicht." }
|
||||
},
|
||||
"job": { "id": 42 }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -183,20 +189,12 @@ Löscht Job aus DB; optional auch Dateien.
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"target": "both",
|
||||
"includeRelated": true,
|
||||
"resetDriveState": false,
|
||||
"keepDetectedDevice": true,
|
||||
"preserveRawForImportJobs": false,
|
||||
"selectedRawPaths": ["/mnt/raw/Inception - RAW - Disc1"],
|
||||
"selectedMoviePaths": ["/mnt/movies/Inception (2010)"]
|
||||
}
|
||||
{ "target": "none" }
|
||||
```
|
||||
|
||||
`target`: `none` | `raw` | `movie` | `both`
|
||||
|
||||
**Response (Beispiel):**
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -211,11 +209,6 @@ Löscht Job aus DB; optional auch Dateien.
|
||||
"uiReset": {
|
||||
"reset": true,
|
||||
"state": "IDLE"
|
||||
},
|
||||
"safeguards": {
|
||||
"containsOrphanRawImportJob": false,
|
||||
"resetDriveStateApplied": false,
|
||||
"keepDetectedDeviceApplied": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -225,5 +218,4 @@ Löscht Job aus DB; optional auch Dateien.
|
||||
## Hinweise
|
||||
|
||||
- Ein aktiver Pipeline-Job kann nicht gelöscht werden (`409`).
|
||||
- Löschoperationen sind irreversibel.
|
||||
- Bei Serien-/Multipart-Containern steuern `includeRelated` und Pfadselektionen den genauen Scope.
|
||||
- Alle Löschoperationen sind irreversibel.
|
||||
|
||||
+3
-168
@@ -95,21 +95,9 @@ Erzwingt erneute Laufwerksprüfung.
|
||||
|
||||
---
|
||||
|
||||
## POST /api/pipeline/rescan-drive
|
||||
## GET /api/pipeline/omdb/search?q=<query>
|
||||
|
||||
Erzwingt Rescan für ein konkretes Laufwerk.
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{ "devicePath": "/dev/sr0" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## GET /api/pipeline/tmdb/movie/search?q=<query>
|
||||
|
||||
TMDb-Filmsuche.
|
||||
OMDb-Titelsuche.
|
||||
|
||||
**Response:**
|
||||
|
||||
@@ -129,78 +117,6 @@ TMDb-Filmsuche.
|
||||
|
||||
---
|
||||
|
||||
## GET /api/pipeline/tmdb/series/search?q=<query>&season=<n>
|
||||
|
||||
TMDb-Seriensuche (für Serien-Workflow bei DVD/Blu-ray).
|
||||
|
||||
---
|
||||
|
||||
## GET /api/pipeline/cd/drives
|
||||
|
||||
Liefert Snapshot der aktuell bekannten CD-Laufwerke.
|
||||
|
||||
---
|
||||
|
||||
## GET /api/pipeline/cd/musicbrainz/search?q=<query>
|
||||
|
||||
MusicBrainz-Suche für CD-Metadaten.
|
||||
|
||||
## GET /api/pipeline/cd/musicbrainz/release/:mbId
|
||||
|
||||
Lädt Release-Details zu einer MusicBrainz-ID.
|
||||
|
||||
## POST /api/pipeline/cd/select-metadata
|
||||
|
||||
Übernimmt CD-Metadaten für einen Job.
|
||||
|
||||
**Request (Beispiel):**
|
||||
|
||||
```json
|
||||
{
|
||||
"jobId": 91,
|
||||
"title": "Album",
|
||||
"artist": "Artist",
|
||||
"year": 2020,
|
||||
"mbId": "f5093c06-23e3-404f-aeaa-40f72885ee3a",
|
||||
"coverUrl": "https://...",
|
||||
"tracks": []
|
||||
}
|
||||
```
|
||||
|
||||
## POST /api/pipeline/cd/start/:jobId
|
||||
|
||||
Startet/queued CD-Rip mit Format-/Script-/Chain-Konfiguration.
|
||||
|
||||
---
|
||||
|
||||
## POST /api/pipeline/audiobook/upload
|
||||
|
||||
Upload von AAX-Datei (Multipart/FormData).
|
||||
|
||||
**FormData-Felder:**
|
||||
|
||||
- `file` (Pflicht)
|
||||
- `format` (optional)
|
||||
- `startImmediately` (optional)
|
||||
|
||||
## GET /api/pipeline/audiobook/pending-activation
|
||||
|
||||
Zeigt AAX-Jobs mit fehlenden Activation-Bytes.
|
||||
|
||||
## POST /api/pipeline/audiobook/start/:jobId
|
||||
|
||||
Startet Audiobook-Job mit optionaler Konfiguration.
|
||||
|
||||
## GET /api/pipeline/audiobook/jobs
|
||||
|
||||
Liefert Audiobook-Jobliste.
|
||||
|
||||
## GET /api/pipeline/audiobook/output-tree
|
||||
|
||||
Read-only Baumansicht des Audiobook-Ausgabeordners.
|
||||
|
||||
---
|
||||
|
||||
## POST /api/pipeline/select-metadata
|
||||
|
||||
Setzt Metadaten (und optional Playlist) für einen Job.
|
||||
@@ -219,69 +135,12 @@ Setzt Metadaten (und optional Playlist) für einen Job.
|
||||
}
|
||||
```
|
||||
|
||||
Wichtige optionale Felder:
|
||||
|
||||
- `selectedHandBrakeTitleId` / `selectedHandBrakeTitleIds`: Titel-Auswahl für Review/MediaInfo.
|
||||
- `metadataProvider`: `omdb` oder `tmdb`.
|
||||
- `workflowKind`: bei Disc-Jobs typischerweise `film` oder `series`.
|
||||
- `discNumber`: Pflicht für Serien-Disc-Zuordnung (`workflowKind=series`).
|
||||
- `duplicateAction`: Duplikatverhalten bei Film-Metadaten (`allow_new` oder `multipart_movie`).
|
||||
- `existingJobId`: optionaler Referenzjob für `multipart_movie`.
|
||||
- `existingDiscNumber`: Disc-Nummer des bestehenden Jobs für `multipart_movie`.
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "job": { "id": 42, "status": "READY_TO_START" } }
|
||||
```
|
||||
|
||||
**Konflikt-Response (Beispiel, HTTP 409):**
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Metadaten bereits in der Historie gefunden. Bitte Auswahl übernehmen oder Multipart movie wählen.",
|
||||
"details": [
|
||||
{
|
||||
"code": "METADATA_DUPLICATE_FOUND",
|
||||
"mediaProfile": "bluray",
|
||||
"existingJob": {
|
||||
"id": 17,
|
||||
"title": "Inception",
|
||||
"year": 2010,
|
||||
"status": "FINISHED",
|
||||
"jobKind": "bluray",
|
||||
"discNumber": 1,
|
||||
"isMultipartMovie": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Relevante Fehlercodes (`POST /api/pipeline/select-metadata`):**
|
||||
|
||||
| Code | Bedeutung |
|
||||
|---|---|
|
||||
| `METADATA_DUPLICATE_FOUND` | Film-Metadaten existieren bereits in der Historie (Konfliktdialog im UI). |
|
||||
| `MULTIPART_DISC_REQUIRED` | Für Multipart fehlen Disc-Nummern (`discNumber`/`existingDiscNumber`). |
|
||||
| `MULTIPART_DISC_ALREADY_EXISTS` | Disc-Nummer im Multipart-Container bereits vergeben oder doppelt. |
|
||||
| `MULTIPART_MEDIA_MISMATCH` | Multipart nur bei gleichem Medientyp (DVD oder Blu-ray). |
|
||||
| `MULTIPART_SERIES_NOT_ALLOWED` | Multipart ist nur für Film-Jobs erlaubt, nicht für Serien-Workflow. |
|
||||
| `MULTIPART_METADATA_MISMATCH` | Ausgewählter bestehender Job passt nicht zu den Film-Metadaten. |
|
||||
| `SERIES_DISC_ALREADY_EXISTS` | Serien-Disc-Nummer innerhalb einer Staffel bereits vorhanden. |
|
||||
|
||||
---
|
||||
|
||||
## POST /api/pipeline/jobs/:jobId/raw-decision
|
||||
|
||||
Trifft Entscheidung bei vorhandenem RAW (`continue` oder `restart` je nach Dialogfluss).
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{ "decision": "continue" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## POST /api/pipeline/start/:jobId
|
||||
@@ -374,28 +233,10 @@ Berechnet Review aus RAW neu.
|
||||
|
||||
Startet Encoding mit letzter bestätigter Review neu.
|
||||
|
||||
## POST /api/pipeline/restart-cd-review/:jobId
|
||||
|
||||
Berechnet CD-Review aus vorhandenem RAW neu.
|
||||
|
||||
## POST /api/pipeline/resume-ready/:jobId
|
||||
|
||||
Lädt `READY_TO_ENCODE`-Job nach Neustart wieder in aktive Session.
|
||||
|
||||
## GET /api/pipeline/output-folders/:jobId
|
||||
|
||||
Liefert bekannte Output-Ordner entlang der Job-Lineage.
|
||||
|
||||
## POST /api/pipeline/delete-output-folders/:jobId
|
||||
|
||||
Löscht ausgewählte Output-Ordner.
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{ "folderPaths": ["/mnt/movies/Inception (2010)"] }
|
||||
```
|
||||
|
||||
Alle Endpunkte liefern `{ result: ... }` bzw. `{ job: ... }`.
|
||||
|
||||
---
|
||||
@@ -517,18 +358,12 @@ Entfernt Queue-Eintrag.
|
||||
| `DISC_DETECTED` | Medium erkannt |
|
||||
| `ANALYZING` | MakeMKV-Analyse läuft |
|
||||
| `METADATA_SELECTION` | Metadaten-Auswahl |
|
||||
| `WAITING_FOR_USER_DECISION` | Nutzerentscheidung erforderlich (Playlist-Auswahl oder RAW-Entscheidung) |
|
||||
| `WAITING_FOR_USER_DECISION` | Playlist-Entscheidung erforderlich |
|
||||
| `READY_TO_START` | Übergang vor Start |
|
||||
| `RIPPING` | MakeMKV-Rip läuft |
|
||||
| `MEDIAINFO_CHECK` | Titel-/Track-Auswertung |
|
||||
| `READY_TO_ENCODE` | Review bereit |
|
||||
| `ENCODING` | HandBrake-Encoding läuft |
|
||||
| `CD_METADATA_SELECTION` | CD-Metadatenauswahl aktiv |
|
||||
| `CD_READY_TO_RIP` | CD-Job ist startbereit |
|
||||
| `CD_ANALYZING` | CD-Struktur/Tracks werden vorbereitet |
|
||||
| `CD_RIPPING` | CD-Ripping läuft |
|
||||
| `CD_ENCODING` | CD-Encode läuft |
|
||||
| `FINISHED` | Abgeschlossen |
|
||||
| `DONE` | Abgeschlossen (v. a. Audiobook/Converter/CD-Varianten) |
|
||||
| `CANCELLED` | Abgebrochen |
|
||||
| `ERROR` | Fehler |
|
||||
|
||||
@@ -105,7 +105,7 @@ Alle Aktivitäts-Endpunkte geben einen Snapshot zurück:
|
||||
|
||||
## Endpunkte
|
||||
|
||||
### GET `/api/runtime/activities`
|
||||
### GET `/api/activities`
|
||||
|
||||
Aktuellen Aktivitäts-Snapshot abrufen.
|
||||
|
||||
@@ -136,7 +136,7 @@ Aktuellen Aktivitäts-Snapshot abrufen.
|
||||
|
||||
---
|
||||
|
||||
### POST `/api/runtime/activities/:id/cancel`
|
||||
### POST `/api/activities/:id/cancel`
|
||||
|
||||
Aktive Aktivität abbrechen (nur wenn `canCancel: true`).
|
||||
|
||||
@@ -172,7 +172,7 @@ Aktive Aktivität abbrechen (nur wenn `canCancel: true`).
|
||||
|
||||
---
|
||||
|
||||
### POST `/api/runtime/activities/:id/next-step`
|
||||
### POST `/api/activities/:id/next-step`
|
||||
|
||||
Nächsten Schritt einer Aktivität auslösen (nur wenn `canNextStep: true`).
|
||||
|
||||
@@ -201,7 +201,7 @@ Nächsten Schritt einer Aktivität auslösen (nur wenn `canNextStep: true`).
|
||||
|
||||
---
|
||||
|
||||
### POST `/api/runtime/activities/clear-recent`
|
||||
### POST `/api/activities/clear-recent`
|
||||
|
||||
Alle abgeschlossenen Aktivitäten aus `recent` löschen.
|
||||
|
||||
@@ -232,4 +232,4 @@ Gekürzte Ausgaben erhalten den Suffix ` ...[gekürzt]` (bei Inline-Text) bzw. `
|
||||
|
||||
## Echtzeit-Updates
|
||||
|
||||
Änderungen werden automatisch als [`RUNTIME_ACTIVITY_CHANGED`](websocket.md#runtime_activity_changed) WebSocket-Event gesendet. Die Frontend-Komponente braucht `GET /api/runtime/activities` nur beim initialen Laden aufzurufen.
|
||||
Änderungen werden automatisch als [`RUNTIME_ACTIVITY_CHANGED`](websocket.md#runtime_activity_changed) WebSocket-Event gesendet. Die Frontend-Komponente braucht `GET /api/activities` nur beim initialen Laden aufzurufen.
|
||||
|
||||
@@ -336,89 +336,3 @@ Body mit beliebigen Feldern aus `POST`, Response `{ "preset": { ... } }`.
|
||||
### DELETE /api/settings/user-presets/:id
|
||||
|
||||
Response `{ "removed": { ... } }`.
|
||||
|
||||
---
|
||||
|
||||
## Weitere Endpunkte
|
||||
|
||||
### GET /api/settings/effective-paths
|
||||
|
||||
Liefert aufgelöste, effektiv genutzte Pfade aus den Settings (für UI- und Diagnosezwecke).
|
||||
|
||||
### POST /api/settings/coverart/recover
|
||||
|
||||
Startet eine manuelle Coverart-Recovery.
|
||||
|
||||
**Response (Beispiel):**
|
||||
|
||||
```json
|
||||
{
|
||||
"result": { "started": true },
|
||||
"scheduler": { "enabled": true }
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Activation Bytes (AAX)
|
||||
|
||||
### GET /api/settings/activation-bytes
|
||||
|
||||
Liest gecachte AAX-Activation-Bytes.
|
||||
|
||||
### POST /api/settings/activation-bytes
|
||||
|
||||
Speichert Activation-Bytes.
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"checksum": "abc123...",
|
||||
"activationBytes": "1a2b3c4d"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Laufwerke
|
||||
|
||||
### GET /api/settings/drives
|
||||
|
||||
Liefert erkannte optische Laufwerke (`/dev/...`) inkl. MakeMKV-Disc-Index.
|
||||
|
||||
### POST /api/settings/drives/force-unlock
|
||||
|
||||
Erzwingt Entsperren aktiver Laufwerkslocks.
|
||||
|
||||
Hinweis: Expertenmodus (`ui_expert_mode`) ist erforderlich, sonst `403`.
|
||||
|
||||
**Request (ein Laufwerk):**
|
||||
|
||||
```json
|
||||
{ "devicePath": "/dev/sr0" }
|
||||
```
|
||||
|
||||
**Request (alle):**
|
||||
|
||||
```json
|
||||
{ "all": true }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## UI Preferences
|
||||
|
||||
### GET /api/settings/prefs/:key
|
||||
|
||||
Liest einen persistierten UI-Preference-Wert.
|
||||
|
||||
### PUT /api/settings/prefs/:key
|
||||
|
||||
Speichert einen persistierten UI-Preference-Wert.
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{ "value": "{\"columns\":[\"id\",\"status\"]}" }
|
||||
```
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Lizenzierung und Drittanbieter-Software
|
||||
|
||||
## Ripster
|
||||
|
||||
Der von diesem Repository entwickelte Ripster-Quellcode steht unter der GNU
|
||||
General Public License Version 2 oder jeder späteren Version
|
||||
(`GPL-2.0-or-later`).
|
||||
|
||||
## Mitgelieferte HandBrakeCLI
|
||||
|
||||
Ripster enthält eine separat ausführbare HandBrakeCLI-Datei, weil Systempakete
|
||||
je nach Distribution nicht alle für Ripster benötigten Hardwarefunktionen
|
||||
bereitstellen.
|
||||
|
||||
Die mitgelieferte HandBrakeCLI bleibt ein eigenständiges Drittanbieterprogramm
|
||||
unter `GPL-2.0-only`. Ripster startet sie als externen Prozess; der
|
||||
HandBrake-Code stammt nicht vom Ripster-Projekt.
|
||||
|
||||
Buildinformationen, Prüfsummen, Patches und Hinweise zum korrespondierenden
|
||||
Quellcode liegen im Repository unter:
|
||||
|
||||
`third_party/handbrake/`
|
||||
|
||||
Der aktuell mitgelieferte Binary-Build enthält FDK-AAC-Hinweise und ist für die
|
||||
Weiterverteilung als ungeklärt markiert, bis eine rechtliche Prüfung erfolgt
|
||||
oder ein sauberer Neuaufbau ohne FDK-AAC bereitgestellt wird.
|
||||
|
||||
## Weitere Drittanbieter-Software
|
||||
|
||||
Ripster kann zusätzliche externe Medientools aufrufen und sich mit externen
|
||||
Metadaten- und Benachrichtigungsdiensten verbinden.
|
||||
|
||||
Siehe `THIRD_PARTY_NOTICES.md` im Repository für die Übersicht.
|
||||
|
||||
## KI-unterstützte Entwicklung
|
||||
|
||||
Teile von Ripster wurden mit Unterstützung generativer KI-Werkzeuge erstellt
|
||||
oder überarbeitet. Alle generierten Ergebnisse wurden unter menschlicher
|
||||
Verantwortung ausgewählt, geprüft, angepasst und integriert.
|
||||
@@ -98,7 +98,7 @@ Features:
|
||||
- profilspezifische Auflösung (`resolveEffectiveToolSettings`)
|
||||
- CLI-Config-Building für MakeMKV/HandBrake/MediaInfo/FFmpeg
|
||||
- HandBrake-Preset-Liste via `HandBrakeCLI -z`
|
||||
- MakeMKV-Key-Synchronisation aus `makemkv_registration_key` nach `~/.MakeMKV/settings.conf`
|
||||
- MakeMKV-Registration-Command aus `makemkv_registration_key`
|
||||
- Pfadauflösung für alle Medienprofile inkl. Audiobook und Converter
|
||||
|
||||
---
|
||||
@@ -111,7 +111,7 @@ Features:
|
||||
|
||||
- Job-Liste/Detail inkl. Log-Tail
|
||||
- Orphan-RAW-Erkennung und Import
|
||||
- TMDb-Neuzuordnung
|
||||
- OMDb-Nachzuweisung
|
||||
- Dateilöschung (`raw|movie|both`)
|
||||
- Job-Löschung (`none|raw|movie|both`)
|
||||
|
||||
@@ -222,7 +222,7 @@ Vollständige API-Dokumentation: [Runtime Activities API](../api/runtime-activit
|
||||
- `audnexService.js` (Audnex-API für Audiobook-Metadaten)
|
||||
- `coverArtRecoveryService.js` (Cover-Art-Wiederherstellung)
|
||||
- `thumbnailService.js` (Vorschaubild-Generierung)
|
||||
- `tmdbService.js` (Film-/Serien-Metadaten-Suche)
|
||||
- `omdbService.js` (OMDb-Metadaten-Suche)
|
||||
- `logger.js` (rotierende Datei-Logs)
|
||||
|
||||
---
|
||||
|
||||
@@ -38,25 +38,9 @@ Zentrale Felder:
|
||||
- Tool-Ausgaben: `makemkv_info_json`, `handbrake_info_json`, `mediainfo_info_json`, `encode_plan_json`
|
||||
- Kontrolle: `encode_review_confirmed`, `rip_successful`, `error_message`
|
||||
- Medientyp: `media_type` (`bluray|dvd|cd|audiobook|converter`)
|
||||
- Job-Typ/Beziehung: `job_kind`, `parent_job_id`
|
||||
- Multipart-/Disc-Merkmale: `is_multipart_movie`, `disc_number`, `metadata_fingerprint`
|
||||
- Prüfsumme: `aax_checksum` (für AAX-Dateien)
|
||||
- Audit: `created_at`, `updated_at`
|
||||
|
||||
Typische `job_kind`-Werte:
|
||||
|
||||
- Standard: `bluray`, `dvd`, `cd`, `audiobook`, `converter_audio`, `converter_video`, `converter_iso`
|
||||
- Serien: `dvd_series_container`, `dvd_series_child`
|
||||
- Multipart Film: `multipart_movie_container`, `multipart_movie_child`
|
||||
|
||||
Wichtige Indizes:
|
||||
|
||||
- `idx_jobs_status`
|
||||
- `idx_jobs_parent_job_id`
|
||||
- `idx_jobs_job_kind`
|
||||
- `idx_jobs_disc_number`
|
||||
- `idx_jobs_metadata_fingerprint`
|
||||
|
||||
---
|
||||
|
||||
## `job_lineage_artifacts`
|
||||
@@ -196,7 +180,6 @@ sqlite3 backend/data/ripster.db
|
||||
|
||||
.mode table
|
||||
SELECT id, status, title, media_type, created_at FROM jobs ORDER BY created_at DESC;
|
||||
SELECT id, parent_job_id, job_kind, is_multipart_movie, disc_number FROM jobs ORDER BY created_at DESC;
|
||||
SELECT key, value FROM settings_values ORDER BY key;
|
||||
SELECT checksum, activation_bytes FROM aax_activation_bytes;
|
||||
SELECT rel_path, job_id FROM converter_scan_entries;
|
||||
|
||||
@@ -34,7 +34,7 @@ Historie:
|
||||
|
||||
- Job-Liste/Filter
|
||||
- Job-Details + Logs
|
||||
- TMDb-Neuzuordnung
|
||||
- OMDb-Nachzuweisung
|
||||
- Re-Encode/Restart-Workflows
|
||||
|
||||
### `ConverterPage.jsx`
|
||||
@@ -49,14 +49,6 @@ Datei-Converter:
|
||||
- Job-Start, Abbruch, Löschung
|
||||
- Automatischer Scan-Status
|
||||
|
||||
### `AudiobooksPage.jsx`
|
||||
|
||||
Dedizierter AAX-/Audiobook-Flow:
|
||||
|
||||
- Upload-Panel für AAX-Dateien
|
||||
- aktive Audiobook-Jobkarten mit Start/Cancel/Retry/Delete
|
||||
- Audiobook-Konfigurationspanel und Output-Explorer
|
||||
|
||||
### `DownloadsPage.jsx`
|
||||
|
||||
Download-Queue:
|
||||
@@ -78,7 +70,7 @@ Expert-Modus:
|
||||
## Wichtige Komponenten
|
||||
|
||||
- `PipelineStatusCard.jsx` — Pipeline-Status-Anzeige mit Progress
|
||||
- `MetadataSelectionDialog.jsx` — TMDb-Metadaten-Auswahl
|
||||
- `MetadataSelectionDialog.jsx` — OMDb-Metadaten-Auswahl
|
||||
- `MediaInfoReviewPanel.jsx` — Track-Auswahl-Interface (Video/Audio/Untertitel)
|
||||
- `JobDetailDialog.jsx` — Job-Detailansicht mit Logs
|
||||
- `CronJobsTab.jsx` — Cron-Job-Verwaltung
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,9 +36,6 @@ wget -qO- https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.s
|
||||
| `--no-makemkv` | – | MakeMKV-Installation überspringen |
|
||||
| `--no-handbrake` | – | HandBrake-Installation überspringen |
|
||||
| `--no-nginx` | – | nginx-Einrichtung überspringen |
|
||||
| `--no-system-deps` | – | Systemabhängigkeiten nicht nachinstallieren |
|
||||
| `--accept-makemkv-eula` | – | MakeMKV-EULA ausdrücklich nichtinteraktiv akzeptieren |
|
||||
| `--force-license-prompts` | – | Lizenzabfragen auch bei vorhandenen Tools erneut anzeigen |
|
||||
| `--reinstall` | – | Bestehende Installation aktualisieren (Daten bleiben erhalten) |
|
||||
| `-h`, `--help` | – | Hilfe anzeigen |
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# Release-Prozess
|
||||
|
||||
## Lizenz- und Drittanbieter-Checkliste
|
||||
|
||||
- [ ] `LICENSE` enthält den vollständigen GPLv2-Text.
|
||||
- [ ] Ripster-Paketmetadaten verwenden `GPL-2.0-or-later`.
|
||||
- [ ] Die mitgelieferte HandBrakeCLI-Version ist dokumentiert.
|
||||
- [ ] Die HandBrakeCLI-SHA-256-Prüfsumme ist aktuell.
|
||||
- [ ] Der exakte HandBrake-Upstream-Commit ist dokumentiert.
|
||||
- [ ] Alle HandBrake-Patches sind enthalten.
|
||||
- [ ] Das Buildskript passt zum veröffentlichten Binary.
|
||||
- [ ] Das vollständige korrespondierende Source-Archiv ist verfügbar.
|
||||
- [ ] Binary und Source-Archiv sind demselben Release zugeordnet.
|
||||
- [ ] FDK-AAC ist nicht in einem weiterverteilten Build enthalten.
|
||||
- [ ] `THIRD_PARTY_NOTICES.md` ist aktuell.
|
||||
- [ ] README- und Dokumentationslinks sind gültig.
|
||||
- [ ] Der Hinweis zur KI-unterstützten Entwicklung ist weiterhin vorhanden.
|
||||
@@ -1,151 +1,71 @@
|
||||
# Ersteinrichtung
|
||||
|
||||
Diese Seite ist die Betriebs-Checkliste vor dem ersten produktiven Lauf.
|
||||
Nach der Installation erfolgt die tägliche Konfiguration fast vollständig in der GUI unter `Settings`.
|
||||
|
||||
## Ziel der Ersteinrichtung
|
||||
## Ziel
|
||||
|
||||
Vor dem ersten Job sollten fünf Bereiche sauber gesetzt sein:
|
||||
Vor dem ersten echten Job müssen Pfade, Tools und Metadatenzugriff sauber gesetzt sein.
|
||||
|
||||
1. Pfade und Templates
|
||||
2. Laufwerk und Disc-Erkennung
|
||||
3. Metadatenzugang über TMDb
|
||||
4. Encode-Standards und Queue-Regeln
|
||||
5. optionale Automatisierung und Benachrichtigungen
|
||||
## Reihenfolge (empfohlen)
|
||||
|
||||
## Empfohlene Reihenfolge
|
||||
### 1. `Settings` -> Tab `Konfiguration`
|
||||
|
||||
### 1. Basis in `Settings -> Konfiguration`
|
||||
Setze zuerst diese Pflichtwerte:
|
||||
|
||||
Prüfe zuerst diese Kernfelder:
|
||||
| Bereich | Wichtige Felder |
|
||||
|---|---|
|
||||
| Pfade | `Raw Ausgabeordner`, `Film Ausgabeordner`, `Log Ordner` |
|
||||
| Tools | `MakeMKV Kommando`, `HandBrake Kommando`, `Mediainfo Kommando` |
|
||||
| Metadaten | `OMDb API Key`, optional `OMDb Typ` |
|
||||
|
||||
- RAW- und Zielordner für Blu-ray, DVD, CD, Audiobooks und Converter
|
||||
- `Log Ordner`
|
||||
- `TMDb Read Access Token`
|
||||
- `MakeMKV Kommando`, `HandBrake Kommando`, `Mediainfo Kommando`
|
||||
- `FFmpeg Kommando`, `FFprobe Kommando`, `cdparanoia Kommando`, `mkvmerge Kommando`, falls du die jeweiligen Workflows nutzt
|
||||
Danach `Änderungen speichern`.
|
||||
|
||||
Danach speichern.
|
||||
### 2. Medienprofile prüfen
|
||||
|
||||
### 2. Pfade und Templates bewusst festlegen
|
||||
Wenn du Blu-ray und DVD unterschiedlich behandeln willst, pflege die profilbezogenen Felder:
|
||||
|
||||
Wichtig für den Alltag:
|
||||
- `*_bluray`
|
||||
- `*_dvd`
|
||||
- optional `*_other`
|
||||
|
||||
- Film-Workflows nutzen die RAW- und Film-Ausgabeordner sowie die Film-Output-Templates
|
||||
- Serien-Workflows nutzen zusätzlich die Serien-RAW-Ordner, die Serien-Zielordner und die Episode-/Multi-Episode-Templates
|
||||
- Audiobooks nutzen `Audiobook RAW-Ordner`, `Audiobook Output-Ordner`, `Audiobook RAW Template`, `Output Template (Audiobook)` und `Kapitel Template (Audiobook)`
|
||||
- Converter nutzt `Converter Raw-Ordner`, `Converter Ausgabe (Video)`, `Converter Ausgabe (Audio)` sowie `Output-Template (Video)` und `Output-Template (Audio)`
|
||||
- Downloads nutzen `Download ZIP-Ordner`
|
||||
Typische Beispiele:
|
||||
|
||||
Wenn du auf NAS, USB oder mit anderen Benutzern/Gruppen schreiben willst, prüfe auch die jeweils zugehörigen `Eigentümer ...`-Felder.
|
||||
- `HandBrake Preset` (Blu-ray und DVD)
|
||||
- `Raw Ausgabeordner` (Blu-ray und DVD)
|
||||
- `Dateiname Template` (Blu-ray und DVD)
|
||||
|
||||
### 3. Laufwerk und automatische Erkennung prüfen
|
||||
### 3. Queue und Monitoring festlegen
|
||||
|
||||
Relevant:
|
||||
- `Parallele Jobs` für den gleichzeitigen Durchsatz
|
||||
- `Hardware Monitoring aktiviert` + `Hardware Monitoring Intervall (ms)` für Live-Metriken im Ripper
|
||||
|
||||
- `Laufwerksmodus`
|
||||
- `Explizite Laufwerke`, falls du nicht mit Auto-Discovery arbeiten willst
|
||||
- `Automatische Disk-Erkennung`
|
||||
- `Polling Intervall (ms)` im Expertenmodus
|
||||
- `Laufwerk nach Rip auswerfen`
|
||||
### 4. Optional: Push-Benachrichtigungen
|
||||
|
||||
Empfehlung:
|
||||
|
||||
- Einzelnes Standardlaufwerk: `auto`
|
||||
- mehrere stabile Laufwerke oder ungewöhnliche Device-Mappings: `Explizite Laufwerke`
|
||||
|
||||
### 4. TMDb und Metadatenverhalten festlegen
|
||||
|
||||
Relevant:
|
||||
|
||||
- `TMDb Read Access Token`
|
||||
- `Film-Sprache`
|
||||
- `Fallback Sprache`
|
||||
- `Coverart-Nachladen aktiv`
|
||||
- `Coverart-Prüfintervall (Stunden)`
|
||||
- `NFO nach Encode erzeugen`
|
||||
|
||||
Diese Einstellungen wirken direkt in Metadatensuche, Serienzuordnung, Nachpflege von Covern und im finalen Output.
|
||||
|
||||
### 5. Encode- und Review-Standards festlegen
|
||||
|
||||
Für Video-Workflows besonders wichtig:
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
- `HandBrake Preset` und `HandBrake Extra Args` je Medium
|
||||
- `Review Audio-Sprachen (...)`
|
||||
- `Review UT-Sprachen (...)`
|
||||
- `Ausgabeformat`
|
||||
|
||||
Praxis:
|
||||
|
||||
- `Minimale Titellänge` filtert Bonusmaterial früh weg
|
||||
- `TMDb Runtime-Abzug ...` lockert bei problematischen Blu-rays die Laufzeitprüfung der Playlist-Kandidaten
|
||||
- Review-Sprachen bestimmen, welche Audio-/Untertitelspuren in der Review schon vorausgewählt sind
|
||||
|
||||
### 6. Queue-Verhalten definieren
|
||||
|
||||
Stelle diese vier Felder bewusst ein:
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
||||
|
||||
Damit steuerst du, wie aggressiv Ripster mehrere Jobs gleichzeitig startet.
|
||||
|
||||
### 7. Optional: User-Presets und Standard-Zuordnungen
|
||||
|
||||
Unter `Settings -> Encode-Presets` kannst du:
|
||||
|
||||
- eigene HandBrake-User-Presets anlegen
|
||||
- Standard-Zuordnungen für `Blu-ray Film`, `Blu-ray Serie`, `DVD Film`, `DVD Serie` setzen
|
||||
|
||||
Diese Defaults wirken später in der Review automatisch vorbefüllend.
|
||||
|
||||
### 8. Optional: Benachrichtigungen
|
||||
|
||||
Prüfe:
|
||||
In den Benachrichtigungsfeldern setzen:
|
||||
|
||||
- `PushOver aktiviert`
|
||||
- Token/User/optional Device
|
||||
- Event-Toggles wie `Bei manueller Auswahl senden`, `Bei Rip-Start senden`, `Bei Erfolg senden`
|
||||
- `PushOver Token`
|
||||
- `PushOver User`
|
||||
|
||||
Danach in `Settings` den Button `PushOver Test` ausführen.
|
||||
Dann über `PushOver Test` direkt prüfen.
|
||||
|
||||
### 9. Optional: Automatisierung
|
||||
## 2-Minuten-Funktionstest
|
||||
|
||||
Erst wenn die Grundkonfiguration stabil ist:
|
||||
1. `Ripper` öffnen
|
||||
2. Disc einlegen
|
||||
3. `Analyse starten`
|
||||
4. Metadaten übernehmen
|
||||
5. Bis `Bereit zum Encodieren` laufen lassen
|
||||
|
||||
1. Skripte anlegen und testen
|
||||
2. Skriptketten aufbauen
|
||||
3. Cronjobs aktivieren
|
||||
Wenn diese Schritte funktionieren, ist die Grundkonfiguration korrekt.
|
||||
|
||||
## Funktionsprüfung
|
||||
## Wenn Werte nicht gespeichert werden
|
||||
|
||||
Ein sinnvoller Kurztest:
|
||||
|
||||
1. Disc in `Ripper` erkennen lassen
|
||||
2. `Analyse starten`
|
||||
3. TMDb-Metadaten übernehmen
|
||||
4. ggf. Playlist-/RAW-Entscheidung durchlaufen
|
||||
5. bis `Bereit zum Encodieren` kommen
|
||||
6. Encode starten
|
||||
7. Ergebnis in `Historie` prüfen
|
||||
|
||||
## Typische Konfigurationsfehler
|
||||
|
||||
| Symptom | Häufige Ursache |
|
||||
|---|---|
|
||||
| Disc wird nicht erkannt | Laufwerksmodus oder Auto-Erkennung passt nicht |
|
||||
| Playlist-Auswahl wirkt unplausibel | `Minimale Titellänge` oder `TMDb Runtime-Abzug ...` ist zu streng/zu locker |
|
||||
| falsche Spuren sind in der Review vorausgewählt | Review-Sprachfilter oder HandBrake-Args greifen unerwartet |
|
||||
| Ausgabe landet am falschen Ort | Profilpfade oder Templates greifen über Fallback |
|
||||
| Queue verhält sich unerwartet | `Parallele Jobs`, CD-Limit und Gesamtlimit widersprechen sich |
|
||||
- Feld mit Fehler markieren lassen (rote Validierung im Formular)
|
||||
- Pfadangaben und numerische Werte prüfen
|
||||
- bei Tool-Pfaden direkt CLI-Aufruf im Terminal testen
|
||||
|
||||
## Weiter
|
||||
|
||||
- [Erster Lauf](quickstart.md)
|
||||
- [GUI-Seiten](../gui/index.md)
|
||||
- [Workflows aus Nutzersicht](../workflows/index.md)
|
||||
- [Alle Einstellungen](../configuration/settings-reference.md)
|
||||
- [GUI-Seiten im Detail](../gui/index.md)
|
||||
|
||||
@@ -1,119 +1,107 @@
|
||||
# Installation
|
||||
|
||||
Die empfohlene Installation startet immer über `setup.sh`. `setup.sh` lädt das passende `install.sh` aus dem gewünschten Branch und übergibt alle weiteren Parameter unverändert an den eigentlichen Installer.
|
||||
Die empfohlene Installation läuft über `install.sh` und richtet Ripster vollständig ein.
|
||||
|
||||
Wichtig:
|
||||
Du musst dafür **keine Tools manuell vorinstallieren**. Das Skript installiert die benötigten Abhängigkeiten automatisch, sofern sie nicht explizit mit `--no-*` übersprungen werden.
|
||||
|
||||
- Standard-Einstieg: `setup.sh`
|
||||
- kein `curl | bash`
|
||||
- du musst die Tools nicht manuell vorinstallieren, sofern du sie nicht bewusst mit `--no-*` auslässt
|
||||
## Unterstützte Systeme und Anforderungen
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
- unterstütztes Linux-System
|
||||
- Root-Rechte oder `sudo`
|
||||
- unterstützt laut Script: `debian`, `ubuntu`, `linuxmint`, `pop`
|
||||
- Ausführung als `root` (oder via `sudo`)
|
||||
- Internetzugang während der Installation
|
||||
|
||||
Der Installer erkennt aktuell:
|
||||
## Schritt-für-Schritt
|
||||
|
||||
- Debian
|
||||
- Ubuntu
|
||||
- Linux Mint
|
||||
- Pop!_OS
|
||||
|
||||
## Standardinstallation
|
||||
### 1. Installationsskript herunterladen
|
||||
|
||||
```bash
|
||||
wget -qO setup.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/setup.sh
|
||||
bash setup.sh
|
||||
wget -qO install.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.sh
|
||||
```
|
||||
|
||||
Ohne `--branch` fragt `setup.sh` interaktiv nach dem gewünschten Branch.
|
||||
|
||||
Die typischen Branches sind:
|
||||
|
||||
- `main`: stabiles Release
|
||||
- `dev`: aktueller Entwicklungsstand
|
||||
|
||||
## Installation mit Branch oder Optionen
|
||||
|
||||
Beispiele:
|
||||
### 2. Installation ausführen
|
||||
|
||||
```bash
|
||||
bash setup.sh --branch main
|
||||
bash setup.sh --branch dev
|
||||
bash setup.sh --branch dev --dir /opt/ripster --user ripster --port 3001 --host 192.168.1.10
|
||||
sudo bash install.sh
|
||||
```
|
||||
|
||||
`setup.sh` wertet selbst nur `--branch` aus. Alles andere übernimmt `install.sh`.
|
||||
Während der Installation wählst du den HandBrake-Modus:
|
||||
|
||||
## Wichtige Optionen von `install.sh`
|
||||
- `1` Standard (Paketinstallation)
|
||||
- `2` GPU/NVDEC (gebündeltes Binary)
|
||||
|
||||
| Option | Default | Zweck |
|
||||
|---|---|---|
|
||||
| `--branch <branch>` | `dev` | installiert genau diesen Git-Branch |
|
||||
| `--dir <pfad>` | `/opt/ripster` | Installationsverzeichnis |
|
||||
| `--user <benutzer>` | `ripster` | Systembenutzer für den Dienst |
|
||||
| `--port <port>` | `3001` | Backend-Port |
|
||||
| `--host <hostname|ip>` | automatisch ermittelte Host-IP | Hostname/IP für Webzugriff und CORS |
|
||||
| `--no-makemkv` | aus | MakeMKV nicht installieren |
|
||||
| `--no-handbrake` | aus | HandBrake nicht installieren |
|
||||
| `--no-nginx` | aus | nginx-Setup überspringen |
|
||||
| `--no-system-deps` | aus | Systemabhängigkeiten nicht nachinstallieren |
|
||||
| `--accept-makemkv-eula` | aus | MakeMKV-EULA ausdrücklich nichtinteraktiv akzeptieren |
|
||||
| `--force-license-prompts` | aus | Lizenzabfragen auch bei vorhandenen Tools erneut anzeigen |
|
||||
| `--reinstall` | aus | bestehende Installation aktualisieren |
|
||||
|
||||
## Was der Installer einrichtet
|
||||
|
||||
Typischer Ablauf:
|
||||
|
||||
1. Betriebssystem, Root-Rechte und Host prüfen
|
||||
2. Systemabhängigkeiten installieren
|
||||
3. Node.js 20 sicherstellen
|
||||
4. optional MakeMKV installieren
|
||||
5. optional HandBrakeCLI installieren
|
||||
6. optional nginx konfigurieren
|
||||
7. Repository nach `--dir` klonen oder aktualisieren
|
||||
8. Backend-/Frontend-Abhängigkeiten installieren
|
||||
9. Frontend bauen
|
||||
10. `backend/.env` und Laufzeitverzeichnisse vorbereiten
|
||||
11. `ripster-backend.service` anlegen und starten
|
||||
|
||||
## Dienst prüfen
|
||||
### 3. Dienststatus prüfen
|
||||
|
||||
```bash
|
||||
sudo systemctl status ripster-backend
|
||||
```
|
||||
|
||||
Typische Aufrufe im Betrieb:
|
||||
### 4. Weboberfläche öffnen
|
||||
|
||||
- mit nginx (Standard): `http://<Server-IP>`
|
||||
- ohne nginx (`--no-nginx`): API auf `http://<Server-IP>:3001/api`
|
||||
|
||||
## Was `install.sh` konkret einrichtet
|
||||
|
||||
1. prüft Betriebssystem, Root-Rechte und ermittelt Host/IP
|
||||
2. aktualisiert Paketquellen und installiert Basispakete (`curl`, `wget`, `git`, `mediainfo`, `udev` ...)
|
||||
3. installiert Node.js 20 (falls nicht passend vorhanden)
|
||||
4. installiert optional MakeMKV (Build aus den offiziellen Quellen)
|
||||
5. installiert optional HandBrakeCLI (Standard oder GPU/NVDEC)
|
||||
6. installiert optional nginx
|
||||
7. legt den Systembenutzer `ripster` an (ohne Login-Shell, ohne Home) und ergänzt Gruppen (`cdrom`, `optical`, `disk`, `video`, `render`, falls vorhanden)
|
||||
8. klont das Repository nach `/opt/ripster` (oder aktualisiert bei `--reinstall`)
|
||||
9. legt Verzeichnisse an:
|
||||
- `/opt/ripster/backend/data`
|
||||
- `/opt/ripster/backend/logs`
|
||||
- `/opt/ripster/backend/data/output/raw`
|
||||
- `/opt/ripster/backend/data/output/movies`
|
||||
- `/opt/ripster/backend/data/logs`
|
||||
10. installiert npm-Abhängigkeiten (Root, Backend, Frontend) und baut das Frontend
|
||||
11. erzeugt `backend/.env` (bei `--reinstall` bleibt bestehende `.env` erhalten)
|
||||
12. setzt Rechte/Besitz und erstellt bei sudo-Installation zusätzlich `~/.MakeMKV` für den aufrufenden Benutzer
|
||||
13. erzeugt und startet `ripster-backend.service`
|
||||
14. konfiguriert und startet nginx (falls nicht übersprungen)
|
||||
|
||||
## Wichtige Optionen
|
||||
|
||||
| Option | Default laut Script | Zweck |
|
||||
|---|---|---|
|
||||
| `--branch <branch>` | `dev` | Branch für die Installation |
|
||||
| `--dir <pfad>` | `/opt/ripster` | Installationsverzeichnis |
|
||||
| `--user <benutzer>` | `ripster` | Service-Benutzer |
|
||||
| `--port <port>` | `3001` | Backend-Port |
|
||||
| `--host <hostname>` | automatisch ermittelte Host-IP | Hostname/IP für Webzugriff/CORS |
|
||||
| `--no-makemkv` | aus | MakeMKV-Installation überspringen |
|
||||
| `--no-handbrake` | aus | HandBrake-Installation überspringen |
|
||||
| `--no-nginx` | aus | nginx-Setup überspringen |
|
||||
| `--reinstall` | aus | bestehende Installation aktualisieren |
|
||||
|
||||
Beispiele:
|
||||
|
||||
```bash
|
||||
sudo journalctl -u ripster-backend -f
|
||||
sudo systemctl restart ripster-backend
|
||||
sudo bash install.sh --branch dev
|
||||
sudo bash install.sh --port 8080 --host ripster.local
|
||||
sudo bash install.sh --reinstall
|
||||
```
|
||||
|
||||
## Update einer bestehenden Installation
|
||||
|
||||
Standard:
|
||||
## Betrieb im Alltag
|
||||
|
||||
```bash
|
||||
# Logs live ansehen
|
||||
sudo journalctl -u ripster-backend -f
|
||||
|
||||
# Dienst neu starten
|
||||
sudo systemctl restart ripster-backend
|
||||
|
||||
# Update aus bestehender Installation
|
||||
sudo bash /opt/ripster/install.sh --reinstall
|
||||
```
|
||||
|
||||
Wenn die Installation mit abweichenden Kernparametern eingerichtet wurde, dieselben Parameter wieder mitgeben:
|
||||
## Häufige Stolperstellen
|
||||
|
||||
```bash
|
||||
sudo bash /opt/ripster/install.sh --reinstall --dir /opt/ripster --user ripster --port 3001 --host 192.168.1.10
|
||||
```
|
||||
|
||||
Alternativ kannst du auch erneut über `setup.sh` gehen:
|
||||
|
||||
```bash
|
||||
sudo bash /opt/ripster/setup.sh --reinstall
|
||||
```
|
||||
|
||||
`--reinstall` aktualisiert die Installation, behält aber die persistenten Daten der bestehenden Instanz.
|
||||
- Laufwerk nicht zugreifbar: Laufwerksrechte/Gruppen prüfen
|
||||
- CLI-Tool fehlt wegen `--no-*`: Tool nachinstallieren oder Befehl in Settings korrigieren
|
||||
- UI nicht erreichbar: nginx-Status und Firewall prüfen
|
||||
|
||||
## Danach weiter
|
||||
|
||||
|
||||
@@ -1,31 +1,19 @@
|
||||
# Voraussetzungen
|
||||
|
||||
Die Voraussetzungen hängen davon ab, ob du Ripster produktiv installieren oder lokal entwickeln willst.
|
||||
Die Voraussetzungen hängen davon ab, **wie** du Ripster betreibst.
|
||||
|
||||
## Produktionsbetrieb mit `setup.sh`
|
||||
## Produktionsbetrieb mit `install.sh` (Standard)
|
||||
|
||||
Für den normalen Betrieb brauchst du nur die Basisvoraussetzungen. Die eigentlichen Tools werden vom Installer eingerichtet, sofern du sie nicht bewusst mit `--no-*` überspringst.
|
||||
Für den normalen Betrieb sind nur wenige Punkte vorab nötig.
|
||||
|
||||
### Pflicht
|
||||
|
||||
- unterstütztes Linux-System
|
||||
- Root-Rechte oder `sudo`
|
||||
- unterstütztes Linux-System (laut Script: Debian, Ubuntu, Linux Mint, Pop!_OS)
|
||||
- `root`-Rechte
|
||||
- Internetzugang während der Installation
|
||||
- optisches Laufwerk, wenn du Disc-Workflows nutzen willst
|
||||
- optisches Laufwerk für Disc-Betrieb
|
||||
|
||||
Der Installer unterstützt aktuell:
|
||||
|
||||
- Debian
|
||||
- Ubuntu
|
||||
- Linux Mint
|
||||
- Pop!_OS
|
||||
|
||||
Standard-Einstieg:
|
||||
|
||||
```bash
|
||||
wget -qO setup.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/setup.sh
|
||||
bash setup.sh
|
||||
```
|
||||
`install.sh` installiert die benötigten Tools selbst (u. a. Node.js, MakeMKV, HandBrakeCLI, MediaInfo), sofern sie nicht explizit per `--no-*` übersprungen werden.
|
||||
|
||||
### Laufwerk kurz prüfen
|
||||
|
||||
@@ -34,25 +22,27 @@ ls /dev/sr*
|
||||
lsblk | grep rom
|
||||
```
|
||||
|
||||
Wenn nötig Rechte setzen (Beispiel):
|
||||
|
||||
```bash
|
||||
sudo chmod a+rw /dev/sr0
|
||||
```
|
||||
|
||||
### Optional vorab
|
||||
|
||||
- TMDb Read Access Token für Film-/Serien-Metadaten
|
||||
- PushOver-Zugangsdaten für Benachrichtigungen
|
||||
- OMDb API-Key (kann auch nach Installation in den `Settings` gesetzt werden)
|
||||
- PushOver-Zugangsdaten (optional)
|
||||
|
||||
Beides kann auch erst nach der Installation in `Settings` gesetzt werden.
|
||||
|
||||
## Entwicklungsmodus
|
||||
## Entwicklungsmodus (nur für Dev)
|
||||
|
||||
Wenn du lokal entwickelst (`./start.sh`, `npm run dev`), gelten zusätzliche Voraussetzungen:
|
||||
|
||||
- Node.js `>= 20.19.0`
|
||||
- Node.js >= 20.19.0
|
||||
- `makemkvcon`, `HandBrakeCLI`, `mediainfo` im `PATH`
|
||||
|
||||
Details: [Entwicklungsumgebung](../deployment/development.md)
|
||||
|
||||
## Abschluss-Checkliste
|
||||
|
||||
- [ ] Linux + Root/Sudo + Internet vorhanden
|
||||
- [ ] optisches Laufwerk vorhanden, falls Disc-Ripping genutzt werden soll
|
||||
- [ ] TMDb/PushOver-Zugangsdaten liegen bereit, falls diese Funktionen sofort genutzt werden sollen
|
||||
- [ ] im Dev-Modus zusätzlich Node.js und CLI-Tools lokal verfügbar
|
||||
- [ ] Produktionsbetrieb: Linux + root + Internet + Laufwerk vorhanden
|
||||
- [ ] Dev-Modus (nur falls benötigt): Node.js und CLI-Tools verfügbar
|
||||
|
||||
@@ -1,151 +1,70 @@
|
||||
# Erster Lauf
|
||||
|
||||
Dieser Ablauf führt einen typischen Disc-Job von Erkennung bis fertiger Datei durch.
|
||||
Dieser Ablauf zeigt einen vollständigen Job aus Anwendersicht: von Disc-Erkennung bis fertiger Datei.
|
||||
|
||||
## 1. Disc erkennen
|
||||
## 1. Ripper öffnen und Disc einlegen
|
||||
|
||||
1. `Ripper` öffnen
|
||||
2. Disc einlegen
|
||||
3. auf `Medium erkannt` warten
|
||||
Erwartung:
|
||||
|
||||
Prüfen:
|
||||
- Status wechselt auf `Medium erkannt`
|
||||
- im Bereich `Disk-Information` sind Laufwerksdaten sichtbar
|
||||
|
||||
- `Disk-Information` zeigt Device, Label und Laufwerksstatus
|
||||
- falls nicht: `Laufwerk neu lesen`
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Laufwerksmodus`
|
||||
- `Automatische Disk-Erkennung`
|
||||
- `Polling Intervall (ms)`
|
||||
Wenn nichts passiert: `Laufwerk neu lesen`.
|
||||
|
||||
## 2. Analyse starten
|
||||
|
||||
Aktion:
|
||||
Aktion im Ripper:
|
||||
|
||||
- `Analyse starten`
|
||||
|
||||
Erwartung:
|
||||
|
||||
- Status `Analyse`
|
||||
- danach der Metadaten-Dialog
|
||||
- danach Metadaten-Dialog
|
||||
|
||||
Relevantes Setting:
|
||||
## 3. Metadaten auswählen
|
||||
|
||||
- `Minimale Titellänge (Minuten)` beeinflusst bereits, welche Titel/Playlists Ripster später als relevant betrachtet
|
||||
Im Dialog `Metadaten auswählen`:
|
||||
|
||||
## 3. Metadaten in TMDb bestätigen
|
||||
1. OMDb-Suche nutzen oder manuell eintragen
|
||||
2. passenden Treffer markieren
|
||||
3. `Auswahl übernehmen`
|
||||
|
||||
Im Dialog:
|
||||
## 4. Auf den nächsten Zustand reagieren
|
||||
|
||||
1. Treffer suchen oder filtern
|
||||
2. Film oder Serie auswählen
|
||||
3. bei Serien zusätzlich `Disc-Nummer` setzen
|
||||
4. `Auswahl übernehmen`
|
||||
- Normalfall ohne vorhandenes RAW: `Rippen` -> `Mediainfo-Pruefung` -> `Bereit zum Encodieren`
|
||||
- bei vorhandenem RAW: direkt `Mediainfo-Pruefung` -> `Bereit zum Encodieren`
|
||||
- bei unklarer Blu-ray-Playlist: `Warte auf Auswahl` (Playlist auswählen und übernehmen)
|
||||
|
||||
Mögliche Abzweigungen:
|
||||
## 5. Review in `Bereit zum Encodieren`
|
||||
|
||||
- Duplikatfilm: `Übernahme erzwingen` oder `Multipart movie`
|
||||
- vorhandenes RAW: Entscheidungsdialog `weiterverwenden` oder `neu rippen`
|
||||
Im aufgeklappten Job (`Pipeline-Status`):
|
||||
|
||||
Relevante Settings:
|
||||
- Encode-Titel wählen
|
||||
- Audio-/Subtitle-Spuren prüfen
|
||||
- optional User-Preset auswählen
|
||||
- optional Pre-/Post-Skripte bzw. Ketten hinzufügen
|
||||
|
||||
- `TMDb Read Access Token`
|
||||
- `Film-Sprache`
|
||||
- `Fallback Sprache`
|
||||
|
||||
## 4. RAW- und Playlist-Entscheidungen
|
||||
|
||||
Je nach Disc-Situation geht es jetzt unterschiedlich weiter.
|
||||
|
||||
### Normalfall
|
||||
|
||||
`Startbereit` -> `Rippen` -> `Mediainfo-Prüfung`
|
||||
|
||||
### Vorhandenes RAW
|
||||
|
||||
Kein neuer Rip, sondern erst eine Entscheidung:
|
||||
|
||||
- vorhandenes RAW weiterverwenden
|
||||
- RAW löschen und Rip neu starten
|
||||
- bei passenden Film-Konstellationen optional Multipart mit Orphan-RAW
|
||||
|
||||
### Playlist- oder Titelauswahl erforderlich
|
||||
|
||||
Bei bestimmten Blu-ray-/DVD-Fällen erscheint `Warte auf Auswahl`.
|
||||
|
||||
Dann bestätigst du:
|
||||
|
||||
- eine Playlist
|
||||
- oder einen/mehrere HandBrake-Titel
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
|
||||
## 5. Encode-Review abschließen
|
||||
|
||||
Bei `Bereit zum Encodieren` prüfst du:
|
||||
|
||||
- Titelwahl
|
||||
- Audio-Spuren
|
||||
- Untertitel
|
||||
- User-Preset oder HandBrake-Preset
|
||||
- Pre-/Post-Encode-Skripte und Ketten
|
||||
|
||||
Dann:
|
||||
|
||||
- `Encoding starten`
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `HandBrake Preset` und `HandBrake Extra Args` je Medium
|
||||
- `Review Audio-Sprachen (...)`
|
||||
- `Review UT-Sprachen (...)`
|
||||
- `Ausgabeformat`
|
||||
- Standard-Zuordnungen unter `Settings -> Encode-Presets`
|
||||
Dann `Encoding starten`.
|
||||
|
||||
## 6. Encoding überwachen
|
||||
|
||||
Während `Encodieren`:
|
||||
|
||||
- Fortschritt/ETA im Ripper
|
||||
- Queue-Status beobachten
|
||||
- bei Bedarf `Hardware`-Ansicht öffnen
|
||||
- Fortschritt + ETA im Ripper
|
||||
- Live-Log im `Pipeline-Status`
|
||||
- Queue- und Skript/Cron-Status parallel beobachtbar
|
||||
|
||||
Relevante Settings:
|
||||
## 7. Ergebnis prüfen
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
- `Hardware Monitoring aktiviert`
|
||||
- `Hardware Monitoring Intervall (ms)`
|
||||
Bei `Fertig`:
|
||||
|
||||
## 7. Ergebnis verifizieren
|
||||
1. Seite `Historie` öffnen
|
||||
2. Job in Details öffnen
|
||||
3. Output-Pfad, Status und Log prüfen
|
||||
|
||||
Nach `Fertig`:
|
||||
## Typische Folgeaktionen
|
||||
|
||||
1. `Historie` öffnen
|
||||
2. Jobdetail prüfen
|
||||
3. Output-Pfad und Log kontrollieren
|
||||
|
||||
Kontrollpunkte:
|
||||
|
||||
- finale Datei liegt am erwarteten Template-Pfad
|
||||
- RAW-Ordner ist finalisiert
|
||||
- optional `.nfo` wurde erzeugt, falls aktiviert
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- Film-Output-Templates oder Serien-Templates
|
||||
- `Serien-Ordner (Blu-ray)` und `Serien-Ordner (DVD)` plus die Episode-/Multi-Episode-Templates
|
||||
- `NFO nach Encode erzeugen`
|
||||
|
||||
## 8. Typische Folgeaktionen
|
||||
|
||||
- falsche TMDb-Zuordnung: `TMDb neu zuweisen`
|
||||
- andere Trackauswahl: `Review neu starten`
|
||||
- erneuter Encode aus RAW: `RAW neu encodieren`
|
||||
- gleicher Plan erneut: `Encode neu starten`
|
||||
- Rip erneut versuchen: `Retry Rippen`
|
||||
- Falsches OMDb-Match: in `Historie` -> `OMDb neu zuordnen`
|
||||
- Neue Encodierung aus RAW: `RAW neu encodieren`
|
||||
- Prüfung komplett neu aufbauen: `Review neu starten`
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
# Audiobooks
|
||||
|
||||
Die Seite `Audiobooks` ist der spezialisierte Workflow für Audible-`*.aax`-Dateien.
|
||||
|
||||
## Seitenstruktur
|
||||
|
||||
Die Oberfläche besteht aus zwei Hauptbereichen:
|
||||
|
||||
1. `Audiobooks Upload`
|
||||
2. `Audiobook Jobs`
|
||||
|
||||
## 1. Audiobooks Upload
|
||||
|
||||
Der Upload akzeptiert ausschließlich `.aax`.
|
||||
|
||||
### Bedienung
|
||||
|
||||
- Datei auswählen oder per Drag-and-Drop ablegen
|
||||
- Upload starten
|
||||
- Auswahl entfernen oder laufenden Upload abbrechen
|
||||
|
||||
Während des Uploads zeigt die UI:
|
||||
|
||||
- Prozentfortschritt
|
||||
- übertragene und gesamte Bytes
|
||||
- Statusmeldung
|
||||
|
||||
### Ablauf nach erfolgreichem Upload
|
||||
|
||||
- die AAX-Datei wird geprüft
|
||||
- Ripster versucht Metadata, Kapitel und Activation-Bytes-Kontext aufzubauen
|
||||
- ein Audiobook-Job wird angelegt
|
||||
- der Job startet direkt oder wird in die Queue eingereiht
|
||||
|
||||
## 2. Audiobook Jobs
|
||||
|
||||
Die Seite zeigt aktive Jobs. Abgeschlossene Jobs findest du in der `Historie`.
|
||||
|
||||
Ein Job kann eingeklappt oder ausgeklappt werden und zeigt:
|
||||
|
||||
- Titel, Autor, Sprecher, Jahr
|
||||
- Kapitelanzahl
|
||||
- Fortschritt und ETA
|
||||
- bei Split-Ausgabe den Kapitelstatus
|
||||
|
||||
## Konfigurierbare Job-Parameter
|
||||
|
||||
Im ausgeklappten Job kannst du setzen:
|
||||
|
||||
- Ausgabeformat `m4b`, `mp3` oder `flac`
|
||||
- formatspezifische Optionen
|
||||
- Kapitelnamen
|
||||
- Pre-Encode-Skripte und -Ketten
|
||||
- Post-Encode-Skripte und -Ketten
|
||||
|
||||
### Formatverhalten
|
||||
|
||||
- `m4b`: eine Datei mit Kapitelmarken
|
||||
- `mp3`: eine Datei pro Kapitel
|
||||
- `flac`: eine Datei pro Kapitel
|
||||
|
||||
Wenn du `mp3` oder `flac` wählst, zeigt die UI zusätzlich eine Kapitel-Status-Tabelle.
|
||||
|
||||
## Activation Bytes
|
||||
|
||||
Wenn Ripster für eine Datei keine Activation Bytes verwenden kann, wird im Workflow eine manuelle Eingabe nötig.
|
||||
|
||||
Wichtig:
|
||||
|
||||
- die Bytes werden lokal gecacht
|
||||
- derselbe AAX-Hash muss dann später nicht erneut manuell eingegeben werden
|
||||
- der Expertenblock in `Settings` zeigt bekannte Cache-Einträge an
|
||||
|
||||
## Relevante Settings
|
||||
|
||||
- `Audiobook RAW-Ordner`
|
||||
- `Audiobook Output-Ordner`
|
||||
- `Eigentümer Audiobook RAW-Ordner`
|
||||
- `Eigentümer Audiobook Output-Ordner`
|
||||
- `Audiobook RAW Template`
|
||||
- `Output Template (Audiobook)`
|
||||
- `Kapitel Template (Audiobook)`
|
||||
- `FFprobe Kommando`
|
||||
- `FFmpeg Kommando`
|
||||
|
||||
### So wirken die Settings im Alltag
|
||||
|
||||
- `Audiobook RAW Template` bestimmt den Namen des AAX-RAW-Ordners
|
||||
- `Output Template (Audiobook)` bestimmt die Einzeldatei für `m4b`
|
||||
- `Kapitel Template (Audiobook)` bestimmt Zielstruktur und Dateinamen für `mp3`/`flac`
|
||||
- `FFprobe Kommando` liest Kapitel und Metadaten
|
||||
- `FFmpeg Kommando` erzeugt die finalen Dateien
|
||||
|
||||
## Queue und Laufzeit
|
||||
|
||||
Audiobook-Jobs nutzen dieselbe globale Pipeline wie die anderen Bereiche.
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
|
||||
## Typische Fehlerbilder
|
||||
|
||||
- Upload wird abgelehnt: Datei ist keine gültige `*.aax`
|
||||
- Analyse schlägt fehl: `ffprobe` ist nicht erreichbar
|
||||
- Encode schlägt fehl: `ffmpeg` ist nicht erreichbar
|
||||
- Ausgabe landet unerwartet: Templates oder Zielpfade passen nicht zur gewünschten Struktur
|
||||
+56
-93
@@ -1,128 +1,91 @@
|
||||
# Converter
|
||||
|
||||
Die Seite `Converter` verarbeitet vorhandene Dateien ohne Laufwerks-Rip. Sie ist für Video-, Audio- und ISO-Dateien gedacht, die bereits auf dem System liegen oder hochgeladen werden.
|
||||
Die Converter-Seite ermöglicht das Konvertieren vorhandener Audio- und Video-Dateien sowie das Verarbeiten von Audiobooks (AAX/M4B).
|
||||
|
||||
## Betriebsmodell
|
||||
---
|
||||
|
||||
Der Converter arbeitet auf dem in `Settings` festgelegten `Converter Raw-Ordner`.
|
||||
## Überblick
|
||||
|
||||
Dort landen:
|
||||
Der Converter arbeitet mit einem konfigurierbaren Eingangsordner (`converter_raw_dir`). Dateien werden dort abgelegt (manuell oder per Upload) und dann als Converter-Jobs in die Pipeline eingereiht.
|
||||
|
||||
- Uploads
|
||||
- neu angelegte Ordner
|
||||
- umbenannte oder verschobene Dateien
|
||||
- alle Dateien, aus denen später Converter-Jobs entstehen
|
||||
|
||||
Wichtig:
|
||||
|
||||
- Upload erzeugt nicht automatisch einen Job
|
||||
- die Joberstellung erfolgt bewusst aus der Explorer-Auswahl
|
||||
---
|
||||
|
||||
## Datei-Explorer
|
||||
|
||||
Der Explorer zeigt den kompletten Baum unter `Converter Raw-Ordner`.
|
||||
Der Datei-Explorer zeigt den Inhalt des `converter_raw_dir` als Baumstruktur.
|
||||
|
||||
Aktionen:
|
||||
### Verfügbare Aktionen
|
||||
|
||||
| Aktion | Wirkung |
|
||||
| Aktion | Beschreibung |
|
||||
|---|---|
|
||||
| `Upload` | schreibt neue Dateien in den Converter-RAW-Baum |
|
||||
| `Ordner erstellen` | legt Unterordner an |
|
||||
| `Umbenennen` | benennt Datei oder Ordner um |
|
||||
| `Verschieben` | verschiebt Einträge innerhalb des Raw-Baums |
|
||||
| `Löschen` | entfernt Datei oder Ordner dauerhaft |
|
||||
| `Scannen` | synchronisiert Dateisystem und Converter-Datenbank |
|
||||
| **Upload** | Dateien direkt aus dem Browser hochladen (bis zu 50 Dateien) |
|
||||
| **Ordner erstellen** | Neuen Unterordner anlegen |
|
||||
| **Umbenennen** | Datei oder Ordner umbenennen |
|
||||
| **Verschieben** | Datei oder Ordner in einen anderen Unterordner verschieben |
|
||||
| **Löschen** | Datei oder Ordner löschen (unwiderruflich) |
|
||||
| **Scannen** | Eingangsordner manuell neu scannen |
|
||||
|
||||
### Upload- und Scan-Regeln
|
||||
### Dateiauswahl
|
||||
|
||||
- Dateiendungen müssen in `Erlaubte Datei-Endungen` enthalten sein
|
||||
- neue Dateien erscheinen sofort nach manuellem Scan
|
||||
- mit Polling auch automatisch
|
||||
Dateien können per Checkbox ausgewählt werden. Aus der Auswahl lassen sich Jobs erstellen:
|
||||
|
||||
Relevante Settings:
|
||||
- **Ein Job pro Datei** — jede Datei wird als eigenständiger Job angelegt
|
||||
- **Gemeinsamer Job (Audio)** — mehrere Audio-Dateien werden zu einem gemeinsamen Job zusammengefasst
|
||||
|
||||
- `Erlaubte Datei-Endungen`
|
||||
- `Auto-Scan (Polling)`
|
||||
- `Polling-Intervall (Sekunden)`
|
||||
Erlaubte Dateiendungen werden in den Settings unter `Converter > Erlaubte Datei-Endungen*` als Checkboxen konfiguriert.
|
||||
|
||||
## Joberstellung aus Explorer-Auswahl
|
||||
---
|
||||
|
||||
Es gibt zwei Audio-Strategien:
|
||||
## Jobs erstellen und konfigurieren
|
||||
|
||||
1. `Ein Job pro Datei`
|
||||
2. `Gemeinsamer Job (Audio)`
|
||||
Nach der Auswahl und Job-Erstellung erscheinen die Jobs in der Job-Liste.
|
||||
|
||||
Verhalten:
|
||||
### Job-Konfiguration
|
||||
|
||||
- Video und ISO werden immer als Einzeljobs angelegt
|
||||
- Audio kann als gemeinsamer Album-/Ordner-Job erzeugt werden
|
||||
Jeder Job kann konfiguriert werden:
|
||||
|
||||
Shared-Audio-Job:
|
||||
- **Medientyp:** Video, Audio oder Audiobook
|
||||
- **Ausgabeformat:** z. B. `mkv`, `mp4`, `m4b`, `mp3`, `flac`
|
||||
- **HandBrake-Preset:** für Video-Konvertierung
|
||||
- **Track-Auswahl:** Video-, Audio- und Untertitel-Spuren
|
||||
- **Metadaten:** Titel, Autor, Jahr (für Audiobooks)
|
||||
- **MusicBrainz-Suche:** automatische Metadaten-Suche für Audiodateien
|
||||
|
||||
- hält mehrere `inputPaths`
|
||||
- kann vor dem Start erweitert oder reduziert werden
|
||||
### Job-Start
|
||||
|
||||
## Job-Konfiguration
|
||||
Jobs starten sofort oder reihen sich in die Queue ein (abhängig von `Parallele Jobs`).
|
||||
|
||||
Vor dem Start je Job einstellbar:
|
||||
---
|
||||
|
||||
- `converterMediaType`
|
||||
- `outputFormat`
|
||||
- Metadaten
|
||||
- Track-/Titelwahl bei Video/ISO
|
||||
- User-Preset und HandBrake-Preset bei Video
|
||||
- Pre-/Post-Encode-Skripte und Ketten
|
||||
## Auto-Scan (Polling)
|
||||
|
||||
Spezifika:
|
||||
Wenn in den Settings `Converter > Auto-Scan (Polling)` aktiviert ist, wird der Eingangsordner automatisch in regelmäßigen Abständen gescannt. Neue Dateien werden in der DB erfasst und im Explorer angezeigt.
|
||||
|
||||
- Video/ISO durchlaufen eine Review ähnlich zum Disc-Flow
|
||||
- Audio wird direkt über Format und Audio-Optionen konfiguriert
|
||||
Das Scan-Intervall wird unter `Converter > Polling-Intervall (Sekunden)` konfiguriert (Standard: 300 Sekunden).
|
||||
|
||||
## Ausgabe-Pfade
|
||||
---
|
||||
|
||||
### Video / ISO
|
||||
## Audiobook-Verarbeitung
|
||||
|
||||
- Zielordner: `Converter Ausgabe (Video)`
|
||||
- Dateiname: `Output-Template (Video)`
|
||||
- Endung: aus dem gewählten Ausgabeformat
|
||||
Für AAX-Dateien (Audible) ist folgendes erforderlich:
|
||||
|
||||
### Audio
|
||||
1. AAX-Datei in den Eingangsordner hochladen
|
||||
2. Job mit Medientyp `Audiobook` erstellen
|
||||
3. Activation Bytes müssen verfügbar sein (werden beim ersten Mal abgefragt und gecacht)
|
||||
4. Ausgabeformat wählen: M4B (empfohlen), MP3 oder FLAC
|
||||
5. Kapitel-Splitting konfigurieren (optional)
|
||||
|
||||
- Zielordner: `Converter Ausgabe (Audio)`
|
||||
- Dateiname/Ordner: `Output-Template (Audio)`
|
||||
- bei Shared- oder Folder-Jobs entsteht eine Ordnerstruktur mit mehreren Track-Dateien
|
||||
---
|
||||
|
||||
Relevante Settings:
|
||||
## Einstellungen
|
||||
|
||||
- `Converter Ausgabe (Video)`
|
||||
- `Converter Ausgabe (Audio)`
|
||||
- `Output-Template (Video)`
|
||||
- `Output-Template (Audio)`
|
||||
- `Eigentümer Converter Video Output-Ordner`
|
||||
- `Eigentümer Converter Audio Output-Ordner`
|
||||
|
||||
## Queue und Start
|
||||
|
||||
Converter-Jobs laufen über dieselbe globale Pipeline-Queue wie Ripper und Audiobooks.
|
||||
|
||||
Das bedeutet:
|
||||
|
||||
- sofortiger Start, wenn Limits frei sind
|
||||
- sonst Einreihung in die Warteschlange
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
|
||||
## Typische Einsatzfälle
|
||||
|
||||
- vorhandene MKV/MP4-Dateien mit neuem Preset encodieren
|
||||
- ISO-Dateien in einen Video-Workflow überführen
|
||||
- Musikdateien gesammelt in einen Audio-Ordner-Job packen
|
||||
- Medien auf anderem Storage per Upload oder Dateibaum vorbereiten
|
||||
|
||||
## Abgrenzung zu Audiobooks
|
||||
|
||||
- `Converter`: beliebige Audio-, Video- und ISO-Dateien
|
||||
- `Audiobooks`: spezialisierter AAX-Workflow mit Activation Bytes, Kapitelmetadaten und Kapiteltemplates
|
||||
| Setting | Pfad in GUI |
|
||||
|---|---|
|
||||
| Eingangsordner | `Settings > Pfade > Converter Raw-Ordner` |
|
||||
| Videoausgabe | `Settings > Pfade > Converter Ausgabe (Video)` |
|
||||
| Audioausgabe | `Settings > Pfade > Converter Ausgabe (Audio)` |
|
||||
| Erlaubte Endungen | `Settings > Converter > Erlaubte Datei-Endungen*` |
|
||||
| Auto-Scan | `Settings > Converter > Auto-Scan (Polling)` |
|
||||
| Scan-Intervall | `Settings > Converter > Polling-Intervall (Sekunden)` |
|
||||
| Output-Template Video | `Settings > Pfade > Output-Template (Video)` |
|
||||
| Output-Template Audio | `Settings > Pfade > Output-Template (Audio)` |
|
||||
|
||||
+15
-21
@@ -1,35 +1,29 @@
|
||||
# Database (Expert)
|
||||
|
||||
`/database` ist die Recovery- und Expertensicht für Fälle, in denen Dateisystem und Historie nicht mehr sauber zusammenpassen.
|
||||
`/database` ist eine erweiterte Ansicht für Power-User und Recovery-Fälle.
|
||||
|
||||
## Zugriff
|
||||
|
||||
- direkte Route: `/database`
|
||||
- nicht Teil der Standardnavigation
|
||||
- Route direkt aufrufen: `/database`
|
||||
- nicht Teil der Standard-Navigation
|
||||
|
||||
## Bereich `Gefundene RAW-Einträge`
|
||||
## Bereiche
|
||||
|
||||
Dieser Bereich listet RAW-Verzeichnisse ohne zugeordneten Historie-Job.
|
||||
### `Gefundene RAW-Einträge`
|
||||
|
||||
Listet RAW-Ordner, die keinen zugehörigen Job-Eintrag haben.
|
||||
|
||||
Aktionen:
|
||||
|
||||
- `RAW prüfen`: scannt konfigurierte RAW-Wurzeln
|
||||
- `Job anlegen`: erstellt aus einem orphan RAW einen neuen Historie-Job
|
||||
- `RAW prüfen` (Scan der konfigurierten RAW-Pfade)
|
||||
- `Job anlegen` (Orphan-RAW in Historie importieren)
|
||||
|
||||
## Was bei `Job anlegen` passiert
|
||||
## Typischer Einsatz
|
||||
|
||||
- RAW-Pfad wird als Importquelle registriert
|
||||
- Job wird in die Historie geschrieben
|
||||
- anschließende Analyse läuft als RAW-basierter Einstieg (ohne klassischen Disc-Read)
|
||||
- nach manuellen Dateioperationen
|
||||
- nach Migrationen oder Recovery
|
||||
- wenn RAW-Dateien vorhanden sind, aber kein Historieneintrag existiert
|
||||
|
||||
Typischer Einsatz:
|
||||
## Vorsicht
|
||||
|
||||
- manuelle Dateioperationen außerhalb der UI
|
||||
- Migrationen
|
||||
- Wiederherstellung nach abgebrochenen Läufen
|
||||
|
||||
## Sicherheits- und Betriebsregeln
|
||||
|
||||
- Aktionen wirken direkt auf produktive Historie/Dateipfade.
|
||||
- Vor Import oder Löschung immer Pfad und Ziel prüfen.
|
||||
- Diese Seite nur für Recovery-Szenarien nutzen, nicht für normalen Tagesbetrieb.
|
||||
Diese Seite erlaubt Eingriffe mit direkter Auswirkung auf Datenbestand und Historie. Vor Lösch- oder Importaktionen Pfade und Zieljob sorgfältig prüfen.
|
||||
|
||||
+30
-35
@@ -1,58 +1,53 @@
|
||||
# Downloads
|
||||
|
||||
Auf `Downloads` werden ZIP-Archive für Historie-Artefakte erstellt und bereitgestellt.
|
||||
Die Downloads-Seite ermöglicht es, Ausgabedateien aus abgeschlossenen Jobs als ZIP-Archiv herunterzuladen.
|
||||
|
||||
## Was heruntergeladen werden kann
|
||||
---
|
||||
|
||||
Ein Download-Eintrag referenziert immer einen Historie-Job und genau ein Ziel:
|
||||
## Überblick
|
||||
|
||||
- `RAW`
|
||||
- `Output`
|
||||
Jobs, die in der Historie abgeschlossen sind, können in die Download-Queue eingereiht werden. Ripster erstellt daraus ein ZIP-Archiv, das direkt im Browser heruntergeladen werden kann.
|
||||
|
||||
Erzeugt wird ein ZIP-Archiv im Download-Verzeichnis des Backends.
|
||||
---
|
||||
|
||||
## Statusmodell
|
||||
## Download-Queue
|
||||
|
||||
| Status | Bedeutung |
|
||||
Die Queue zeigt alle aktuellen Download-Einträge mit ihrem Status:
|
||||
|
||||
| Status | Beschreibung |
|
||||
|---|---|
|
||||
| `queued` | Eintrag erstellt, wartet auf Verarbeitung |
|
||||
| `processing` | ZIP wird gerade gebaut |
|
||||
| `ready` | Archiv fertig, Download-Link aktiv |
|
||||
| `failed` | Erzeugung oder Zugriff fehlgeschlagen |
|
||||
| **Ausstehend** | In der Queue, ZIP-Erstellung noch nicht gestartet |
|
||||
| **Wird verarbeitet** | ZIP-Archiv wird gerade erstellt |
|
||||
| **Bereit** | ZIP fertig, Download-Button verfügbar |
|
||||
| **Fehlgeschlagen** | Fehler bei der ZIP-Erstellung |
|
||||
|
||||
## Eintrag anlegen
|
||||
---
|
||||
|
||||
Startpunkt ist die `Historie`:
|
||||
## Download einreihen
|
||||
|
||||
1. Job öffnen.
|
||||
2. Download einreihen.
|
||||
3. Ziel (`RAW` oder `Output`) wählen.
|
||||
4. Status in `Downloads` verfolgen.
|
||||
Downloads können über die **Historie** eingereiht werden:
|
||||
|
||||
## Wichtige Laufzeitdetails
|
||||
1. Job in der Historie öffnen
|
||||
2. **Download einreihen** wählen
|
||||
3. Ziel auswählen: `RAW-Dateien` oder `Ausgabedateien`
|
||||
4. Den Eintrag in der Downloads-Queue verfolgen
|
||||
|
||||
- Wenn bereits ein passendes, aktuelles Archiv existiert, kann der Eintrag wiederverwendet werden.
|
||||
- Nach Backend-Neustart werden unterbrochene `queued`/`processing`-Einträge geprüft und fortgesetzt.
|
||||
- Fehlt eine erwartete ZIP-Datei bei `ready`, wird der Eintrag auf `failed` gesetzt.
|
||||
---
|
||||
|
||||
## Download auslösen
|
||||
## Download starten
|
||||
|
||||
Bei Status `ready`:
|
||||
Sobald der Status **Bereit** angezeigt wird, kann die ZIP-Datei mit dem Download-Button heruntergeladen werden.
|
||||
|
||||
- Download-Button lädt die ZIP direkt aus `/api/downloads/:id/file`.
|
||||
ZIP-Dateinamen folgen dem Muster: `Job_<id>_<target>.zip`
|
||||
|
||||
## Einträge entfernen
|
||||
---
|
||||
|
||||
`Löschen` entfernt:
|
||||
## Einträge löschen
|
||||
|
||||
- Queue-Metadaten
|
||||
- zugehörige Archivdatei
|
||||
Abgeschlossene oder fehlerhafte Einträge können einzeln gelöscht werden. Die dazugehörige ZIP-Datei wird dabei ebenfalls vom Server entfernt.
|
||||
|
||||
Nicht erlaubt:
|
||||
---
|
||||
|
||||
- Löschen während `queued`/`processing`
|
||||
## Echtzeit-Updates
|
||||
|
||||
## Echtzeitaktualisierung
|
||||
|
||||
Die Seite reagiert auf `DOWNLOADS_UPDATED` per WebSocket.
|
||||
Dadurch sind Statuswechsel ohne Reload sichtbar.
|
||||
Die Downloads-Seite aktualisiert sich automatisch per WebSocket (`DOWNLOADS_UPDATED`). Statusänderungen (z. B. von `Wird verarbeitet` zu `Bereit`) werden ohne Seiten-Reload angezeigt.
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
# Hardware
|
||||
|
||||
Die Seite `Hardware` ist die ausführliche Detailansicht für das Live-Monitoring aus dem `Ripper`.
|
||||
|
||||
## Was die Seite zeigt
|
||||
|
||||
- aktuelle CPU-Auslastung
|
||||
- RAM-Auslastung
|
||||
- GPU-Auslastung und VRAM, falls vorhanden
|
||||
- Temperaturen
|
||||
- Verlaufshistorie für Auslastung und Temperatur
|
||||
- Zeitfenster für `1h`, `6h`, `24h`, `4d`
|
||||
|
||||
## Live-Bereich
|
||||
|
||||
Oben zeigt die Seite:
|
||||
|
||||
- ob Monitoring aktiv ist
|
||||
- aktuelles Polling-Intervall
|
||||
- Zeitpunkt der letzten Messung
|
||||
|
||||
Wenn Monitoring deaktiviert ist, führt die Seite direkt zu `Settings`.
|
||||
|
||||
## Historie
|
||||
|
||||
Die Historie lädt Messpunkte aus dem Backend und zeigt:
|
||||
|
||||
- Auslastung als Linienchart
|
||||
- Temperatur als Linienchart
|
||||
- umschaltbare Serien für CPU, RAM und GPU
|
||||
|
||||
Das ist besonders nützlich bei:
|
||||
|
||||
- mehreren parallelen Encodes
|
||||
- Fehlersuche bei Hitzespitzen
|
||||
- Abschätzung, ob weitere Jobs sinnvoll gestartet werden können
|
||||
|
||||
## Relevante Settings
|
||||
|
||||
- `Hardware Monitoring aktiviert`
|
||||
- `Hardware Monitoring Intervall (ms)`
|
||||
|
||||
Außerdem sinnvoll:
|
||||
|
||||
- `Externe Speicher`, damit Speicherstände im `Ripper` sinnvoll angezeigt werden
|
||||
+41
-67
@@ -1,88 +1,62 @@
|
||||
# Historie
|
||||
|
||||
`Historie` ist die Kontroll- und Nachbearbeitungsoberfläche für alle bereits angelegten Jobs.
|
||||
Die Seite `Historie` ist für Suche, Prüfung und Nachbearbeitung bestehender Jobs.
|
||||
|
||||
## Hauptansicht
|
||||
|
||||
Filter und Arbeitsmittel:
|
||||
Filter und Werkzeuge:
|
||||
|
||||
- Suche
|
||||
- Statusfilter
|
||||
- Mediumfilter
|
||||
- Suche (Titel/IMDb)
|
||||
- Status-Filter
|
||||
- Medium-Filter (`Blu-ray`, `DVD`, `Sonstiges`)
|
||||
- Sortierung
|
||||
- Listen-/Grid-Layout
|
||||
|
||||
Jeder Eintrag zeigt auf einen Blick:
|
||||
Jeder Eintrag zeigt:
|
||||
|
||||
- Titel, Jahr, Poster oder Cover
|
||||
- Status und Zeitstempel
|
||||
- RAW- und Output-Verfügbarkeit
|
||||
- Medien- und Containerhinweise
|
||||
- Poster, Titel, Jahr, IMDb
|
||||
- Medium-Indikator
|
||||
- Status
|
||||
- Start/Ende
|
||||
- Verfügbarkeit von RAW/Movie
|
||||
- Ratings (wenn OMDb-Daten vorhanden)
|
||||
|
||||
## Detaildialog
|
||||
Klick auf einen Eintrag öffnet die Detailansicht.
|
||||
|
||||
Der Detaildialog bündelt:
|
||||
---
|
||||
|
||||
- Metadaten
|
||||
- Jobstatus und Fehlertexte
|
||||
- RAW- und Output-Pfade
|
||||
- Encode-Plan und Trackauswahl
|
||||
- ausgeführte Kommandos
|
||||
- Prozesslog
|
||||
- verfügbare Folgeaktionen
|
||||
## Job-Detaildialog
|
||||
|
||||
Bei Seriencontainern und Multipart-Jobs wird container- und child-orientiert dargestellt.
|
||||
Bereiche:
|
||||
|
||||
## Nachbearbeitungsaktionen
|
||||
- Film-Infos + OMDb-Details
|
||||
- Job-Infos (Status, Pfade, Erfolgsflags, Fehler)
|
||||
- hinterlegte Encode-Auswahl
|
||||
- ausgeführter HandBrake-Befehl
|
||||
- strukturierte JSON-Blöcke (OMDb/MakeMKV/MediaInfo/EncodePlan/HandBrake)
|
||||
- Log-Ladefunktionen (`Tail`, `Vollständig`)
|
||||
|
||||
| Aktion | Typischer Einsatz | Technische Wirkung |
|
||||
|---|---|---|
|
||||
| `TMDb neu zuweisen` | falsches Match, anderer Film, andere Staffel | Metadaten werden neu geschrieben; Poster, Jahr und ggf. Ordnername werden best effort aktualisiert |
|
||||
| `Review neu starten` | neue Track-/Titelbewertung nötig | Review wird aus vorhandenem RAW neu aufgebaut |
|
||||
| `RAW neu encodieren` | neuer Encode mit vorhandenem RAW | startet Encode ohne neuen Disc-Rip |
|
||||
| `Encode neu starten` | gleiche bestätigte Auswahl erneut fahren | letzter bestätigter Plan wird geladen |
|
||||
| `Retry Rippen` | Rip oder Analyse erneut anstoßen | neuer Rip-Lauf inklusive RAW-Phase |
|
||||
## Typische Aktionen im Detaildialog
|
||||
|
||||
Relevante Settings:
|
||||
- `OMDb neu zuordnen`
|
||||
- `Encode neu starten`
|
||||
- `Review neu starten`
|
||||
- `RAW neu encodieren`
|
||||
- `RAW löschen`, `Movie löschen`, `Beides löschen`
|
||||
- `Historieneintrag löschen`
|
||||
- bei Queue-Lock: `Aus Queue löschen`
|
||||
|
||||
- `Encode-Neustart: unvollständige Ausgabe löschen`
|
||||
- `NFO nach Encode erzeugen`
|
||||
## Wann welche Aktion?
|
||||
|
||||
## Löschaktionen und Vorschau
|
||||
| Ziel | Aktion |
|
||||
|---|---|
|
||||
| Metadaten korrigieren | `OMDb neu zuordnen` |
|
||||
| mit gleicher bestätigter Auswahl neu encodieren | `Encode neu starten` |
|
||||
| Titel-/Spurprüfung komplett neu berechnen | `Review neu starten` |
|
||||
| aus vorhandenem RAW erneut encodieren | `RAW neu encodieren` |
|
||||
| Speicher freigeben | Dateilöschaktionen |
|
||||
|
||||
Vor dem endgültigen Löschen zeigt Ripster eine Vorschau mit:
|
||||
## Logs
|
||||
|
||||
- RAW-Kandidaten
|
||||
- Movie-/Episode-Kandidaten
|
||||
- Related-Scope für Container, Kinder und verbundene Jobs
|
||||
|
||||
Wichtige Punkte:
|
||||
|
||||
- Pfade sind selektierbar
|
||||
- bei mehreren RAW-Kandidaten muss mindestens ein RAW-Pfad gewählt werden
|
||||
- Schutzlogik verhindert Löschungen außerhalb erlaubter Root-Verzeichnisse
|
||||
|
||||
## Serien- und Multipart-Sicht
|
||||
|
||||
### Serien
|
||||
|
||||
- Container zeigt den aggregierten Zustand der Child-Jobs
|
||||
- Disk- und Episodenaktionen können child-spezifisch ausgeführt werden
|
||||
- `Im Ripper öffnen` hilft bei offenen Reviews
|
||||
|
||||
### Multipart
|
||||
|
||||
- gemeinsamer Container mit Disc-Childs
|
||||
- Disc-Nummern bleiben pro Child nachvollziehbar
|
||||
- Delete-Preview kann Related-Pfade gemeinsam auflösen
|
||||
|
||||
## Logs sinnvoll nutzen
|
||||
|
||||
- `Tail laden` für schnellen Fehlerkontext
|
||||
- `Vollständiges Log laden` für tiefe Analyse
|
||||
|
||||
Empfehlung:
|
||||
|
||||
1. erst den Tail prüfen
|
||||
2. dann die Stelle im Log eingrenzen
|
||||
3. anschließend die passende Wiederanlauf-Aktion wählen
|
||||
- `Tail laden (800)` für schnelle Fehleranalyse
|
||||
- `Vollständiges Log laden` für vollständige Nachverfolgung
|
||||
|
||||
+19
-33
@@ -1,42 +1,28 @@
|
||||
# GUI-Seiten
|
||||
|
||||
Dieses Kapitel ist das Bedienhandbuch für die Oberflächen im Alltag.
|
||||
Ripster hat fünf Hauptseiten in der Navigation plus eine Expert-Seite.
|
||||
|
||||
## Seitenüberblick
|
||||
|
||||
| Seite | Rolle im Betrieb | Typischer Einsatz |
|
||||
|---|---|---|
|
||||
| [Ripper](ripper.md) | Live-Steuerung der Disc-Pipeline | Disc erkennen, Analyse starten, Entscheidungen treffen, Queue steuern |
|
||||
| [Hardware](hardware.md) | Detailansicht für Live-Monitoring | CPU/RAM/GPU und Verlauf prüfen |
|
||||
| [Audiobooks](audiobooks.md) | AAX-Spezialflow | Upload, Kapitelprüfung und Encode von Audiobooks |
|
||||
| [Settings](settings.md) | Konfiguration und Automatisierung | Pfade, Tools, Queue, Presets, Skripte, Cron |
|
||||
| [Historie](history.md) | Nachbearbeitung und Kontrolle | Logs, Re-Encode, TMDb-Neuzuordnung, Löschvorschau |
|
||||
| [Converter](converter.md) | dateibasierte Konvertierung | Video/Audio/ISO ohne Disc-Rip verarbeiten |
|
||||
| [Downloads](downloads.md) | ZIP-Exports | RAW/Output aus der Historie bereitstellen |
|
||||
| [Database (Expert)](database.md) | Recovery-Sicht | orphan RAW finden, prüfen und importieren |
|
||||
| [TMDb Migration](tmdb-migration.md) | Sonderseite für Altbestände | alte Jobs gesammelt auf TMDb umstellen |
|
||||
| Seite | Zweck |
|
||||
|---|---|
|
||||
| [Ripper](ripper.md) | Live-Betrieb: Pipeline, Queue, Aktivitäten, Disc-Infos |
|
||||
| [Settings](settings.md) | Konfiguration, Skripte, Ketten, Presets, Cronjobs |
|
||||
| [Historie](history.md) | abgeschlossene/laufende Jobs durchsuchen und nachbearbeiten |
|
||||
| [Converter](converter.md) | Audio/Video-Dateien konvertieren, Datei-Explorer, Upload |
|
||||
| [Downloads](downloads.md) | Ausgabedateien als ZIP herunterladen |
|
||||
| [Database (Expert)](database.md) | tabellarische Rohsicht inkl. Orphan-RAW-Import |
|
||||
|
||||
## Empfohlener Tagesablauf
|
||||
## Empfohlene Nutzung im Alltag
|
||||
|
||||
1. `Ripper`, `Converter` oder `Audiobooks`: neue Arbeit starten
|
||||
2. `Historie`: Ergebnisse kontrollieren und ggf. nachbearbeiten
|
||||
3. `Downloads`: Artefakte für externe Übergabe vorbereiten
|
||||
4. `Settings`: Regeln, Presets oder Limits nur kontrolliert anpassen
|
||||
5. `Hardware`: bei Lastspitzen oder Batch-Läufen den Verlauf prüfen
|
||||
1. **Start eines neuen Disc-Jobs:** `Ripper`
|
||||
2. **Dateien konvertieren oder Audiobooks verarbeiten:** `Converter`
|
||||
3. **Regeln/Automatisierung anpassen:** `Settings`
|
||||
4. **Ergebnisse prüfen oder Jobs nachbearbeiten:** `Historie`
|
||||
5. **Dateien herunterladen:** `Downloads`
|
||||
6. **Sonderfälle/Recovery:** `Database`
|
||||
|
||||
## Navigation
|
||||
## Hinweise zur Navigation
|
||||
|
||||
Direkt in der Top-Navigation:
|
||||
|
||||
- `Ripper`
|
||||
- `Converter`
|
||||
- `Audiobooks`
|
||||
- `Settings`
|
||||
- `Historie`
|
||||
- `Downloads`
|
||||
|
||||
Zusatzansichten:
|
||||
|
||||
- `Hardware` unter `/hardware`
|
||||
- `Database` unter `/database` und im Expertenmodus zusätzlich in der Navigation
|
||||
- `TMDb Migration` unter `/tmdb-migration` als Direktlink
|
||||
- `Ripper`, `Settings`, `Historie`, `Converter` und `Downloads` sind direkt in der Kopfnavigation.
|
||||
- `Database` ist als Expert-Route verfügbar: `/database`.
|
||||
|
||||
+69
-172
@@ -1,227 +1,124 @@
|
||||
# Ripper
|
||||
|
||||
Die Seite `Ripper` ist die Live-Steuerung der Disc-Pipeline. Hier laufen Disc-Erkennung, Queue, manuelle Entscheidungen, Review und aktive Jobs zusammen.
|
||||
Das Ripper ist die **Betriebszentrale** für laufende Jobs.
|
||||
|
||||
## Seitenaufbau
|
||||
## Aufbau der Seite
|
||||
|
||||
Die wichtigsten Bereiche:
|
||||
Die Bereiche erscheinen in dieser Reihenfolge:
|
||||
|
||||
1. `Hardware`
|
||||
1. `Hardware Monitoring`
|
||||
2. `Job Queue`
|
||||
3. `Skript- / Cron-Status`
|
||||
4. `Job Übersicht`
|
||||
5. `Disk-Information`
|
||||
|
||||
## 1. Hardware
|
||||
---
|
||||
|
||||
Die Hardware-Karte zeigt live:
|
||||
## 1) Hardware Monitoring
|
||||
|
||||
- CPU
|
||||
Zeigt live:
|
||||
|
||||
- CPU (gesamt + optional pro Kern)
|
||||
- RAM
|
||||
- GPU, falls vorhanden
|
||||
- freie Speicherstände der konfigurierten Pfade
|
||||
- GPU-Auslastung/Temperatur/VRAM
|
||||
- freien Speicher in den konfigurierten Pfaden
|
||||
|
||||
Aktionen:
|
||||
Wichtig für den Betrieb:
|
||||
|
||||
- Klick auf das Hardware-Symbol öffnet die Seite [Hardware](hardware.md)
|
||||
- Hohe Speicherauslastung oder fast volle Zielpfade früh erkennen
|
||||
- über `Settings` aktivierbar/deaktivierbar (`Hardware Monitoring aktiviert`)
|
||||
|
||||
Relevante Settings:
|
||||
## 2) Job Queue
|
||||
|
||||
- `Hardware Monitoring aktiviert`
|
||||
- `Hardware Monitoring Intervall (ms)`
|
||||
- `Externe Speicher`
|
||||
Zwei Spalten:
|
||||
|
||||
## 2. Job Queue
|
||||
- `Laufende Jobs`
|
||||
- `Warteschlange`
|
||||
|
||||
Es gibt zwei operative Zonen:
|
||||
Mögliche Aktionen:
|
||||
|
||||
- laufende Jobs
|
||||
- Warteschlange
|
||||
- Queue per Drag-and-Drop umsortieren
|
||||
- Queue-Job entfernen (`X`)
|
||||
- zusätzliche Queue-Elemente einfügen (`+`):
|
||||
- Skript
|
||||
- Skriptkette
|
||||
- Wartezeit
|
||||
|
||||
Mögliche Queue-Einträge:
|
||||
Hinweis:
|
||||
|
||||
- normale Job-Starts
|
||||
- `Retry Rippen`
|
||||
- `RAW neu encodieren`
|
||||
- `Encode neu starten`
|
||||
- `Review neu starten`
|
||||
- `Audio CD starten`
|
||||
- `Skript`
|
||||
- `Skriptkette`
|
||||
- `Warten`
|
||||
- `Parallel` zeigt den Wert aus `Settings` -> `Parallele Jobs`.
|
||||
|
||||
Wichtige Regeln:
|
||||
## 3) Skript- / Cron-Status
|
||||
|
||||
- Reihenfolge ist per Drag-and-Drop änderbar
|
||||
- `Warten` blockiert nachfolgende Starts, bis keine aktive Verarbeitung mehr läuft
|
||||
- Queue-Einträge können auch ohne Medienjob existieren
|
||||
Zeigt:
|
||||
|
||||
Relevante Settings:
|
||||
- aktive Ausführungen (Skripte, Ketten, Cron)
|
||||
- zuletzt abgeschlossene Ausführungen
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
||||
Mögliche Aktionen:
|
||||
|
||||
## 3. Skript- / Cron-Status
|
||||
- laufende Ketten: `Nächster Schritt`
|
||||
- laufende Einträge: `Abbrechen`
|
||||
- Historie der Aktivitäten: `Liste leeren`
|
||||
|
||||
Zeigt Runtime-Aktivitäten:
|
||||
## 4) Job Übersicht
|
||||
|
||||
- laufende Skripte
|
||||
- laufende Ketten
|
||||
- Cron-Ausführungen
|
||||
- kürzlich abgeschlossene Aktivitäten
|
||||
Kompakte Jobliste mit Status, Fortschritt, ETA. Klick auf einen Job klappt die Detailsteuerung auf.
|
||||
|
||||
Aktionen:
|
||||
|
||||
- `Nächster Schritt` bei Ketten
|
||||
- `Abbrechen`
|
||||
- `Liste leeren`
|
||||
|
||||
## 4. Job Übersicht
|
||||
|
||||
Die Jobliste ist der zentrale Arbeitsbereich. Ein Klick öffnet den jeweiligen `Pipeline-Status`.
|
||||
Im aufgeklappten Zustand erscheint die Karte `Pipeline-Status` mit allen zustandsabhängigen Aktionen.
|
||||
|
||||
### Zustandsabhängige Hauptaktionen
|
||||
|
||||
| Zustand | Typische Aktion | Ergebnis |
|
||||
|---|---|---|
|
||||
| `Medium erkannt` | `Analyse starten` | MakeMKV-Analyse beginnt |
|
||||
| `Metadatenauswahl` | `Metadaten öffnen` | TMDb-Dialog für Film/Serie |
|
||||
| `Warte auf Auswahl` | Entscheidung bestätigen | Flow geht an die passende Stelle weiter |
|
||||
| `Startbereit` | `Job starten` | Rip oder RAW-basierte Prüfung startet |
|
||||
| `Bereit zum Encodieren` | `Encoding starten` | HandBrake startet mit bestätigter Auswahl |
|
||||
| laufend | `Abbrechen` | Job wird gestoppt |
|
||||
| `Fehler` / `Abgebrochen` | `Retry Rippen` | neuer Rip-Anlauf |
|
||||
| Zustand | Typische Aktion |
|
||||
|---|---|
|
||||
| `Medium erkannt` / `Bereit` | `Analyse starten` |
|
||||
| `Metadatenauswahl` | `Metadaten öffnen` |
|
||||
| `Warte auf Auswahl` | Playlist wählen und `Playlist übernehmen` |
|
||||
| `Startbereit` | `Job starten` |
|
||||
| `Bereit zum Encodieren` | Tracks/Skripte prüfen, dann `Encoding starten` |
|
||||
| laufend (`Analyse`/`Rippen`/`Encodieren`) | `Abbrechen` |
|
||||
| `Fehler` / `Abgebrochen` | `Retry Rippen`, `Disk-Analyse neu starten` |
|
||||
|
||||
### Was `Warte auf Auswahl` heute bedeuten kann
|
||||
Zusätzlich je nach Job:
|
||||
|
||||
Der Status ist nicht nur für eine einzige Entscheidung da. Im aktuellen Stand gibt es drei typische Fälle:
|
||||
- `Review neu starten`
|
||||
- `Encode neu starten`
|
||||
- `Aus Queue löschen`
|
||||
|
||||
#### Vorhandenes RAW
|
||||
### Titel-/Spurprüfung (`Bereit zum Encodieren`)
|
||||
|
||||
Ripster hat zu den Metadaten bereits ein passendes RAW gefunden. Dann entscheidest du:
|
||||
Im selben Block siehst du:
|
||||
|
||||
- mit RAW weiterarbeiten
|
||||
- RAW löschen und neu rippen
|
||||
- in passenden Film-Fällen optional Multipart mit Orphan-RAW bilden
|
||||
- Auswahl des Encode-Titels
|
||||
- Audio-/Subtitle-Trackauswahl
|
||||
- User-Preset-Auswahl
|
||||
- Pre-/Post-Encode-Skripte und Ketten
|
||||
- Preview des finalen HandBrakeCLI-Befehls
|
||||
|
||||
#### Playlist-Auswahl
|
||||
## 5) Disk-Information
|
||||
|
||||
Bei mehrdeutigen Blu-rays oder bestimmten DVD-Fällen musst du eine Playlist bestätigen. Die Liste zeigt unter anderem:
|
||||
|
||||
- Playlist-Datei
|
||||
- Titel-ID
|
||||
- Laufzeit
|
||||
- Score
|
||||
- Empfehlung
|
||||
- Segment- und Audio-Vorschau
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
- `Bei manueller Auswahl senden` für PushOver
|
||||
|
||||
#### Titelauswahl / PlayAll-Grenzfall
|
||||
|
||||
Wenn Ripster mehrere HandBrake-Titel als plausibel erkannt hat, musst du einen oder mehrere Titel bestätigen. Bei Serien kann das der Grenzfall `PlayAll oder Doppelfolge?` sein.
|
||||
|
||||
## 5. Review-Bereich (`Bereit zum Encodieren`)
|
||||
|
||||
Hier triffst du die eigentliche Encode-Entscheidung.
|
||||
|
||||
Du legst fest:
|
||||
|
||||
- welchen Titel Ripster encodieren soll
|
||||
- welche Audio-Spuren übernommen werden
|
||||
- welche Untertitel übernommen, erzwungen oder eingebrannt werden
|
||||
- welches User-Preset oder HandBrake-Preset verwendet wird
|
||||
- welche Pre-/Post-Encode-Skripte oder Ketten mitlaufen
|
||||
|
||||
Wichtig:
|
||||
|
||||
- ohne diese Bestätigung startet kein produktiver Encode
|
||||
- bei Multipart-Locks können Einstellungen von einer Referenz-Disc übernommen und gesperrt sein
|
||||
|
||||
### Welche Settings hier direkt sichtbar werden
|
||||
|
||||
- `HandBrake Preset`
|
||||
- `HandBrake Extra Args`
|
||||
- `Review Audio-Sprachen (...)`
|
||||
- `Review UT-Sprachen (...)`
|
||||
- `Ausgabeformat`
|
||||
- Standard-Zuordnungen aus `Settings -> Encode-Presets`
|
||||
|
||||
## RAW-Ordnerphasen
|
||||
|
||||
Der Ripper arbeitet mit drei RAW-Zuständen:
|
||||
|
||||
- `Incomplete_...` während eines unvollständigen Rips
|
||||
- `Rip_Complete_...` nach erfolgreichem Rip, vor dem finalen Encode
|
||||
- ohne Prefix nach erfolgreichem Encode
|
||||
|
||||
Das ist wichtig für:
|
||||
|
||||
- Recovery
|
||||
- RAW-Wiederverwendung
|
||||
- Delete-Preview in `Historie`
|
||||
|
||||
## Disk-Information
|
||||
|
||||
Zeigt aktuelle Laufwerksdaten:
|
||||
|
||||
- Device-Pfad
|
||||
- Modell
|
||||
- Disc-Label
|
||||
- Mount-Informationen
|
||||
Zeigt aktuelles Laufwerk und Disc-Metadaten (`Pfad`, `Modell`, `Disc-Label`, `Mount`).
|
||||
|
||||
Aktionen:
|
||||
|
||||
- `Laufwerk neu lesen`
|
||||
- `Disk neu analysieren`
|
||||
- Metadaten-Dialog öffnen
|
||||
- `Metadaten-Modal öffnen`
|
||||
|
||||
Hinweis:
|
||||
---
|
||||
|
||||
- `Laufwerk neu lesen` ist nicht mehr an einen festen Pipeline-State gebunden
|
||||
|
||||
## Wichtige Dialoge
|
||||
## Wichtige Dialoge im Ripper
|
||||
|
||||
### Metadaten auswählen
|
||||
|
||||
Im Dialog bestätigst du Film- oder Serienmetadaten aus TMDb.
|
||||
- OMDb-Suche + Ergebnisliste
|
||||
- manuelle Eingabe als Fallback
|
||||
- `Auswahl übernehmen` startet den nächsten Pipeline-Schritt
|
||||
|
||||
Sonderfälle:
|
||||
### Abbruch-Bereinigung
|
||||
|
||||
- Film-Duplikat: `Übernahme erzwingen` oder `Multipart movie`
|
||||
- Serie: `Disc-Nummer` ist Pflicht
|
||||
|
||||
### Vorhandenes RAW erkannt
|
||||
|
||||
Wenn zu den Metadaten bereits RAW existiert, fordert Ripster eine explizite Entscheidung:
|
||||
|
||||
- vorhandenes RAW verwenden
|
||||
- RAW verwerfen/löschen und neu rippen
|
||||
Nach Abbruch kann Ripster optional fragen, ob erzeugte RAW- oder Movie-Dateien gelöscht werden sollen.
|
||||
|
||||
### Queue-Eintrag einfügen
|
||||
|
||||
Du kannst gezielt ab Position einfügen:
|
||||
|
||||
- Skript
|
||||
- Skriptkette
|
||||
- Wartezeit
|
||||
|
||||
### Audible Activation Bytes eintragen
|
||||
|
||||
Wenn für eine AAX-Datei keine Activation Bytes verfügbar sind, öffnet Ripster einen Dialog zur manuellen Eingabe.
|
||||
|
||||
- Format: genau 8 Hex-Zeichen, z. B. `1a2b3c4d`
|
||||
- Speicherung: lokal im Activation-Bytes-Cache
|
||||
- Wirkung: der Audiobook-Flow kann anschließend fortgesetzt werden
|
||||
|
||||
## Siehe auch
|
||||
|
||||
- [Hardware](hardware.md)
|
||||
- [Settings](settings.md)
|
||||
- [Workflows aus Nutzersicht](../workflows/index.md)
|
||||
Erstellt gezielt einen Skript-, Ketten- oder Warte-Eintrag an einer bestimmten Queue-Position.
|
||||
|
||||
+49
-240
@@ -1,283 +1,92 @@
|
||||
# Settings
|
||||
|
||||
Die Seite `Settings` ist das Kontrollzentrum für Laufzeitverhalten, Standardwerte und Automatisierung. Alles, was spätere Jobs automatisch tun oder vorschlagen, wird hier vorbereitet.
|
||||
Die Seite `Settings` steuert Konfiguration und Automatisierung.
|
||||
|
||||
Für die detaillierte Feld-für-Feld-Erklärung jeder einzelnen Einstellung nutze die Seite [Einstellungsreferenz](../configuration/settings-reference.md). Dort ist jedes sichtbare Feld aus der GUI mit Wirkung, Workflow-Bezug und typischem Einsatz beschrieben.
|
||||
|
||||
## Tab-Überblick
|
||||
## Tabs im Überblick
|
||||
|
||||
| Tab | Zweck |
|
||||
|---|---|
|
||||
| `Konfiguration` | alle fachlichen Einstellungen aus der GUI |
|
||||
| `Scripte` | einzelne Bash-Skripte anlegen, testen und sortieren |
|
||||
| `Skriptketten` | mehrstufige Abläufe aus Skript- und Warte-Schritten bauen |
|
||||
| `Encode-Presets` | eigene Video-Presets und Standard-Zuordnungen pflegen |
|
||||
| `Cronjobs` | zeitgesteuerte Ausführung von Skripten oder Ketten |
|
||||
| `Konfiguration` | alle Kernsettings (Pfade, Tools, Monitoring, Metadaten, Queue, Benachrichtigungen) |
|
||||
| `Scripte` | einzelne Bash-Skripte verwalten und testen |
|
||||
| `Skriptketten` | Sequenzen aus Skript- und Warte-Schritten bauen |
|
||||
| `Encode-Presets` | benutzerdefinierte Presets für das Review im Ripper |
|
||||
| `Cronjobs` | zeitgesteuerte Skript-/Kettenausführung |
|
||||
|
||||
---
|
||||
|
||||
## Tab `Konfiguration`
|
||||
|
||||
### Bedienlogik
|
||||
Wichtiges Bedienmuster:
|
||||
|
||||
1. Felder ändern
|
||||
2. `Änderungen speichern` klicken
|
||||
3. erst dann gelten die neuen Werte für künftige Starts, Reviews oder Scheduler
|
||||
1. Werte ändern
|
||||
2. `Änderungen speichern`
|
||||
3. bei Bedarf `Änderungen verwerfen` oder `Neu laden`
|
||||
|
||||
Ausnahmen:
|
||||
Zusätzlich:
|
||||
|
||||
- `Expertenmodus` wird sofort gespeichert
|
||||
- Buttons wie `PushOver Test`, `Coverarts prüfen` oder der MakeMKV-Betakey-Import lösen direkte Aktionen aus
|
||||
|
||||
### Toolbar-Aktionen
|
||||
|
||||
- `Änderungen speichern`: schreibt nur geänderte Felder
|
||||
- `Änderungen verwerfen`: setzt den Formularzustand zurück
|
||||
- `Neu laden`: lädt Schema und Werte neu
|
||||
- `PushOver Test`: sendet eine Testnachricht mit den aktuellen PushOver-Werten
|
||||
- `Coverarts prüfen`: startet den Coverart-Recovery-Lauf sofort
|
||||
|
||||
### Was die Kategorien im Alltag steuern
|
||||
|
||||
#### Benachrichtigungen
|
||||
|
||||
Hier steuerst du zwei Dinge:
|
||||
|
||||
- ob und wohin Ripster PushOver-Nachrichten sendet
|
||||
- bei welchen Ereignissen Ripster überhaupt benachrichtigt
|
||||
|
||||
Wichtig:
|
||||
|
||||
- `PushOver aktiviert` ist der Master-Schalter
|
||||
- `Bei manueller Auswahl senden` ist besonders relevant für Playlist-, RAW- oder Titelentscheidungen
|
||||
- der `Expertenmodus` blendet zusätzliche technische Felder in der gesamten Settings-Seite ein
|
||||
|
||||
#### Laufwerk
|
||||
|
||||
Diese Kategorie beeinflusst, wie Ripster optische Laufwerke findet und überwacht.
|
||||
|
||||
Typische Fragen:
|
||||
|
||||
- Soll Ripster Laufwerke automatisch erkennen?
|
||||
- Soll ein bestimmtes Laufwerk fest an einen MakeMKV-Index gebunden werden?
|
||||
- Soll das Laufwerk nach erfolgreichem Rip automatisch auswerfen?
|
||||
|
||||
Das ist vor allem wichtig bei:
|
||||
|
||||
- mehreren Laufwerken
|
||||
- USB-SATA-Adaptern
|
||||
- Hosts mit instabilen Device-Namen
|
||||
|
||||
#### Logging
|
||||
|
||||
Diese Felder ändern nicht die Job-Logs auf Platte, sondern die Ausgabe im Server-Terminal.
|
||||
|
||||
Damit steuerst du zum Beispiel:
|
||||
|
||||
- ob `start.sh` oder ein Terminal-Run sehr gesprächig sein darf
|
||||
- ob HTTP-Requests im Terminal sichtbar sein sollen
|
||||
- ob DEBUG/INFO/WARN/ERROR dort mitlaufen
|
||||
|
||||
#### Metadaten
|
||||
|
||||
Hier legst du fest, wie Ripster mit TMDb, Covern und NFO-Dateien umgeht.
|
||||
|
||||
Besonders wichtig:
|
||||
|
||||
- ohne `TMDb Read Access Token` funktionieren Film-/Seriensuche und Neu-Zuordnung nur eingeschränkt oder gar nicht
|
||||
- `Film-Sprache` und `Fallback Sprache` bestimmen, welche Titel, Beschreibungen und Staffelinformationen bevorzugt werden
|
||||
- `Coverart-Nachladen aktiv` hilft bei nachträglich fehlenden Postern/Covern
|
||||
|
||||
#### Monitoring
|
||||
|
||||
Steuert das Hardware-Monitoring für:
|
||||
|
||||
- CPU
|
||||
- RAM
|
||||
- GPU
|
||||
- Speicherstände
|
||||
|
||||
Diese Werte erscheinen:
|
||||
|
||||
- kompakt im `Ripper`
|
||||
- ausführlich in der Seite `Hardware`
|
||||
|
||||
#### Pfade
|
||||
|
||||
Hier legst du fest, wohin Ripster schreibt und wie Dateien benannt werden.
|
||||
|
||||
Die Felder steuern:
|
||||
|
||||
- RAW-Verzeichnisse pro Medium
|
||||
- Zielordner für Filme, Serien, CDs, Audiobooks, Converter und Downloads
|
||||
- Eigentümer per `user:gruppe`
|
||||
- Templates für Datei- und Ordnernamen
|
||||
|
||||
Praxisbeispiele:
|
||||
|
||||
- Serien getrennt von Filmen ablegen
|
||||
- RAW auf große HDD, Final-Output auf NAS
|
||||
- Audiobooks kapitelweise in Unterordnern strukturieren
|
||||
|
||||
#### Converter
|
||||
|
||||
Diese Kategorie wirkt nur auf die Seite `Converter`.
|
||||
|
||||
Sie steuert:
|
||||
|
||||
- welche Dateiendungen der Upload und der Verzeichnisscan akzeptieren
|
||||
- ob der Converter-RAW-Baum automatisch neu gescannt wird
|
||||
- wie häufig dieses Polling läuft
|
||||
|
||||
#### Tools
|
||||
|
||||
Diese Kategorie entscheidet über das technische Verhalten der eigentlichen Pipeline.
|
||||
|
||||
Dazu gehören:
|
||||
|
||||
- Pfade/Befehle für externe Tools
|
||||
- MakeMKV-Filter und Rip-Modi
|
||||
- HandBrake-Presets und Extra-Args
|
||||
- Vorauswahl von Audio-/Untertitelsprachen in der Review
|
||||
- Ausgabeformate
|
||||
- Queue- und Parallelitätsregeln
|
||||
- Timeout für Script-Tests
|
||||
|
||||
Für die Nutzer-Workflows besonders relevant:
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
- `HandBrake Preset` und `HandBrake Extra Args`
|
||||
- `Review Audio-Sprachen (...)`
|
||||
- `Review UT-Sprachen (...)`
|
||||
- `Parallele Jobs`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
|
||||
### Kategorie `Pfade`: Besondere Interaktion
|
||||
|
||||
Die Pfad-Kategorie hat eine eigene Darstellung:
|
||||
|
||||
- Tabelle `Effektive Pfade`: zeigt die aktuell wirklich verwendeten Laufzeitpfade inklusive Fallbacks
|
||||
- Accordion pro Bereich wie `Blu-ray`, `DVD`, `CD / Audio`, `Audiobook`, `Converter`, `Downloads`, `Logs`
|
||||
- Owner-Felder (`*_owner`) erscheinen direkt beim zugehörigen Pfad
|
||||
- Owner-Felder sind deaktiviert, solange der zugehörige Pfad leer ist
|
||||
|
||||
### Spezial-Editoren
|
||||
|
||||
- `Explizite Laufwerke`: Editor für mehrere Laufwerke mit Pfad und MakeMKV-Index
|
||||
- `Externe Speicher`: Liste aus Anzeigename und Pfad für die Speicheranzeige
|
||||
- `Erlaubte Datei-Endungen`: Auswahl der erlaubten Upload-/Scan-Endungen
|
||||
- `MakeMKV Key`: inkl. Betakey-Hinweis und Übernahme-Button
|
||||
|
||||
### Wichtig für Reviews und Workflows
|
||||
|
||||
Die Seite `Settings` bestimmt direkt, was Nutzer später im Workflow sehen:
|
||||
|
||||
- Playlist-Kandidaten werden durch `Minimale Titellänge` und `TMDb Runtime-Abzug ...` beeinflusst
|
||||
- Audio-/Untertitel-Vorauswahlen in `Bereit zum Encodieren` hängen an den Review-Sprachfeldern
|
||||
- automatisch vorgeschlagene Presets hängen an den Standard-Zuordnungen unter `Encode-Presets`
|
||||
- Queue-Verhalten im `Ripper` hängt an den drei Parallelitätsfeldern plus `Audio CDs: Queue-Reihenfolge überspringen`
|
||||
- `PushOver Test` sendet eine Testnachricht
|
||||
- Änderungen werden erst nach Speichern wirksam
|
||||
- Tool-Preset-Felder bieten HandBrake-Presetauswahl direkt im Formular
|
||||
|
||||
## Tab `Scripte`
|
||||
|
||||
Funktionen:
|
||||
|
||||
- Skript anlegen
|
||||
- Skript bearbeiten
|
||||
- Skript löschen
|
||||
- Skript testen
|
||||
- Reihenfolge per Drag-and-Drop ändern
|
||||
- Favorit markieren
|
||||
- Skript anlegen, bearbeiten, löschen
|
||||
- Skript testen (`Test`)
|
||||
- Reihenfolge per Drag-and-Drop
|
||||
|
||||
Das Testergebnis zeigt:
|
||||
Praxis:
|
||||
|
||||
- Erfolg oder Fehler
|
||||
- Exit-Code
|
||||
- Dauer
|
||||
- stdout/stderr
|
||||
- Timeout, falls `Script-Test Timeout (ms)` greift
|
||||
- Reihenfolge ist wichtig, weil ausgewählte Skripte später sequentiell abgearbeitet werden.
|
||||
- Testresultate zeigen Exit-Code, Dauer und stdout/stderr.
|
||||
|
||||
## Tab `Skriptketten`
|
||||
|
||||
Skriptketten bestehen aus Schritten:
|
||||
|
||||
- `Skript`
|
||||
- `Warten (Sekunden)`
|
||||
|
||||
Funktionen:
|
||||
|
||||
- Ketten anlegen, bearbeiten, löschen
|
||||
- Reihenfolge der Ketten ändern
|
||||
- einzelne Ketten testen
|
||||
- Schritte innerhalb der Kette per Drag-and-Drop sortieren
|
||||
- Kette anlegen/bearbeiten/löschen
|
||||
- Kette testen
|
||||
- Reihenfolge der Ketten per Drag-and-Drop
|
||||
|
||||
Wichtig:
|
||||
Im Ketten-Editor:
|
||||
|
||||
- dieselben Skripte können sowohl in Jobs als auch in Ketten und Cronjobs wiederverwendet werden
|
||||
- Bausteine links (`Warten`, vorhandene Skripte)
|
||||
- Schritte rechts per Klick oder Drag-and-Drop hinzufügen
|
||||
- Schrittreihenfolge im Canvas ändern
|
||||
|
||||
## Tab `Encode-Presets`
|
||||
|
||||
Hier werden Video-Standards für Disc- und Converter-Workflows verwaltet.
|
||||
Ein Preset bündelt:
|
||||
|
||||
### Standard-Zuordnungen
|
||||
- optional HandBrake-Preset (`-Z`)
|
||||
- optionale Extra-Args
|
||||
- Medientyp (`Universell`, `Blu-ray`, `DVD`, `Sonstiges`)
|
||||
|
||||
Es gibt vier feste Slots:
|
||||
Verwendung:
|
||||
|
||||
- `Blu-ray Film`
|
||||
- `Blu-ray Serie`
|
||||
- `DVD Film`
|
||||
- `DVD Serie`
|
||||
|
||||
Wenn für einen Workflow hier ein Default gesetzt ist, erscheint dieses User-Preset später in der Review bereits vorausgewählt.
|
||||
|
||||
### Preset-Inhalt
|
||||
|
||||
Ein User-Preset besteht aus:
|
||||
|
||||
- Name
|
||||
- Medientyp (`all`, `bluray`, `dvd`)
|
||||
- HandBrake-Preset
|
||||
- Extra Args
|
||||
- optionaler Beschreibung
|
||||
- Diese Presets erscheinen später im Ripper im Review (`Bereit zum Encodieren`).
|
||||
|
||||
## Tab `Cronjobs`
|
||||
|
||||
Funktionen:
|
||||
|
||||
- Cronjob anlegen, bearbeiten, löschen
|
||||
- Cron-Ausdruck live validieren
|
||||
- Quelle wählen: `Skript` oder `Skriptkette`
|
||||
- Aktiv- und PushOver-Status pro Job setzen
|
||||
- Cronjob anlegen und bearbeiten
|
||||
- Quelle wählen: Skript oder Skriptkette
|
||||
- Cron-Ausdruck validieren
|
||||
- `Jetzt ausführen`
|
||||
- Lauf-Logs öffnen
|
||||
- Logs je Cronjob anzeigen
|
||||
- `Aktiviert` und `Pushover` toggeln
|
||||
|
||||
Die Runtime-Aktivitäten der laufenden Cronjobs werden zusätzlich live angezeigt.
|
||||
Hilfen:
|
||||
|
||||
## Expertenbereich: Activation Bytes Cache
|
||||
- Beispiele für Cron-Ausdrücke direkt im Dialog
|
||||
- Link zu `crontab.guru` im Editor
|
||||
|
||||
Dieser Block wird nur im Expertenmodus angezeigt.
|
||||
---
|
||||
|
||||
Er zeigt lokal bekannte AAX-Activation-Bytes mit:
|
||||
## Empfehlung für stabile Nutzung
|
||||
|
||||
- Prüfsumme
|
||||
- Activation Bytes
|
||||
- Speicherzeitpunkt
|
||||
|
||||
Das hilft bei Audiobook-Workflows, wenn dieselbe Datei oder derselbe Hash später erneut auftaucht.
|
||||
|
||||
## Validierung von Template-Feldern
|
||||
|
||||
Template-Felder akzeptieren nur:
|
||||
|
||||
- Buchstaben und Ziffern
|
||||
- Leerzeichen
|
||||
- `_` und `-`
|
||||
- Platzhalter in `{...}` oder `${...}`
|
||||
- `/` für Unterordner
|
||||
|
||||
Damit verhindert Ripster fehlerhafte Dateinamen schon beim Speichern.
|
||||
|
||||
## Siehe auch
|
||||
|
||||
- [Alle Einstellungen](../configuration/settings-reference.md)
|
||||
- [Ripper](ripper.md)
|
||||
- [Workflows aus Nutzersicht](../workflows/index.md)
|
||||
1. Erst `Konfiguration` sauber setzen
|
||||
2. dann Skripte/Ketten testen
|
||||
3. danach Cronjobs aktivieren
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
# TMDb Migration
|
||||
|
||||
Die Seite `TMDb Migration` ist eine Sonderansicht für ältere Bestandsjobs, die noch nicht als auf TMDb migriert markiert sind.
|
||||
|
||||
## Zugriff
|
||||
|
||||
- Direktlink: `/tmdb-migration`
|
||||
- nicht in der normalen Top-Navigation verlinkt
|
||||
|
||||
## Wofür die Seite gedacht ist
|
||||
|
||||
Typische Einsatzfälle:
|
||||
|
||||
- Altbestand aus früheren Ständen bereinigen
|
||||
- mehrere Jobs nacheinander auf aktuelle TMDb-Metadaten umstellen
|
||||
- Historie konsistent auf den heutigen Metadaten-Workflow bringen
|
||||
|
||||
## Funktionsweise
|
||||
|
||||
Die Seite lädt offene Migrationskandidaten und zeigt:
|
||||
|
||||
- Job-ID
|
||||
- Titel
|
||||
- Jahr
|
||||
- Medium
|
||||
- aktuellen Status
|
||||
|
||||
Aktionen:
|
||||
|
||||
- `Liste neu laden`
|
||||
- `Start`
|
||||
- `Stop`
|
||||
|
||||
## Ablauf einer Sequenz
|
||||
|
||||
1. Jobliste laden
|
||||
2. `Start`
|
||||
3. der bekannte TMDb-Metadaten-Dialog öffnet sich für den ersten Job
|
||||
4. nach erfolgreicher Übernahme plant Ripster den nächsten Job mit Cooldown
|
||||
|
||||
Wichtig:
|
||||
|
||||
- zwischen zwei Jobs liegt bewusst eine Wartezeit von mindestens 10 Sekunden
|
||||
- damit wird die TMDb-API bei Serienmigrationen nicht unnötig belastet
|
||||
|
||||
## Relevante Settings
|
||||
|
||||
- `TMDb Read Access Token`
|
||||
- `Film-Sprache`
|
||||
- `Fallback Sprache`
|
||||
|
||||
Ohne diese Einstellungen ist die Migration nicht sinnvoll nutzbar.
|
||||
+21
-12
@@ -1,24 +1,33 @@
|
||||
# Ripster Handbuch
|
||||
|
||||
Diese Dokumentation ist als vollständiges Benutzerhandbuch aufgebaut: tägliche Bedienung zuerst, technische Referenz danach.
|
||||
Dieses Dokumentationsset ist als **Benutzerhandbuch** aufgebaut: erst Bedienung und Alltag, dann Technik im Anhang.
|
||||
|
||||
## Einstieg in 3 Schritten
|
||||
---
|
||||
|
||||
1. Installation: [Installation](getting-started/installation.md)
|
||||
2. Betriebskonfiguration: [Ersteinrichtung](getting-started/configuration.md)
|
||||
3. erster End-to-End-Lauf: [Erster Lauf](getting-started/quickstart.md)
|
||||
## Schnellstart in 3 Schritten
|
||||
|
||||
## Was das Handbuch abdeckt
|
||||
1. Voraussetzungen prüfen und installieren: [Installation](getting-started/installation.md)
|
||||
2. Grundkonfiguration in der UI setzen: [Ersteinrichtung](getting-started/configuration.md)
|
||||
3. Ersten vollständigen Job durchlaufen: [Erster Lauf](getting-started/quickstart.md)
|
||||
|
||||
- alle GUI-Seiten mit Aktionen und Wirkung
|
||||
- vollständige Workflows für Film, Serie und Multipart
|
||||
- Queue-, Job-, Container- und Recovery-Verhalten
|
||||
- detaillierte Settings-Wirkung inklusive Fallbacks
|
||||
---
|
||||
|
||||
## Was du hier findest
|
||||
|
||||
- **Benutzerhandbuch**
|
||||
- Installation
|
||||
- GUI-Seiten im Detail (`Ripper`, `Settings`, `Historie`, `Database`)
|
||||
- typische Arbeitsabläufe aus Anwendersicht
|
||||
- **Technischer Anhang**
|
||||
- vollständige Einstellungsreferenz
|
||||
- Pipeline-/API-/Architekturdetails
|
||||
- Deployment und Tool-Hintergründe
|
||||
|
||||
---
|
||||
|
||||
## Empfohlene Lesereihenfolge
|
||||
|
||||
1. [Benutzerhandbuch Überblick](getting-started/index.md)
|
||||
2. [GUI-Seiten](gui/index.md)
|
||||
3. [Workflows aus Nutzersicht](workflows/index.md)
|
||||
4. [Einstellungsreferenz](configuration/settings-reference.md)
|
||||
5. bei Bedarf technischer Tiefgang im [Anhang](appendix/index.md)
|
||||
4. Bei Bedarf: [Technischer Anhang](appendix/index.md)
|
||||
|
||||
@@ -44,8 +44,7 @@ Dann muss eine Playlist bestätigt werden, bevor der Workflow weiterläuft.
|
||||
|
||||
| Feld in `Settings` | Wirkung |
|
||||
|---|---|
|
||||
| `Minimale Titellänge (Minuten)` | Mindestlaufzeit für Kandidaten aus MakeMKV/Playlist-Analyse |
|
||||
| `TMDb Runtime-Abzug für Playlistfilter (%)` | lockert bei Bedarf die untere Laufzeitgrenze relativ zur TMDb-Laufzeit, damit leicht kürzere Hauptfassungen Kandidaten bleiben |
|
||||
| `Minimale Titellaenge (Minuten)` | Mindestlaufzeit für Kandidaten |
|
||||
|
||||
Default ist aktuell `60` Minuten.
|
||||
|
||||
@@ -53,14 +52,7 @@ Default ist aktuell `60` Minuten.
|
||||
|
||||
## UI-Verhalten
|
||||
|
||||
Bei manueller Entscheidung zeigt der `Ripper` Kandidaten mit:
|
||||
|
||||
- Playlist-Datei
|
||||
- Titel-ID
|
||||
- Laufzeit
|
||||
- Score
|
||||
- Empfehlung
|
||||
- Segment- und Audio-Vorschau
|
||||
Bei manueller Entscheidung zeigt das Ripper Kandidaten inkl. Score/Bewertung und markiert eine Empfehlung.
|
||||
|
||||
Nach Bestätigung:
|
||||
|
||||
|
||||
@@ -35,17 +35,11 @@ flowchart LR
|
||||
| `Analyse` | MakeMKV-Analyse läuft |
|
||||
| `Metadatenauswahl` | Metadaten müssen bestätigt werden |
|
||||
| `Warte auf Auswahl` | Playlist-Auswahl ist erforderlich |
|
||||
| `Warte auf Auswahl` | auch für RAW-Entscheidung bei vorhandenen Quelldaten genutzt |
|
||||
| `Startbereit` | kurzer Übergang vor Start |
|
||||
| `Rippen` | MakeMKV-Rip läuft |
|
||||
| `Mediainfo-Pruefung` | Titel/Spuren werden ausgewertet |
|
||||
| `Bereit zum Encodieren` | Review ist bereit |
|
||||
| `Encodieren` | HandBrake läuft |
|
||||
| `CD-Metadatenauswahl` | CD-Metadaten müssen bestätigt werden |
|
||||
| `CD-Startbereit` | CD-Job wartet auf Start |
|
||||
| `CD-Analyse` | CD-Track-/Strukturaufbereitung |
|
||||
| `CD-Rippen` | Audio-CD-Rip läuft |
|
||||
| `CD-Encodieren` | CD-Encode läuft |
|
||||
| `Fertig` | erfolgreich abgeschlossen |
|
||||
| `Abgebrochen` | manuell oder technisch abgebrochen |
|
||||
| `Fehler` | fehlgeschlagen |
|
||||
@@ -72,14 +66,6 @@ flowchart LR
|
||||
|
||||
`Mediainfo-Pruefung` -> `Warte auf Auswahl` bis Playlist bestätigt wurde.
|
||||
|
||||
### Vorhandenes RAW mit Nutzerentscheidung
|
||||
|
||||
`Metadatenauswahl` -> `Warte auf Auswahl` bis Entscheidung für Weiterverarbeitung (`continue`) oder Neustart getroffen wurde.
|
||||
|
||||
### CD-Flow
|
||||
|
||||
`CD-Metadatenauswahl` -> `CD-Startbereit` -> `CD-Rippen` -> `CD-Encodieren` -> `Fertig`
|
||||
|
||||
---
|
||||
|
||||
## Queue-Verhalten
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# HandBrake
|
||||
|
||||
Ripster verwendet `HandBrakeCLI` für Scan und Encode. Die mitgelieferte Datei
|
||||
`bin/HandBrakeCLI` ist ein separat ausführbares Drittanbieterprogramm und steht
|
||||
unter `GPL-2.0-only`; die Ripster-Lizenz ersetzt diese Lizenz nicht.
|
||||
Ripster verwendet `HandBrakeCLI` für Scan und Encode.
|
||||
|
||||
---
|
||||
|
||||
@@ -68,7 +66,4 @@ Ripster parst HandBrake-Stderr (Prozent/ETA/Detail) und sendet WebSocket-Progres
|
||||
- Preset nicht gefunden: Preset-Namen mit `HandBrakeCLI -z` prüfen
|
||||
- sehr langsames Encoding: Preset/Extra-Args prüfen (z. B. `--encoder-preset`)
|
||||
|
||||
Das Produktions-Installer-Script `install.sh` bietet eine Option zur Installation
|
||||
des gebündelten HandBrakeCLI-Binaries. Buildinformationen, Prüfsummen,
|
||||
Lizenzhinweise und der Status des korrespondierenden Quellcodes liegen unter
|
||||
`third_party/handbrake/`.
|
||||
Das Produktions-Installer-Script `install.sh` bietet eine Option zur Installation eines gebündelten HandBrakeCLI-Binaries mit NVDEC-Unterstützung (NVIDIA GPU-Dekodierung). Diese Option erscheint interaktiv während der Installation.
|
||||
|
||||
+2
-14
@@ -34,24 +34,12 @@ makemkvcon backup <source> <rawDir> --decrypt
|
||||
|
||||
## Registrierungsschlüssel (optional)
|
||||
|
||||
MakeMKV unterliegt eigenen Lizenz- und Registrierungsbedingungen. Ripster
|
||||
lizenziert MakeMKV nicht um und darf diese Bedingungen nicht automatisch für den
|
||||
Benutzer akzeptieren.
|
||||
|
||||
Wenn in `Settings` ein `MakeMKV Key` gesetzt ist, synchronisiert Ripster ihn nach:
|
||||
Wenn in `Settings` ein `MakeMKV Key` gesetzt ist, führt Ripster vor Analyse/Rip aus:
|
||||
|
||||
```bash
|
||||
~/.MakeMKV/settings.conf
|
||||
makemkvcon reg <key>
|
||||
```
|
||||
|
||||
Format:
|
||||
|
||||
```ini
|
||||
app_Key = "product-key"
|
||||
```
|
||||
|
||||
Zusätzlich zeigt die UI unterhalb des Feldes den aktuellen Betakey an, der per Button in das Eingabefeld übernommen werden kann.
|
||||
|
||||
---
|
||||
|
||||
## Relevante Felder in `Settings`
|
||||
|
||||
+40
-345
@@ -1,366 +1,61 @@
|
||||
# Workflows aus Nutzersicht
|
||||
|
||||
Diese Seite beschreibt die produktiven Abläufe aus Sicht der Benutzer: welche Entscheidung wann anfällt, welche Jobs oder Container entstehen und welche Settings den Ablauf sichtbar beeinflussen.
|
||||
Diese Seite beschreibt typische Abläufe mit den passenden UI-Aktionen.
|
||||
|
||||
## Gemeinsame Grundlagen
|
||||
## Workflow 1: Standardlauf (Disc -> fertige Datei)
|
||||
|
||||
### Typische Statuskette
|
||||
1. `Ripper`: Disc einlegen, `Analyse starten`
|
||||
2. Metadaten im Dialog übernehmen
|
||||
3. bei `Bereit zum Encodieren` Titel/Tracks prüfen
|
||||
4. `Encoding starten`
|
||||
5. Ergebnis in `Historie` kontrollieren
|
||||
|
||||
`Medium erkannt` -> `Analyse` -> `Metadatenauswahl` -> `Startbereit` -> `Rippen` -> `Mediainfo-Prüfung` -> `Bereit zum Encodieren` -> `Encodieren` -> `Fertig`
|
||||
## Workflow 2: Playlist-Entscheidung bei Blu-ray
|
||||
|
||||
Wichtige Abweichungen:
|
||||
1. Job landet in `Warte auf Auswahl`
|
||||
2. im `Pipeline-Status` Playlist-Kandidaten vergleichen
|
||||
3. gewünschte Playlist auswählen
|
||||
4. `Playlist übernehmen`
|
||||
5. danach normal weiter bis `Bereit zum Encodieren`
|
||||
|
||||
- bei vorhandenem RAW: Sprung direkt in RAW-Entscheidung oder Review
|
||||
- bei mehrdeutigen Blu-rays/DVDs: `Warte auf Auswahl` für Playlist- oder Titelauswahl
|
||||
- bei Fehler oder Abbruch: `Fehler` oder `Abgebrochen` mit Folgeaktionen
|
||||
- bei Audio-CDs und Audiobooks: eigener Spezialflow innerhalb derselben Gesamtpipeline
|
||||
## Workflow 3: Mehrere Jobs mit Queue
|
||||
|
||||
### Welche Settings fast überall hineinspielen
|
||||
1. Parallel-Limit in `Settings` über `Parallele Jobs` setzen
|
||||
2. neue Jobs starten; überschüssige Starts gehen in `Job Queue`
|
||||
3. Reihenfolge per Drag-and-Drop anpassen
|
||||
4. bei Bedarf Skript/Kette/Warten als Queue-Eintrag ergänzen
|
||||
|
||||
Die wichtigsten globalen Einflussfaktoren:
|
||||
## Workflow 4: Nachbearbeitung eines bestehenden Jobs
|
||||
|
||||
- `Parallele Jobs`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Max. Encodes gesamt (medienunabhängig)`
|
||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
||||
- `PushOver`-Ereignisse
|
||||
- Pfade, Templates und Owner-Felder
|
||||
In `Historie` -> Detaildialog:
|
||||
|
||||
Für Disc-Video zusätzlich:
|
||||
- Metadaten korrigieren: `OMDb neu zuordnen`
|
||||
- gleiche Einstellungen erneut nutzen: `Encode neu starten`
|
||||
- Analyse neu aufbauen: `Review neu starten`
|
||||
- aus RAW erneut encodieren: `RAW neu encodieren`
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
- `HandBrake Preset`
|
||||
- `HandBrake Extra Args`
|
||||
- `Review Audio-Sprachen (...)`
|
||||
- `Review UT-Sprachen (...)`
|
||||
- Standard-Zuordnungen aus `Settings -> Encode-Presets`
|
||||
## Workflow 5: Automatisierung mit Skripten und Cron
|
||||
|
||||
## Workflow A: Film von Disc (Blu-ray / DVD)
|
||||
1. `Settings` -> `Scripte`: Skripte anlegen und testen
|
||||
2. `Settings` -> `Skriptketten`: Ketten bauen und testen
|
||||
3. im Ripper-Review Pre-/Post-Ausführungen pro Job auswählen
|
||||
4. `Settings` -> `Cronjobs`: zeitgesteuerte Ausführung konfigurieren
|
||||
5. Status im Ripper (`Skript- / Cron-Status`) überwachen
|
||||
|
||||
### 1. Disc analysieren und TMDb-Metadaten wählen
|
||||
## Workflow 6: Abbruch und Recovery
|
||||
|
||||
1. Im `Ripper` `Analyse starten`
|
||||
2. im Metadaten-Dialog Film auswählen
|
||||
3. `Auswahl übernehmen`
|
||||
### Fall A: Job wurde abgebrochen
|
||||
|
||||
Wirkung:
|
||||
- im Ripper optional erzeugte RAW/Movie-Datei bereinigen
|
||||
- anschließend je nach Ziel: `Retry Rippen` oder `Disk-Analyse neu starten`
|
||||
|
||||
- der Job wird als Film-Workflow geführt
|
||||
- Film-Metadaten, Poster und Fingerprint werden gesetzt
|
||||
### Fall B: Job steht in `Bereit zum Encodieren`, ist aber nicht aktive Session
|
||||
|
||||
Relevante Settings:
|
||||
- in `Historie`: `Im Ripper öffnen`
|
||||
- im Ripper Review erneut prüfen und starten
|
||||
|
||||
- `TMDb Read Access Token`
|
||||
- `Film-Sprache`
|
||||
- `Fallback Sprache`
|
||||
### Fall C: RAW ohne Historieneintrag
|
||||
|
||||
### 2. Duplikatfall entscheiden
|
||||
|
||||
Wenn ein Film mit gleichem Fingerprint bereits existiert:
|
||||
|
||||
1. `Übernahme erzwingen`: neuer unabhängiger Film-Job
|
||||
2. `Multipart movie`: neuer Job wird mit bestehendem Film zu einem Multipart-Container verknüpft
|
||||
|
||||
Bei Multipart gilt:
|
||||
|
||||
- beide Discs brauchen unterschiedliche Disc-Nummern
|
||||
- gleiche Disc-Nummern blockieren den Vorgang
|
||||
|
||||
### 3. RAW-Verzeichnis und RAW-Entscheidung
|
||||
|
||||
Wenn noch kein passendes RAW vorhanden ist:
|
||||
|
||||
- Ripster legt ein neues RAW-Verzeichnis an
|
||||
|
||||
Wenn bereits ein passendes RAW gefunden wird:
|
||||
|
||||
- der Job geht in `Warte auf Auswahl`
|
||||
- du entscheidest, ob das vorhandene RAW weiterverwendet oder neu gerippt wird
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Raw Ausgabeordner (Blu-ray)` und `Raw Ausgabeordner (DVD)`
|
||||
- `Eigentümer Raw-Ordner (Blu-ray)` und `Eigentümer Raw-Ordner (DVD)`
|
||||
|
||||
### 4. Playlist- oder Titelauswahl
|
||||
|
||||
Bei bestimmten Discs ist nach der Metadatenphase eine manuelle Auswahl nötig:
|
||||
|
||||
- Playlist-Auswahl
|
||||
- HandBrake-Titelauswahl
|
||||
- bei Serien-Grenzfällen PlayAll- oder Doppelfolgen-Entscheidung
|
||||
|
||||
Das ist der aktuelle `playlistflow`.
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Minimale Titellänge (Minuten)`
|
||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
||||
- `Bei manueller Auswahl senden`
|
||||
|
||||
Praxis:
|
||||
|
||||
- zu hoher Mindestwert blendet legitime Alternativfassungen aus
|
||||
- ein kleiner Runtime-Abzug hilft bei Discs, deren Hauptfilm minimal unter der TMDb-Laufzeit liegt
|
||||
|
||||
### 5. Review und Encode
|
||||
|
||||
Im Zustand `Bereit zum Encodieren` entscheidest du:
|
||||
|
||||
- welcher Titel encodiert wird
|
||||
- welche Audio-Spuren übernommen werden
|
||||
- welche Untertitel übernommen, erzwungen oder eingebrannt werden
|
||||
- welches Preset gilt
|
||||
- welche Pre-/Post-Encode-Skripte oder Ketten mitlaufen
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `HandBrake Preset`
|
||||
- `HandBrake Extra Args`
|
||||
- `Review Audio-Sprachen (Blu-ray Film)` oder `Review Audio-Sprachen (DVD Film)`
|
||||
- `Review UT-Sprachen (Blu-ray Film)` oder `Review UT-Sprachen (DVD Film)`
|
||||
- `Ausgabeformat`
|
||||
- Standard-Userpreset für Film unter `Settings -> Encode-Presets`
|
||||
|
||||
### 6. Finale Ausgabe
|
||||
|
||||
Finale Ausgabe:
|
||||
|
||||
- Zielordner: `Film Ausgabeordner (Blu-ray)` oder `Film Ausgabeordner (DVD)`
|
||||
- Dateiname und Ordner: `Output Template (Blu-ray)` oder `Output Template (DVD)`
|
||||
|
||||
Optional:
|
||||
|
||||
- `.nfo` direkt nach Encode
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Film Ausgabeordner (Blu-ray)` und `Film Ausgabeordner (DVD)`
|
||||
- `Eigentümer Film-Ordner (Blu-ray)` und `Eigentümer Film-Ordner (DVD)`
|
||||
- `Output Template (Blu-ray)` und `Output Template (DVD)`
|
||||
- `NFO nach Encode erzeugen`
|
||||
|
||||
## Workflow B: Serie von Disc (Blu-ray / DVD)
|
||||
|
||||
### 1. Serienmodus festlegen
|
||||
|
||||
1. Disc analysieren
|
||||
2. im Metadaten-Dialog Serienmetadaten wählen
|
||||
3. `Disc-Nummer` setzen
|
||||
|
||||
Wirkung:
|
||||
|
||||
- Ripster arbeitet als Serien-Workflow
|
||||
- Seriencontainer wird gesucht oder angelegt
|
||||
- der Job wird als Child unter diesem Container geführt
|
||||
|
||||
### 2. Serien-RAW und Staffelkontext
|
||||
|
||||
Für Serien bevorzugt Ripster eigene Serien-RAW-Verzeichnisse:
|
||||
|
||||
- `RAW-Ordner (Blu-ray Serie)`
|
||||
- `RAW-Ordner (DVD Serie)`
|
||||
|
||||
Falls leer:
|
||||
|
||||
- Fallback auf `Raw Ausgabeordner (Blu-ray)` bzw. `Raw Ausgabeordner (DVD)`
|
||||
|
||||
### 3. Episodenprüfung und Multi-Episode-Fälle
|
||||
|
||||
In der Review werden Episoden oder Mehrfachfolgen aufgelöst.
|
||||
|
||||
Ausgabevarianten:
|
||||
|
||||
- Einzel-Episode
|
||||
- Multi-Episode-Datei
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Output Template (Blu-ray Serie, Episode)`
|
||||
- `Output Template (Blu-ray Serie, Multi-Episode)`
|
||||
- `Output Template (DVD Serie, Episode)`
|
||||
- `Output Template (DVD Serie, Multi-Episode)`
|
||||
- `Serien-Ordner (Blu-ray)`
|
||||
- `Serien-Ordner (DVD)`
|
||||
|
||||
### 4. Playlistflow auch bei Serien
|
||||
|
||||
Auch Serien können vor der Review in eine Playlist- oder Titelauswahl laufen.
|
||||
|
||||
Zusätzlich wirken:
|
||||
|
||||
- `Review Audio-Sprachen (Blu-ray Serie)` / `Review Audio-Sprachen (DVD Serie)`
|
||||
- `Review UT-Sprachen (Blu-ray Serie)` / `Review UT-Sprachen (DVD Serie)`
|
||||
- Serien-Default-Presets unter `Settings -> Encode-Presets`
|
||||
|
||||
## Workflow C: Multipart-Film
|
||||
|
||||
### Wann der Flow gedacht ist
|
||||
|
||||
- gleicher Film auf mehreren Discs
|
||||
- die Discs sollen in Historie und Detailansichten zusammengehören
|
||||
|
||||
### Ablauf
|
||||
|
||||
1. Film-Metadaten wählen
|
||||
2. Duplikatdialog `Multipart movie`
|
||||
3. Disc-Nummern für bestehenden und neuen Job festlegen
|
||||
|
||||
Wirkung:
|
||||
|
||||
- `multipart_movie_container` wird angelegt oder wiederverwendet
|
||||
- die Discs werden als Child-Jobs darunter geführt
|
||||
- zusätzlich wird ein Merge-Job vorbereitet
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `mkvmerge_command`
|
||||
- Film-Output-Templates
|
||||
- Queue-Limits, falls mehrere Discs parallel weiterverarbeitet werden
|
||||
|
||||
## Workflow D: Audio-CD
|
||||
|
||||
### 1. TOC lesen und Metadaten wählen
|
||||
|
||||
1. Audio-CD analysieren
|
||||
2. Tracks prüfen
|
||||
3. Metadaten aus MusicBrainz übernehmen oder manuell anpassen
|
||||
|
||||
### 2. Trackauswahl und Format
|
||||
|
||||
Vor dem Start legst du fest:
|
||||
|
||||
- welche Tracks übernommen werden
|
||||
- welches Ausgabeformat gilt
|
||||
- welche Formatoptionen genutzt werden
|
||||
- welche Pre-/Post-Encode-Skripte oder Ketten mitlaufen
|
||||
|
||||
### 3. Rip und Encode
|
||||
|
||||
Die CD läuft anschließend als Track-für-Track-Flow:
|
||||
|
||||
`CD-Metadatenauswahl` -> `CD-Startbereit` -> `CD-Rippen` -> `CD-Encodieren` -> `Fertig`
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `CD RAW-Ordner`
|
||||
- `CD Output-Ordner`
|
||||
- `Eigentümer CD RAW-Ordner`
|
||||
- `Eigentümer CD Output-Ordner`
|
||||
- `CD Output Template`
|
||||
- `cdparanoia Kommando`
|
||||
- `Max. parallele Audio CD Jobs`
|
||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
||||
|
||||
## Workflow E: Converter
|
||||
|
||||
### 1. Dateien bereitstellen
|
||||
|
||||
Dateien gelangen in den Converter über:
|
||||
|
||||
- Upload
|
||||
- bestehende Ordner im `Converter Raw-Ordner`
|
||||
- manuelle Dateiverwaltung im Explorer
|
||||
|
||||
### 2. Jobs aus Auswahl erzeugen
|
||||
|
||||
- Video und ISO: immer ein Job pro Datei
|
||||
- Audio: ein Job pro Datei oder gemeinsamer Audio-Job
|
||||
|
||||
### 3. Job konfigurieren und starten
|
||||
|
||||
Je nach Medium:
|
||||
|
||||
- Video/ISO: Review mit Track- und Preset-Auswahl
|
||||
- Audio: direkte Format- und Zielkonfiguration
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Erlaubte Datei-Endungen`
|
||||
- `Auto-Scan (Polling)`
|
||||
- `Polling-Intervall (Sekunden)`
|
||||
- `Converter Raw-Ordner`
|
||||
- `Converter Ausgabe (Video)`
|
||||
- `Converter Ausgabe (Audio)`
|
||||
- `Output-Template (Video)`
|
||||
- `Output-Template (Audio)`
|
||||
- globale Queue-Limits
|
||||
|
||||
## Workflow F: Audiobooks
|
||||
|
||||
### 1. AAX hochladen
|
||||
|
||||
1. Datei hochladen
|
||||
2. Metadaten und Kapitel aufbauen lassen
|
||||
3. bei Bedarf Activation Bytes klären
|
||||
|
||||
### 2. Ausgabeformat wählen
|
||||
|
||||
- `m4b`: eine Datei
|
||||
- `mp3`: eine Datei pro Kapitel
|
||||
- `flac`: eine Datei pro Kapitel
|
||||
|
||||
### 3. Kapitel und Skripte prüfen
|
||||
|
||||
Vor dem Start anpassbar:
|
||||
|
||||
- Kapitelnamen
|
||||
- Pre-Encode-Skripte und -Ketten
|
||||
- Post-Encode-Skripte und -Ketten
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Audiobook RAW-Ordner`
|
||||
- `Audiobook Output-Ordner`
|
||||
- `Audiobook RAW Template`
|
||||
- `Output Template (Audiobook)`
|
||||
- `Kapitel Template (Audiobook)`
|
||||
- `FFprobe Kommando`
|
||||
- `FFmpeg Kommando`
|
||||
- globale Queue-Limits
|
||||
|
||||
## Workflow G: Nachbearbeitung in der Historie
|
||||
|
||||
Typische Folgeaktionen:
|
||||
|
||||
- `TMDb neu zuweisen`
|
||||
- `Review neu starten`
|
||||
- `RAW neu encodieren`
|
||||
- `Encode neu starten`
|
||||
- `Retry Rippen`
|
||||
- `Download` als ZIP einreihen
|
||||
|
||||
Besonders wichtig:
|
||||
|
||||
- `Encode neu starten` verwendet den letzten bestätigten Plan
|
||||
- `Encode-Neustart: unvollständige Ausgabe löschen` entscheidet, ob unvollständige Ausgaben vorher gelöscht werden
|
||||
|
||||
## Workflow H: Downloads und Recovery
|
||||
|
||||
### Downloads
|
||||
|
||||
Aus `Historie` können ZIPs für:
|
||||
|
||||
- `RAW`
|
||||
- `Output`
|
||||
|
||||
erstellt werden.
|
||||
|
||||
Relevante Settings:
|
||||
|
||||
- `Download ZIP-Ordner`
|
||||
- `Eigentümer Download ZIP-Ordner`
|
||||
|
||||
### Database (Expert)
|
||||
|
||||
Die Recovery-Seite hilft bei orphan RAW:
|
||||
|
||||
- `RAW prüfen`
|
||||
- `/database` öffnen
|
||||
- Bereich `Gefundene RAW-Einträge`
|
||||
- `Job anlegen`
|
||||
|
||||
So lassen sich vorhandene RAW-Verzeichnisse wieder in einen normalen Workflow zurückführen.
|
||||
|
||||
### TMDb Migration
|
||||
|
||||
Für ältere Bestandsjobs gibt es die Sonderseite `/tmdb-migration`, um mehrere Jobs nacheinander auf den heutigen TMDb-Stand zu bringen.
|
||||
|
||||
Generated
+2
-20
@@ -1,15 +1,13 @@
|
||||
{
|
||||
"name": "ripster-frontend",
|
||||
"version": "1.0.0-1",
|
||||
"version": "0.13.1-6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ripster-frontend",
|
||||
"version": "1.0.0-1",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"version": "0.13.1-6",
|
||||
"dependencies": {
|
||||
"chart.js": "^4.5.1",
|
||||
"primeicons": "^7.0.0",
|
||||
"primereact": "^10.9.2",
|
||||
"react": "^18.3.1",
|
||||
@@ -705,11 +703,6 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@kurkle/color": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
|
||||
"integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w=="
|
||||
},
|
||||
"node_modules/@remix-run/router": {
|
||||
"version": "1.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz",
|
||||
@@ -1198,17 +1191,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/chart.js": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz",
|
||||
"integrity": "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==",
|
||||
"dependencies": {
|
||||
"@kurkle/color": "^0.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"pnpm": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/convert-source-map": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||
|
||||
+1
-11
@@ -1,16 +1,7 @@
|
||||
{
|
||||
"name": "ripster-frontend",
|
||||
"version": "1.0.0-1",
|
||||
"version": "0.13.1-6",
|
||||
"private": true,
|
||||
"license": "GPL-2.0-or-later",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mboehmlaender/ripster.git"
|
||||
},
|
||||
"homepage": "https://mboehmlaender.github.io/ripster/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mboehmlaender/ripster/issues"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -18,7 +9,6 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"chart.js": "^4.5.1",
|
||||
"primeicons": "^7.0.0",
|
||||
"primereact": "^10.9.2",
|
||||
"react": "^18.3.1",
|
||||
|
||||
+154
-254
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Navigate, Outlet, Routes, Route, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Button } from 'primereact/button';
|
||||
import { ProgressBar } from 'primereact/progressbar';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { ConfirmDialog } from 'primereact/confirmdialog';
|
||||
import { api } from './api/client';
|
||||
@@ -13,9 +13,8 @@ import HistoryPage from './pages/HistoryPage';
|
||||
import DatabasePage from './pages/DatabasePage';
|
||||
import DownloadsPage from './pages/DownloadsPage';
|
||||
import ConverterPage from './pages/ConverterPage';
|
||||
import JobsInboxPage from './pages/JobsInboxPage';
|
||||
import AudiobooksPage from './pages/AudiobooksPage';
|
||||
import TmdbMigrationPage from './pages/TmdbMigrationPage';
|
||||
import HardwarePage from './pages/HardwarePage';
|
||||
|
||||
function normalizeJobId(value) {
|
||||
const parsed = Number(value);
|
||||
@@ -25,20 +24,6 @@ function normalizeJobId(value) {
|
||||
return Math.trunc(parsed);
|
||||
}
|
||||
|
||||
function extractUploadJobIdFromResponse(response) {
|
||||
const payload = response && typeof response === 'object' ? response : {};
|
||||
const result = payload?.result && typeof payload.result === 'object' ? payload.result : {};
|
||||
return (
|
||||
normalizeJobId(result?.jobId)
|
||||
|| normalizeJobId(payload?.jobId)
|
||||
|| normalizeJobId(result?.id)
|
||||
|| normalizeJobId(payload?.id)
|
||||
|| normalizeJobId(result?.job?.id)
|
||||
|| normalizeJobId(payload?.job?.id)
|
||||
|| null
|
||||
);
|
||||
}
|
||||
|
||||
function clampPercent(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed)) {
|
||||
@@ -51,57 +36,28 @@ function normalizeStage(value) {
|
||||
return String(value || '').trim().toUpperCase();
|
||||
}
|
||||
|
||||
function isRunningStage(value) {
|
||||
const normalized = normalizeStage(value);
|
||||
return normalized === 'ANALYZING'
|
||||
|| normalized === 'RIPPING'
|
||||
|| normalized === 'MEDIAINFO_CHECK'
|
||||
|| normalized === 'ENCODING'
|
||||
|| normalized === 'CD_ANALYZING'
|
||||
|| normalized === 'CD_RIPPING'
|
||||
|| normalized === 'CD_ENCODING';
|
||||
}
|
||||
|
||||
function isTerminalStage(value) {
|
||||
const normalized = normalizeStage(value);
|
||||
return normalized === 'FINISHED' || normalized === 'ERROR' || normalized === 'CANCELLED';
|
||||
}
|
||||
|
||||
function isInteractiveReviewStage(value) {
|
||||
const normalized = normalizeStage(value);
|
||||
return normalized === 'METADATA_LOOKUP'
|
||||
|| normalized === 'METADATA_SELECTION'
|
||||
|| normalized === 'WAITING_FOR_USER_DECISION'
|
||||
|| normalized === 'READY_TO_ENCODE';
|
||||
}
|
||||
|
||||
function parseTimestamp(value) {
|
||||
if (!value) {
|
||||
return 0;
|
||||
function formatBytes(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed) || parsed < 0) {
|
||||
return 'n/a';
|
||||
}
|
||||
const ts = Date.parse(String(value));
|
||||
return Number.isFinite(ts) ? ts : 0;
|
||||
}
|
||||
|
||||
function mergePipelineStatePreservingNewestQueue(previousPipeline, incomingPipeline) {
|
||||
const prev = previousPipeline && typeof previousPipeline === 'object' ? previousPipeline : {};
|
||||
const incoming = incomingPipeline && typeof incomingPipeline === 'object' ? incomingPipeline : {};
|
||||
const prevQueue = prev?.queue && typeof prev.queue === 'object' ? prev.queue : null;
|
||||
const incomingQueue = incoming?.queue && typeof incoming.queue === 'object' ? incoming.queue : null;
|
||||
if (!prevQueue || !incomingQueue) {
|
||||
return {
|
||||
...prev,
|
||||
...incoming
|
||||
};
|
||||
if (parsed === 0) {
|
||||
return '0 B';
|
||||
}
|
||||
const prevQueueTs = parseTimestamp(prevQueue.updatedAt);
|
||||
const incomingQueueTs = parseTimestamp(incomingQueue.updatedAt);
|
||||
const queue = incomingQueueTs >= prevQueueTs ? incomingQueue : prevQueue;
|
||||
return {
|
||||
...prev,
|
||||
...incoming,
|
||||
queue
|
||||
};
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
||||
let unitIndex = 0;
|
||||
let current = parsed;
|
||||
while (current >= 1024 && unitIndex < units.length - 1) {
|
||||
current /= 1024;
|
||||
unitIndex += 1;
|
||||
}
|
||||
const digits = unitIndex <= 1 ? 0 : 2;
|
||||
return `${current.toFixed(digits)} ${units[unitIndex]}`;
|
||||
}
|
||||
|
||||
function createInitialAudiobookUploadState() {
|
||||
@@ -114,14 +70,28 @@ function createInitialAudiobookUploadState() {
|
||||
statusText: null,
|
||||
errorMessage: null,
|
||||
jobId: null,
|
||||
uploadSessionId: null,
|
||||
fileLastModified: null,
|
||||
fileFingerprint: null,
|
||||
startedAt: null,
|
||||
finishedAt: null
|
||||
};
|
||||
}
|
||||
|
||||
function getAudiobookUploadTagMeta(phase) {
|
||||
const normalized = String(phase || '').trim().toLowerCase();
|
||||
if (normalized === 'uploading') {
|
||||
return { label: 'Upload läuft', severity: 'warning' };
|
||||
}
|
||||
if (normalized === 'processing') {
|
||||
return { label: 'Server verarbeitet', severity: 'info' };
|
||||
}
|
||||
if (normalized === 'completed') {
|
||||
return { label: 'Bereit', severity: 'success' };
|
||||
}
|
||||
if (normalized === 'error') {
|
||||
return { label: 'Fehler', severity: 'danger' };
|
||||
}
|
||||
return { label: 'Inaktiv', severity: 'secondary' };
|
||||
}
|
||||
|
||||
function getDownloadIndicatorMeta(summary) {
|
||||
const activeCount = Number(summary?.activeCount || 0);
|
||||
const failedCount = Number(summary?.failedCount || 0);
|
||||
@@ -148,11 +118,6 @@ function getDownloadIndicatorMeta(summary) {
|
||||
};
|
||||
}
|
||||
|
||||
const HARDWARE_MONITOR_SETTING_KEYS = new Set([
|
||||
'hardware_monitoring_enabled',
|
||||
'hardware_monitoring_interval_ms'
|
||||
]);
|
||||
|
||||
function App() {
|
||||
const appVersion = __APP_VERSION__;
|
||||
const [pipeline, setPipeline] = useState({ state: 'IDLE', progress: 0, context: {} });
|
||||
@@ -164,20 +129,11 @@ function App() {
|
||||
const [historyJobsRefreshToken, setHistoryJobsRefreshToken] = useState(0);
|
||||
const [downloadsRefreshToken, setDownloadsRefreshToken] = useState(0);
|
||||
const [downloadSummary, setDownloadSummary] = useState(null);
|
||||
const [pendingRipperJobId, setPendingRipperJobId] = useState(null);
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const globalToastRef = useRef(null);
|
||||
const prevCdDrivesRef = useRef({});
|
||||
const prevJobProgressStatesRef = useRef({});
|
||||
const hardwareWarmupRef = useRef({ timer: null, attempts: 0 });
|
||||
const audiobookUploadAbortRef = useRef(null);
|
||||
|
||||
const clearHardwareWarmupRetry = () => {
|
||||
if (hardwareWarmupRef.current?.timer) {
|
||||
clearTimeout(hardwareWarmupRef.current.timer);
|
||||
hardwareWarmupRef.current.timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
// When a virtual CD drive is removed (CD encode/rip finished or failed),
|
||||
// or when a CD drive transitions away from an active job, force both
|
||||
@@ -219,148 +175,90 @@ function App() {
|
||||
prevCdDrivesRef.current = current;
|
||||
}, [pipeline?.cdDrives]);
|
||||
|
||||
// Trigger a jobs refresh when a tracked job transitions into a terminal or
|
||||
// interactive review state through PIPELINE_PROGRESS, so Ripper/History
|
||||
// update immediately without a manual page reload.
|
||||
useEffect(() => {
|
||||
const current = pipeline?.jobProgress && typeof pipeline.jobProgress === 'object'
|
||||
? pipeline.jobProgress
|
||||
: {};
|
||||
const previousStates = prevJobProgressStatesRef.current || {};
|
||||
const nextStates = {};
|
||||
let shouldRefresh = false;
|
||||
|
||||
for (const [jobId, entry] of Object.entries(current)) {
|
||||
const currentState = normalizeStage(entry?.state);
|
||||
const previousState = normalizeStage(previousStates[jobId]);
|
||||
if (currentState) {
|
||||
nextStates[jobId] = currentState;
|
||||
}
|
||||
if (
|
||||
currentState
|
||||
&& isTerminalStage(currentState)
|
||||
&& currentState !== previousState
|
||||
&& !isTerminalStage(previousState)
|
||||
) {
|
||||
shouldRefresh = true;
|
||||
}
|
||||
if (
|
||||
currentState
|
||||
&& isInteractiveReviewStage(currentState)
|
||||
&& currentState !== previousState
|
||||
) {
|
||||
shouldRefresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
prevJobProgressStatesRef.current = nextStates;
|
||||
if (shouldRefresh) {
|
||||
setRipperJobsRefreshToken((token) => token + 1);
|
||||
setHistoryJobsRefreshToken((token) => token + 1);
|
||||
}
|
||||
}, [pipeline?.jobProgress]);
|
||||
|
||||
const refreshPipeline = async () => {
|
||||
const response = await api.getPipelineState();
|
||||
setPipeline(response.pipeline);
|
||||
const monitoringPayload = response?.hardwareMonitoring || null;
|
||||
setHardwareMonitoring(monitoringPayload);
|
||||
const monitoringEnabled = Boolean(monitoringPayload?.enabled);
|
||||
const hasSample = Boolean(monitoringPayload?.sample && typeof monitoringPayload.sample === 'object');
|
||||
if (monitoringEnabled && !hasSample) {
|
||||
const nextAttempts = Number(hardwareWarmupRef.current?.attempts || 0) + 1;
|
||||
hardwareWarmupRef.current.attempts = nextAttempts;
|
||||
if (nextAttempts <= 10 && !hardwareWarmupRef.current.timer) {
|
||||
hardwareWarmupRef.current.timer = setTimeout(() => {
|
||||
hardwareWarmupRef.current.timer = null;
|
||||
refreshPipeline().catch(() => null);
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
hardwareWarmupRef.current.attempts = 0;
|
||||
clearHardwareWarmupRetry();
|
||||
}
|
||||
setHardwareMonitoring(response?.hardwareMonitoring || null);
|
||||
return response;
|
||||
};
|
||||
|
||||
const clearAudiobookUpload = () => {
|
||||
setAudiobookUpload(createInitialAudiobookUploadState());
|
||||
};
|
||||
|
||||
const handleAudiobookUpload = async (file, payload = {}) => {
|
||||
if (!file) {
|
||||
throw new Error('Bitte zuerst eine AAX-Datei auswählen.');
|
||||
}
|
||||
const fileName = String(file.name || '').trim() || 'upload.aax';
|
||||
const totalBytes = Number(file.size || 0);
|
||||
const abortController = new AbortController();
|
||||
audiobookUploadAbortRef.current = abortController;
|
||||
|
||||
const fallbackTotalBytes = Number.isFinite(Number(file.size)) && Number(file.size) > 0
|
||||
? Number(file.size)
|
||||
: 0;
|
||||
|
||||
setAudiobookUpload({
|
||||
phase: 'uploading',
|
||||
fileName,
|
||||
fileName: String(file.name || '').trim() || 'upload.aax',
|
||||
loadedBytes: 0,
|
||||
totalBytes,
|
||||
totalBytes: fallbackTotalBytes,
|
||||
progressPercent: 0,
|
||||
statusText: 'AAX-Datei wird hochgeladen ...',
|
||||
errorMessage: null,
|
||||
jobId: null,
|
||||
uploadSessionId: null,
|
||||
fileLastModified: Number.isFinite(Number(file.lastModified))
|
||||
? Math.trunc(Number(file.lastModified))
|
||||
: null,
|
||||
fileFingerprint: null,
|
||||
startedAt: new Date().toISOString(),
|
||||
finishedAt: null
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await api.uploadAudiobook(file, payload, {
|
||||
signal: abortController.signal,
|
||||
onProgress: ({ loaded, total, percent }) => {
|
||||
const loadedBytes = Number.isFinite(Number(loaded)) ? Number(loaded) : 0;
|
||||
const totalSize = Number.isFinite(Number(total)) && Number(total) > 0 ? Number(total) : totalBytes;
|
||||
const progressPercent = Number.isFinite(Number(percent))
|
||||
const nextLoaded = Number.isFinite(Number(loaded)) && Number(loaded) >= 0
|
||||
? Number(loaded)
|
||||
: 0;
|
||||
const nextTotal = Number.isFinite(Number(total)) && Number(total) > 0
|
||||
? Number(total)
|
||||
: fallbackTotalBytes;
|
||||
const nextPercent = Number.isFinite(Number(percent))
|
||||
? clampPercent(Number(percent))
|
||||
: (totalSize > 0 ? clampPercent((loadedBytes / totalSize) * 100) : 0);
|
||||
: (nextTotal > 0 ? clampPercent((nextLoaded / nextTotal) * 100) : 0);
|
||||
const transferComplete = nextTotal > 0 && nextLoaded >= nextTotal;
|
||||
|
||||
setAudiobookUpload((prev) => ({
|
||||
...prev,
|
||||
phase: 'uploading',
|
||||
loadedBytes,
|
||||
totalBytes: totalSize,
|
||||
progressPercent,
|
||||
statusText: 'AAX-Datei wird hochgeladen ...',
|
||||
errorMessage: null
|
||||
phase: transferComplete ? 'processing' : 'uploading',
|
||||
loadedBytes: nextLoaded,
|
||||
totalBytes: nextTotal,
|
||||
progressPercent: nextPercent,
|
||||
statusText: transferComplete
|
||||
? 'Upload abgeschlossen, AAX wird serverseitig verarbeitet ...'
|
||||
: 'AAX-Datei wird hochgeladen ...'
|
||||
}));
|
||||
}
|
||||
});
|
||||
const uploadedJobId = extractUploadJobIdFromResponse(response);
|
||||
const started = Boolean(response?.result?.started);
|
||||
const queued = Boolean(response?.result?.queued);
|
||||
|
||||
const uploadedJobId = normalizeJobId(response?.result?.jobId);
|
||||
await refreshPipeline().catch(() => null);
|
||||
setRipperJobsRefreshToken((prev) => prev + 1);
|
||||
setHistoryJobsRefreshToken((prev) => prev + 1);
|
||||
if (uploadedJobId) {
|
||||
setPendingRipperJobId(uploadedJobId);
|
||||
}
|
||||
|
||||
setAudiobookUpload((prev) => ({
|
||||
...prev,
|
||||
phase: 'completed',
|
||||
loadedBytes: prev.totalBytes || totalBytes,
|
||||
totalBytes: prev.totalBytes || totalBytes,
|
||||
loadedBytes: prev.totalBytes || prev.loadedBytes || fallbackTotalBytes,
|
||||
totalBytes: prev.totalBytes || fallbackTotalBytes,
|
||||
progressPercent: 100,
|
||||
statusText: uploadedJobId
|
||||
? (
|
||||
queued
|
||||
? `Upload abgeschlossen. Job #${uploadedJobId} wurde in die Queue eingereiht.`
|
||||
: (started
|
||||
? `Upload abgeschlossen. Job #${uploadedJobId} wurde gestartet.`
|
||||
: `Upload abgeschlossen. Job #${uploadedJobId} ist bereit.`)
|
||||
)
|
||||
? `Upload abgeschlossen. Job #${uploadedJobId} ist bereit fuer den naechsten Schritt.`
|
||||
: 'Upload abgeschlossen.',
|
||||
errorMessage: null,
|
||||
jobId: uploadedJobId,
|
||||
finishedAt: new Date().toISOString()
|
||||
}));
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
if (error?.name === 'AbortError') {
|
||||
setAudiobookUpload(createInitialAudiobookUploadState());
|
||||
throw error;
|
||||
}
|
||||
setAudiobookUpload((prev) => ({
|
||||
...prev,
|
||||
phase: 'error',
|
||||
@@ -369,20 +267,17 @@ function App() {
|
||||
finishedAt: new Date().toISOString()
|
||||
}));
|
||||
throw error;
|
||||
} finally {
|
||||
if (audiobookUploadAbortRef.current === abortController) {
|
||||
audiobookUploadAbortRef.current = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancelAudiobookUpload = () => {
|
||||
const activeAbortController = audiobookUploadAbortRef.current;
|
||||
if (activeAbortController) {
|
||||
activeAbortController.abort();
|
||||
const handleRipperJobFocusConsumed = (jobId) => {
|
||||
const normalizedJobId = normalizeJobId(jobId);
|
||||
if (!normalizedJobId) {
|
||||
return;
|
||||
}
|
||||
setAudiobookUpload(createInitialAudiobookUploadState());
|
||||
setPendingRipperJobId((prev) => (
|
||||
normalizeJobId(prev) === normalizedJobId ? null : prev
|
||||
));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -399,24 +294,12 @@ function App() {
|
||||
setExpertMode(val === 'true' || val === true);
|
||||
})
|
||||
.catch(() => null);
|
||||
return () => {
|
||||
clearHardwareWarmupRetry();
|
||||
};
|
||||
}, []);
|
||||
|
||||
useWebSocket({
|
||||
onMessage: (message) => {
|
||||
if (message.type === 'WS_CONNECTED') {
|
||||
refreshPipeline().catch(() => null);
|
||||
}
|
||||
|
||||
if (message.type === 'PIPELINE_STATE_CHANGED') {
|
||||
setPipeline((prev) => mergePipelineStatePreservingNewestQueue(prev, message.payload));
|
||||
const nextState = normalizeStage(message?.payload?.state);
|
||||
if (isTerminalStage(nextState) || isInteractiveReviewStage(nextState)) {
|
||||
setRipperJobsRefreshToken((token) => token + 1);
|
||||
setHistoryJobsRefreshToken((token) => token + 1);
|
||||
}
|
||||
setPipeline(message.payload);
|
||||
}
|
||||
|
||||
if (message.type === 'PIPELINE_PROGRESS') {
|
||||
@@ -432,24 +315,17 @@ function App() {
|
||||
const isCdProgressStage = progressStage === 'CD_ANALYZING'
|
||||
|| progressStage === 'CD_RIPPING'
|
||||
|| progressStage === 'CD_ENCODING';
|
||||
const incomingIsRunning = isRunningStage(progressStage);
|
||||
const incomingIsTerminal = isTerminalStage(progressStage);
|
||||
const prevActiveJobId = normalizeJobId(prev?.activeJobId || prev?.context?.jobId);
|
||||
const prevJobProgress = normalizedProgressJobId
|
||||
? (prev?.jobProgress?.[normalizedProgressJobId] || null)
|
||||
: null;
|
||||
const prevJobProgressState = normalizeStage(prevJobProgress?.state);
|
||||
const prevJobProgressIsRunning = isRunningStage(prevJobProgressState);
|
||||
const prevJobProgressIsTerminal = isTerminalStage(prevJobProgressState);
|
||||
const matchingCdDriveEntry = normalizedProgressJobId
|
||||
? Object.values(prev?.cdDrives || {}).find((driveState) => normalizeJobId(driveState?.jobId) === normalizedProgressJobId)
|
||||
: null;
|
||||
const matchingCdDriveState = normalizeStage(matchingCdDriveEntry?.state);
|
||||
const matchingCdDriveIsRunning = isRunningStage(matchingCdDriveState);
|
||||
const matchingCdDriveIsTerminal = isTerminalStage(matchingCdDriveEntry?.state);
|
||||
const previousGlobalStage = normalizeStage(prev?.state);
|
||||
const previousGlobalIsRunning = isRunningStage(previousGlobalStage);
|
||||
const previousGlobalIsTerminal = isTerminalStage(previousGlobalStage);
|
||||
const hasKnownBinding = Boolean(
|
||||
normalizedProgressJobId
|
||||
&& (
|
||||
@@ -458,43 +334,16 @@ function App() {
|
||||
|| matchingCdDriveEntry
|
||||
)
|
||||
);
|
||||
const regressesStableJobState = Boolean(
|
||||
normalizedProgressJobId
|
||||
&& incomingIsRunning
|
||||
&& (
|
||||
(prevJobProgressState && !prevJobProgressIsRunning && !prevJobProgressIsTerminal)
|
||||
|| (matchingCdDriveState && !matchingCdDriveIsRunning && !matchingCdDriveIsTerminal)
|
||||
|| (
|
||||
prevActiveJobId === normalizedProgressJobId
|
||||
&& previousGlobalStage
|
||||
&& !previousGlobalIsRunning
|
||||
&& !previousGlobalIsTerminal
|
||||
)
|
||||
)
|
||||
);
|
||||
const isUnknownRunningProgress = Boolean(
|
||||
normalizedProgressJobId
|
||||
&& incomingIsRunning
|
||||
&& !hasKnownBinding
|
||||
);
|
||||
const allowRunningTransitionFromTerminal = Boolean(
|
||||
normalizedProgressJobId
|
||||
&& incomingIsRunning
|
||||
&& prevActiveJobId === normalizedProgressJobId
|
||||
);
|
||||
|
||||
// Ignore late/stale progress packets that arrive after a terminal state
|
||||
// or regress a job from an interactive/ready state back into an
|
||||
// earlier running stage because an older progress packet arrived late.
|
||||
// or for jobs that are no longer bound in pipeline state.
|
||||
if (
|
||||
normalizedProgressJobId
|
||||
&& !incomingIsTerminal
|
||||
&& !allowRunningTransitionFromTerminal
|
||||
&& (
|
||||
prevJobProgressIsTerminal
|
||||
|| matchingCdDriveIsTerminal
|
||||
|| isUnknownRunningProgress
|
||||
|| regressesStableJobState
|
||||
|| !hasKnownBinding
|
||||
)
|
||||
) {
|
||||
return prev;
|
||||
@@ -503,9 +352,7 @@ function App() {
|
||||
if (progressJobId != null) {
|
||||
const previousJobProgress = prev?.jobProgress?.[progressJobId] || {};
|
||||
const previousJobStage = normalizeStage(previousJobProgress?.state);
|
||||
const keepPreviousJobStage = isTerminalStage(previousJobStage)
|
||||
&& !incomingIsTerminal
|
||||
&& !allowRunningTransitionFromTerminal;
|
||||
const keepPreviousJobStage = isTerminalStage(previousJobStage) && !incomingIsTerminal;
|
||||
const mergedJobContext = contextPatch
|
||||
? {
|
||||
...(previousJobProgress?.context && typeof previousJobProgress.context === 'object'
|
||||
@@ -529,9 +376,8 @@ function App() {
|
||||
};
|
||||
}
|
||||
if (progressJobId === prev?.activeJobId || progressJobId == null) {
|
||||
const keepPreviousGlobalStage = isTerminalStage(previousGlobalStage)
|
||||
&& !incomingIsTerminal
|
||||
&& !allowRunningTransitionFromTerminal;
|
||||
const previousGlobalStage = normalizeStage(prev?.state);
|
||||
const keepPreviousGlobalStage = isTerminalStage(previousGlobalStage) && !incomingIsTerminal;
|
||||
next.state = keepPreviousGlobalStage ? prev?.state : (payload.state ?? prev?.state);
|
||||
next.progress = keepPreviousGlobalStage ? prev?.progress : (payload.progress ?? prev?.progress);
|
||||
next.eta = keepPreviousGlobalStage ? prev?.eta : (payload.eta ?? prev?.eta);
|
||||
@@ -609,8 +455,6 @@ function App() {
|
||||
...(prev || {}),
|
||||
queue: message.payload || null
|
||||
}));
|
||||
setRipperJobsRefreshToken((prev) => prev + 1);
|
||||
setHistoryJobsRefreshToken((prev) => prev + 1);
|
||||
}
|
||||
|
||||
if (message.type === 'DISC_DETECTED') {
|
||||
@@ -632,15 +476,10 @@ function App() {
|
||||
const val = setting?.value;
|
||||
setExpertMode(val === 'true' || val === true);
|
||||
}
|
||||
const normalizedKey = String(setting?.key || '').trim().toLowerCase();
|
||||
if (HARDWARE_MONITOR_SETTING_KEYS.has(normalizedKey)) {
|
||||
refreshPipeline().catch(() => null);
|
||||
}
|
||||
}
|
||||
|
||||
if (message.type === 'SETTINGS_BULK_UPDATED') {
|
||||
const keys = message.payload?.keys || [];
|
||||
const normalizedKeys = keys.map((key) => String(key || '').trim().toLowerCase());
|
||||
if (keys.includes('ui_expert_mode')) {
|
||||
api.getSettings({ forceRefresh: true })
|
||||
.then((response) => {
|
||||
@@ -650,9 +489,6 @@ function App() {
|
||||
})
|
||||
.catch(() => null);
|
||||
}
|
||||
if (normalizedKeys.some((key) => HARDWARE_MONITOR_SETTING_KEYS.has(key))) {
|
||||
refreshPipeline().catch(() => null);
|
||||
}
|
||||
}
|
||||
|
||||
if (message.type === 'DOWNLOADS_UPDATED') {
|
||||
@@ -691,6 +527,7 @@ function App() {
|
||||
});
|
||||
|
||||
const nav = [
|
||||
{ label: 'Jobs', path: '/jobs' },
|
||||
{ label: 'Ripper', path: '/ripper' },
|
||||
{ label: 'Converter', path: '/converter' },
|
||||
{ label: 'Audiobooks', path: '/audiobooks' },
|
||||
@@ -699,6 +536,18 @@ function App() {
|
||||
{ label: 'Downloads', path: '/downloads' },
|
||||
...(expertMode ? [{ label: 'Database', path: '/database' }] : [])
|
||||
];
|
||||
const uploadPhase = String(audiobookUpload?.phase || 'idle').trim().toLowerCase();
|
||||
const showAudiobookUploadBanner = uploadPhase !== 'idle';
|
||||
const uploadProgress = clampPercent(audiobookUpload?.progressPercent);
|
||||
const uploadTagMeta = getAudiobookUploadTagMeta(uploadPhase);
|
||||
const uploadLoadedBytes = Number(audiobookUpload?.loadedBytes || 0);
|
||||
const uploadTotalBytes = Number(audiobookUpload?.totalBytes || 0);
|
||||
const uploadBytesLabel = uploadTotalBytes > 0
|
||||
? `${formatBytes(uploadLoadedBytes)} / ${formatBytes(uploadTotalBytes)}`
|
||||
: (uploadLoadedBytes > 0 ? `${formatBytes(uploadLoadedBytes)} hochgeladen` : null);
|
||||
const canDismissUploadBanner = uploadPhase === 'completed' || uploadPhase === 'error';
|
||||
const hasUploadedJob = Boolean(normalizeJobId(audiobookUpload?.jobId));
|
||||
const isAudiobooksRoute = location.pathname === '/audiobooks';
|
||||
const downloadIndicator = getDownloadIndicatorMeta(downloadSummary);
|
||||
const isNavActive = (path) => {
|
||||
if (path === '/ripper') {
|
||||
@@ -738,6 +587,57 @@ function App() {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{showAudiobookUploadBanner ? (
|
||||
<section className={`app-upload-banner phase-${uploadPhase}`}>
|
||||
<div className="app-upload-banner-copy">
|
||||
<div className="app-upload-banner-head">
|
||||
<strong>Audiobook Upload</strong>
|
||||
<Tag value={uploadTagMeta.label} severity={uploadTagMeta.severity} />
|
||||
</div>
|
||||
<small>{audiobookUpload?.statusText || 'Upload aktiv.'}</small>
|
||||
{audiobookUpload?.fileName ? <small>Datei: {audiobookUpload.fileName}</small> : null}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="app-upload-banner-progress"
|
||||
aria-label={`Audiobook Upload ${Math.round(uploadProgress)} Prozent`}
|
||||
>
|
||||
<ProgressBar value={uploadProgress} showValue={false} />
|
||||
<small>
|
||||
{uploadPhase === 'processing'
|
||||
? `100% | ${uploadBytesLabel || 'Upload abgeschlossen'}`
|
||||
: uploadBytesLabel
|
||||
? `${Math.round(uploadProgress)}% | ${uploadBytesLabel}`
|
||||
: `${Math.round(uploadProgress)}%`}
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div className="app-upload-banner-actions">
|
||||
{hasUploadedJob && !isAudiobooksRoute ? (
|
||||
<Button
|
||||
label="Zu Audiobooks"
|
||||
icon="pi pi-arrow-right"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => {
|
||||
navigate('/audiobooks');
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
{canDismissUploadBanner ? (
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
rounded
|
||||
text
|
||||
severity="secondary"
|
||||
aria-label="Upload-Hinweis schliessen"
|
||||
onClick={clearAudiobookUpload}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
<main className="app-main">
|
||||
<Routes>
|
||||
<Route
|
||||
@@ -749,28 +649,28 @@ function App() {
|
||||
lastDiscEvent={lastDiscEvent}
|
||||
refreshPipeline={refreshPipeline}
|
||||
jobsRefreshToken={ripperJobsRefreshToken}
|
||||
pendingExpandedJobId={pendingRipperJobId}
|
||||
onPendingExpandedJobHandled={handleRipperJobFocusConsumed}
|
||||
downloadSummary={downloadSummary}
|
||||
>
|
||||
<Outlet />
|
||||
</RipperPage>
|
||||
}
|
||||
>
|
||||
<Route index element={<Navigate to="ripper" replace />} />
|
||||
<Route index element={<Navigate to="jobs" replace />} />
|
||||
<Route path="ripper" element={null} />
|
||||
<Route path="settings" element={<SettingsPage />} />
|
||||
<Route path="history" element={<HistoryPage refreshToken={historyJobsRefreshToken} />} />
|
||||
<Route path="tmdb-migration" element={<TmdbMigrationPage />} />
|
||||
<Route path="downloads" element={<DownloadsPage refreshToken={downloadsRefreshToken} />} />
|
||||
<Route path="database" element={<DatabasePage />} />
|
||||
<Route path="jobs" element={<JobsInboxPage />} />
|
||||
<Route path="converter" element={<ConverterPage />} />
|
||||
<Route path="hardware" element={<HardwarePage hardwareMonitoring={hardwareMonitoring} />} />
|
||||
<Route
|
||||
path="audiobooks"
|
||||
element={
|
||||
<AudiobooksPage
|
||||
audiobookUpload={audiobookUpload}
|
||||
onAudiobookUpload={handleAudiobookUpload}
|
||||
onCancelAudiobookUpload={handleCancelAudiobookUpload}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
+16
-214
@@ -267,12 +267,6 @@ async function requestWithXhr(path, options = {}) {
|
||||
|
||||
xhr.onerror = () => {
|
||||
settle(() => {
|
||||
if (Number(xhr.status || 0) === 0) {
|
||||
const abortLikeError = new Error('Request unterbrochen.');
|
||||
abortLikeError.name = 'AbortError';
|
||||
reject(abortLikeError);
|
||||
return;
|
||||
}
|
||||
reject(new Error('Netzwerkfehler'));
|
||||
});
|
||||
};
|
||||
@@ -382,27 +376,6 @@ export const api = {
|
||||
});
|
||||
return normalizeHandBrakePresetPayload(result);
|
||||
},
|
||||
getMakeMKVBetaKey(options = {}) {
|
||||
return requestCachedGet('/settings/makemkv/beta-key', {
|
||||
ttlMs: 10 * 60 * 1000,
|
||||
forceRefresh: options.forceRefresh
|
||||
});
|
||||
},
|
||||
async checkMakeMKVBetaKey() {
|
||||
const result = await request('/settings/makemkv/beta-key/check', {
|
||||
method: 'POST'
|
||||
});
|
||||
afterMutationInvalidate(['/settings/makemkv/beta-key']);
|
||||
return result;
|
||||
},
|
||||
async applyMakeMKVBetaKey(payload = {}) {
|
||||
const result = await request('/settings/makemkv/beta-key/apply', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload || {})
|
||||
});
|
||||
afterMutationInvalidate(['/settings/makemkv/beta-key', '/settings']);
|
||||
return result;
|
||||
},
|
||||
getScripts(options = {}) {
|
||||
return requestCachedGet('/settings/scripts', {
|
||||
ttlMs: 2 * 60 * 1000,
|
||||
@@ -435,14 +408,6 @@ export const api = {
|
||||
afterMutationInvalidate(['/settings/scripts']);
|
||||
return result;
|
||||
},
|
||||
async setScriptFavorite(scriptId, isFavorite) {
|
||||
const result = await request(`/settings/scripts/${encodeURIComponent(scriptId)}/favorite`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ isFavorite: isFavorite === true })
|
||||
});
|
||||
afterMutationInvalidate(['/settings/scripts']);
|
||||
return result;
|
||||
},
|
||||
async deleteScript(scriptId) {
|
||||
const result = await request(`/settings/scripts/${encodeURIComponent(scriptId)}`, {
|
||||
method: 'DELETE'
|
||||
@@ -487,14 +452,6 @@ export const api = {
|
||||
afterMutationInvalidate(['/settings/script-chains']);
|
||||
return result;
|
||||
},
|
||||
async setScriptChainFavorite(chainId, isFavorite) {
|
||||
const result = await request(`/settings/script-chains/${encodeURIComponent(chainId)}/favorite`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ isFavorite: isFavorite === true })
|
||||
});
|
||||
afterMutationInvalidate(['/settings/script-chains']);
|
||||
return result;
|
||||
},
|
||||
async deleteScriptChain(chainId) {
|
||||
const result = await request(`/settings/script-chains/${encodeURIComponent(chainId)}`, {
|
||||
method: 'DELETE'
|
||||
@@ -549,21 +506,6 @@ export const api = {
|
||||
getPipelineState() {
|
||||
return request('/pipeline/state');
|
||||
},
|
||||
getHardwareHistory(options = {}) {
|
||||
const hoursRaw = Number(options?.hours);
|
||||
const maxPointsRaw = Number(options?.maxPoints);
|
||||
const hours = Number.isFinite(hoursRaw) ? Math.max(1, Math.min(96, Math.trunc(hoursRaw))) : 24;
|
||||
const maxPoints = Number.isFinite(maxPointsRaw) ? Math.max(120, Math.min(5000, Math.trunc(maxPointsRaw))) : 720;
|
||||
const query = new URLSearchParams({
|
||||
hours: String(hours),
|
||||
maxPoints: String(maxPoints)
|
||||
});
|
||||
const path = `/pipeline/hardware/history?${query.toString()}`;
|
||||
return requestCachedGet(path, {
|
||||
ttlMs: 10 * 1000,
|
||||
forceRefresh: options.forceRefresh
|
||||
});
|
||||
},
|
||||
getRuntimeActivities() {
|
||||
return request('/runtime/activities');
|
||||
},
|
||||
@@ -608,8 +550,8 @@ export const api = {
|
||||
});
|
||||
return result;
|
||||
},
|
||||
searchTmdbMovie(q) {
|
||||
return request(`/pipeline/tmdb/movie/search?q=${encodeURIComponent(q)}`);
|
||||
searchOmdb(q) {
|
||||
return request(`/pipeline/omdb/search?q=${encodeURIComponent(q)}`);
|
||||
},
|
||||
searchTmdbSeries(q, seasonNumber = null) {
|
||||
const params = new URLSearchParams();
|
||||
@@ -619,14 +561,8 @@ export const api = {
|
||||
}
|
||||
return request(`/pipeline/tmdb/series/search?${params.toString()}`);
|
||||
},
|
||||
searchMusicBrainz(q, options = {}) {
|
||||
const params = new URLSearchParams();
|
||||
params.set('q', String(q || ''));
|
||||
const expectedTrackCount = Number(options?.trackCount);
|
||||
if (Number.isFinite(expectedTrackCount) && expectedTrackCount > 0) {
|
||||
params.set('trackCount', String(Math.trunc(expectedTrackCount)));
|
||||
}
|
||||
return request(`/pipeline/cd/musicbrainz/search?${params.toString()}`);
|
||||
searchMusicBrainz(q) {
|
||||
return request(`/pipeline/cd/musicbrainz/search?q=${encodeURIComponent(q)}`);
|
||||
},
|
||||
getMusicBrainzRelease(mbId) {
|
||||
return request(`/pipeline/cd/musicbrainz/release/${encodeURIComponent(String(mbId || '').trim())}`);
|
||||
@@ -678,6 +614,9 @@ export const api = {
|
||||
getAudiobookJobs() {
|
||||
return request('/pipeline/audiobook/jobs');
|
||||
},
|
||||
getAudiobookOutputTree() {
|
||||
return request('/pipeline/audiobook/output-tree');
|
||||
},
|
||||
async selectMetadata(payload) {
|
||||
const result = await request('/pipeline/select-metadata', {
|
||||
method: 'POST',
|
||||
@@ -686,14 +625,6 @@ export const api = {
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async submitRawDecision(jobId, decision) {
|
||||
const result = await request(`/pipeline/jobs/${jobId}/raw-decision`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ decision })
|
||||
});
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async startJob(jobId) {
|
||||
const result = await request(`/pipeline/start/${jobId}`, {
|
||||
method: 'POST'
|
||||
@@ -701,36 +632,6 @@ export const api = {
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async reorderMultipartMergeSources(jobId, orderedSourceJobIds = []) {
|
||||
const result = await request(`/pipeline/multipart-merge/${jobId}/reorder`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
orderedSourceJobIds: Array.isArray(orderedSourceJobIds) ? orderedSourceJobIds : []
|
||||
})
|
||||
});
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async updateMultipartMergeSettings(jobId, settings = {}) {
|
||||
const result = await request(`/pipeline/multipart-merge/${jobId}/settings`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
deleteInputsAfterMerge: Boolean(settings?.deleteInputsAfterMerge)
|
||||
})
|
||||
});
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
getMultipartMergePreview(jobId) {
|
||||
return request(`/pipeline/multipart-merge/${jobId}/preview`);
|
||||
},
|
||||
async restoreMultipartMergeJob(containerJobId) {
|
||||
const result = await request(`/pipeline/multipart-merge/${containerJobId}/restore`, {
|
||||
method: 'POST'
|
||||
});
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async confirmEncodeReview(jobId, payload = {}) {
|
||||
const result = await request(`/pipeline/confirm-encode/${jobId}`, {
|
||||
method: 'POST',
|
||||
@@ -747,12 +648,9 @@ export const api = {
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async retryJob(jobId, options = {}) {
|
||||
const body = {};
|
||||
if (options.createNewJob) body.createNewJob = true;
|
||||
async retryJob(jobId) {
|
||||
const result = await request(`/pipeline/retry/${jobId}`, {
|
||||
method: 'POST',
|
||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
||||
method: 'POST'
|
||||
});
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
@@ -780,7 +678,6 @@ export const api = {
|
||||
if (options.keepBoth) body.keepBoth = true;
|
||||
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
||||
if (options.reuseCurrentJob) body.reuseCurrentJob = true;
|
||||
if (options.createNewJob) body.createNewJob = true;
|
||||
const result = await request(`/pipeline/restart-review/${jobId}`, {
|
||||
method: 'POST',
|
||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
||||
@@ -793,7 +690,6 @@ export const api = {
|
||||
if (options.keepBoth) body.keepBoth = true;
|
||||
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
||||
if (options.restartMode) body.restartMode = options.restartMode;
|
||||
if (options.createNewJob) body.createNewJob = true;
|
||||
const result = await request(`/pipeline/restart-encode/${jobId}`, {
|
||||
method: 'POST',
|
||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
||||
@@ -868,24 +764,6 @@ export const api = {
|
||||
const suffix = query.toString() ? `?${query.toString()}` : '';
|
||||
return request(`/history${suffix}`);
|
||||
},
|
||||
getTmdbMigrationPendingJobs(params = {}) {
|
||||
const query = new URLSearchParams();
|
||||
if (Number.isFinite(Number(params.limit)) && Number(params.limit) > 0) {
|
||||
query.set('limit', String(Math.trunc(Number(params.limit))));
|
||||
}
|
||||
const suffix = query.toString() ? `?${query.toString()}` : '';
|
||||
return request(`/history/tmdb-migration/pending${suffix}`);
|
||||
},
|
||||
async setJobTmdbMigrationFlag(jobId, migrated = false) {
|
||||
const result = await request(`/history/${jobId}/tmdb-migration`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
migrated: Boolean(migrated)
|
||||
})
|
||||
});
|
||||
afterMutationInvalidate(['/history']);
|
||||
return result;
|
||||
},
|
||||
getOrphanRawFolders() {
|
||||
return request('/history/orphan-raw');
|
||||
},
|
||||
@@ -897,16 +775,8 @@ export const api = {
|
||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||
return result;
|
||||
},
|
||||
async deleteOrphanRawFolder(rawPath) {
|
||||
const result = await request('/history/orphan-raw/delete', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ rawPath })
|
||||
});
|
||||
afterMutationInvalidate(['/history']);
|
||||
return result;
|
||||
},
|
||||
async assignJobMetadata(jobId, payload = {}) {
|
||||
const result = await request(`/history/${jobId}/metadata/assign`, {
|
||||
async assignJobOmdb(jobId, payload = {}) {
|
||||
const result = await request(`/history/${jobId}/omdb/assign`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload || {})
|
||||
});
|
||||
@@ -928,74 +798,23 @@ export const api = {
|
||||
afterMutationInvalidate(['/history']);
|
||||
return result;
|
||||
},
|
||||
async generateJobNfo(jobId) {
|
||||
const result = await request(`/history/${jobId}/nfo/generate`, {
|
||||
method: 'POST'
|
||||
});
|
||||
afterMutationInvalidate(['/history']);
|
||||
return result;
|
||||
},
|
||||
async deleteJobFiles(jobId, target = 'both', options = {}) {
|
||||
const includeRelated = Boolean(options?.includeRelated);
|
||||
const selectedJobIds = Array.isArray(options?.selectedJobIds)
|
||||
? options.selectedJobIds
|
||||
.map((item) => Number(item))
|
||||
.filter((value) => Number.isFinite(value) && value > 0)
|
||||
.map((value) => Math.trunc(value))
|
||||
: null;
|
||||
const selectedRawPaths = Array.isArray(options?.selectedRawPaths)
|
||||
? options.selectedRawPaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
const selectedMoviePaths = Array.isArray(options?.selectedMoviePaths)
|
||||
? options.selectedMoviePaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
async deleteJobFiles(jobId, target = 'both') {
|
||||
const result = await request(`/history/${jobId}/delete-files`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
target,
|
||||
includeRelated,
|
||||
...(selectedJobIds ? { selectedJobIds } : {}),
|
||||
...(selectedRawPaths ? { selectedRawPaths } : {}),
|
||||
...(selectedMoviePaths ? { selectedMoviePaths } : {})
|
||||
})
|
||||
body: JSON.stringify({ target })
|
||||
});
|
||||
afterMutationInvalidate(['/history']);
|
||||
return result;
|
||||
},
|
||||
getJobDeletePreview(jobId, options = {}) {
|
||||
const includeRelated = options?.includeRelated !== false;
|
||||
const selectedJobIds = Array.isArray(options?.selectedJobIds)
|
||||
? options.selectedJobIds
|
||||
.map((item) => Number(item))
|
||||
.filter((value) => Number.isFinite(value) && value > 0)
|
||||
.map((value) => Math.trunc(value))
|
||||
: null;
|
||||
const query = new URLSearchParams();
|
||||
query.set('includeRelated', includeRelated ? '1' : '0');
|
||||
if (selectedJobIds) {
|
||||
query.set('selectedJobIds', selectedJobIds.join(','));
|
||||
}
|
||||
return request(`/history/${jobId}/delete-preview?${query.toString()}`);
|
||||
},
|
||||
async deleteJobEntry(jobId, target = 'none', options = {}) {
|
||||
const includeRelated = Boolean(options?.includeRelated);
|
||||
const resetDriveState = Boolean(options?.resetDriveState);
|
||||
const preserveRawForImportJobs = Boolean(options?.preserveRawForImportJobs);
|
||||
const selectedJobIds = Array.isArray(options?.selectedJobIds)
|
||||
? options.selectedJobIds
|
||||
.map((item) => Number(item))
|
||||
.filter((value) => Number.isFinite(value) && value > 0)
|
||||
.map((value) => Math.trunc(value))
|
||||
: null;
|
||||
const selectedRawPaths = Array.isArray(options?.selectedRawPaths)
|
||||
? options.selectedRawPaths
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
const selectedMoviePaths = Array.isArray(options?.selectedMoviePaths)
|
||||
? options.selectedMoviePaths
|
||||
.map((item) => String(item || '').trim())
|
||||
@@ -1011,10 +830,7 @@ export const api = {
|
||||
target,
|
||||
includeRelated,
|
||||
resetDriveState,
|
||||
preserveRawForImportJobs,
|
||||
...(selectedJobIds ? { selectedJobIds } : {}),
|
||||
...(hasKeepDetectedDevice ? { keepDetectedDevice } : {}),
|
||||
...(selectedRawPaths ? { selectedRawPaths } : {}),
|
||||
...(selectedMoviePaths ? { selectedMoviePaths } : {})
|
||||
})
|
||||
});
|
||||
@@ -1090,26 +906,12 @@ export const api = {
|
||||
forceRefresh: options.forceRefresh
|
||||
});
|
||||
},
|
||||
getUserPresetDefaults(options = {}) {
|
||||
return requestCachedGet('/settings/user-preset-defaults', {
|
||||
ttlMs: 2 * 60 * 1000,
|
||||
forceRefresh: options.forceRefresh
|
||||
});
|
||||
},
|
||||
async updateUserPresetDefaults(defaults = {}) {
|
||||
const result = await request('/settings/user-preset-defaults', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ defaults })
|
||||
});
|
||||
afterMutationInvalidate(['/settings/user-preset-defaults']);
|
||||
return result;
|
||||
},
|
||||
async createUserPreset(payload = {}) {
|
||||
const result = await request('/settings/user-presets', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
||||
afterMutationInvalidate(['/settings/user-presets']);
|
||||
return result;
|
||||
},
|
||||
async updateUserPreset(id, payload = {}) {
|
||||
@@ -1117,14 +919,14 @@ export const api = {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
||||
afterMutationInvalidate(['/settings/user-presets']);
|
||||
return result;
|
||||
},
|
||||
async deleteUserPreset(id) {
|
||||
const result = await request(`/settings/user-presets/${encodeURIComponent(id)}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
||||
afterMutationInvalidate(['/settings/user-presets']);
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Merge job">
|
||||
<defs>
|
||||
<linearGradient id="mergebg" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#eaf6ff"/>
|
||||
<stop offset="100%" stop-color="#86b6d6"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle cx="32" cy="32" r="30" fill="url(#mergebg)"/>
|
||||
<path d="M14 18h15l7 8h10" fill="none" stroke="#1f2f3f" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14 46h15l7-8h10" fill="none" stroke="#1f2f3f" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M45 24l7 2-7 2" fill="none" stroke="#1f2f3f" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M45 38l7-2-7-2" fill="none" stroke="#1f2f3f" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="34" cy="32" r="3" fill="#1f2f3f"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 898 B |
@@ -3,10 +3,10 @@ import { Dialog } from 'primereact/dialog';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Slider } from 'primereact/slider';
|
||||
import { Button } from 'primereact/button';
|
||||
import { ProgressBar } from 'primereact/progressbar';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { AUDIOBOOK_FORMATS, AUDIOBOOK_FORMAT_SCHEMAS, getDefaultAudiobookFormatOptions } from '../config/audiobookFormatSchemas';
|
||||
import { api } from '../api/client';
|
||||
import { getStatusLabel, getStatusSeverity } from '../utils/statusPresentation';
|
||||
|
||||
function normalizeJobId(value) {
|
||||
@@ -84,108 +84,6 @@ function normalizeEditableChapters(chapters = []) {
|
||||
});
|
||||
}
|
||||
|
||||
function formatChapterDuration(startSecondsValue, endSecondsValue) {
|
||||
const startSeconds = Number(startSecondsValue || 0);
|
||||
const endSeconds = Number(endSecondsValue || 0);
|
||||
if (!Number.isFinite(startSeconds) || !Number.isFinite(endSeconds) || endSeconds <= startSeconds) {
|
||||
return '-';
|
||||
}
|
||||
return formatChapterTime(endSeconds - startSeconds);
|
||||
}
|
||||
|
||||
function normalizeTrackStageStatus(value) {
|
||||
const raw = String(value || '').trim().toLowerCase();
|
||||
if (raw === 'done' || raw === 'complete' || raw === 'completed' || raw === 'ok' || raw === 'success') {
|
||||
return 'done';
|
||||
}
|
||||
if (raw === 'in_progress' || raw === 'running' || raw === 'active' || raw === 'processing') {
|
||||
return 'in_progress';
|
||||
}
|
||||
if (raw === 'error' || raw === 'failed' || raw === 'cancelled' || raw === 'aborted') {
|
||||
return 'error';
|
||||
}
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
function trackStatusTagMeta(value) {
|
||||
const normalized = normalizeTrackStageStatus(value);
|
||||
if (normalized === 'done') {
|
||||
return { label: 'Fertig', severity: 'success' };
|
||||
}
|
||||
if (normalized === 'in_progress') {
|
||||
return { label: 'Läuft', severity: 'info' };
|
||||
}
|
||||
if (normalized === 'error') {
|
||||
return { label: 'Fehler', severity: 'danger' };
|
||||
}
|
||||
return { label: 'Offen', severity: 'secondary' };
|
||||
}
|
||||
|
||||
function normalizeScriptId(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed) || parsed <= 0) {
|
||||
return null;
|
||||
}
|
||||
return Math.trunc(parsed);
|
||||
}
|
||||
|
||||
function normalizeChainId(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed) || parsed <= 0) {
|
||||
return null;
|
||||
}
|
||||
return Math.trunc(parsed);
|
||||
}
|
||||
|
||||
function normalizeIdList(values, kind = 'script') {
|
||||
const list = Array.isArray(values) ? values : [];
|
||||
const seen = new Set();
|
||||
const output = [];
|
||||
for (const value of list) {
|
||||
const normalized = kind === 'chain' ? normalizeChainId(value) : normalizeScriptId(value);
|
||||
if (normalized === null) {
|
||||
continue;
|
||||
}
|
||||
const key = String(normalized);
|
||||
if (seen.has(key)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(key);
|
||||
output.push(normalized);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function buildEncodeItemsFromConfig(config, phase) {
|
||||
const source = config && typeof config === 'object' ? config : {};
|
||||
const prefix = phase === 'post' ? 'post' : 'pre';
|
||||
const explicitItems = Array.isArray(source[`${prefix}EncodeItems`]) ? source[`${prefix}EncodeItems`] : [];
|
||||
const fromExplicit = explicitItems
|
||||
.map((item) => {
|
||||
const type = String(item?.type || '').trim().toLowerCase();
|
||||
if (type !== 'script' && type !== 'chain') {
|
||||
return null;
|
||||
}
|
||||
const id = type === 'chain'
|
||||
? normalizeChainId(item?.id ?? item?.chainId)
|
||||
: normalizeScriptId(item?.id ?? item?.scriptId);
|
||||
if (!id) {
|
||||
return null;
|
||||
}
|
||||
return { type, id };
|
||||
})
|
||||
.filter(Boolean);
|
||||
if (fromExplicit.length > 0) {
|
||||
return fromExplicit;
|
||||
}
|
||||
const scriptIds = normalizeIdList(source[`${prefix}EncodeScriptIds`], 'script');
|
||||
const chainIds = normalizeIdList(source[`${prefix}EncodeChainIds`], 'chain');
|
||||
return [
|
||||
...scriptIds.map((id) => ({ type: 'script', id })),
|
||||
...chainIds.map((id) => ({ type: 'chain', id }))
|
||||
];
|
||||
}
|
||||
|
||||
function FormatField({ field, value, onChange, disabled }) {
|
||||
if (field.type === 'slider') {
|
||||
return (
|
||||
@@ -230,6 +128,7 @@ export default function AudiobookConfigPanel({
|
||||
pipeline,
|
||||
onStart,
|
||||
onCancel,
|
||||
onRetry,
|
||||
onDeleteJob,
|
||||
busy
|
||||
}) {
|
||||
@@ -250,18 +149,6 @@ export default function AudiobookConfigPanel({
|
||||
const [formatOptions, setFormatOptions] = useState(() => buildFormatOptions(initialFormat, audiobookConfig?.formatOptions));
|
||||
const [editableChapters, setEditableChapters] = useState(() => normalizeEditableChapters(chapters));
|
||||
const [descriptionDialogVisible, setDescriptionDialogVisible] = useState(false);
|
||||
const [scriptCatalog, setScriptCatalog] = useState([]);
|
||||
const [chainCatalog, setChainCatalog] = useState([]);
|
||||
const [preRipItems, setPreRipItems] = useState([]);
|
||||
const [postRipItems, setPostRipItems] = useState([]);
|
||||
const audiobookConfigKey = JSON.stringify({
|
||||
preEncodeScriptIds: normalizeIdList(audiobookConfig?.preEncodeScriptIds, 'script'),
|
||||
postEncodeScriptIds: normalizeIdList(audiobookConfig?.postEncodeScriptIds, 'script'),
|
||||
preEncodeChainIds: normalizeIdList(audiobookConfig?.preEncodeChainIds, 'chain'),
|
||||
postEncodeChainIds: normalizeIdList(audiobookConfig?.postEncodeChainIds, 'chain'),
|
||||
preEncodeItems: Array.isArray(audiobookConfig?.preEncodeItems) ? audiobookConfig.preEncodeItems : [],
|
||||
postEncodeItems: Array.isArray(audiobookConfig?.postEncodeItems) ? audiobookConfig.postEncodeItems : []
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const nextFormat = normalizeFormat(audiobookConfig?.format);
|
||||
@@ -273,51 +160,13 @@ export default function AudiobookConfigPanel({
|
||||
setEditableChapters(normalizeEditableChapters(chapters));
|
||||
}, [jobId, JSON.stringify(chapters || [])]);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const loadCatalog = async () => {
|
||||
try {
|
||||
const [scriptsResponse, chainsResponse] = await Promise.allSettled([api.getScripts(), api.getScriptChains()]);
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
const scripts = scriptsResponse.status === 'fulfilled'
|
||||
? (Array.isArray(scriptsResponse.value?.scripts) ? scriptsResponse.value.scripts : [])
|
||||
: [];
|
||||
const chains = chainsResponse.status === 'fulfilled'
|
||||
? (Array.isArray(chainsResponse.value?.chains) ? chainsResponse.value.chains : [])
|
||||
: [];
|
||||
setScriptCatalog(scripts.map((item) => ({ id: item?.id, name: item?.name })));
|
||||
setChainCatalog(chains.map((item) => ({ id: item?.id, name: item?.name })));
|
||||
} catch (_error) {
|
||||
if (!cancelled) {
|
||||
setScriptCatalog([]);
|
||||
setChainCatalog([]);
|
||||
}
|
||||
}
|
||||
};
|
||||
void loadCatalog();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setPreRipItems(buildEncodeItemsFromConfig(audiobookConfig, 'pre'));
|
||||
setPostRipItems(buildEncodeItemsFromConfig(audiobookConfig, 'post'));
|
||||
}, [jobId, audiobookConfigKey]);
|
||||
|
||||
const schema = AUDIOBOOK_FORMAT_SCHEMAS[format] || AUDIOBOOK_FORMAT_SCHEMAS.mp3;
|
||||
const canStart = Boolean(jobId) && (
|
||||
state === 'READY_TO_START'
|
||||
|| state === 'READY_TO_ENCODE'
|
||||
|| state === 'ERROR'
|
||||
|| state === 'CANCELLED'
|
||||
);
|
||||
const canStart = Boolean(jobId) && (state === 'READY_TO_START' || state === 'ERROR' || state === 'CANCELLED');
|
||||
const isRunning = state === 'ENCODING';
|
||||
const isFinished = state === 'FINISHED';
|
||||
const progress = Number.isFinite(Number(pipeline?.progress)) ? Math.max(0, Math.min(100, Number(pipeline.progress))) : 0;
|
||||
const outputPath = String(context?.outputPath || '').trim() || null;
|
||||
const isSplitOutput = format === 'mp3' || format === 'flac';
|
||||
const showEditableChapters = !(isSplitOutput && isRunning);
|
||||
const currentChapter = context?.currentChapter && typeof context.currentChapter === 'object' ? context.currentChapter : null;
|
||||
const completedChapterCount = Number(context?.completedChapterCount ?? -1);
|
||||
const chapterTotal = Number(currentChapter?.total || editableChapters.length || 0);
|
||||
@@ -333,88 +182,6 @@ export default function AudiobookConfigPanel({
|
||||
[schema, formatOptions]
|
||||
);
|
||||
|
||||
const moveEncodeItem = (phase, index, direction) => {
|
||||
const updater = phase === 'post' ? setPostRipItems : setPreRipItems;
|
||||
updater((prev) => {
|
||||
const list = Array.isArray(prev) ? [...prev] : [];
|
||||
const from = Number(index);
|
||||
const to = from + (direction === 'up' ? -1 : 1);
|
||||
if (!Number.isInteger(from) || from < 0 || from >= list.length || to < 0 || to >= list.length) {
|
||||
return list;
|
||||
}
|
||||
const [moved] = list.splice(from, 1);
|
||||
list.splice(to, 0, moved);
|
||||
return list;
|
||||
});
|
||||
};
|
||||
|
||||
const addEncodeItem = (phase, type) => {
|
||||
const normalizedType = type === 'chain' ? 'chain' : 'script';
|
||||
const updater = phase === 'post' ? setPostRipItems : setPreRipItems;
|
||||
updater((prev) => {
|
||||
const current = Array.isArray(prev) ? prev : [];
|
||||
const selectedIds = new Set(
|
||||
current
|
||||
.filter((item) => item?.type === normalizedType)
|
||||
.map((item) => normalizedType === 'chain' ? normalizeChainId(item?.id) : normalizeScriptId(item?.id))
|
||||
.filter((id) => id !== null)
|
||||
.map((id) => String(id))
|
||||
);
|
||||
const catalog = normalizedType === 'chain' ? chainCatalog : scriptCatalog;
|
||||
const candidate = (Array.isArray(catalog) ? catalog : [])
|
||||
.map((item) => normalizedType === 'chain' ? normalizeChainId(item?.id) : normalizeScriptId(item?.id))
|
||||
.find((id) => id !== null && !selectedIds.has(String(id)));
|
||||
if (candidate === undefined || candidate === null) {
|
||||
return current;
|
||||
}
|
||||
return [...current, { type: normalizedType, id: candidate }];
|
||||
});
|
||||
};
|
||||
|
||||
const changeEncodeItem = (phase, index, type, nextId) => {
|
||||
const normalizedType = type === 'chain' ? 'chain' : 'script';
|
||||
const normalizedId = normalizedType === 'chain' ? normalizeChainId(nextId) : normalizeScriptId(nextId);
|
||||
if (normalizedId === null) {
|
||||
return;
|
||||
}
|
||||
const updater = phase === 'post' ? setPostRipItems : setPreRipItems;
|
||||
updater((prev) => {
|
||||
const current = Array.isArray(prev) ? prev : [];
|
||||
const rowIndex = Number(index);
|
||||
if (!Number.isInteger(rowIndex) || rowIndex < 0 || rowIndex >= current.length) {
|
||||
return current;
|
||||
}
|
||||
const duplicate = current.some((item, itemIndex) => {
|
||||
if (itemIndex === rowIndex) {
|
||||
return false;
|
||||
}
|
||||
if (item?.type !== normalizedType) {
|
||||
return false;
|
||||
}
|
||||
const existingId = normalizedType === 'chain' ? normalizeChainId(item?.id) : normalizeScriptId(item?.id);
|
||||
return existingId !== null && String(existingId) === String(normalizedId);
|
||||
});
|
||||
if (duplicate) {
|
||||
return current;
|
||||
}
|
||||
const next = [...current];
|
||||
next[rowIndex] = { type: normalizedType, id: normalizedId };
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const removeEncodeItem = (phase, index) => {
|
||||
const updater = phase === 'post' ? setPostRipItems : setPreRipItems;
|
||||
updater((prev) => {
|
||||
const current = Array.isArray(prev) ? prev : [];
|
||||
const rowIndex = Number(index);
|
||||
if (!Number.isInteger(rowIndex) || rowIndex < 0 || rowIndex >= current.length) {
|
||||
return current;
|
||||
}
|
||||
return current.filter((_, itemIndex) => itemIndex !== rowIndex);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="audiobook-config-panel">
|
||||
<div className="audiobook-config-head">
|
||||
@@ -450,8 +217,11 @@ export default function AudiobookConfigPanel({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="ripper-job-badges">
|
||||
<div className="audiobook-config-tags">
|
||||
<Tag value={statusLabel} severity={statusSeverity} />
|
||||
<Tag value={`Format: ${format.toUpperCase()}`} severity="info" />
|
||||
{metadata?.durationMs ? <Tag value={`Dauer: ${Math.round(Number(metadata.durationMs) / 60000)} min`} severity="secondary" /> : null}
|
||||
{posterUrl ? <Tag value="Cover erkannt" severity="success" /> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -493,316 +263,78 @@ export default function AudiobookConfigPanel({
|
||||
</small>
|
||||
</div>
|
||||
|
||||
{showEditableChapters ? (
|
||||
<div className="audiobook-config-chapters">
|
||||
<h4>Kapitel</h4>
|
||||
{editableChapters.length === 0 ? (
|
||||
<small>Keine Kapitel in der Quelle erkannt.</small>
|
||||
) : (
|
||||
<div className="audiobook-chapter-list">
|
||||
{editableChapters.map((chapter, index) => (
|
||||
<div key={`${chapter.index}-${index}`} className="audiobook-chapter-row audiobook-chapter-row-editable">
|
||||
<div className="audiobook-chapter-row-head">
|
||||
<strong>#{chapter.index || index + 1}</strong>
|
||||
<small>
|
||||
{formatChapterTime(chapter.startSeconds)} - {formatChapterTime(chapter.endSeconds)}
|
||||
</small>
|
||||
</div>
|
||||
<InputText
|
||||
value={chapter.title}
|
||||
onChange={(event) => {
|
||||
const nextTitle = event.target.value;
|
||||
setEditableChapters((prev) => prev.map((entry, entryIndex) => (
|
||||
entryIndex === index
|
||||
? { ...entry, title: nextTitle }
|
||||
: entry
|
||||
)));
|
||||
}}
|
||||
disabled={busy || isRunning}
|
||||
/>
|
||||
<div className="audiobook-config-chapters">
|
||||
<h4>Kapitel</h4>
|
||||
{editableChapters.length === 0 ? (
|
||||
<small>Keine Kapitel in der Quelle erkannt.</small>
|
||||
) : (
|
||||
<div className="audiobook-chapter-list">
|
||||
{editableChapters.map((chapter, index) => (
|
||||
<div key={`${chapter.index}-${index}`} className="audiobook-chapter-row audiobook-chapter-row-editable">
|
||||
<div className="audiobook-chapter-row-head">
|
||||
<strong>#{chapter.index || index + 1}</strong>
|
||||
<small>
|
||||
{formatChapterTime(chapter.startSeconds)} - {formatChapterTime(chapter.endSeconds)}
|
||||
</small>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
<InputText
|
||||
value={chapter.title}
|
||||
onChange={(event) => {
|
||||
const nextTitle = event.target.value;
|
||||
setEditableChapters((prev) => prev.map((entry, entryIndex) => (
|
||||
entryIndex === index
|
||||
? { ...entry, title: nextTitle }
|
||||
: entry
|
||||
)));
|
||||
}}
|
||||
disabled={busy || isRunning}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isRunning ? (
|
||||
<div className="ripper-job-row-progress" aria-label={`Audiobook Fortschritt ${Math.round(progress)}%`}>
|
||||
<ProgressBar value={progress} showValue={false} />
|
||||
<small>{Math.round(progress)}%{currentChapter ? ` | Kapitel ${currentChapter.index}/${currentChapter.total}: ${currentChapter.title}` : ''}</small>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{isSplitOutput && (isRunning || isFinished) && editableChapters.length > 0 ? (
|
||||
<div className="audiobook-chapter-status">
|
||||
<strong>Kapitel-Status ({completedChapterCount >= 0 ? completedChapterCount : (isFinished ? editableChapters.length : 0)}/{chapterTotal || editableChapters.length} fertig)</strong>
|
||||
<div className="cd-track-selection">
|
||||
<div className="cd-track-list">
|
||||
<table className="cd-track-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="check">Auswahl</th>
|
||||
<th className="num">Nr</th>
|
||||
<th className="title">Titel</th>
|
||||
<th className="duration">Länge</th>
|
||||
<th className="status">Rip</th>
|
||||
<th className="status">Encode</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{editableChapters.map((chapter, idx) => {
|
||||
const chIdx = chapter.index || idx + 1;
|
||||
const isDone = isFinished || (completedChapterCount >= 0 && chIdx <= completedChapterCount);
|
||||
const isActive = !isDone && currentChapter?.index === chIdx;
|
||||
const ripMeta = trackStatusTagMeta('done');
|
||||
const encodeMeta = trackStatusTagMeta(isDone ? 'done' : (isActive ? 'in_progress' : 'pending'));
|
||||
return (
|
||||
<tr key={chIdx} className="selected">
|
||||
<td className="check">Ja</td>
|
||||
<td className="num">{String(chIdx).padStart(2, '0')}</td>
|
||||
<td className="title">{chapter.title || '-'}</td>
|
||||
<td className="duration">{formatChapterDuration(chapter.startSeconds, chapter.endSeconds)}</td>
|
||||
<td className="status"><Tag value={ripMeta.label} severity={ripMeta.severity} /></td>
|
||||
<td className="status"><Tag value={encodeMeta.label} severity={encodeMeta.severity} /></td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="audiobook-chapter-status-list">
|
||||
{editableChapters.map((chapter, idx) => {
|
||||
const chIdx = chapter.index || idx + 1;
|
||||
const isDone = isFinished || (completedChapterCount >= 0 && chIdx <= completedChapterCount);
|
||||
const isActive = !isDone && currentChapter?.index === chIdx;
|
||||
const statusIcon = isDone ? 'pi pi-check-circle' : isActive ? 'pi pi-spin pi-spinner' : 'pi pi-circle';
|
||||
const statusClass = isDone ? 'chapter-status-done' : isActive ? 'chapter-status-active' : 'chapter-status-pending';
|
||||
return (
|
||||
<div key={chIdx} className={`audiobook-chapter-status-row ${statusClass}`}>
|
||||
<i className={statusIcon} />
|
||||
<span className="chapter-status-nr">#{String(chIdx).padStart(2, '0')}</span>
|
||||
<span className="chapter-status-title">{chapter.title}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="encode-automation-grid">
|
||||
<div className="post-script-box">
|
||||
<h4>Pre-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{preRipItems.length === 0 ? (
|
||||
<small>Keine Pre-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{preRipItems.map((item, rowIndex) => {
|
||||
const isScript = item?.type === 'script';
|
||||
const usedScriptIds = new Set(
|
||||
preRipItems
|
||||
.filter((entry, index) => entry?.type === 'script' && index !== rowIndex)
|
||||
.map((entry) => normalizeScriptId(entry?.id))
|
||||
.filter((id) => id !== null)
|
||||
.map((id) => String(id))
|
||||
);
|
||||
const usedChainIds = new Set(
|
||||
preRipItems
|
||||
.filter((entry, index) => entry?.type === 'chain' && index !== rowIndex)
|
||||
.map((entry) => normalizeChainId(entry?.id))
|
||||
.filter((id) => id !== null)
|
||||
.map((id) => String(id))
|
||||
);
|
||||
const scriptOptions = scriptCatalog.map((entry) => ({
|
||||
label: entry?.name || `Skript #${entry?.id}`,
|
||||
value: normalizeScriptId(entry?.id),
|
||||
disabled: usedScriptIds.has(String(normalizeScriptId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
const chainOptions = chainCatalog.map((entry) => ({
|
||||
label: entry?.name || `Kette #${entry?.id}`,
|
||||
value: normalizeChainId(entry?.id),
|
||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
return (
|
||||
<div key={`ab-pre-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||
<div className="cd-encode-item-order">
|
||||
<Button
|
||||
icon="pi pi-angle-up"
|
||||
severity="secondary"
|
||||
text
|
||||
rounded
|
||||
onClick={() => moveEncodeItem('pre', rowIndex, 'up')}
|
||||
disabled={busy || rowIndex <= 0}
|
||||
/>
|
||||
<Button
|
||||
icon="pi pi-angle-down"
|
||||
severity="secondary"
|
||||
text
|
||||
rounded
|
||||
onClick={() => moveEncodeItem('pre', rowIndex, 'down')}
|
||||
disabled={busy || rowIndex >= preRipItems.length - 1}
|
||||
/>
|
||||
</div>
|
||||
{isScript ? (
|
||||
<Dropdown
|
||||
value={normalizeScriptId(item?.id)}
|
||||
options={scriptOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
optionDisabled="disabled"
|
||||
onChange={(event) => changeEncodeItem('pre', rowIndex, 'script', event.value)}
|
||||
className="full-width"
|
||||
disabled={busy}
|
||||
/>
|
||||
) : (
|
||||
<Dropdown
|
||||
value={normalizeChainId(item?.id)}
|
||||
options={chainOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
optionDisabled="disabled"
|
||||
onChange={(event) => changeEncodeItem('pre', rowIndex, 'chain', event.value)}
|
||||
className="full-width"
|
||||
disabled={busy}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
severity="danger"
|
||||
outlined
|
||||
onClick={() => removeEncodeItem('pre', rowIndex)}
|
||||
disabled={busy}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > preRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > preRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung vor dem Rippen, strikt nacheinander. Bei Fehler wird der Encode abgebrochen.</small>
|
||||
{outputPath ? (
|
||||
<div className="audiobook-output-path">
|
||||
<strong>Ausgabe:</strong> <code>{outputPath}</code>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="post-script-box">
|
||||
<h4>Post-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{postRipItems.length === 0 ? (
|
||||
<small>Keine Post-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{postRipItems.map((item, rowIndex) => {
|
||||
const isScript = item?.type === 'script';
|
||||
const usedScriptIds = new Set(
|
||||
postRipItems
|
||||
.filter((entry, index) => entry?.type === 'script' && index !== rowIndex)
|
||||
.map((entry) => normalizeScriptId(entry?.id))
|
||||
.filter((id) => id !== null)
|
||||
.map((id) => String(id))
|
||||
);
|
||||
const usedChainIds = new Set(
|
||||
postRipItems
|
||||
.filter((entry, index) => entry?.type === 'chain' && index !== rowIndex)
|
||||
.map((entry) => normalizeChainId(entry?.id))
|
||||
.filter((id) => id !== null)
|
||||
.map((id) => String(id))
|
||||
);
|
||||
const scriptOptions = scriptCatalog.map((entry) => ({
|
||||
label: entry?.name || `Skript #${entry?.id}`,
|
||||
value: normalizeScriptId(entry?.id),
|
||||
disabled: usedScriptIds.has(String(normalizeScriptId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
const chainOptions = chainCatalog.map((entry) => ({
|
||||
label: entry?.name || `Kette #${entry?.id}`,
|
||||
value: normalizeChainId(entry?.id),
|
||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
return (
|
||||
<div key={`ab-post-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||
<div className="cd-encode-item-order">
|
||||
<Button
|
||||
icon="pi pi-angle-up"
|
||||
severity="secondary"
|
||||
text
|
||||
rounded
|
||||
onClick={() => moveEncodeItem('post', rowIndex, 'up')}
|
||||
disabled={busy || rowIndex <= 0}
|
||||
/>
|
||||
<Button
|
||||
icon="pi pi-angle-down"
|
||||
severity="secondary"
|
||||
text
|
||||
rounded
|
||||
onClick={() => moveEncodeItem('post', rowIndex, 'down')}
|
||||
disabled={busy || rowIndex >= postRipItems.length - 1}
|
||||
/>
|
||||
</div>
|
||||
{isScript ? (
|
||||
<Dropdown
|
||||
value={normalizeScriptId(item?.id)}
|
||||
options={scriptOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
optionDisabled="disabled"
|
||||
onChange={(event) => changeEncodeItem('post', rowIndex, 'script', event.value)}
|
||||
className="full-width"
|
||||
disabled={busy}
|
||||
/>
|
||||
) : (
|
||||
<Dropdown
|
||||
value={normalizeChainId(item?.id)}
|
||||
options={chainOptions}
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
optionDisabled="disabled"
|
||||
onChange={(event) => changeEncodeItem('post', rowIndex, 'chain', event.value)}
|
||||
className="full-width"
|
||||
disabled={busy}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
severity="danger"
|
||||
outlined
|
||||
onClick={() => removeEncodeItem('post', rowIndex)}
|
||||
disabled={busy}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > postRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > postRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung nach erfolgreichem Rippen/Encodieren, strikt nacheinander.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="actions-row" style={{ marginTop: '1rem' }}>
|
||||
<div className="actions-row">
|
||||
{canStart ? (
|
||||
<Button
|
||||
label={(state === 'READY_TO_START' || state === 'READY_TO_ENCODE')
|
||||
? 'Encode starten'
|
||||
: 'Mit diesen Einstellungen starten'}
|
||||
label={state === 'READY_TO_START' ? 'Encoding starten' : 'Mit diesen Einstellungen starten'}
|
||||
icon="pi pi-play"
|
||||
severity="success"
|
||||
onClick={() => onStart?.({
|
||||
@@ -815,23 +347,7 @@ export default function AudiobookConfigPanel({
|
||||
endSeconds: chapter.endSeconds,
|
||||
startMs: chapter.startMs,
|
||||
endMs: chapter.endMs
|
||||
})),
|
||||
selectedPreEncodeScriptIds: normalizeIdList(
|
||||
preRipItems.filter((item) => item?.type === 'script').map((item) => item?.id),
|
||||
'script'
|
||||
),
|
||||
selectedPostEncodeScriptIds: normalizeIdList(
|
||||
postRipItems.filter((item) => item?.type === 'script').map((item) => item?.id),
|
||||
'script'
|
||||
),
|
||||
selectedPreEncodeChainIds: normalizeIdList(
|
||||
preRipItems.filter((item) => item?.type === 'chain').map((item) => item?.id),
|
||||
'chain'
|
||||
),
|
||||
selectedPostEncodeChainIds: normalizeIdList(
|
||||
postRipItems.filter((item) => item?.type === 'chain').map((item) => item?.id),
|
||||
'chain'
|
||||
)
|
||||
}))
|
||||
})}
|
||||
loading={busy}
|
||||
disabled={!jobId}
|
||||
@@ -849,15 +365,28 @@ export default function AudiobookConfigPanel({
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<Button
|
||||
label="Abbrechen"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => onCancel?.()}
|
||||
loading={busy}
|
||||
disabled={!jobId}
|
||||
/>
|
||||
{isRunning ? (
|
||||
<Button
|
||||
label="Abbrechen"
|
||||
icon="pi pi-stop"
|
||||
severity="danger"
|
||||
onClick={() => onCancel?.()}
|
||||
loading={busy}
|
||||
disabled={!jobId}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{(state === 'ERROR' || state === 'CANCELLED') ? (
|
||||
<Button
|
||||
label="Retry-Job anlegen"
|
||||
icon="pi pi-refresh"
|
||||
severity="warning"
|
||||
outlined
|
||||
onClick={() => onRetry?.()}
|
||||
loading={busy}
|
||||
disabled={!jobId}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Button } from 'primereact/button';
|
||||
import { ProgressSpinner } from 'primereact/progressspinner';
|
||||
import { api } from '../api/client';
|
||||
|
||||
function formatBytes(value) {
|
||||
const n = Number(value);
|
||||
if (!Number.isFinite(n) || n <= 0) {
|
||||
return '';
|
||||
}
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
let index = 0;
|
||||
let current = n;
|
||||
while (current >= 1024 && index < units.length - 1) {
|
||||
current /= 1024;
|
||||
index += 1;
|
||||
}
|
||||
return `${current.toFixed(index <= 1 ? 0 : 1)} ${units[index]}`;
|
||||
}
|
||||
|
||||
function formatDateTime(value) {
|
||||
if (!value) {
|
||||
return '-';
|
||||
}
|
||||
const parsed = new Date(value);
|
||||
if (Number.isNaN(parsed.getTime())) {
|
||||
return '-';
|
||||
}
|
||||
return parsed.toLocaleString('de-DE');
|
||||
}
|
||||
|
||||
function getNodeByPath(root, targetPath) {
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
if ((root.path || '') === (targetPath || '')) {
|
||||
return root;
|
||||
}
|
||||
for (const child of (root.children || [])) {
|
||||
if (child.type !== 'folder') {
|
||||
continue;
|
||||
}
|
||||
const found = getNodeByPath(child, targetPath);
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function listChildren(node) {
|
||||
if (!node || !Array.isArray(node.children)) {
|
||||
return [];
|
||||
}
|
||||
return node.children;
|
||||
}
|
||||
|
||||
function buildBreadcrumb(pathValue) {
|
||||
if (!pathValue) {
|
||||
return [];
|
||||
}
|
||||
const parts = String(pathValue).split('/').filter(Boolean);
|
||||
return parts.map((part, index) => ({
|
||||
name: part,
|
||||
path: parts.slice(0, index + 1).join('/')
|
||||
}));
|
||||
}
|
||||
|
||||
function filterFolderTree(node, query) {
|
||||
if (!node || node.type !== 'folder') {
|
||||
return null;
|
||||
}
|
||||
if (!query || !query.trim()) {
|
||||
return node;
|
||||
}
|
||||
const normalized = query.toLowerCase();
|
||||
const children = (node.children || [])
|
||||
.filter((child) => child.type === 'folder')
|
||||
.map((child) => filterFolderTree(child, query))
|
||||
.filter(Boolean);
|
||||
const nameMatches = String(node.name || '').toLowerCase().includes(normalized);
|
||||
if (nameMatches || children.length > 0) {
|
||||
return { ...node, children };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function defaultExpandedSet(tree) {
|
||||
const next = new Set(['']);
|
||||
const firstLevel = Array.isArray(tree?.children) ? tree.children : [];
|
||||
for (const entry of firstLevel) {
|
||||
if (entry?.type === 'folder' && entry?.path) {
|
||||
next.add(entry.path);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
export default function AudiobookOutputExplorer({ refreshToken = 0 }) {
|
||||
const [tree, setTree] = useState(null);
|
||||
const [outputDir, setOutputDir] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState('');
|
||||
const [currentPath, setCurrentPath] = useState('');
|
||||
const [expandedFolders, setExpandedFolders] = useState(() => new Set(['']));
|
||||
const [sidebarQuery, setSidebarQuery] = useState('');
|
||||
|
||||
const loadTree = useCallback(async () => {
|
||||
setLoading(true);
|
||||
setErrorMessage('');
|
||||
try {
|
||||
const response = await api.getAudiobookOutputTree();
|
||||
const nextTree = response?.tree || null;
|
||||
setTree(nextTree);
|
||||
setOutputDir(response?.outputDir || null);
|
||||
setExpandedFolders(defaultExpandedSet(nextTree));
|
||||
setCurrentPath('');
|
||||
} catch (error) {
|
||||
setTree(null);
|
||||
setErrorMessage(error?.message || 'Explorer konnte nicht geladen werden.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
void loadTree();
|
||||
}, [loadTree, refreshToken]);
|
||||
|
||||
const navigateTo = (pathValue) => {
|
||||
const normalized = String(pathValue || '').trim();
|
||||
const node = getNodeByPath(tree, normalized);
|
||||
if (node && node.type === 'folder') {
|
||||
setCurrentPath(normalized);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleFolder = (pathValue) => {
|
||||
const normalized = String(pathValue || '').trim();
|
||||
setExpandedFolders((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (next.has(normalized)) {
|
||||
next.delete(normalized);
|
||||
} else {
|
||||
next.add(normalized);
|
||||
}
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const renderTreeNode = (node, depth = 0) => {
|
||||
if (!node || node.type !== 'folder') {
|
||||
return null;
|
||||
}
|
||||
const key = node.path || '';
|
||||
const isExpanded = expandedFolders.has(key);
|
||||
const isCurrent = currentPath === key;
|
||||
const children = Array.isArray(node.children) ? node.children.filter((entry) => entry.type === 'folder') : [];
|
||||
|
||||
return (
|
||||
<div key={key || '__root__'} className={`tree-node depth-${depth}`}>
|
||||
<button
|
||||
type="button"
|
||||
className={`tree-row folder${isCurrent ? ' active' : ''}`}
|
||||
onClick={() => navigateTo(key)}
|
||||
>
|
||||
{children.length > 0 ? (
|
||||
<span
|
||||
className="tree-caret"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
toggleFolder(key);
|
||||
}}
|
||||
>
|
||||
<i className={`pi ${isExpanded ? 'pi-chevron-down' : 'pi-chevron-right'}`} />
|
||||
</span>
|
||||
) : (
|
||||
<span className="tree-caret disabled" aria-hidden="true" />
|
||||
)}
|
||||
<span className="tree-icon folder">
|
||||
<i className="pi pi-folder" />
|
||||
</span>
|
||||
<span className="tree-label">{node.name || 'audiobooks'}</span>
|
||||
</button>
|
||||
{isExpanded && children.map((child) => renderTreeNode(child, depth + 1))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const filteredTree = useMemo(() => filterFolderTree(tree, sidebarQuery), [tree, sidebarQuery]);
|
||||
const currentNode = getNodeByPath(tree, currentPath);
|
||||
const currentChildren = listChildren(currentNode);
|
||||
const breadcrumb = buildBreadcrumb(currentPath);
|
||||
|
||||
if (loading && !tree) {
|
||||
return (
|
||||
<div className="explorer-loading">
|
||||
<ProgressSpinner style={{ width: '2.2rem', height: '2.2rem' }} strokeWidth="5" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!tree) {
|
||||
return (
|
||||
<div className="explorer-empty">
|
||||
{errorMessage ? (
|
||||
<small className="error-text">{errorMessage}</small>
|
||||
) : (
|
||||
<small>Kein Audiobook-Output vorhanden. Ausgabepfad: <code>{outputDir || 'nicht konfiguriert'}</code></small>
|
||||
)}
|
||||
<div style={{ marginTop: '0.6rem' }}>
|
||||
<Button icon="pi pi-refresh" label="Neu laden" outlined size="small" onClick={() => void loadTree()} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="explorer audiobook-output-explorer">
|
||||
<div className="explorer-sidebar">
|
||||
<div className="explorer-toolbar sidebar-toolbar">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Ordner filtern..."
|
||||
value={sidebarQuery}
|
||||
onChange={(event) => setSidebarQuery(event.target.value)}
|
||||
className="sidebar-search"
|
||||
/>
|
||||
</div>
|
||||
<div className="sidebar-tree">
|
||||
{filteredTree ? renderTreeNode(filteredTree, 0) : <small>Keine Ordner gefunden.</small>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="explorer-main">
|
||||
<div className="explorer-toolbar">
|
||||
<Button
|
||||
icon={loading ? 'pi pi-spin pi-spinner' : 'pi pi-refresh'}
|
||||
label="Aktualisieren"
|
||||
outlined
|
||||
size="small"
|
||||
onClick={() => void loadTree()}
|
||||
disabled={loading}
|
||||
/>
|
||||
<div className="explorer-path">
|
||||
<Button text label="/" onClick={() => navigateTo('')} />
|
||||
{breadcrumb.map((crumb) => (
|
||||
<Button key={crumb.path} text label={crumb.name} onClick={() => navigateTo(crumb.path)} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="explorer-list">
|
||||
<div className="explorer-row header audiobook-output-row">
|
||||
<span>Name</span>
|
||||
<span>Größe</span>
|
||||
<span>Geändert</span>
|
||||
</div>
|
||||
|
||||
{currentChildren.length === 0 ? (
|
||||
<div className="explorer-row audiobook-output-row">
|
||||
<span>Keine Einträge in diesem Ordner.</span>
|
||||
<span />
|
||||
<span />
|
||||
</div>
|
||||
) : (
|
||||
currentChildren.map((entry) => (
|
||||
<button
|
||||
type="button"
|
||||
key={entry.path || entry.name}
|
||||
className="explorer-row audiobook-output-row"
|
||||
onClick={() => {
|
||||
if (entry.type === 'folder') {
|
||||
navigateTo(entry.path);
|
||||
}
|
||||
}}
|
||||
style={{ cursor: entry.type === 'folder' ? 'pointer' : 'default' }}
|
||||
>
|
||||
<span style={{ display: 'inline-flex', alignItems: 'center', gap: '0.5rem' }}>
|
||||
<i className={`pi ${entry.type === 'folder' ? 'pi-folder' : 'pi-file'}`} />
|
||||
{entry.name}
|
||||
</span>
|
||||
<span>{entry.type === 'file' ? (formatBytes(entry.size) || '-') : '-'}</span>
|
||||
<span>{formatDateTime(entry.mtime)}</span>
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="explorer-footer">
|
||||
<small>
|
||||
Root: <code>{outputDir || '-'}</code>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { FileUpload } from 'primereact/fileupload';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Tag } from 'primereact/tag';
|
||||
import { ProgressBar } from 'primereact/progressbar';
|
||||
import { Toast } from 'primereact/toast';
|
||||
|
||||
@@ -31,30 +32,15 @@ function normalizeJobId(value) {
|
||||
return Math.trunc(parsed);
|
||||
}
|
||||
|
||||
function extractUploadJobIdFromResponse(response) {
|
||||
const payload = response && typeof response === 'object' ? response : {};
|
||||
const result = payload?.result && typeof payload.result === 'object' ? payload.result : {};
|
||||
return (
|
||||
normalizeJobId(result?.jobId)
|
||||
|| normalizeJobId(payload?.jobId)
|
||||
|| normalizeJobId(result?.id)
|
||||
|| normalizeJobId(payload?.id)
|
||||
|| normalizeJobId(result?.job?.id)
|
||||
|| normalizeJobId(payload?.job?.id)
|
||||
|| null
|
||||
);
|
||||
}
|
||||
|
||||
export default function AudiobookUploadPanel({
|
||||
audiobookUpload,
|
||||
onAudiobookUpload,
|
||||
onCancelUpload = null,
|
||||
onUploaded = null
|
||||
}) {
|
||||
const toastRef = useRef(null);
|
||||
const fileUploadRef = useRef(null);
|
||||
const fallbackFileInputRef = useRef(null);
|
||||
const [uploadFile, setUploadFile] = useState(null);
|
||||
const [statusVisible, setStatusVisible] = useState(false);
|
||||
|
||||
const phase = String(audiobookUpload?.phase || 'idle').trim().toLowerCase();
|
||||
const uploadBusy = phase === 'uploading' || phase === 'processing';
|
||||
@@ -63,15 +49,40 @@ export default function AudiobookUploadPanel({
|
||||
: 0;
|
||||
const loadedBytes = Number(audiobookUpload?.loadedBytes || 0);
|
||||
const totalBytes = Number(audiobookUpload?.totalBytes || 0);
|
||||
const progressLabel = phase === 'processing'
|
||||
? '100% | Upload fertig, Job wird vorbereitet ...'
|
||||
: totalBytes > 0
|
||||
? `${Math.trunc(progress)}% | ${formatBytes(loadedBytes)} / ${formatBytes(totalBytes)}`
|
||||
: `${Math.trunc(progress)}%`;
|
||||
const hasHeaderStatus = phase !== 'idle' || Boolean(uploadFile);
|
||||
const canStartUpload = Boolean(uploadFile) && !uploadBusy;
|
||||
const canCancelUpload = uploadBusy && typeof onCancelUpload === 'function';
|
||||
const canClearSelection = Boolean(uploadFile) && !uploadBusy;
|
||||
const fileName = String(audiobookUpload?.fileName || '').trim()
|
||||
|| String(uploadFile?.name || '').trim()
|
||||
|| null;
|
||||
const statusTone = phase === 'error'
|
||||
? 'danger'
|
||||
: phase === 'completed'
|
||||
? 'success'
|
||||
: phase === 'processing'
|
||||
? 'info'
|
||||
: phase === 'uploading'
|
||||
? 'warning'
|
||||
: 'secondary';
|
||||
const statusLabel = phase === 'uploading'
|
||||
? 'Upload laeuft'
|
||||
: phase === 'processing'
|
||||
? 'Server verarbeitet'
|
||||
: phase === 'completed'
|
||||
? 'Bereit'
|
||||
: phase === 'error'
|
||||
? 'Fehler'
|
||||
: 'Inaktiv';
|
||||
|
||||
useEffect(() => {
|
||||
if (phase === 'idle') {
|
||||
setStatusVisible(false);
|
||||
return;
|
||||
}
|
||||
setStatusVisible(true);
|
||||
if (phase === 'completed') {
|
||||
const timer = setTimeout(() => setStatusVisible(false), 5000);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
return undefined;
|
||||
}, [phase]);
|
||||
|
||||
const handleUpload = async () => {
|
||||
if (!uploadFile) {
|
||||
@@ -85,7 +96,7 @@ export default function AudiobookUploadPanel({
|
||||
}
|
||||
try {
|
||||
const response = await onAudiobookUpload?.(uploadFile, { startImmediately: false });
|
||||
const uploadedJobId = extractUploadJobIdFromResponse(response);
|
||||
const uploadedJobId = normalizeJobId(response?.result?.jobId);
|
||||
if (uploadedJobId) {
|
||||
toastRef.current?.show({
|
||||
severity: 'success',
|
||||
@@ -105,15 +116,6 @@ export default function AudiobookUploadPanel({
|
||||
fileUploadRef.current?.clear?.();
|
||||
onUploaded?.(uploadedJobId, response);
|
||||
} catch (error) {
|
||||
if (error?.name === 'AbortError') {
|
||||
toastRef.current?.show({
|
||||
severity: 'info',
|
||||
summary: 'Upload abgebrochen',
|
||||
detail: 'Der Audiobook-Upload wurde gestoppt.',
|
||||
life: 2800
|
||||
});
|
||||
return;
|
||||
}
|
||||
toastRef.current?.show({
|
||||
severity: 'error',
|
||||
summary: 'Upload fehlgeschlagen',
|
||||
@@ -123,72 +125,6 @@ export default function AudiobookUploadPanel({
|
||||
}
|
||||
};
|
||||
|
||||
const handleFileSelected = (file) => {
|
||||
if (!file) {
|
||||
setUploadFile(null);
|
||||
return;
|
||||
}
|
||||
setUploadFile(file);
|
||||
};
|
||||
|
||||
const handleFileCleared = () => {
|
||||
setUploadFile(null);
|
||||
};
|
||||
|
||||
const handleChooseFile = () => {
|
||||
if (uploadBusy) {
|
||||
return;
|
||||
}
|
||||
fallbackFileInputRef.current?.click();
|
||||
};
|
||||
|
||||
const handleFileItemAction = (onRemove = null) => {
|
||||
if (canCancelUpload) {
|
||||
void onCancelUpload();
|
||||
onRemove?.();
|
||||
fileUploadRef.current?.clear?.();
|
||||
handleFileCleared();
|
||||
return;
|
||||
}
|
||||
onRemove?.();
|
||||
fileUploadRef.current?.clear?.();
|
||||
handleFileCleared();
|
||||
};
|
||||
|
||||
const renderFileRow = (file, onRemove = null) => (
|
||||
<div className="aax-file-item">
|
||||
<i className="pi pi-headphones aax-file-icon" />
|
||||
<div className="aax-file-info">
|
||||
<span className="aax-file-name" title={file?.name}>{file?.name || 'upload.aax'}</span>
|
||||
<small>{formatBytes(Number(file?.size || 0))}</small>
|
||||
{hasHeaderStatus ? (
|
||||
<div className="aax-file-status">
|
||||
<>
|
||||
<small className="audiobook-upload-inline-text">{progressLabel}</small>
|
||||
<ProgressBar value={progress} showValue={false} />
|
||||
{audiobookUpload?.statusText ? (
|
||||
<small className="audiobook-upload-inline-text">{audiobookUpload.statusText}</small>
|
||||
) : null}
|
||||
</>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
text
|
||||
rounded
|
||||
severity="danger"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
handleFileItemAction(onRemove);
|
||||
}}
|
||||
disabled={!canCancelUpload && !canClearSelection}
|
||||
tooltip={canCancelUpload ? 'Upload abbrechen' : 'Auswahl entfernen'}
|
||||
tooltipOptions={{ position: 'left' }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="audiobook-upload-panel">
|
||||
<Toast ref={toastRef} position="top-right" />
|
||||
@@ -199,91 +135,66 @@ export default function AudiobookUploadPanel({
|
||||
customUpload
|
||||
uploadHandler={() => void handleUpload()}
|
||||
disabled={uploadBusy}
|
||||
onSelect={(event) => {
|
||||
handleFileSelected(event.files[0] || null);
|
||||
}}
|
||||
onClear={() => {
|
||||
handleFileCleared();
|
||||
}}
|
||||
onRemove={() => {
|
||||
handleFileCleared();
|
||||
}}
|
||||
onSelect={(event) => setUploadFile(event.files[0] || null)}
|
||||
onClear={() => setUploadFile(null)}
|
||||
onRemove={() => setUploadFile(null)}
|
||||
chooseOptions={{ icon: 'pi pi-images', iconOnly: true, className: 'p-button-rounded p-button-outlined' }}
|
||||
uploadOptions={{ icon: 'pi pi-cloud-upload', iconOnly: true, className: 'p-button-rounded p-button-outlined p-button-success' }}
|
||||
cancelOptions={{ icon: 'pi pi-times', iconOnly: true, className: 'p-button-rounded p-button-outlined p-button-danger' }}
|
||||
headerTemplate={(options) => (
|
||||
<div className={options.className}>
|
||||
<div className="audiobook-upload-header">
|
||||
<div className="audiobook-upload-header-actions">
|
||||
<Button
|
||||
icon="pi pi-images"
|
||||
rounded
|
||||
outlined
|
||||
aria-label="Datei auswählen"
|
||||
onClick={() => {
|
||||
void handleChooseFile();
|
||||
}}
|
||||
disabled={uploadBusy}
|
||||
/>
|
||||
<Button
|
||||
icon="pi pi-cloud-upload"
|
||||
rounded
|
||||
outlined
|
||||
severity="success"
|
||||
aria-label="Upload starten"
|
||||
onClick={() => {
|
||||
void handleUpload();
|
||||
}}
|
||||
disabled={!canStartUpload}
|
||||
/>
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
rounded
|
||||
outlined
|
||||
severity="secondary"
|
||||
aria-label="Auswahl entfernen"
|
||||
onClick={() => {
|
||||
fileUploadRef.current?.clear?.();
|
||||
handleFileCleared();
|
||||
}}
|
||||
disabled={!canClearSelection}
|
||||
/>
|
||||
</div>
|
||||
itemTemplate={(file, options) => (
|
||||
<div className="aax-file-item">
|
||||
<i className="pi pi-headphones aax-file-icon" />
|
||||
<div className="aax-file-info">
|
||||
<span className="aax-file-name" title={file.name}>{file.name}</span>
|
||||
<small>{options.formatSize}</small>
|
||||
</div>
|
||||
<Button
|
||||
icon="pi pi-times"
|
||||
text
|
||||
rounded
|
||||
severity="danger"
|
||||
size="small"
|
||||
onClick={options.onRemove}
|
||||
disabled={uploadBusy}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
itemTemplate={(file, options) => (
|
||||
renderFileRow(file, () => {
|
||||
options.onRemove?.();
|
||||
})
|
||||
)}
|
||||
emptyTemplate={() => (
|
||||
uploadFile
|
||||
? renderFileRow(uploadFile, () => {
|
||||
// handled by handleFileItemAction
|
||||
})
|
||||
: (
|
||||
<div className="aax-drop-zone">
|
||||
<i className="pi pi-headphones aax-drop-icon" />
|
||||
<p>AAX-Datei hier ablegen</p>
|
||||
<small>oder oben "Auswaehlen" klicken</small>
|
||||
</div>
|
||||
)
|
||||
<div className="aax-drop-zone">
|
||||
<i className="pi pi-headphones aax-drop-icon" />
|
||||
<p>AAX-Datei hier ablegen</p>
|
||||
<small>oder oben "Auswaehlen" klicken</small>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
<input
|
||||
ref={fallbackFileInputRef}
|
||||
type="file"
|
||||
accept=".aax,audio/vnd.audible.aax"
|
||||
style={{ display: 'none' }}
|
||||
onChange={(event) => {
|
||||
const file = event.target?.files?.[0] || null;
|
||||
handleFileSelected(file);
|
||||
if (event.target) {
|
||||
event.target.value = '';
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
{statusVisible ? (
|
||||
<div className={`audiobook-upload-status tone-${statusTone}`}>
|
||||
<div className="audiobook-upload-status-head">
|
||||
<strong>{statusLabel}</strong>
|
||||
<Tag value={statusLabel} severity={statusTone} />
|
||||
</div>
|
||||
{audiobookUpload?.statusText ? <small>{audiobookUpload.statusText}</small> : null}
|
||||
{fileName ? (
|
||||
<small className="audiobook-upload-file" title={fileName}>
|
||||
Datei: {fileName}
|
||||
</small>
|
||||
) : null}
|
||||
<div
|
||||
className="ripper-job-row-progress audiobook-upload-progress"
|
||||
aria-label={`Audiobook Upload ${Math.round(progress)} Prozent`}
|
||||
>
|
||||
<ProgressBar value={progress} showValue={false} />
|
||||
<small>
|
||||
{phase === 'processing'
|
||||
? '100% | Upload fertig, Job wird vorbereitet ...'
|
||||
: totalBytes > 0
|
||||
? `${Math.round(progress)}% | ${formatBytes(loadedBytes)} / ${formatBytes(totalBytes)}`
|
||||
: `${Math.round(progress)}%`}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -142,10 +142,7 @@ export default function CdMetadataDialog({
|
||||
const searchRunId = searchRunRef.current + 1;
|
||||
searchRunRef.current = searchRunId;
|
||||
try {
|
||||
const expectedTrackCount = Array.isArray(tocTracks) ? tocTracks.length : 0;
|
||||
const searchResults = await onSearch(trimmedQuery, {
|
||||
trackCount: expectedTrackCount > 0 ? expectedTrackCount : null
|
||||
});
|
||||
const searchResults = await onSearch(trimmedQuery);
|
||||
const normalizedResults = Array.isArray(searchResults) ? searchResults : [];
|
||||
await Promise.all(normalizedResults.map((item) => preloadCoverImage(item?.coverArtUrl)));
|
||||
if (searchRunRef.current !== searchRunId) {
|
||||
@@ -267,7 +264,6 @@ export default function CdMetadataDialog({
|
||||
emptyMessage="Keine Treffer"
|
||||
>
|
||||
<Column header="Album" body={mbTitleBody} />
|
||||
<Column field="trackCount" header="Tracks" style={{ width: '6rem' }} />
|
||||
<Column field="year" header="Jahr" style={{ width: '6rem' }} />
|
||||
<Column field="country" header="Land" style={{ width: '6rem' }} />
|
||||
</DataTable>
|
||||
|
||||
@@ -115,8 +115,11 @@ function formatProgressLabel(value) {
|
||||
return '0%';
|
||||
}
|
||||
const clamped = Math.max(0, Math.min(100, parsed));
|
||||
const whole = Math.trunc(clamped);
|
||||
return `${whole}%`;
|
||||
const rounded = Math.round(clamped * 10) / 10;
|
||||
if (Number.isInteger(rounded)) {
|
||||
return `${rounded}%`;
|
||||
}
|
||||
return `${rounded.toFixed(1)}%`;
|
||||
}
|
||||
|
||||
function normalizeTrackStageStatus(value) {
|
||||
@@ -239,7 +242,6 @@ export default function CdRipConfigPanel({
|
||||
const selectedMeta = context.selectedMetadata || {};
|
||||
const state = String(pipeline?.state || '').trim().toUpperCase();
|
||||
const jobId = normalizePosition(context?.jobId);
|
||||
const isPostRipWorkflow = context?.skipRip === true;
|
||||
|
||||
const isRipping = state === 'CD_RIPPING' || state === 'CD_ENCODING';
|
||||
const isFinished = state === 'FINISHED';
|
||||
@@ -615,7 +617,7 @@ export default function CdRipConfigPanel({
|
||||
}).length;
|
||||
const progress = Number(pipeline?.progress ?? 0);
|
||||
const clampedProgress = Math.max(0, Math.min(100, progress));
|
||||
const wholeProgress = Math.trunc(clampedProgress);
|
||||
const roundedProgress = Math.round(clampedProgress * 10) / 10;
|
||||
const eta = String(pipeline?.eta || '').trim();
|
||||
const statusText = String(pipeline?.statusText || '').trim();
|
||||
const stateLabel = getStatusLabel(state);
|
||||
@@ -663,7 +665,6 @@ export default function CdRipConfigPanel({
|
||||
|| ''
|
||||
) || null;
|
||||
const devicePath = normalizeTrackText(context?.devicePath) || '-';
|
||||
const rawPath = normalizeTrackText(context?.rawPath) || '-';
|
||||
const outputPath = normalizeTrackText(context?.outputPath) || '-';
|
||||
const formatValue = String(cdRipConfig?.format || '').trim().toLowerCase();
|
||||
const formatLabel = (Array.isArray(CD_FORMATS)
|
||||
@@ -792,14 +793,12 @@ export default function CdRipConfigPanel({
|
||||
{isRipping ? (
|
||||
<div className="progress-wrap">
|
||||
<ProgressBar
|
||||
value={wholeProgress}
|
||||
value={roundedProgress}
|
||||
showValue
|
||||
displayValueTemplate={(value) => formatProgressLabel(value)}
|
||||
/>
|
||||
<small>
|
||||
{isPostRipWorkflow
|
||||
? `Fortschritt: ${formatProgressLabel(wholeProgress)} | ${livePhaseLabel} ${completedRipCount}/${selectedTrackRows.length || effectiveTrackRows.length} Rip | ${completedEncodeCount}/${selectedTrackRows.length || effectiveTrackRows.length} Encode`
|
||||
: `Fortschritt: ${formatProgressLabel(wholeProgress)}`}
|
||||
{`Fortschritt: ${formatProgressLabel(roundedProgress)} | ${livePhaseLabel} ${completedRipCount}/${selectedTrackRows.length || effectiveTrackRows.length} Rip | ${completedEncodeCount}/${selectedTrackRows.length || effectiveTrackRows.length} Encode`}
|
||||
</small>
|
||||
<small>{eta ? `ETA ${eta}` : 'ETA unbekannt'}</small>
|
||||
</div>
|
||||
@@ -896,30 +895,25 @@ export default function CdRipConfigPanel({
|
||||
<div><strong>Jahr:</strong> {albumYear}</div>
|
||||
<div><strong>MusicBrainz:</strong> {musicBrainzId}</div>
|
||||
<div><strong>Status:</strong> {stateLabel}</div>
|
||||
{!isRipping ? <div><strong>Format:</strong> {formatLabel}</div> : null}
|
||||
{isPostRipWorkflow ? (
|
||||
<>
|
||||
<div><strong>Rip fertig:</strong> {completedRipCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
||||
<div><strong>Encode fertig:</strong> {completedEncodeCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
||||
<div><strong>Aktueller Track:</strong> {liveCurrentTrackPosition ? String(liveCurrentTrackPosition).padStart(2, '0') : '-'}</div>
|
||||
<div><strong>Pre-Skripte:</strong> {preScriptNames.length > 0 ? preScriptNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Pre-Ketten:</strong> {preChainNames.length > 0 ? preChainNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Post-Skripte:</strong> {postScriptNames.length > 0 ? postScriptNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Post-Ketten:</strong> {postChainNames.length > 0 ? postChainNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Auswahl:</strong> {selectedTrackNumbers || '-'}</div>
|
||||
<div><strong>Gesamtdauer:</strong> {formatTotalDuration(selectedTrackDurationSec)}</div>
|
||||
</>
|
||||
) : null}
|
||||
{!isRipping ? <div><strong>Laufwerk:</strong> {devicePath}</div> : null}
|
||||
<div><strong>RAW-Pfad:</strong> {rawPath}</div>
|
||||
{!isRipping ? <div><strong>Output-Pfad:</strong> {outputPath}</div> : null}
|
||||
<div><strong>Format:</strong> {formatLabel}</div>
|
||||
<div><strong>Rip fertig:</strong> {completedRipCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
||||
<div><strong>Encode fertig:</strong> {completedEncodeCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
||||
<div><strong>Aktueller Track:</strong> {liveCurrentTrackPosition ? String(liveCurrentTrackPosition).padStart(2, '0') : '-'}</div>
|
||||
<div><strong>Pre-Skripte:</strong> {preScriptNames.length > 0 ? preScriptNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Pre-Ketten:</strong> {preChainNames.length > 0 ? preChainNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Post-Skripte:</strong> {postScriptNames.length > 0 ? postScriptNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Post-Ketten:</strong> {postChainNames.length > 0 ? postChainNames.join(' | ') : '-'}</div>
|
||||
<div><strong>Auswahl:</strong> {selectedTrackNumbers || '-'}</div>
|
||||
<div><strong>Gesamtdauer:</strong> {formatTotalDuration(selectedTrackDurationSec)}</div>
|
||||
<div><strong>Laufwerk:</strong> {devicePath}</div>
|
||||
<div><strong>Output-Pfad:</strong> {outputPath}</div>
|
||||
{lastState ? <div><strong>Letzter Pipeline-State:</strong> {lastStateLabel}</div> : null}
|
||||
{!isRipping && jobId ? <div><strong>Job-ID:</strong> #{jobId}</div> : null}
|
||||
{jobId ? <div><strong>Job-ID:</strong> #{jobId}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isPostRipWorkflow && displayTrackRows.length > 0 ? (
|
||||
{displayTrackRows.length > 0 ? (
|
||||
<div className="cd-track-selection">
|
||||
<strong>Zu rippende Tracks ({displayTrackRows.length})</strong>
|
||||
<div className="cd-track-list">
|
||||
@@ -960,58 +954,6 @@ export default function CdRipConfigPanel({
|
||||
);
|
||||
}
|
||||
|
||||
if (!isPostRipWorkflow) {
|
||||
return (
|
||||
<div className="cd-rip-config-panel">
|
||||
<div className="status-row">
|
||||
<Tag value={stateLabel} severity={stateSeverity} />
|
||||
<span>{statusText || 'Bereit'}</span>
|
||||
</div>
|
||||
<div className="cd-meta-summary">
|
||||
<strong>CD-Details</strong>
|
||||
<div className="device-meta" style={{ marginTop: '0.55rem' }}>
|
||||
<div><strong>Album:</strong> {albumTitle}</div>
|
||||
<div><strong>Interpret:</strong> {albumArtist}</div>
|
||||
<div><strong>Jahr:</strong> {albumYear}</div>
|
||||
<div><strong>MusicBrainz:</strong> {musicBrainzId}</div>
|
||||
<div><strong>Status:</strong> {stateLabel}</div>
|
||||
<div><strong>Laufwerk:</strong> {devicePath}</div>
|
||||
<div><strong>RAW-Pfad:</strong> {rawPath}</div>
|
||||
<div><strong>Output-Pfad:</strong> {outputPath}</div>
|
||||
{lastState ? <div><strong>Letzter Pipeline-State:</strong> {lastStateLabel}</div> : null}
|
||||
{jobId ? <div><strong>Job-ID:</strong> #{jobId}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="actions-row">
|
||||
<Button
|
||||
label="Rip starten"
|
||||
icon="pi pi-play"
|
||||
severity="success"
|
||||
onClick={() => handleStart({ forceSkipRip: false })}
|
||||
loading={busy}
|
||||
/>
|
||||
<Button
|
||||
label="Metadaten ändern"
|
||||
icon="pi pi-pencil"
|
||||
severity="secondary"
|
||||
onClick={() => onOpenMetadata && onOpenMetadata()}
|
||||
loading={busy}
|
||||
/>
|
||||
{jobId ? (
|
||||
<Button
|
||||
label="Job löschen"
|
||||
icon="pi pi-trash"
|
||||
severity="danger"
|
||||
outlined
|
||||
onClick={() => onDeleteJob && onDeleteJob(jobId)}
|
||||
loading={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="cd-rip-config-panel">
|
||||
<h4 style={{ marginTop: 0, marginBottom: '0.75rem' }}>CD-Rip Konfiguration</h4>
|
||||
@@ -1143,16 +1085,15 @@ export default function CdRipConfigPanel({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="encode-automation-grid">
|
||||
<div className="post-script-box">
|
||||
<h4>Pre-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{preRipItems.length === 0 ? (
|
||||
<small>Keine Pre-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{preRipItems.map((item, rowIndex) => {
|
||||
<div className="post-script-box">
|
||||
<h4>Pre-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{preRipItems.length === 0 ? (
|
||||
<small>Keine Pre-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{preRipItems.map((item, rowIndex) => {
|
||||
const isScript = item?.type === 'script';
|
||||
const usedScriptIds = new Set(
|
||||
preRipItems
|
||||
@@ -1178,8 +1119,8 @@ export default function CdRipConfigPanel({
|
||||
value: normalizeChainId(entry?.id),
|
||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
return (
|
||||
<div key={`cd-pre-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
return (
|
||||
<div key={`cd-pre-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||
<div className="cd-encode-item-order">
|
||||
<Button
|
||||
@@ -1229,43 +1170,43 @@ export default function CdRipConfigPanel({
|
||||
onClick={() => removeEncodeItem('pre', rowIndex)}
|
||||
disabled={busy}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > preRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > preRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung vor dem Rippen, strikt nacheinander. Bei Fehler wird der CD-Rip abgebrochen.</small>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > preRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > preRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('pre', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung vor dem Rippen, strikt nacheinander. Bei Fehler wird der CD-Rip abgebrochen.</small>
|
||||
</div>
|
||||
|
||||
<div className="post-script-box">
|
||||
<h4>Post-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{postRipItems.length === 0 ? (
|
||||
<small>Keine Post-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{postRipItems.map((item, rowIndex) => {
|
||||
<div className="post-script-box">
|
||||
<h4>Post-Rip Ausführungen (optional)</h4>
|
||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||
) : null}
|
||||
{postRipItems.length === 0 ? (
|
||||
<small>Keine Post-Rip Ausführungen ausgewählt.</small>
|
||||
) : null}
|
||||
{postRipItems.map((item, rowIndex) => {
|
||||
const isScript = item?.type === 'script';
|
||||
const usedScriptIds = new Set(
|
||||
postRipItems
|
||||
@@ -1291,8 +1232,8 @@ export default function CdRipConfigPanel({
|
||||
value: normalizeChainId(entry?.id),
|
||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||
})).filter((entry) => entry.value !== null);
|
||||
return (
|
||||
<div key={`cd-post-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
return (
|
||||
<div key={`cd-post-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
||||
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||
<div className="cd-encode-item-order">
|
||||
<Button
|
||||
@@ -1342,33 +1283,32 @@ export default function CdRipConfigPanel({
|
||||
onClick={() => removeEncodeItem('post', rowIndex)}
|
||||
disabled={busy}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > postRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > postRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung nach erfolgreichem Rippen/Encodieren, strikt nacheinander.</small>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="actions-row">
|
||||
{scriptCatalog.length > postRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||
<Button
|
||||
label="Skript hinzufügen"
|
||||
icon="pi pi-code"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'script')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
{chainCatalog.length > postRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||
<Button
|
||||
label="Kette hinzufügen"
|
||||
icon="pi pi-link"
|
||||
severity="secondary"
|
||||
outlined
|
||||
onClick={() => addEncodeItem('post', 'chain')}
|
||||
disabled={busy}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<small>Ausführung nach erfolgreichem Rippen/Encodieren, strikt nacheinander.</small>
|
||||
</div>
|
||||
|
||||
{/* Actions */}
|
||||
|
||||
@@ -154,59 +154,6 @@ function deriveAudioTracks(plan) {
|
||||
return [];
|
||||
}
|
||||
|
||||
function normalizePositiveInt(value) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed) || parsed <= 0) {
|
||||
return null;
|
||||
}
|
||||
return Math.trunc(parsed);
|
||||
}
|
||||
|
||||
function buildVideoMetadataPayload(sourceMetadata, fallbackTitle = '') {
|
||||
const source = sourceMetadata && typeof sourceMetadata === 'object' ? sourceMetadata : {};
|
||||
const normalized = {
|
||||
title: String(source?.title || fallbackTitle || '').trim() || null,
|
||||
year: Number.isFinite(Number(source?.year)) ? Math.trunc(Number(source.year)) : null,
|
||||
imdbId: String(source?.imdbId || '').trim() || null,
|
||||
poster: String(source?.poster || '').trim() || null
|
||||
};
|
||||
|
||||
const metadataProvider = String(source?.metadataProvider || '').trim() || null;
|
||||
const workflowKind = String(source?.workflowKind || '').trim() || null;
|
||||
const providerId = String(source?.providerId || '').trim() || null;
|
||||
const metadataKind = String(source?.metadataKind || '').trim() || null;
|
||||
const seasonName = String(source?.seasonName || '').trim() || null;
|
||||
const imdbRating = String(source?.imdbRating || '').trim() || null;
|
||||
const tmdbId = normalizePositiveInt(source?.tmdbId);
|
||||
const seasonNumber = normalizePositiveInt(source?.seasonNumber);
|
||||
const discNumber = normalizePositiveInt(source?.discNumber);
|
||||
const episodeCount = Number(source?.episodeCount || 0);
|
||||
const voteAverageRaw = Number(source?.voteAverage || 0);
|
||||
const voteAverage = Number.isFinite(voteAverageRaw) && voteAverageRaw > 0
|
||||
? Number(voteAverageRaw.toFixed(1))
|
||||
: null;
|
||||
const episodes = Array.isArray(source?.episodes) ? source.episodes : [];
|
||||
const tmdbDetails = source?.tmdbDetails && typeof source.tmdbDetails === 'object' && !Array.isArray(source.tmdbDetails)
|
||||
? source.tmdbDetails
|
||||
: null;
|
||||
|
||||
if (metadataProvider) normalized.metadataProvider = metadataProvider;
|
||||
if (workflowKind) normalized.workflowKind = workflowKind;
|
||||
if (providerId) normalized.providerId = providerId;
|
||||
if (metadataKind) normalized.metadataKind = metadataKind;
|
||||
if (tmdbId) normalized.tmdbId = tmdbId;
|
||||
if (seasonNumber) normalized.seasonNumber = seasonNumber;
|
||||
if (seasonName) normalized.seasonName = seasonName;
|
||||
if (discNumber) normalized.discNumber = discNumber;
|
||||
if (Number.isFinite(episodeCount) && episodeCount > 0) normalized.episodeCount = Math.trunc(episodeCount);
|
||||
if (episodes.length > 0) normalized.episodes = episodes;
|
||||
if (voteAverage !== null) normalized.voteAverage = voteAverage;
|
||||
if (imdbRating) normalized.imdbRating = imdbRating;
|
||||
if (tmdbDetails) normalized.tmdbDetails = tmdbDetails;
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
// ── Status helpers ────────────────────────────────────────────────────────────
|
||||
|
||||
function mediaTypeBadge(type) {
|
||||
@@ -313,10 +260,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
|
||||
// ── Video metadata ──────────────────────────────────────────────────────────
|
||||
const [videoMetadata, setVideoMetadata] = useState(() => ({
|
||||
...buildVideoMetadataPayload(
|
||||
planMetadata,
|
||||
String(job.title || job.detected_title || '').trim()
|
||||
)
|
||||
title: String(planMetadata?.title || job.title || job.detected_title || '').trim(),
|
||||
year: Number.isFinite(Number(planMetadata?.year)) ? Math.trunc(Number(planMetadata.year)) : null,
|
||||
imdbId: String(planMetadata?.imdbId || '').trim() || null,
|
||||
poster: String(planMetadata?.poster || '').trim() || null
|
||||
}));
|
||||
|
||||
// ── Script / Chain catalog ──────────────────────────────────────────────────
|
||||
@@ -431,10 +378,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
coverUrl: coverUrl || null
|
||||
}
|
||||
: {
|
||||
...buildVideoMetadataPayload(
|
||||
videoMetadata,
|
||||
String(job.title || job.detected_title || '').trim()
|
||||
)
|
||||
title: String(videoMetadata?.title || job.title || job.detected_title || '').trim() || null,
|
||||
year: Number.isFinite(Number(videoMetadata?.year)) ? Math.trunc(Number(videoMetadata.year)) : null,
|
||||
imdbId: String(videoMetadata?.imdbId || '').trim() || null,
|
||||
poster: String(videoMetadata?.poster || '').trim() || null
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -489,13 +436,12 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
jobId: job.id,
|
||||
detectedTitle: videoMetadata?.title || job.title || job.detected_title || '',
|
||||
selectedMetadata: {
|
||||
...videoMetadata,
|
||||
title: videoMetadata?.title || job.title || job.detected_title || '',
|
||||
year: videoMetadata?.year || null,
|
||||
imdbId: videoMetadata?.imdbId || null,
|
||||
poster: videoMetadata?.poster || null
|
||||
},
|
||||
metadataCandidates: []
|
||||
omdbCandidates: []
|
||||
}), [job.id, job.title, job.detected_title, videoMetadata]);
|
||||
|
||||
const cdMetadataDialogContext = useMemo(() => ({
|
||||
@@ -508,50 +454,31 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
}), [job.id, audioTracks, trackFields]);
|
||||
|
||||
// ── Dialog handlers ─────────────────────────────────────────────────────────
|
||||
const handleMetadataSearch = async (query, options = {}) => {
|
||||
const handleOmdbSearch = async (query) => {
|
||||
try {
|
||||
const filterRaw = String(options?.resultFilter || '').trim().toLowerCase();
|
||||
const includeMovies = filterRaw !== 'series';
|
||||
const includeSeries = filterRaw !== 'movies' && filterRaw !== 'movie';
|
||||
const [movieResponse, seriesResponse] = await Promise.all([
|
||||
includeMovies ? api.searchTmdbMovie(query) : Promise.resolve({ results: [] }),
|
||||
includeSeries ? api.searchTmdbSeries(query) : Promise.resolve({ results: [] })
|
||||
]);
|
||||
const movieRows = Array.isArray(movieResponse?.results)
|
||||
? movieResponse.results.map((row) => ({
|
||||
...row,
|
||||
workflowKind: 'film',
|
||||
metadataKind: 'movie',
|
||||
resultType: 'movie'
|
||||
}))
|
||||
: [];
|
||||
const seriesRows = Array.isArray(seriesResponse?.results)
|
||||
? seriesResponse.results.map((row) => ({
|
||||
...row,
|
||||
workflowKind: 'series',
|
||||
metadataKind: String(row?.metadataKind || '').trim().toLowerCase() || 'series',
|
||||
resultType: 'series'
|
||||
}))
|
||||
: [];
|
||||
return [...movieRows, ...seriesRows];
|
||||
const response = await api.searchOmdb(query);
|
||||
return Array.isArray(response?.results) ? response.results : [];
|
||||
} catch { return []; }
|
||||
};
|
||||
|
||||
const handleMetadataSubmit = async (payload) => {
|
||||
const handleOmdbSubmit = async (payload) => {
|
||||
setSearchDialogBusy(true);
|
||||
try {
|
||||
setVideoMetadata(buildVideoMetadataPayload(payload, String(job.title || job.detected_title || '').trim()));
|
||||
setVideoMetadata({
|
||||
title: String(payload?.title || job.title || job.detected_title || '').trim(),
|
||||
year: Number.isFinite(Number(payload?.year)) ? Math.trunc(Number(payload.year)) : null,
|
||||
imdbId: String(payload?.imdbId || '').trim() || null,
|
||||
poster: String(payload?.poster || '').trim() || null
|
||||
});
|
||||
setMetadataDialogVisible(false);
|
||||
} finally {
|
||||
setSearchDialogBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMusicBrainzSearchDialog = async (query, options = {}) => {
|
||||
const handleMusicBrainzSearchDialog = async (query) => {
|
||||
try {
|
||||
const response = await api.searchMusicBrainz(query, {
|
||||
trackCount: Number(options?.trackCount || 0) > 0 ? Math.trunc(Number(options.trackCount)) : null
|
||||
});
|
||||
const response = await api.searchMusicBrainz(query);
|
||||
return Array.isArray(response?.results) ? response.results : [];
|
||||
} catch { return []; }
|
||||
};
|
||||
@@ -715,10 +642,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
coverUrl: coverUrl || null
|
||||
}
|
||||
: {
|
||||
...buildVideoMetadataPayload(
|
||||
videoMetadata,
|
||||
String(job.title || job.detected_title || '').trim()
|
||||
)
|
||||
title: String(videoMetadata?.title || job.title || job.detected_title || '').trim() || null,
|
||||
year: Number.isFinite(Number(videoMetadata?.year)) ? Math.trunc(Number(videoMetadata.year)) : null,
|
||||
imdbId: String(videoMetadata?.imdbId || '').trim() || null,
|
||||
poster: String(videoMetadata?.poster || '').trim() || null
|
||||
};
|
||||
|
||||
await api.startConverterJob(job.id, {
|
||||
@@ -953,10 +880,8 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
)}
|
||||
|
||||
{/* Pre / Post Ausführungen */}
|
||||
<div className="encode-automation-grid">
|
||||
{renderEncodeSection('pre', preItems)}
|
||||
{renderEncodeSection('post', postItems)}
|
||||
</div>
|
||||
{renderEncodeSection('pre', preItems)}
|
||||
{renderEncodeSection('post', postItems)}
|
||||
|
||||
{/* Aktionen */}
|
||||
<div className="actions-row" style={{ marginTop: '1rem' }}>
|
||||
@@ -1015,9 +940,9 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
{isVideo && (
|
||||
<div className="converter-job-card-actions" style={{ marginTop: 0 }}>
|
||||
<Button
|
||||
label="Metadaten neu zuweisen"
|
||||
label="OMDb neu zuordnen"
|
||||
icon="pi pi-search"
|
||||
severity="info"
|
||||
severity="secondary"
|
||||
outlined
|
||||
size="small"
|
||||
onClick={() => setMetadataDialogVisible(true)}
|
||||
@@ -1100,8 +1025,8 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
||||
visible={metadataDialogVisible}
|
||||
context={metadataDialogContext}
|
||||
onHide={() => setMetadataDialogVisible(false)}
|
||||
onSubmit={handleMetadataSubmit}
|
||||
onSearch={handleMetadataSearch}
|
||||
onSubmit={handleOmdbSubmit}
|
||||
onSearch={handleOmdbSearch}
|
||||
busy={searchDialogBusy}
|
||||
/>
|
||||
</div>
|
||||
@@ -1146,7 +1071,7 @@ export default function ConverterJobCard({
|
||||
const liveProgress = jobProgress?.progress ?? null;
|
||||
const liveEta = jobProgress?.eta || null;
|
||||
const liveStatusText = jobProgress?.statusText || null;
|
||||
const progressValue = liveProgress !== null ? Math.trunc(liveProgress) : null;
|
||||
const progressValue = liveProgress !== null ? Math.round(liveProgress) : null;
|
||||
|
||||
// ── Audio details (for active/terminal state) ─────────────────────────────
|
||||
const audioTracks = isAudio ? deriveAudioTracks(plan) : [];
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function ConverterUploadPanel({ onUploaded, allowedExtensions = n
|
||||
// XHR für Upload-Fortschritt
|
||||
const result = await uploadWithProgress(formData, (pct) => {
|
||||
setProgress(pct);
|
||||
setStatusText(`Upload: ${Math.trunc(pct)}%`);
|
||||
setStatusText(`Upload: ${Math.round(pct)}%`);
|
||||
});
|
||||
|
||||
setPhase('done');
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Dropdown } from 'primereact/dropdown';
|
||||
import { InputSwitch } from 'primereact/inputswitch';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { api } from '../api/client';
|
||||
import { useWebSocket } from '../hooks/useWebSocket';
|
||||
import { confirmModal } from '../utils/confirmModal';
|
||||
|
||||
// ── Hilfsfunktionen ──────────────────────────────────────────────────────────
|
||||
@@ -62,7 +61,7 @@ const EMPTY_FORM = {
|
||||
|
||||
// ── Hauptkomponente ───────────────────────────────────────────────────────────
|
||||
|
||||
export default function CronJobsTab() {
|
||||
export default function CronJobsTab({ onWsMessage }) {
|
||||
const toastRef = useRef(null);
|
||||
|
||||
const [jobs, setJobs] = useState([]);
|
||||
@@ -90,7 +89,6 @@ export default function CronJobsTab() {
|
||||
|
||||
// Aktionen Busy-State per Job-ID
|
||||
const [busyId, setBusyId] = useState(null);
|
||||
const wsReloadTimerRef = useRef(null);
|
||||
|
||||
// ── Daten laden ──────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -137,16 +135,6 @@ export default function CronJobsTab() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const scheduleLoadAll = (delayMs = 120) => {
|
||||
if (wsReloadTimerRef.current) {
|
||||
return;
|
||||
}
|
||||
wsReloadTimerRef.current = setTimeout(() => {
|
||||
wsReloadTimerRef.current = null;
|
||||
void loadAll();
|
||||
}, delayMs);
|
||||
};
|
||||
|
||||
const activeCronRunByJobId = useMemo(() => {
|
||||
const map = new Map();
|
||||
for (const item of activeCronRuns) {
|
||||
@@ -158,28 +146,11 @@ export default function CronJobsTab() {
|
||||
return map;
|
||||
}, [activeCronRuns]);
|
||||
|
||||
useEffect(() => () => {
|
||||
if (wsReloadTimerRef.current) {
|
||||
clearTimeout(wsReloadTimerRef.current);
|
||||
wsReloadTimerRef.current = null;
|
||||
}
|
||||
}, []);
|
||||
|
||||
useWebSocket({
|
||||
onMessage: (message) => {
|
||||
const type = String(message?.type || '').trim().toUpperCase();
|
||||
if (!type) {
|
||||
return;
|
||||
}
|
||||
if (type === 'RUNTIME_ACTIVITY_CHANGED') {
|
||||
setActiveCronRuns(normalizeActiveCronRuns(message?.payload));
|
||||
return;
|
||||
}
|
||||
if (type === 'CRON_JOBS_UPDATED' || type === 'CRON_JOB_UPDATED') {
|
||||
scheduleLoadAll(80);
|
||||
}
|
||||
}
|
||||
});
|
||||
// WebSocket: Cronjob-Updates empfangen
|
||||
useEffect(() => {
|
||||
if (!onWsMessage) return;
|
||||
// onWsMessage ist eine Funktion, die wir anmelden
|
||||
}, [onWsMessage]);
|
||||
|
||||
// ── Cron-Ausdruck validieren (debounced) ─────────────────────────────────────
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@ const GENERAL_TOOL_KEYS = new Set([
|
||||
'makemkv_command',
|
||||
'makemkv_registration_key',
|
||||
'makemkv_min_length_minutes',
|
||||
'playlist_tmdb_runtime_subtract_percent',
|
||||
'mediainfo_command',
|
||||
'handbrake_command',
|
||||
'ffmpeg_command',
|
||||
'mkvmerge_command',
|
||||
'ffprobe_command',
|
||||
'handbrake_restart_delete_incomplete_output',
|
||||
'script_test_timeout_ms'
|
||||
@@ -58,11 +56,7 @@ const ALWAYS_HIDDEN_SETTING_KEYS = new Set([
|
||||
'makemkv_rip_mode',
|
||||
'makemkv_rip_mode_bluray',
|
||||
'makemkv_rip_mode_dvd',
|
||||
'makemkv_backup_mode',
|
||||
'handbrake_review_audio_languages_bluray',
|
||||
'handbrake_review_subtitle_languages_bluray',
|
||||
'handbrake_review_audio_languages_dvd',
|
||||
'handbrake_review_subtitle_languages_dvd'
|
||||
'makemkv_backup_mode'
|
||||
]);
|
||||
const EXPERT_ONLY_SETTING_KEYS = new Set([
|
||||
'pushover_device',
|
||||
@@ -82,9 +76,6 @@ const EXPERT_ONLY_SETTING_KEYS = new Set([
|
||||
'cdparanoia_command',
|
||||
'script_test_timeout_ms'
|
||||
]);
|
||||
const EXPERT_ONLY_CATEGORY_NAMES = new Set([
|
||||
'logging'
|
||||
]);
|
||||
|
||||
function toBoolean(value) {
|
||||
if (typeof value === 'boolean') {
|
||||
@@ -443,14 +434,6 @@ function filterSettingsByVisibility(settings, expertModeEnabled) {
|
||||
return list.filter((setting) => !shouldHideSettingByExpertMode(setting?.key, expertModeEnabled));
|
||||
}
|
||||
|
||||
function shouldHideCategoryByExpertMode(categoryName, expertModeEnabled) {
|
||||
const normalizedCategory = normalizeText(categoryName);
|
||||
if (!normalizedCategory) {
|
||||
return false;
|
||||
}
|
||||
return !expertModeEnabled && EXPERT_ONLY_CATEGORY_NAMES.has(normalizedCategory);
|
||||
}
|
||||
|
||||
function buildToolSections(settings) {
|
||||
const list = Array.isArray(settings) ? settings : [];
|
||||
const generalBucket = {
|
||||
@@ -518,15 +501,7 @@ function buildToolSections(settings) {
|
||||
}
|
||||
|
||||
// Path keys per medium — _owner keys are rendered inline
|
||||
const BLURAY_PATH_KEYS = [
|
||||
'raw_dir_bluray',
|
||||
'raw_dir_bluray_series',
|
||||
'movie_dir_bluray',
|
||||
'series_dir_bluray',
|
||||
'output_template_bluray',
|
||||
'output_template_bluray_series_episode',
|
||||
'output_template_bluray_series_multi_episode'
|
||||
];
|
||||
const BLURAY_PATH_KEYS = ['raw_dir_bluray', 'movie_dir_bluray', 'output_template_bluray'];
|
||||
const DVD_PATH_KEYS = [
|
||||
'raw_dir_dvd',
|
||||
'raw_dir_dvd_series',
|
||||
@@ -547,15 +522,6 @@ const CONVERTER_SCAN_EXTENSION_OPTIONS = [
|
||||
'mkv', 'mp4', 'm2ts', 'iso', 'avi', 'mov',
|
||||
'flac', 'mp3', 'wav', 'm4a', 'ogg', 'opus'
|
||||
];
|
||||
const READONLY_CLI_SETTING_KEYS = new Set([
|
||||
'makemkv_command',
|
||||
'mediainfo_command',
|
||||
'handbrake_command',
|
||||
'ffmpeg_command',
|
||||
'ffprobe_command',
|
||||
'cdparanoia_command',
|
||||
'mkvmerge_command'
|
||||
]);
|
||||
|
||||
function parseConverterScanExtensions(value) {
|
||||
const tokens = String(value || '')
|
||||
@@ -656,10 +622,6 @@ function isNotificationEventToggleSetting(setting) {
|
||||
}
|
||||
|
||||
function isReadonlySetting(setting) {
|
||||
const key = normalizeSettingKey(setting?.key);
|
||||
if (READONLY_CLI_SETTING_KEYS.has(key)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
// API gibt validation als parsed object zurück, nicht validation_json als String
|
||||
const v = setting?.validation;
|
||||
@@ -670,202 +632,6 @@ function isReadonlySetting(setting) {
|
||||
}
|
||||
}
|
||||
|
||||
function MakeMKVBetaKeyHint({ disabled = false, onNotify = null, onSettingApplied = null }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [checking, setChecking] = useState(false);
|
||||
const [applying, setApplying] = useState(false);
|
||||
const [betaKey, setBetaKey] = useState('');
|
||||
const [validUntil, setValidUntil] = useState('');
|
||||
const [fetchedAt, setFetchedAt] = useState('');
|
||||
const [appliedKey, setAppliedKey] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [warning, setWarning] = useState('');
|
||||
|
||||
const loadCachedState = async () => {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
setWarning('');
|
||||
try {
|
||||
const response = await api.getMakeMKVBetaKey();
|
||||
setBetaKey(String(response?.betaKey || '').trim());
|
||||
setValidUntil(String(response?.validUntil || '').trim());
|
||||
setFetchedAt(String(response?.fetchedAt || '').trim());
|
||||
setAppliedKey(String(response?.appliedKey || '').trim());
|
||||
if (response?.stale) {
|
||||
setWarning('Zwischengespeicherter Betakey ist veraltet. Bitte bei Bedarf neu prüfen.');
|
||||
} else if (!response?.betaKey) {
|
||||
setWarning('Noch kein geprüfter Betakey im Cache. Prüfung startet nur per Button.');
|
||||
} else if (response?.appliedMatchesCache) {
|
||||
setWarning('Geprüfter Betakey ist bereits übernommen.');
|
||||
} else {
|
||||
setWarning('');
|
||||
}
|
||||
} catch (loadError) {
|
||||
setBetaKey('');
|
||||
setValidUntil('');
|
||||
setFetchedAt('');
|
||||
setAppliedKey('');
|
||||
setError(loadError?.message || 'Betakey konnte nicht geladen werden.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
void loadCachedState();
|
||||
}, []);
|
||||
|
||||
const handleCheck = async () => {
|
||||
setChecking(true);
|
||||
setError('');
|
||||
setWarning('');
|
||||
try {
|
||||
const response = await api.checkMakeMKVBetaKey();
|
||||
const nextKey = String(response?.betaKey || '').trim();
|
||||
setBetaKey(nextKey);
|
||||
setValidUntil(String(response?.validUntil || '').trim());
|
||||
setFetchedAt(String(response?.fetchedAt || '').trim());
|
||||
setWarning('');
|
||||
if (typeof onNotify === 'function') {
|
||||
onNotify({
|
||||
severity: 'success',
|
||||
summary: 'MakeMKV Betakey',
|
||||
detail: nextKey ? 'Betakey erfolgreich geprüft.' : 'Betakey-Prüfung abgeschlossen.'
|
||||
});
|
||||
}
|
||||
} catch (checkError) {
|
||||
setError(checkError?.message || 'Betakey konnte nicht geprüft werden.');
|
||||
if (typeof onNotify === 'function') {
|
||||
onNotify({
|
||||
severity: 'error',
|
||||
summary: 'MakeMKV Betakey',
|
||||
detail: checkError?.message || 'Betakey konnte nicht geprüft werden.'
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
setChecking(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleApply = async () => {
|
||||
if (!betaKey) {
|
||||
return;
|
||||
}
|
||||
setApplying(true);
|
||||
setError('');
|
||||
try {
|
||||
const response = await api.applyMakeMKVBetaKey({ betaKey });
|
||||
const nextAppliedKey = String(response?.betaKey || betaKey).trim();
|
||||
setAppliedKey(nextAppliedKey);
|
||||
setWarning('Geprüfter Betakey ist bereits übernommen.');
|
||||
if (typeof onSettingApplied === 'function') {
|
||||
onSettingApplied({
|
||||
key: 'makemkv_registration_key',
|
||||
value: nextAppliedKey
|
||||
});
|
||||
}
|
||||
if (typeof onNotify === 'function') {
|
||||
onNotify({
|
||||
severity: 'success',
|
||||
summary: 'MakeMKV Betakey',
|
||||
detail: 'Betakey wurde übernommen und gespeichert.'
|
||||
});
|
||||
}
|
||||
} catch (applyError) {
|
||||
setError(applyError?.message || 'Betakey konnte nicht übernommen werden.');
|
||||
if (typeof onNotify === 'function') {
|
||||
onNotify({
|
||||
severity: 'error',
|
||||
summary: 'MakeMKV Betakey',
|
||||
detail: applyError?.message || 'Betakey konnte nicht übernommen werden.'
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
setApplying(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="makemkv-beta-key-box">
|
||||
<div className="makemkv-beta-key-head">
|
||||
<span className="makemkv-beta-key-title">Betakey</span>
|
||||
<div className="settings-inline-actions">
|
||||
<Button
|
||||
type="button"
|
||||
size="small"
|
||||
text
|
||||
label="prüfen"
|
||||
disabled={disabled || loading || checking || applying}
|
||||
onClick={() => void handleCheck()}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
size="small"
|
||||
text
|
||||
label="übernehmen"
|
||||
disabled={disabled || loading || checking || applying || !betaKey || betaKey === appliedKey}
|
||||
onClick={() => void handleApply()}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{loading ? (
|
||||
<small className="setting-description">Zwischengespeicherter Betakey wird geladen…</small>
|
||||
) : null}
|
||||
{!loading && error ? (
|
||||
<small className="error-text">{error}</small>
|
||||
) : null}
|
||||
{!loading && !error && warning ? (
|
||||
<small className="setting-description">{warning}</small>
|
||||
) : null}
|
||||
{!loading && !error && fetchedAt ? (
|
||||
<small className="setting-description">Zuletzt geprüft: {new Date(fetchedAt).toLocaleString('de-DE')}</small>
|
||||
) : null}
|
||||
{!loading && !error && validUntil ? (
|
||||
<small className="setting-description">Gültig bis: {new Date(validUntil).toLocaleString('de-DE')}</small>
|
||||
) : null}
|
||||
{!loading && !error && betaKey ? (
|
||||
<code className="makemkv-beta-key-value">{betaKey}</code>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ActivationBytesCacheBox({ entries = [] }) {
|
||||
const list = Array.isArray(entries) ? entries : [];
|
||||
return (
|
||||
<section className="settings-section grouped activation-bytes-cache-box">
|
||||
<div className="settings-section-head">
|
||||
<h4>Activation Bytes Cache</h4>
|
||||
<small>Lokal gespeicherte AAX-Activation Bytes. Werden beim ersten Upload automatisch über die Audible-Tools API ermittelt.</small>
|
||||
</div>
|
||||
{list.length === 0 ? (
|
||||
<p>Keine Einträge vorhanden.</p>
|
||||
) : (
|
||||
<div className="activation-bytes-table-wrap">
|
||||
<table className="activation-bytes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Checksum</th>
|
||||
<th>Activation Bytes</th>
|
||||
<th>Gespeichert am</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{list.map((entry, index) => (
|
||||
<tr key={String(entry?.checksum || `activation-bytes-${index}`)}>
|
||||
<td>{String(entry?.checksum || '-')}</td>
|
||||
<td>{String(entry?.activation_bytes || '-')}</td>
|
||||
<td>{entry?.created_at ? new Date(entry.created_at).toLocaleString('de-DE') : '-'}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function SettingField({
|
||||
setting,
|
||||
value,
|
||||
@@ -877,15 +643,11 @@ function SettingField({
|
||||
ownerDirty,
|
||||
onChange,
|
||||
variant = 'default',
|
||||
disabled = false,
|
||||
onNotify = null,
|
||||
onSettingApplied = null
|
||||
disabled = false
|
||||
}) {
|
||||
const ownerKey = ownerSetting?.key;
|
||||
const pathHasValue = Boolean(String(value ?? '').trim());
|
||||
const isNotificationToggleBox = variant === 'notification-toggle' && setting?.type === 'boolean';
|
||||
const readonlySetting = isReadonlySetting(setting);
|
||||
const isDisabled = Boolean(disabled || readonlySetting);
|
||||
|
||||
return (
|
||||
<div className={`setting-row${isNotificationToggleBox ? ' notification-toggle-box' : ''}`}>
|
||||
@@ -898,17 +660,15 @@ function SettingField({
|
||||
<InputSwitch
|
||||
id={setting.key}
|
||||
checked={Boolean(value)}
|
||||
disabled={isDisabled}
|
||||
onChange={isDisabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
disabled={disabled}
|
||||
onChange={disabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<label htmlFor={setting.key} className={isDisabled ? 'setting-label--readonly' : undefined}>
|
||||
<label htmlFor={setting.key} className={disabled ? 'setting-label--readonly' : undefined}>
|
||||
{setting.label}
|
||||
{setting.required && <span className="required">*</span>}
|
||||
{isDisabled ? (
|
||||
<span className="setting-badge--coming-soon">{readonlySetting ? ' (gesperrt)' : ' (bald)'}</span>
|
||||
) : null}
|
||||
{disabled ? <span className="setting-badge--coming-soon"> (bald)</span> : null}
|
||||
</label>
|
||||
)}
|
||||
|
||||
@@ -919,9 +679,7 @@ function SettingField({
|
||||
<InputText
|
||||
id={setting.key}
|
||||
value={value ?? ''}
|
||||
readOnly={isDisabled}
|
||||
disabled={isDisabled}
|
||||
onChange={isDisabled ? undefined : (event) => onChange?.(setting.key, event.target.value)}
|
||||
onChange={(event) => onChange?.(setting.key, event.target.value)}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -953,8 +711,7 @@ function SettingField({
|
||||
<InputNumber
|
||||
id={setting.key}
|
||||
value={value ?? 0}
|
||||
disabled={isDisabled}
|
||||
onValueChange={isDisabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
onValueChange={(event) => onChange?.(setting.key, event.value)}
|
||||
mode="decimal"
|
||||
useGrouping={false}
|
||||
/>
|
||||
@@ -964,8 +721,8 @@ function SettingField({
|
||||
<InputSwitch
|
||||
id={setting.key}
|
||||
checked={Boolean(value)}
|
||||
disabled={isDisabled}
|
||||
onChange={isDisabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
disabled={disabled}
|
||||
onChange={disabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -977,8 +734,7 @@ function SettingField({
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
optionDisabled="disabled"
|
||||
disabled={isDisabled}
|
||||
onChange={isDisabled ? undefined : (event) => onChange?.(setting.key, event.value)}
|
||||
onChange={(event) => onChange?.(setting.key, event.value)}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -995,13 +751,6 @@ function SettingField({
|
||||
</a>
|
||||
</small>
|
||||
) : null}
|
||||
{normalizeSettingKey(setting?.key) === 'makemkv_registration_key' ? (
|
||||
<MakeMKVBetaKeyHint
|
||||
disabled={isDisabled}
|
||||
onNotify={onNotify}
|
||||
onSettingApplied={onSettingApplied}
|
||||
/>
|
||||
) : null}
|
||||
{error ? (
|
||||
<small className="error-text">{error}</small>
|
||||
) : (
|
||||
@@ -1021,8 +770,8 @@ function SettingField({
|
||||
id={ownerKey}
|
||||
value={ownerValue ?? ''}
|
||||
placeholder="z.B. michael:ripster"
|
||||
disabled={isDisabled || !pathHasValue}
|
||||
onChange={isDisabled ? undefined : (event) => onChange?.(ownerKey, event.target.value)}
|
||||
disabled={!pathHasValue}
|
||||
onChange={(event) => onChange?.(ownerKey, event.target.value)}
|
||||
/>
|
||||
{ownerError ? (
|
||||
<small className="error-text">{ownerError}</small>
|
||||
@@ -1040,16 +789,7 @@ function SettingField({
|
||||
}
|
||||
|
||||
|
||||
function PathCategoryTab({
|
||||
settings,
|
||||
values,
|
||||
errors,
|
||||
dirtyKeys,
|
||||
onChange,
|
||||
effectivePaths,
|
||||
onNotify,
|
||||
onSettingApplied
|
||||
}) {
|
||||
function PathCategoryTab({ settings, values, errors, dirtyKeys, onChange, effectivePaths }) {
|
||||
const list = Array.isArray(settings) ? settings : [];
|
||||
const settingsByKey = new Map(list.map((s) => [s.key, s]));
|
||||
|
||||
@@ -1076,9 +816,7 @@ function PathCategoryTab({
|
||||
|
||||
const ep = effectivePaths || {};
|
||||
const blurayRaw = ep.bluray?.raw || defaultRaw;
|
||||
const bluraySeriesRaw = ep.bluray?.seriesRaw || blurayRaw;
|
||||
const blurayMovies = ep.bluray?.movies || defaultMovies;
|
||||
const bluraySeries = ep.bluray?.series || defaultSeries;
|
||||
const dvdRaw = ep.dvd?.raw || defaultRaw;
|
||||
const dvdSeriesRaw = ep.dvd?.seriesRaw || dvdRaw;
|
||||
const dvdMovies = ep.dvd?.movies || defaultMovies;
|
||||
@@ -1122,17 +860,6 @@ function PathCategoryTab({
|
||||
{isDefault(blurayMovies, defaultMovies) && <span className="path-default-badge">Standard</span>}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Blu-ray Serie</strong></td>
|
||||
<td>
|
||||
<code>{bluraySeriesRaw}</code>
|
||||
{isDefault(bluraySeriesRaw, blurayRaw) && <span className="path-default-badge">wie Blu-ray RAW</span>}
|
||||
</td>
|
||||
<td>
|
||||
<code>{bluraySeries}</code>
|
||||
{isDefault(bluraySeries, defaultSeries) && <span className="path-default-badge">Standard</span>}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>DVD</strong></td>
|
||||
<td>
|
||||
@@ -1256,8 +983,6 @@ function PathCategoryTab({
|
||||
ownerError={ownerError}
|
||||
ownerDirty={ownerDirty}
|
||||
onChange={onChange}
|
||||
onNotify={onNotify}
|
||||
onSettingApplied={onSettingApplied}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -1277,14 +1002,11 @@ export default function DynamicSettingsForm({
|
||||
dirtyKeys,
|
||||
onChange,
|
||||
effectivePaths,
|
||||
activationBytes = [],
|
||||
onNotify,
|
||||
onSettingApplied
|
||||
onNotify
|
||||
}) {
|
||||
const safeCategories = Array.isArray(categories) ? categories : [];
|
||||
const expertModeEnabled = toBoolean(values?.[EXPERT_MODE_SETTING_KEY]);
|
||||
const visibleCategories = safeCategories
|
||||
.filter((category) => !shouldHideCategoryByExpertMode(category?.category, expertModeEnabled))
|
||||
.map((category) => ({
|
||||
...category,
|
||||
settings: filterSettingsByVisibility(category?.settings, expertModeEnabled)
|
||||
@@ -1364,8 +1086,6 @@ export default function DynamicSettingsForm({
|
||||
dirtyKeys={dirtyKeys}
|
||||
onChange={onChange}
|
||||
effectivePaths={effectivePaths}
|
||||
onNotify={onNotify}
|
||||
onSettingApplied={onSettingApplied}
|
||||
/>
|
||||
) : (() => {
|
||||
const sections = buildSectionsForCategory(category?.category, category?.settings || []);
|
||||
@@ -1374,7 +1094,6 @@ export default function DynamicSettingsForm({
|
||||
const pushoverEnabled = toBoolean(values?.[PUSHOVER_ENABLED_SETTING_KEY]);
|
||||
|
||||
const isDriveCategory = normalizeText(category?.category) === 'laufwerk';
|
||||
const isToolsCategory = normalizeText(category?.category) === 'tools';
|
||||
return (
|
||||
<div className="settings-sections">
|
||||
{isDriveCategory && <DetectedDrivesInfo expertModeEnabled={expertModeEnabled} onNotify={onNotify} />}
|
||||
@@ -1447,8 +1166,6 @@ export default function DynamicSettingsForm({
|
||||
onChange={onChangeFn}
|
||||
variant={variant}
|
||||
disabled={disabled}
|
||||
onNotify={onNotify}
|
||||
onSettingApplied={onSettingApplied}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -1505,7 +1222,6 @@ export default function DynamicSettingsForm({
|
||||
})()}
|
||||
</section>
|
||||
))}
|
||||
{isToolsCategory ? <ActivationBytesCacheBox entries={activationBytes} /> : null}
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user