Compare commits
210
Commits
main
..
482f7ccec1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
482f7ccec1 | ||
|
|
6636eb11df | ||
|
|
d679eface4 | ||
|
|
ff8a8f67bf | ||
|
|
730bc50715 | ||
|
|
3e5840f329 | ||
|
|
120a9e6ad1 | ||
|
|
1f0a357abf | ||
|
|
06d5a45d9c | ||
|
|
ccd6c3ab2a | ||
|
|
c27a81cdb1 | ||
|
|
caf6a638f7 | ||
|
|
720a6f5609 | ||
|
|
d423527f0a | ||
|
|
9890971ff3 | ||
|
|
010c96461c | ||
|
|
fc67e2264b | ||
|
|
bebe9eac8c | ||
|
|
f25b6e1181 | ||
|
|
07f6ee9bdf | ||
|
|
717bb305c0 | ||
|
|
c89a93ed05 | ||
|
|
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 |
No files matched your search
@@ -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.
|
|
||||||
@@ -13,16 +13,9 @@ frontend/.vite/
|
|||||||
backend/dist/
|
backend/dist/
|
||||||
dist/
|
dist/
|
||||||
build/
|
build/
|
||||||
.build/
|
|
||||||
.venv-docs/
|
|
||||||
.worktrees/
|
|
||||||
site/
|
|
||||||
.cache/
|
.cache/
|
||||||
coverage/
|
coverage/
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
third_party/handbrake/work/
|
|
||||||
third_party/handbrake/build/
|
|
||||||
!third_party/handbrake/source/*.tar.zst
|
|
||||||
|
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Runtime state / PIDs / temp
|
# Runtime state / PIDs / temp
|
||||||
@@ -90,4 +83,3 @@ Thumbs.db
|
|||||||
/release.sh
|
/release.sh
|
||||||
/Audible_Tool
|
/Audible_Tool
|
||||||
/AddOns
|
/AddOns
|
||||||
/oldignore
|
|
||||||
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.
@@ -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
|
||||||
|
|
||||||

|
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
|
## Dokumentation
|
||||||
- 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
|
|
||||||
|
|
||||||
### 📀 Video (Blu-ray / DVD)
|
- Ausführliche Dokumentation: https://mboehmlaender.github.io/ripster/
|
||||||
- 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
|
|
||||||
|
|
||||||
### 🎵 Audio-CD
|
## Voraussetzungen
|
||||||
- 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
|
|
||||||
|
|
||||||
### 🎧 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
|
Auf Debian 11/12 oder Ubuntu 22.04/24.04 (root erforderlich):
|
||||||
- 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:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wget -qO setup.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/setup.sh
|
wget -qO install.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.sh
|
||||||
bash setup.sh
|
sudo bash install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Es gibt 2 Branches: main und dev
|
Alternativ direkt per Pipe:
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```bash
|
```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
|
```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
|
### UI-Settings (empfohlen)
|
||||||
sudo bash Pfad_zur_Installation/setup.sh --reinstall
|
|
||||||
|
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
|
**Converter**
|
||||||
./start.sh
|
- `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:
|
**History**
|
||||||
- `npm run dev`
|
- `GET /api/history`
|
||||||
- `npm run dev:backend`
|
- `GET /api/history/:id`
|
||||||
- `npm run dev:frontend`
|
- `GET /api/history/database`
|
||||||
- `npm run build:frontend`
|
- `GET /api/history/orphan-raw`
|
||||||
- `npm run start`
|
- `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:
|
**Cron-Jobs**
|
||||||
- Pfade und Output-Templates für Blu-ray, DVD, Serie, CD, Audiobook, Converter, Downloads und Logs
|
- `GET /api/crons`
|
||||||
- Tool-Kommandos für MakeMKV, HandBrake, MediaInfo, FFmpeg, FFprobe, `cdparanoia` und `mkvmerge`
|
- `POST /api/crons`
|
||||||
- Laufwerksmodus, Disc-Erkennung und Queue-/Parallelisierungsregeln
|
- `GET /api/crons/:id`
|
||||||
- Hardware-Monitoring, Logging, Expert Mode und Cover-Art-Recovery
|
- `PUT /api/crons/:id`
|
||||||
- TMDB-Zugangsdaten, Pushover, Skripte, Skript-Ketten, User-Presets und Preset-Defaults
|
- `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:
|
## Troubleshooting
|
||||||
- `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`
|
|
||||||
|
|
||||||
Frontend:
|
- WebSocket verbindet nicht:
|
||||||
- `VITE_API_BASE`
|
- prüfen, ob Frontend über Vite-Proxy läuft (`/ws` -> Backend)
|
||||||
- `VITE_WS_URL`
|
- 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`
|
- Keine echten Tokens/Passwörter ins Repository committen.
|
||||||
- Standard-Logs: `backend/logs`
|
- Lokale Secrets in `.env` oder in Settings pflegen, aber nicht versionieren.
|
||||||
- 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).
|
|
||||||
@@ -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",
|
"name": "ripster-backend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ripster-backend",
|
"name": "ripster-backend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"license": "GPL-2.0-or-later",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
|||||||
+1
-10
@@ -1,16 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ripster-backend",
|
"name": "ripster-backend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"private": true,
|
"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",
|
"type": "commonjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/index.js",
|
"start": "node src/index.js",
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const rootDir = path.resolve(__dirname, '..');
|
const rootDir = path.resolve(__dirname, '..');
|
||||||
@@ -20,7 +18,6 @@ module.exports = {
|
|||||||
port: process.env.PORT ? Number(process.env.PORT) : 3001,
|
port: process.env.PORT ? Number(process.env.PORT) : 3001,
|
||||||
dbPath: resolvedDbPath,
|
dbPath: resolvedDbPath,
|
||||||
dataDir,
|
dataDir,
|
||||||
tempDir: resolveOutputPath(process.env.DEFAULT_TEMP_DIR, 'temp'),
|
|
||||||
corsOrigin: process.env.CORS_ORIGIN || '*',
|
corsOrigin: process.env.CORS_ORIGIN || '*',
|
||||||
logDir: path.isAbsolute(rawLogDir) ? rawLogDir : path.resolve(rootDir, rawLogDir),
|
logDir: path.isAbsolute(rawLogDir) ? rawLogDir : path.resolve(rootDir, rawLogDir),
|
||||||
logLevel: process.env.LOG_LEVEL || 'info',
|
logLevel: process.env.LOG_LEVEL || 'info',
|
||||||
|
|||||||
+17
-123
@@ -528,7 +528,6 @@ async function openAndPrepareDatabase() {
|
|||||||
await migrateLegacyProfiledToolSettings(dbInstance);
|
await migrateLegacyProfiledToolSettings(dbInstance);
|
||||||
await migrateOutputTemplates(dbInstance);
|
await migrateOutputTemplates(dbInstance);
|
||||||
await removeDeprecatedSettings(dbInstance);
|
await removeDeprecatedSettings(dbInstance);
|
||||||
await migrateTmdbMigrationFlags(dbInstance);
|
|
||||||
await migrateSettingsSchemaMetadata(dbInstance);
|
await migrateSettingsSchemaMetadata(dbInstance);
|
||||||
await ensurePipelineStateRow(dbInstance);
|
await ensurePipelineStateRow(dbInstance);
|
||||||
await backfillJobOutputFolders(dbInstance);
|
await backfillJobOutputFolders(dbInstance);
|
||||||
@@ -812,9 +811,7 @@ async function removeDeprecatedSettings(db) {
|
|||||||
'use_plugin_architecture_audiobook_analyze',
|
'use_plugin_architecture_audiobook_analyze',
|
||||||
'use_plugin_architecture_audiobook_encode',
|
'use_plugin_architecture_audiobook_encode',
|
||||||
'dvd_series_plugin_enabled',
|
'dvd_series_plugin_enabled',
|
||||||
'dvd_series_prescan_enabled',
|
'dvd_series_prescan_enabled'
|
||||||
'dvd_series_reuse_disc_profiles',
|
|
||||||
'musicbrainz_enabled'
|
|
||||||
];
|
];
|
||||||
for (const key of deprecatedKeys) {
|
for (const key of deprecatedKeys) {
|
||||||
const schemaResult = await db.run('DELETE FROM settings_schema WHERE key = ?', [key]);
|
const schemaResult = await db.run('DELETE FROM settings_schema WHERE key = ?', [key]);
|
||||||
@@ -831,64 +828,6 @@ 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)
|
// Aktualisiert settings_schema-Metadaten (required, description, validation_json)
|
||||||
// für bestehende Einträge, ohne user-konfigurierte Werte in settings_values anzutasten.
|
// für bestehende Einträge, ohne user-konfigurierte Werte in settings_values anzutasten.
|
||||||
const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
||||||
@@ -910,18 +849,6 @@ const SETTINGS_SCHEMA_METADATA_UPDATES = [
|
|||||||
description: 'Preset Name für -Z (DVD). Leer = kein Preset, nur CLI-Parameter werden verwendet.',
|
description: 'Preset Name für -Z (DVD). Leer = kein Preset, nur CLI-Parameter werden verwendet.',
|
||||||
validation_json: '{}'
|
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',
|
key: 'output_template_bluray_series_episode',
|
||||||
required: 1,
|
required: 1,
|
||||||
@@ -1046,41 +973,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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 dvdSeriesMultiEpisodeTemplateDefault = '{seriesTitle}/Staffel {seasonNr}/S{0:seasonNr}E{episodeRange} - {episodeTitle} (Teil {parts})';
|
||||||
const legacyDvdSeriesMultiEpisodeTemplateDefaults = [
|
const legacyDvdSeriesMultiEpisodeTemplateDefaults = [
|
||||||
'{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeRange}'
|
'{seriesTitle}/Staffel {seasonNr}/S{seasonNr}E{episodeRange}'
|
||||||
@@ -1171,17 +1063,9 @@ async function migrateSettingsSchemaMetadata(db) {
|
|||||||
|
|
||||||
await db.run(
|
await db.run(
|
||||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
`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)`
|
VALUES ('handbrake_pre_metadata_scan_enabled', 'Tools', 'Vorab-HandBrake-Scan vor Metadaten', 'boolean', 1, 'Wenn deaktiviert, wird der erste HandBrake-Scan vor der Metadatenauswahl übersprungen.', 'true', '[]', '{}', 221)`
|
||||||
);
|
);
|
||||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('playlist_tmdb_runtime_subtract_percent', '0')`);
|
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_pre_metadata_scan_enabled', 'true')`);
|
||||||
|
|
||||||
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(
|
await db.run(
|
||||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||||
@@ -1342,20 +1226,30 @@ async function migrateSettingsSchemaMetadata(db) {
|
|||||||
|
|
||||||
await db.run(
|
await db.run(
|
||||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
`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_values (key, value) VALUES ('dvd_series_language', 'de-DE')`);
|
||||||
|
|
||||||
await db.run(
|
await db.run(
|
||||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
`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_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_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_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
|
// Converter-Pfade und Eigentümer
|
||||||
await db.run(
|
await db.run(
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
@@ -26,20 +24,10 @@ const diskDetectionService = require('./services/diskDetectionService');
|
|||||||
const hardwareMonitorService = require('./services/hardwareMonitorService');
|
const hardwareMonitorService = require('./services/hardwareMonitorService');
|
||||||
const coverArtRecoveryService = require('./services/coverArtRecoveryService');
|
const coverArtRecoveryService = require('./services/coverArtRecoveryService');
|
||||||
const tempCleanupService = require('./services/tempCleanupService');
|
const tempCleanupService = require('./services/tempCleanupService');
|
||||||
const { fetchCurrentBetaKey } = require('./services/makemkvKeyService');
|
|
||||||
const logger = require('./services/logger').child('BOOT');
|
const logger = require('./services/logger').child('BOOT');
|
||||||
const { errorToMeta } = require('./utils/errorMeta');
|
const { errorToMeta } = require('./utils/errorMeta');
|
||||||
const { getThumbnailsDir, migrateExistingThumbnails } = require('./services/thumbnailService');
|
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() {
|
async function start() {
|
||||||
logger.info('backend:start:init');
|
logger.info('backend:start:init');
|
||||||
await initDatabase();
|
await initDatabase();
|
||||||
@@ -49,32 +37,6 @@ async function start() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('backend:runtime-settings:apply-failed', { error: errorToMeta(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 tempCleanupService.init();
|
||||||
await pipelineService.init();
|
await pipelineService.init();
|
||||||
await converterScanService.startPolling();
|
await converterScanService.startPolling();
|
||||||
@@ -143,7 +105,6 @@ async function start() {
|
|||||||
hardwareMonitorService.stop();
|
hardwareMonitorService.stop();
|
||||||
cronService.stop();
|
cronService.stop();
|
||||||
tempCleanupService.stop();
|
tempCleanupService.stop();
|
||||||
clearTimeout(betaKeyRefreshTimer);
|
|
||||||
server.close(() => {
|
server.close(() => {
|
||||||
logger.warn('backend:shutdown:completed');
|
logger.warn('backend:shutdown:completed');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ function truncate(value, maxLen = 1500) {
|
|||||||
module.exports = function requestLogger(req, res, next) {
|
module.exports = function requestLogger(req, res, next) {
|
||||||
const reqId = randomUUID();
|
const reqId = randomUUID();
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
let completionLogged = false;
|
|
||||||
|
|
||||||
req.reqId = reqId;
|
req.reqId = reqId;
|
||||||
|
|
||||||
@@ -39,37 +38,15 @@ module.exports = function requestLogger(req, res, next) {
|
|||||||
body: truncate(req.body)
|
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', () => {
|
res.on('close', () => {
|
||||||
if (!res.writableEnded) {
|
if (!res.writableEnded) {
|
||||||
logger.warn('request:aborted', {
|
logger.warn('request:aborted', {
|
||||||
reqId,
|
reqId,
|
||||||
method: req.method,
|
method: req.method,
|
||||||
url: req.originalUrl,
|
url: req.originalUrl,
|
||||||
statusCode: res.statusCode,
|
|
||||||
durationMs: Date.now() - startedAt
|
durationMs: Date.now() - startedAt
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
logCompletion('close');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { SourcePlugin } = require('./PluginBase');
|
const { SourcePlugin } = require('./PluginBase');
|
||||||
const tmdbService = require('../services/tmdbService');
|
const omdbService = require('../services/omdbService');
|
||||||
const { spawnTrackedProcess } = require('../services/processRunner');
|
const { spawnTrackedProcess } = require('../services/processRunner');
|
||||||
const { parseMakeMkvProgress, parseHandBrakeProgress } = require('../utils/progressParsers');
|
const { parseMakeMkvProgress, parseHandBrakeProgress } = require('../utils/progressParsers');
|
||||||
const { ensureDir } = require('../utils/files');
|
const { ensureDir } = require('../utils/files');
|
||||||
@@ -11,7 +11,7 @@ const { ensureDir } = require('../utils/files');
|
|||||||
* Gemeinsame Basisklasse für Blu-ray und DVD Plugins.
|
* Gemeinsame Basisklasse für Blu-ray und DVD Plugins.
|
||||||
*
|
*
|
||||||
* Implementiert die gemeinsame Pipeline-Logik für alle Video-Disc-Medien:
|
* 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)
|
* review() → HandBrake-Scan (liefert rohe Scandaten für den Orchestrator)
|
||||||
* rip() → makemkvcon backup/mkv
|
* rip() → makemkvcon backup/mkv
|
||||||
* encode() → HandBrakeCLI
|
* encode() → HandBrakeCLI
|
||||||
@@ -54,13 +54,13 @@ class VideoDiscPlugin extends SourcePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Führt eine TMDb-Suche für den erkannten Disc-Titel durch.
|
* Führt eine OMDB-Suche für den erkannten Disc-Titel durch.
|
||||||
* Gibt { detectedTitle, metadataCandidates } zurück.
|
* Gibt { detectedTitle, omdbCandidates } zurück.
|
||||||
*
|
*
|
||||||
* @param {string} devicePath
|
* @param {string} devicePath
|
||||||
* @param {object} job - Vorbereiteter Job-Record (noch ohne Metadaten)
|
* @param {object} job - Vorbereiteter Job-Record (noch ohne Metadaten)
|
||||||
* @param {PluginContext} ctx
|
* @param {PluginContext} ctx
|
||||||
* @returns {Promise<{detectedTitle: string, metadataCandidates: Array}>}
|
* @returns {Promise<{detectedTitle: string, omdbCandidates: Array}>}
|
||||||
*/
|
*/
|
||||||
async analyze(devicePath, job, ctx) {
|
async analyze(devicePath, job, ctx) {
|
||||||
ctx.markExecution('analyze', {
|
ctx.markExecution('analyze', {
|
||||||
@@ -76,8 +76,8 @@ class VideoDiscPlugin extends SourcePlugin {
|
|||||||
|
|
||||||
ctx.logger.info(`${this.id}:analyze:start`, { devicePath, jobId: job?.id, detectedTitle });
|
ctx.logger.info(`${this.id}:analyze:start`, { devicePath, jobId: job?.id, detectedTitle });
|
||||||
|
|
||||||
const metadataCandidates = await tmdbService.searchMoviesWithDetails(detectedTitle).catch((error) => {
|
const omdbCandidates = await omdbService.search(detectedTitle).catch((error) => {
|
||||||
ctx.logger.warn(`${this.id}:analyze:tmdb-failed`, {
|
ctx.logger.warn(`${this.id}:analyze:omdb-failed`, {
|
||||||
jobId: job?.id,
|
jobId: job?.id,
|
||||||
error: error?.message || String(error)
|
error: error?.message || String(error)
|
||||||
});
|
});
|
||||||
@@ -87,10 +87,10 @@ class VideoDiscPlugin extends SourcePlugin {
|
|||||||
ctx.logger.info(`${this.id}:analyze:done`, {
|
ctx.logger.info(`${this.id}:analyze:done`, {
|
||||||
jobId: job?.id,
|
jobId: job?.id,
|
||||||
detectedTitle,
|
detectedTitle,
|
||||||
metadataCandidates: metadataCandidates.length
|
omdbCandidates: omdbCandidates.length
|
||||||
});
|
});
|
||||||
|
|
||||||
return { detectedTitle, metadataCandidates };
|
return { detectedTitle, omdbCandidates };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,9 +277,6 @@ class VideoDiscPlugin extends SourcePlugin {
|
|||||||
// des PipelineService und liefert das volle runInfo (inkl. highlights, stdout-Log,
|
// des PipelineService und liefert das volle runInfo (inkl. highlights, stdout-Log,
|
||||||
// Prozess-Tracking, Cancellation). Fallback: _spawnAndWait für Standalone/Tests.
|
// Prozess-Tracking, Cancellation). Fallback: _spawnAndWait für Standalone/Tests.
|
||||||
const runCommandFn = typeof ctx.extra?.runCommand === 'function' ? ctx.extra.runCommand : null;
|
const runCommandFn = typeof ctx.extra?.runCommand === 'function' ? ctx.extra.runCommand : null;
|
||||||
const makeMkvLineFilter = typeof ctx.extra?.makeMkvLineFilter === 'function'
|
|
||||||
? ctx.extra.makeMkvLineFilter
|
|
||||||
: null;
|
|
||||||
let runInfo;
|
let runInfo;
|
||||||
if (runCommandFn) {
|
if (runCommandFn) {
|
||||||
runInfo = await runCommandFn({
|
runInfo = await runCommandFn({
|
||||||
@@ -288,8 +285,7 @@ class VideoDiscPlugin extends SourcePlugin {
|
|||||||
source: 'MAKEMKV_RIP',
|
source: 'MAKEMKV_RIP',
|
||||||
cmd: ripConfig.cmd,
|
cmd: ripConfig.cmd,
|
||||||
args: ripConfig.args,
|
args: ripConfig.args,
|
||||||
parser: parseMakeMkvProgress,
|
parser: parseMakeMkvProgress
|
||||||
lineFilter: makeMkvLineFilter
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
runInfo = await _spawnAndWait({
|
runInfo = await _spawnAndWait({
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const multer = require('multer');
|
const multer = require('multer');
|
||||||
const asyncHandler = require('../middleware/asyncHandler');
|
const asyncHandler = require('../middleware/asyncHandler');
|
||||||
@@ -9,7 +10,6 @@ const pipelineService = require('../services/pipelineService');
|
|||||||
const converterScanService = require('../services/converterScanService');
|
const converterScanService = require('../services/converterScanService');
|
||||||
const historyService = require('../services/historyService');
|
const historyService = require('../services/historyService');
|
||||||
const logger = require('../services/logger').child('CONVERTER_ROUTE');
|
const logger = require('../services/logger').child('CONVERTER_ROUTE');
|
||||||
const { tempDir } = require('../config');
|
|
||||||
|
|
||||||
/** Pfadauflösung mit Traversal-Schutz (wie Klangkiste resolveMediaTarget) */
|
/** Pfadauflösung mit Traversal-Schutz (wie Klangkiste resolveMediaTarget) */
|
||||||
function resolveTarget(rawDir, input) {
|
function resolveTarget(rawDir, input) {
|
||||||
@@ -20,11 +20,9 @@ function resolveTarget(rawDir, input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const converterUploadDir = path.join(tempDir, 'ripster-converter-uploads');
|
|
||||||
fs.mkdirSync(converterUploadDir, { recursive: true });
|
|
||||||
|
|
||||||
const converterUpload = multer({
|
const converterUpload = multer({
|
||||||
dest: converterUploadDir
|
dest: path.join(os.tmpdir(), 'ripster-converter-uploads')
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Scan ──────────────────────────────────────────────────────────────────
|
// ── Scan ──────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -66,42 +66,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(
|
router.post(
|
||||||
'/orphan-raw/import',
|
'/orphan-raw/import',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
@@ -140,21 +104,11 @@ router.post(
|
|||||||
);
|
);
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/orphan-raw/delete',
|
'/:id/omdb/assign',
|
||||||
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',
|
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const id = Number(req.params.id);
|
const id = Number(req.params.id);
|
||||||
const payload = req.body || {};
|
const payload = req.body || {};
|
||||||
logger.info('post:job:metadata:assign', {
|
logger.info('post:job:omdb:assign', {
|
||||||
reqId: req.reqId,
|
reqId: req.reqId,
|
||||||
id,
|
id,
|
||||||
imdbId: payload?.imdbId || null,
|
imdbId: payload?.imdbId || null,
|
||||||
@@ -162,11 +116,11 @@ router.post(
|
|||||||
hasYear: Boolean(payload?.year)
|
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)
|
// Rename raw/output folders to reflect new metadata (best-effort, non-blocking)
|
||||||
pipelineService.renameJobFolders(id).catch((err) => {
|
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 });
|
res.json({ job });
|
||||||
@@ -187,15 +141,7 @@ router.post(
|
|||||||
trackCount: Array.isArray(payload?.tracks) ? payload.tracks.length : 0
|
trackCount: Array.isArray(payload?.tracks) ? payload.tracks.length : 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const job = await pipelineService.selectCdMetadata({
|
const job = await historyService.assignCdMetadata(id, payload);
|
||||||
jobId: id,
|
|
||||||
title: payload?.title,
|
|
||||||
artist: payload?.artist,
|
|
||||||
year: payload?.year,
|
|
||||||
mbId: payload?.mbId,
|
|
||||||
coverUrl: payload?.coverUrl,
|
|
||||||
tracks: payload?.tracks
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rename raw/output folders to reflect new metadata (best-effort, non-blocking)
|
// Rename raw/output folders to reflect new metadata (best-effort, non-blocking)
|
||||||
pipelineService.renameJobFolders(id).catch((err) => {
|
pipelineService.renameJobFolders(id).catch((err) => {
|
||||||
@@ -304,10 +250,9 @@ router.post(
|
|||||||
});
|
});
|
||||||
const requestedResetDriveState = ['1', 'true', 'yes'].includes(String(req.body?.resetDriveState || 'false').toLowerCase());
|
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 preserveRawForImportJobs = ['1', 'true', 'yes'].includes(String(req.body?.preserveRawForImportJobs || 'false').toLowerCase());
|
||||||
const hasRequestedKeepDetectedDevice = req.body?.keepDetectedDevice !== undefined;
|
const requestedKeepDetectedDevice = req.body?.keepDetectedDevice !== undefined
|
||||||
const requestedKeepDetectedDevice = hasRequestedKeepDetectedDevice
|
|
||||||
? ['1', 'true', 'yes'].includes(String(req.body?.keepDetectedDevice || 'false').toLowerCase())
|
? ['1', 'true', 'yes'].includes(String(req.body?.keepDetectedDevice || 'false').toLowerCase())
|
||||||
: null;
|
: !requestedResetDriveState;
|
||||||
const selectedRawPaths = Array.isArray(req.body?.selectedRawPaths)
|
const selectedRawPaths = Array.isArray(req.body?.selectedRawPaths)
|
||||||
? req.body.selectedRawPaths
|
? req.body.selectedRawPaths
|
||||||
.map((item) => String(item || '').trim())
|
.map((item) => String(item || '').trim())
|
||||||
@@ -339,35 +284,12 @@ router.post(
|
|||||||
(row) => Boolean(row?.selected) && Boolean(row?.orphanRawImport)
|
(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
|
const resetDriveState = containsOrphanRawImportJob
|
||||||
? false
|
? false
|
||||||
: requestedResetDriveStateEffective;
|
: requestedResetDriveState;
|
||||||
const keepDetectedDevice = containsOrphanRawImportJob
|
const keepDetectedDevice = containsOrphanRawImportJob
|
||||||
? true
|
? true
|
||||||
: (hasRequestedKeepDetectedDevice
|
: requestedKeepDetectedDevice;
|
||||||
? requestedKeepDetectedDevice
|
|
||||||
: !requestedResetDriveStateEffective);
|
|
||||||
|
|
||||||
if (containsOrphanRawImportJob && requestedResetDriveState) {
|
if (containsOrphanRawImportJob && requestedResetDriveState) {
|
||||||
logger.info('post:delete-job:orphan-drive-reset-skipped', {
|
logger.info('post:delete-job:orphan-drive-reset-skipped', {
|
||||||
@@ -376,14 +298,6 @@ router.post(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoResetDriveStateForPhysicalCd && !requestedResetDriveState) {
|
|
||||||
logger.info('post:delete-job:auto-drive-reset-cd', {
|
|
||||||
reqId: req.reqId,
|
|
||||||
id,
|
|
||||||
selectedJobIds: selectedDeleteJobIds
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const relatedDevicePaths = Array.isArray(preview?.relatedJobs)
|
const relatedDevicePaths = Array.isArray(preview?.relatedJobs)
|
||||||
? preview.relatedJobs
|
? preview.relatedJobs
|
||||||
.filter((row) => Boolean(row?.selected))
|
.filter((row) => Boolean(row?.selected))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const multer = require('multer');
|
const multer = require('multer');
|
||||||
const asyncHandler = require('../middleware/asyncHandler');
|
const asyncHandler = require('../middleware/asyncHandler');
|
||||||
@@ -10,16 +11,86 @@ const hardwareMonitorService = require('../services/hardwareMonitorService');
|
|||||||
const settingsService = require('../services/settingsService');
|
const settingsService = require('../services/settingsService');
|
||||||
const logger = require('../services/logger').child('PIPELINE_ROUTE');
|
const logger = require('../services/logger').child('PIPELINE_ROUTE');
|
||||||
const activationBytesService = require('../services/activationBytesService');
|
const activationBytesService = require('../services/activationBytesService');
|
||||||
const { tempDir } = require('../config');
|
const { defaultAudiobookDir } = require('../config');
|
||||||
const { getDb } = require('../db/database');
|
const { getDb } = require('../db/database');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const audiobookUploadDir = path.join(tempDir, 'ripster-audiobook-uploads');
|
|
||||||
fs.mkdirSync(audiobookUploadDir, { recursive: true });
|
|
||||||
const audiobookUpload = multer({
|
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(
|
router.get(
|
||||||
'/state',
|
'/state',
|
||||||
asyncHandler(async (req, res) => {
|
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(
|
router.post(
|
||||||
'/analyze',
|
'/analyze',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
@@ -137,11 +146,11 @@ router.post(
|
|||||||
);
|
);
|
||||||
|
|
||||||
router.get(
|
router.get(
|
||||||
'/tmdb/movie/search',
|
'/omdb/search',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const query = req.query.q || '';
|
const query = req.query.q || '';
|
||||||
logger.info('get:tmdb:movie-search', { reqId: req.reqId, query });
|
logger.info('get:omdb:search', { reqId: req.reqId, query });
|
||||||
const results = await pipelineService.searchTmdbMovies(String(query));
|
const results = await pipelineService.searchOmdb(String(query));
|
||||||
res.json({ results });
|
res.json({ results });
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -161,12 +170,8 @@ router.get(
|
|||||||
'/cd/musicbrainz/search',
|
'/cd/musicbrainz/search',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const query = req.query.q || '';
|
const query = req.query.q || '';
|
||||||
const trackCountRaw = Number(req.query.trackCount);
|
logger.info('get:cd:musicbrainz:search', { reqId: req.reqId, query });
|
||||||
const trackCount = Number.isFinite(trackCountRaw) && trackCountRaw > 0
|
const results = await pipelineService.searchMusicBrainz(String(query));
|
||||||
? Math.trunc(trackCountRaw)
|
|
||||||
: null;
|
|
||||||
logger.info('get:cd:musicbrainz:search', { reqId: req.reqId, query, trackCount });
|
|
||||||
const results = await pipelineService.searchMusicBrainz(String(query), { trackCount });
|
|
||||||
res.json({ results });
|
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(
|
router.post(
|
||||||
'/select-metadata',
|
'/select-metadata',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const {
|
const {
|
||||||
jobId,
|
jobId,
|
||||||
title,
|
title,
|
||||||
artist,
|
|
||||||
year,
|
year,
|
||||||
imdbId,
|
imdbId,
|
||||||
poster,
|
poster,
|
||||||
mbId,
|
fromOmdb,
|
||||||
coverUrl,
|
|
||||||
tracks,
|
|
||||||
selectedPlaylist,
|
selectedPlaylist,
|
||||||
selectedHandBrakeTitleId,
|
selectedHandBrakeTitleId,
|
||||||
selectedHandBrakeTitleIds,
|
selectedHandBrakeTitleIds,
|
||||||
@@ -354,13 +387,10 @@ router.post(
|
|||||||
reqId: req.reqId,
|
reqId: req.reqId,
|
||||||
jobId,
|
jobId,
|
||||||
title,
|
title,
|
||||||
artist,
|
|
||||||
year,
|
year,
|
||||||
imdbId,
|
imdbId,
|
||||||
poster,
|
poster,
|
||||||
mbId,
|
fromOmdb,
|
||||||
coverUrl,
|
|
||||||
trackCount: Array.isArray(tracks) ? tracks.length : null,
|
|
||||||
selectedPlaylist,
|
selectedPlaylist,
|
||||||
selectedHandBrakeTitleId,
|
selectedHandBrakeTitleId,
|
||||||
selectedHandBrakeTitleIds: Array.isArray(selectedHandBrakeTitleIds) ? selectedHandBrakeTitleIds : null,
|
selectedHandBrakeTitleIds: Array.isArray(selectedHandBrakeTitleIds) ? selectedHandBrakeTitleIds : null,
|
||||||
@@ -375,37 +405,13 @@ router.post(
|
|||||||
existingDiscNumber
|
existingDiscNumber
|
||||||
});
|
});
|
||||||
|
|
||||||
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({
|
const job = await pipelineService.selectMetadata({
|
||||||
jobId: Number(jobId),
|
jobId: Number(jobId),
|
||||||
title,
|
title,
|
||||||
year,
|
year,
|
||||||
imdbId,
|
imdbId,
|
||||||
poster,
|
poster,
|
||||||
|
fromOmdb,
|
||||||
selectedPlaylist,
|
selectedPlaylist,
|
||||||
selectedHandBrakeTitleId,
|
selectedHandBrakeTitleId,
|
||||||
selectedHandBrakeTitleIds,
|
selectedHandBrakeTitleIds,
|
||||||
@@ -526,9 +532,6 @@ router.post(
|
|||||||
'/confirm-encode/:jobId',
|
'/confirm-encode/:jobId',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const jobId = Number(req.params.jobId);
|
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 selectedEncodeTitleId = req.body?.selectedEncodeTitleId ?? null;
|
||||||
const selectedEncodeTitleIds = req.body?.selectedEncodeTitleIds ?? null;
|
const selectedEncodeTitleIds = req.body?.selectedEncodeTitleIds ?? null;
|
||||||
const selectedTrackSelection = req.body?.selectedTrackSelection ?? null;
|
const selectedTrackSelection = req.body?.selectedTrackSelection ?? null;
|
||||||
@@ -538,12 +541,8 @@ router.post(
|
|||||||
const selectedPostEncodeChainIds = req.body?.selectedPostEncodeChainIds;
|
const selectedPostEncodeChainIds = req.body?.selectedPostEncodeChainIds;
|
||||||
const selectedPreEncodeChainIds = req.body?.selectedPreEncodeChainIds;
|
const selectedPreEncodeChainIds = req.body?.selectedPreEncodeChainIds;
|
||||||
const skipPipelineStateUpdate = Boolean(req.body?.skipPipelineStateUpdate);
|
const skipPipelineStateUpdate = Boolean(req.body?.skipPipelineStateUpdate);
|
||||||
const selectedUserPresetId = hasSelectedUserPresetId
|
const selectedUserPresetId = req.body?.selectedUserPresetId ?? null;
|
||||||
? body.selectedUserPresetId
|
const selectedHandBrakePreset = req.body?.selectedHandBrakePreset ?? null;
|
||||||
: undefined;
|
|
||||||
const selectedHandBrakePreset = hasSelectedHandBrakePreset
|
|
||||||
? body.selectedHandBrakePreset
|
|
||||||
: undefined;
|
|
||||||
logger.info('post:confirm-encode', {
|
logger.info('post:confirm-encode', {
|
||||||
reqId: req.reqId,
|
reqId: req.reqId,
|
||||||
jobId,
|
jobId,
|
||||||
@@ -601,9 +600,8 @@ router.post(
|
|||||||
'/retry/:jobId',
|
'/retry/:jobId',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
const jobId = Number(req.params.jobId);
|
const jobId = Number(req.params.jobId);
|
||||||
const createNewJob = Boolean(req.body?.createNewJob);
|
logger.info('post:retry', { reqId: req.reqId, jobId });
|
||||||
logger.info('post:retry', { reqId: req.reqId, jobId, createNewJob });
|
const result = await pipelineService.retry(jobId);
|
||||||
const result = await pipelineService.retry(jobId, { createNewJob });
|
|
||||||
res.json({ result });
|
res.json({ result });
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -656,24 +654,15 @@ router.post(
|
|||||||
const jobId = Number(req.params.jobId);
|
const jobId = Number(req.params.jobId);
|
||||||
const keepBoth = Boolean(req.body?.keepBoth);
|
const keepBoth = Boolean(req.body?.keepBoth);
|
||||||
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
||||||
const createNewJob = Boolean(req.body?.createNewJob);
|
const reuseCurrentJob = Boolean(req.body?.reuseCurrentJob);
|
||||||
const reuseCurrentJob = Object.prototype.hasOwnProperty.call(req.body || {}, 'reuseCurrentJob')
|
|
||||||
? Boolean(req.body?.reuseCurrentJob)
|
|
||||||
: !createNewJob;
|
|
||||||
logger.info('post:restart-review', {
|
logger.info('post:restart-review', {
|
||||||
reqId: req.reqId,
|
reqId: req.reqId,
|
||||||
jobId,
|
jobId,
|
||||||
keepBoth,
|
keepBoth,
|
||||||
createNewJob,
|
|
||||||
reuseCurrentJob,
|
reuseCurrentJob,
|
||||||
deleteFolderCount: deleteFolders.length
|
deleteFolderCount: deleteFolders.length
|
||||||
});
|
});
|
||||||
const result = await pipelineService.restartReviewFromRaw(jobId, {
|
const result = await pipelineService.restartReviewFromRaw(jobId, { keepBoth, deleteFolders, reuseCurrentJob });
|
||||||
keepBoth,
|
|
||||||
deleteFolders,
|
|
||||||
reuseCurrentJob,
|
|
||||||
createNewJob
|
|
||||||
});
|
|
||||||
res.json({ result });
|
res.json({ result });
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -685,20 +674,17 @@ router.post(
|
|||||||
const keepBoth = Boolean(req.body?.keepBoth);
|
const keepBoth = Boolean(req.body?.keepBoth);
|
||||||
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
const deleteFolders = Array.isArray(req.body?.deleteFolders) ? req.body.deleteFolders : [];
|
||||||
const restartMode = String(req.body?.restartMode || 'all').trim().toLowerCase() || 'all';
|
const restartMode = String(req.body?.restartMode || 'all').trim().toLowerCase() || 'all';
|
||||||
const createNewJob = Boolean(req.body?.createNewJob);
|
|
||||||
logger.info('post:restart-encode', {
|
logger.info('post:restart-encode', {
|
||||||
reqId: req.reqId,
|
reqId: req.reqId,
|
||||||
jobId,
|
jobId,
|
||||||
keepBoth,
|
keepBoth,
|
||||||
createNewJob,
|
|
||||||
restartMode,
|
restartMode,
|
||||||
deleteFolderCount: deleteFolders.length
|
deleteFolderCount: deleteFolders.length
|
||||||
});
|
});
|
||||||
const result = await pipelineService.restartEncodeWithLastSettings(jobId, {
|
const result = await pipelineService.restartEncodeWithLastSettings(jobId, {
|
||||||
keepBoth,
|
keepBoth,
|
||||||
deleteFolders,
|
deleteFolders,
|
||||||
restartMode,
|
restartMode
|
||||||
createNewJob
|
|
||||||
});
|
});
|
||||||
res.json({ result });
|
res.json({ result });
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ const pipelineService = require('../services/pipelineService');
|
|||||||
const wsService = require('../services/websocketService');
|
const wsService = require('../services/websocketService');
|
||||||
const hardwareMonitorService = require('../services/hardwareMonitorService');
|
const hardwareMonitorService = require('../services/hardwareMonitorService');
|
||||||
const userPresetService = require('../services/userPresetService');
|
const userPresetService = require('../services/userPresetService');
|
||||||
const userPresetDefaultsService = require('../services/userPresetDefaultsService');
|
|
||||||
const activationBytesService = require('../services/activationBytesService');
|
const activationBytesService = require('../services/activationBytesService');
|
||||||
const diskDetectionService = require('../services/diskDetectionService');
|
const diskDetectionService = require('../services/diskDetectionService');
|
||||||
const coverArtRecoveryService = require('../services/coverArtRecoveryService');
|
const coverArtRecoveryService = require('../services/coverArtRecoveryService');
|
||||||
const { fetchCurrentBetaKey, getCachedBetaKey } = require('../services/makemkvKeyService');
|
const { fetchCurrentBetaKey } = require('../services/makemkvKeyService');
|
||||||
const logger = require('../services/logger').child('SETTINGS_ROUTE');
|
const logger = require('../services/logger').child('SETTINGS_ROUTE');
|
||||||
|
|
||||||
const { getDb } = require('../db/database');
|
const { getDb } = require('../db/database');
|
||||||
@@ -58,35 +57,10 @@ router.get(
|
|||||||
'/makemkv/beta-key',
|
'/makemkv/beta-key',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
logger.debug('get:settings:makemkv:beta-key', { reqId: req.reqId });
|
logger.debug('get:settings:makemkv:beta-key', { reqId: req.reqId });
|
||||||
const currentSettings = await settingsService.getSettingsMap({ forceRefresh: false });
|
const result = await fetchCurrentBetaKey();
|
||||||
const existingKey = String(currentSettings?.makemkv_registration_key || '').trim();
|
|
||||||
const cached = await getCachedBetaKey({ allowExpired: true });
|
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
betaKey: cached?.key || '',
|
betaKey: result.key,
|
||||||
sourceUrl: cached?.sourceUrl || null,
|
sourceUrl: result.sourceUrl
|
||||||
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
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -95,26 +69,35 @@ router.post(
|
|||||||
'/makemkv/beta-key/apply',
|
'/makemkv/beta-key/apply',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
logger.info('post:settings:makemkv:beta-key:apply', { reqId: req.reqId });
|
logger.info('post:settings:makemkv:beta-key:apply', { reqId: req.reqId });
|
||||||
const requestedKey = String(req.body?.betaKey || '').trim();
|
const force = req.body?.force === true;
|
||||||
const cachedResult = requestedKey
|
const currentSettings = await settingsService.getSettingsMap({ forceRefresh: true });
|
||||||
? { key: requestedKey }
|
const existingKey = String(currentSettings?.makemkv_registration_key || '').trim();
|
||||||
: await getCachedBetaKey({ allowExpired: true });
|
const betaKeyResult = await fetchCurrentBetaKey();
|
||||||
const betaKey = String(cachedResult?.key || '').trim();
|
|
||||||
|
|
||||||
if (!betaKey) {
|
if (!force && existingKey && existingKey !== betaKeyResult.key) {
|
||||||
const error = new Error('Kein geprüfter Betakey vorhanden. Bitte zuerst prüfen.');
|
const syncResult = await settingsService.syncMakeMKVRegistrationKeyFromSettings({
|
||||||
error.statusCode = 400;
|
settingsMap: currentSettings
|
||||||
throw error;
|
});
|
||||||
|
res.json({
|
||||||
|
applied: false,
|
||||||
|
preservedExistingKey: true,
|
||||||
|
reason: 'existing_key',
|
||||||
|
betaKey: betaKeyResult.key,
|
||||||
|
sourceUrl: betaKeyResult.sourceUrl,
|
||||||
|
settingsFilePath: syncResult?.path || null
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const updated = await settingsService.setSettingValue('makemkv_registration_key', betaKey);
|
const updated = await settingsService.setSettingValue('makemkv_registration_key', betaKeyResult.key);
|
||||||
wsService.broadcast('SETTINGS_UPDATED', updated);
|
wsService.broadcast('SETTINGS_UPDATED', updated);
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
applied: true,
|
applied: true,
|
||||||
|
preservedExistingKey: false,
|
||||||
setting: updated,
|
setting: updated,
|
||||||
betaKey,
|
betaKey: betaKeyResult.key,
|
||||||
sourceUrl: String(cachedResult?.sourceUrl || '').trim() || null
|
sourceUrl: betaKeyResult.sourceUrl
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -174,26 +157,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(
|
router.delete(
|
||||||
'/scripts/:id',
|
'/scripts/:id',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
@@ -287,22 +250,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(
|
router.delete(
|
||||||
'/script-chains/:id',
|
'/script-chains/:id',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
@@ -330,72 +277,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(
|
router.put(
|
||||||
'/:key',
|
'/:key',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
@@ -527,6 +408,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(
|
router.post(
|
||||||
'/pushover/test',
|
'/pushover/test',
|
||||||
asyncHandler(async (req, res) => {
|
asyncHandler(async (req, res) => {
|
||||||
|
|||||||
@@ -130,6 +130,12 @@ function collectCoverCandidates(row) {
|
|||||||
push(deriveCoverArtArchiveUrl(mbId), 'musicbrainz.coverartarchive');
|
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;
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +280,8 @@ class CoverArtRecoveryService {
|
|||||||
status,
|
status,
|
||||||
poster_url,
|
poster_url,
|
||||||
imdb_id,
|
imdb_id,
|
||||||
makemkv_info_json
|
makemkv_info_json,
|
||||||
|
omdb_json
|
||||||
FROM jobs
|
FROM jobs
|
||||||
ORDER BY COALESCE(updated_at, created_at) DESC, id DESC
|
ORDER BY COALESCE(updated_at, created_at) DESC, id DESC
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ const settingsService = require('./settingsService');
|
|||||||
const wsService = require('./websocketService');
|
const wsService = require('./websocketService');
|
||||||
const logger = require('./logger').child('HWMON');
|
const logger = require('./logger').child('HWMON');
|
||||||
const { errorToMeta } = require('../utils/errorMeta');
|
const { errorToMeta } = require('../utils/errorMeta');
|
||||||
const { getDb } = require('../db/database');
|
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
|
|
||||||
const DEFAULT_INTERVAL_MS = 5000;
|
const DEFAULT_INTERVAL_MS = 5000;
|
||||||
const MIN_INTERVAL_MS = 1000;
|
const MIN_INTERVAL_MS = 1000;
|
||||||
const MAX_INTERVAL_MS = 60000;
|
const MAX_INTERVAL_MS = 60000;
|
||||||
const HISTORY_RETENTION_PREVIOUS_DAYS = 3;
|
|
||||||
const DF_TIMEOUT_MS = 1800;
|
const DF_TIMEOUT_MS = 1800;
|
||||||
const SENSORS_TIMEOUT_MS = 1800;
|
const SENSORS_TIMEOUT_MS = 1800;
|
||||||
const NVIDIA_SMI_TIMEOUT_MS = 1800;
|
const NVIDIA_SMI_TIMEOUT_MS = 1800;
|
||||||
@@ -36,27 +34,6 @@ function nowIso() {
|
|||||||
return new Date().toISOString();
|
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) {
|
function toBoolean(value) {
|
||||||
if (typeof value === 'boolean') {
|
if (typeof value === 'boolean') {
|
||||||
return value;
|
return value;
|
||||||
@@ -360,8 +337,6 @@ class HardwareMonitorService {
|
|||||||
this.running = false;
|
this.running = false;
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.pollInFlight = false;
|
this.pollInFlight = false;
|
||||||
this.activePollAbortController = null;
|
|
||||||
this.reloadSettingsSeq = 0;
|
|
||||||
this.lastCpuTimes = null;
|
this.lastCpuTimes = null;
|
||||||
this.sensorsCommandAvailable = null;
|
this.sensorsCommandAvailable = null;
|
||||||
this.nvidiaSmiAvailable = null;
|
this.nvidiaSmiAvailable = null;
|
||||||
@@ -372,7 +347,6 @@ class HardwareMonitorService {
|
|||||||
sample: null,
|
sample: null,
|
||||||
error: null
|
error: null
|
||||||
};
|
};
|
||||||
this.lastHistoryCleanupDayKey = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@@ -416,8 +390,6 @@ class HardwareMonitorService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async reloadFromSettings(options = {}) {
|
async reloadFromSettings(options = {}) {
|
||||||
const requestSeq = this.reloadSettingsSeq + 1;
|
|
||||||
this.reloadSettingsSeq = requestSeq;
|
|
||||||
const forceBroadcast = Boolean(options?.forceBroadcast);
|
const forceBroadcast = Boolean(options?.forceBroadcast);
|
||||||
const forceImmediatePoll = Boolean(options?.forceImmediatePoll);
|
const forceImmediatePoll = Boolean(options?.forceImmediatePoll);
|
||||||
let settingsMap = {};
|
let settingsMap = {};
|
||||||
@@ -427,9 +399,6 @@ class HardwareMonitorService {
|
|||||||
logger.warn('settings:load:failed', { error: errorToMeta(error) });
|
logger.warn('settings:load:failed', { error: errorToMeta(error) });
|
||||||
return this.getSnapshot();
|
return this.getSnapshot();
|
||||||
}
|
}
|
||||||
if (requestSeq !== this.reloadSettingsSeq) {
|
|
||||||
return this.getSnapshot();
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextEnabled = toBoolean(settingsMap.hardware_monitoring_enabled);
|
const nextEnabled = toBoolean(settingsMap.hardware_monitoring_enabled);
|
||||||
const nextIntervalMs = clampIntervalMs(settingsMap.hardware_monitoring_interval_ms);
|
const nextIntervalMs = clampIntervalMs(settingsMap.hardware_monitoring_interval_ms);
|
||||||
@@ -449,19 +418,11 @@ class HardwareMonitorService {
|
|||||||
|
|
||||||
if (!this.enabled) {
|
if (!this.enabled) {
|
||||||
this.stopPolling();
|
this.stopPolling();
|
||||||
let storage = [];
|
|
||||||
try {
|
|
||||||
storage = await this.collectStorageMetrics();
|
|
||||||
} catch (error) {
|
|
||||||
logger.debug('storage:collect:disabled-mode:failed', { error: errorToMeta(error) });
|
|
||||||
}
|
|
||||||
this.lastSnapshot = {
|
this.lastSnapshot = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
intervalMs: this.intervalMs,
|
intervalMs: this.intervalMs,
|
||||||
updatedAt: nowIso(),
|
updatedAt: nowIso(),
|
||||||
sample: {
|
sample: null,
|
||||||
storage
|
|
||||||
},
|
|
||||||
error: null
|
error: null
|
||||||
};
|
};
|
||||||
this.broadcastUpdate();
|
this.broadcastUpdate();
|
||||||
@@ -560,14 +521,6 @@ class HardwareMonitorService {
|
|||||||
this.running = false;
|
this.running = false;
|
||||||
this.pollInFlight = false;
|
this.pollInFlight = false;
|
||||||
this.lastCpuTimes = null;
|
this.lastCpuTimes = null;
|
||||||
if (this.activePollAbortController) {
|
|
||||||
try {
|
|
||||||
this.activePollAbortController.abort();
|
|
||||||
} catch (_error) {
|
|
||||||
// ignore abort errors
|
|
||||||
}
|
|
||||||
this.activePollAbortController = null;
|
|
||||||
}
|
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
@@ -600,15 +553,8 @@ class HardwareMonitorService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.pollInFlight = true;
|
this.pollInFlight = true;
|
||||||
const pollAbortController = new AbortController();
|
|
||||||
this.activePollAbortController = pollAbortController;
|
|
||||||
try {
|
try {
|
||||||
const sample = await this.collectSample(pollAbortController.signal);
|
const sample = await this.collectSample();
|
||||||
try {
|
|
||||||
await this.persistHistorySample(sample);
|
|
||||||
} catch (historyError) {
|
|
||||||
logger.warn('history:write:failed', { error: errorToMeta(historyError) });
|
|
||||||
}
|
|
||||||
this.lastSnapshot = {
|
this.lastSnapshot = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
intervalMs: this.intervalMs,
|
intervalMs: this.intervalMs,
|
||||||
@@ -618,10 +564,6 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
this.broadcastUpdate();
|
this.broadcastUpdate();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isAbortError(error)) {
|
|
||||||
logger.debug('poll:aborted');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
logger.warn('poll:failed', { error: errorToMeta(error) });
|
logger.warn('poll:failed', { error: errorToMeta(error) });
|
||||||
this.lastSnapshot = {
|
this.lastSnapshot = {
|
||||||
...this.lastSnapshot,
|
...this.lastSnapshot,
|
||||||
@@ -632,9 +574,6 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
this.broadcastUpdate();
|
this.broadcastUpdate();
|
||||||
} finally {
|
} finally {
|
||||||
if (this.activePollAbortController === pollAbortController) {
|
|
||||||
this.activePollAbortController = null;
|
|
||||||
}
|
|
||||||
this.pollInFlight = false;
|
this.pollInFlight = false;
|
||||||
if (this.running && this.enabled) {
|
if (this.running && this.enabled) {
|
||||||
this.scheduleNext(this.intervalMs);
|
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() {
|
broadcastUpdate() {
|
||||||
wsService.broadcast('HARDWARE_MONITOR_UPDATE', this.getSnapshot());
|
wsService.broadcast('HARDWARE_MONITOR_UPDATE', this.getSnapshot());
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectSample(signal) {
|
async collectSample() {
|
||||||
const memory = this.collectMemoryMetrics();
|
const memory = this.collectMemoryMetrics();
|
||||||
const [cpu, gpu, storage] = await Promise.all([
|
const [cpu, gpu, storage] = await Promise.all([
|
||||||
this.collectCpuMetrics(signal),
|
this.collectCpuMetrics(),
|
||||||
this.collectGpuMetrics(signal),
|
this.collectGpuMetrics(),
|
||||||
this.collectStorageMetrics(signal)
|
this.collectStorageMetrics()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -817,13 +665,13 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectCpuMetrics(signal) {
|
async collectCpuMetrics() {
|
||||||
const cpus = os.cpus() || [];
|
const cpus = os.cpus() || [];
|
||||||
const currentTimes = this.getCpuTimes();
|
const currentTimes = this.getCpuTimes();
|
||||||
const usage = this.calculateCpuUsage(currentTimes, this.lastCpuTimes || []);
|
const usage = this.calculateCpuUsage(currentTimes, this.lastCpuTimes || []);
|
||||||
this.lastCpuTimes = currentTimes;
|
this.lastCpuTimes = currentTimes;
|
||||||
|
|
||||||
const tempMetrics = await this.collectCpuTemperatures(signal);
|
const tempMetrics = await this.collectCpuTemperatures();
|
||||||
const tempByCoreIndex = new Map(
|
const tempByCoreIndex = new Map(
|
||||||
(tempMetrics.perCore || []).map((item) => [Number(item.index), item.temperatureC])
|
(tempMetrics.perCore || []).map((item) => [Number(item.index), item.temperatureC])
|
||||||
);
|
);
|
||||||
@@ -860,8 +708,8 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectCpuTemperatures(signal) {
|
async collectCpuTemperatures() {
|
||||||
const sensors = await this.collectTempsViaSensors(signal);
|
const sensors = await this.collectTempsViaSensors();
|
||||||
if (sensors.available) {
|
if (sensors.available) {
|
||||||
return sensors;
|
return sensors;
|
||||||
}
|
}
|
||||||
@@ -884,7 +732,7 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectTempsViaSensors(signal) {
|
async collectTempsViaSensors() {
|
||||||
if (this.sensorsCommandAvailable === false) {
|
if (this.sensorsCommandAvailable === false) {
|
||||||
return {
|
return {
|
||||||
source: 'sensors',
|
source: 'sensors',
|
||||||
@@ -897,8 +745,7 @@ class HardwareMonitorService {
|
|||||||
try {
|
try {
|
||||||
const { stdout } = await execFileAsync('sensors', ['-j'], {
|
const { stdout } = await execFileAsync('sensors', ['-j'], {
|
||||||
timeout: SENSORS_TIMEOUT_MS,
|
timeout: SENSORS_TIMEOUT_MS,
|
||||||
maxBuffer: 2 * 1024 * 1024,
|
maxBuffer: 2 * 1024 * 1024
|
||||||
signal
|
|
||||||
});
|
});
|
||||||
this.sensorsCommandAvailable = true;
|
this.sensorsCommandAvailable = true;
|
||||||
const parsed = JSON.parse(String(stdout || '{}'));
|
const parsed = JSON.parse(String(stdout || '{}'));
|
||||||
@@ -909,9 +756,6 @@ class HardwareMonitorService {
|
|||||||
...mapTemperatureCandidates(preferred)
|
...mapTemperatureCandidates(preferred)
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isAbortError(error)) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
if (isCommandMissingError(error)) {
|
if (isCommandMissingError(error)) {
|
||||||
this.sensorsCommandAvailable = false;
|
this.sensorsCommandAvailable = false;
|
||||||
}
|
}
|
||||||
@@ -1019,7 +863,7 @@ class HardwareMonitorService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectGpuMetrics(signal) {
|
async collectGpuMetrics() {
|
||||||
if (this.nvidiaSmiAvailable === false) {
|
if (this.nvidiaSmiAvailable === false) {
|
||||||
return {
|
return {
|
||||||
source: 'nvidia-smi',
|
source: 'nvidia-smi',
|
||||||
@@ -1038,8 +882,7 @@ class HardwareMonitorService {
|
|||||||
],
|
],
|
||||||
{
|
{
|
||||||
timeout: NVIDIA_SMI_TIMEOUT_MS,
|
timeout: NVIDIA_SMI_TIMEOUT_MS,
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 1024 * 1024
|
||||||
signal
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1052,10 +895,6 @@ class HardwareMonitorService {
|
|||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
if (devices.length === 0) {
|
if (devices.length === 0) {
|
||||||
const fallback = this.getLastKnownGpuMetrics();
|
|
||||||
if (fallback) {
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
source: 'nvidia-smi',
|
source: 'nvidia-smi',
|
||||||
available: false,
|
available: false,
|
||||||
@@ -1071,47 +910,26 @@ class HardwareMonitorService {
|
|||||||
message: null
|
message: null
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isAbortError(error)) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
const commandMissing = isCommandMissingError(error);
|
const commandMissing = isCommandMissingError(error);
|
||||||
if (commandMissing) {
|
if (commandMissing) {
|
||||||
this.nvidiaSmiAvailable = false;
|
this.nvidiaSmiAvailable = false;
|
||||||
}
|
}
|
||||||
logger.debug('gpu:nvidia-smi:failed', { error: errorToMeta(error) });
|
logger.debug('gpu:nvidia-smi:failed', { error: errorToMeta(error) });
|
||||||
const fallback = this.getLastKnownGpuMetrics();
|
|
||||||
if (fallback) {
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
source: 'nvidia-smi',
|
source: 'nvidia-smi',
|
||||||
available: false,
|
available: false,
|
||||||
devices: [],
|
devices: [],
|
||||||
message: commandMissing
|
message: commandMissing
|
||||||
? 'nvidia-smi ist nicht verfuegbar.'
|
? 'nvidia-smi ist nicht verfuegbar.'
|
||||||
: 'GPU-Daten derzeit nicht verfuegbar.'
|
: (String(error?.stderr || error?.message || 'GPU-Abfrage fehlgeschlagen').trim().slice(0, 220))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getLastKnownGpuMetrics() {
|
async collectStorageMetrics() {
|
||||||
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) {
|
|
||||||
const list = [];
|
const list = [];
|
||||||
for (const entry of this.monitoredPaths) {
|
for (const entry of this.monitoredPaths) {
|
||||||
const metric = await this.collectStorageForPath(entry, signal);
|
const metric = await this.collectStorageForPath(entry);
|
||||||
if (metric && !metric.hidden) {
|
if (metric && !metric.hidden) {
|
||||||
list.push(metric);
|
list.push(metric);
|
||||||
}
|
}
|
||||||
@@ -1141,7 +959,7 @@ class HardwareMonitorService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async collectStorageForPath(entry, signal) {
|
async collectStorageForPath(entry) {
|
||||||
const key = String(entry?.key || '');
|
const key = String(entry?.key || '');
|
||||||
const label = String(entry?.label || key || 'Pfad');
|
const label = String(entry?.label || key || 'Pfad');
|
||||||
const rawPath = String(entry?.path || '').trim();
|
const rawPath = String(entry?.path || '').trim();
|
||||||
@@ -1210,8 +1028,7 @@ class HardwareMonitorService {
|
|||||||
try {
|
try {
|
||||||
const { stdout } = await execFileAsync('df', ['-Pk', queryPath], {
|
const { stdout } = await execFileAsync('df', ['-Pk', queryPath], {
|
||||||
timeout: DF_TIMEOUT_MS,
|
timeout: DF_TIMEOUT_MS,
|
||||||
maxBuffer: 256 * 1024,
|
maxBuffer: 256 * 1024
|
||||||
signal
|
|
||||||
});
|
});
|
||||||
const parsed = parseDfStats(stdout);
|
const parsed = parseDfStats(stdout);
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
@@ -1239,9 +1056,7 @@ class HardwareMonitorService {
|
|||||||
}
|
}
|
||||||
const mountPoint = parsed?.mountPoint ? path.resolve(parsed.mountPoint) : parsed.mountPoint;
|
const mountPoint = parsed?.mountPoint ? path.resolve(parsed.mountPoint) : parsed.mountPoint;
|
||||||
const hasDedicatedMount = Boolean(mountPoint) && !isRootPath(mountPoint);
|
const hasDedicatedMount = Boolean(mountPoint) && !isRootPath(mountPoint);
|
||||||
// External storage entries must only be visible when a dedicated filesystem
|
const shouldShowExternal = exists || hasDedicatedMount;
|
||||||
// mount is present. Existing directories alone are not enough.
|
|
||||||
const shouldShowExternal = hasDedicatedMount;
|
|
||||||
if (hideWhenUnavailable && requireDedicatedMount && !shouldShowExternal) {
|
if (hideWhenUnavailable && requireDedicatedMount && !shouldShowExternal) {
|
||||||
return hiddenResult({
|
return hiddenResult({
|
||||||
path: resolvedPath,
|
path: resolvedPath,
|
||||||
@@ -1262,9 +1077,6 @@ class HardwareMonitorService {
|
|||||||
error: null
|
error: null
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isAbortError(error)) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
if (hideWhenUnavailable) {
|
if (hideWhenUnavailable) {
|
||||||
return hiddenResult({
|
return hiddenResult({
|
||||||
path: resolvedPath,
|
path: resolvedPath,
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,6 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { logLevel } = require('../config');
|
const { logLevel } = require('../config');
|
||||||
const { getBackendLogDir, getFallbackLogRootDir } = require('./logPathService');
|
const { getBackendLogDir, getFallbackLogRootDir } = require('./logPathService');
|
||||||
const { getServerTimestamp } = require('../utils/serverTime');
|
|
||||||
|
|
||||||
const LEVELS = {
|
const LEVELS = {
|
||||||
debug: 10,
|
debug: 10,
|
||||||
@@ -124,7 +123,7 @@ function emit(level, scope, message, meta = null) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const timestamp = getServerTimestamp();
|
const timestamp = new Date().toISOString();
|
||||||
const payload = {
|
const payload = {
|
||||||
timestamp,
|
timestamp,
|
||||||
level: normLevel,
|
level: normLevel,
|
||||||
|
|||||||
@@ -2,218 +2,17 @@ const fs = require('fs');
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { execFile } = require('child_process');
|
const { execFile } = require('child_process');
|
||||||
const { getDb } = require('../db/database');
|
|
||||||
const logger = require('./logger').child('MAKEMKV_KEY');
|
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_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
|
const MAKEMKV_BETA_KEY_API_USER_AGENT = process.env.MAKEMKV_BETA_KEY_API_USER_AGENT
|
||||||
|| DEFAULT_USER_AGENT;
|
|| 'Ripster/1.0 (MakeMKV beta key sync)';
|
||||||
|
const MAKEMKV_BETA_KEY_API_FROM = process.env.MAKEMKV_BETA_KEY_API_FROM
|
||||||
|
|| 'admin@example.invalid';
|
||||||
const MAKEMKV_BETA_KEY_API_TIMEOUT_MS = Math.max(
|
const MAKEMKV_BETA_KEY_API_TIMEOUT_MS = Math.max(
|
||||||
1000,
|
1000,
|
||||||
Number(process.env.MAKEMKV_BETA_KEY_API_TIMEOUT_MS || 15000)
|
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) {
|
function normalizeRegistrationKey(rawValue) {
|
||||||
return String(rawValue || '').trim();
|
return String(rawValue || '').trim();
|
||||||
@@ -294,53 +93,30 @@ async function syncRegistrationKeyToConfig(rawValue, options = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchCurrentBetaKey(options = {}) {
|
async function fetchCurrentBetaKey() {
|
||||||
const forceRefresh = options?.forceRefresh === true;
|
const errors = [];
|
||||||
const now = Date.now();
|
|
||||||
|
|
||||||
if (!forceRefresh && isCacheEntryValid(cachedBetaKeyEntry, now)) {
|
try {
|
||||||
return buildPublicResult(cachedBetaKeyEntry, { cached: true, stale: false });
|
return await fetchCurrentBetaKeyViaCurl();
|
||||||
}
|
} catch (error) {
|
||||||
|
errors.push(error?.message || String(error));
|
||||||
if (!forceRefresh) {
|
logger.warn('beta-key:curl-failed', {
|
||||||
const persistentCacheHit = await tryUsePersistentCache(now);
|
error: error?.message || String(error)
|
||||||
if (persistentCacheHit) {
|
});
|
||||||
return persistentCacheHit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!forceRefresh && blockedUntilMs > now) {
|
|
||||||
throw buildExistingBackoffError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const apiResult = await fetchCurrentBetaKeyViaCurl();
|
return await fetchCurrentBetaKeyViaFetch();
|
||||||
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) {
|
} catch (error) {
|
||||||
|
errors.push(error?.message || String(error));
|
||||||
logger.warn('beta-key:fetch-failed', {
|
logger.warn('beta-key:fetch-failed', {
|
||||||
error: error?.message || String(error)
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const error = new Error(`Betakey konnte nicht geladen werden. Details: ${errors.join(' | ')}`);
|
||||||
|
error.statusCode = 502;
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseBetaKeyResponse(rawBody) {
|
function parseBetaKeyResponse(rawBody) {
|
||||||
@@ -353,35 +129,35 @@ function parseBetaKeyResponse(rawBody) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const betaKey = parseBetaKeyCandidate(String(payload?.key || '').trim(), 'Betakey-Antwort ist ungültig.');
|
const betaKey = String(payload?.key || '').trim();
|
||||||
|
|
||||||
let validUntil = null;
|
if (!/^[A-Za-z0-9][A-Za-z0-9-]{15,}$/.test(betaKey)) {
|
||||||
const unixExpiry = Number(payload?.keydate || payload?.expires || payload?.valid_until_unix || 0);
|
const error = new Error('Betakey-Antwort ist ungültig.');
|
||||||
if (Number.isFinite(unixExpiry) && unixExpiry > 0) {
|
error.statusCode = 502;
|
||||||
validUntil = new Date(unixExpiry * 1000).toISOString();
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedValidUntil = resolveValidityOrFallback(validUntil, MAKEMKV_BETA_KEY_API_URL);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key: betaKey,
|
key: betaKey,
|
||||||
sourceUrl: MAKEMKV_BETA_KEY_API_URL,
|
sourceUrl: MAKEMKV_BETA_KEY_API_URL
|
||||||
validUntil: resolvedValidUntil
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchCurrentBetaKeyViaCurl() {
|
function fetchCurrentBetaKeyViaCurl() {
|
||||||
return new Promise((resolve, reject) => {
|
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(
|
execFile(
|
||||||
'curl',
|
'curl',
|
||||||
curlArgs,
|
[
|
||||||
|
'-fsSL',
|
||||||
|
'--max-time', String(Math.ceil(MAKEMKV_BETA_KEY_API_TIMEOUT_MS / 1000)),
|
||||||
|
'-A', MAKEMKV_BETA_KEY_API_USER_AGENT,
|
||||||
|
'-H', `From: ${MAKEMKV_BETA_KEY_API_FROM}`,
|
||||||
|
'-H', 'Accept: text/plain, text/html;q=0.9, */*;q=0.8',
|
||||||
|
'-H', 'Accept-Language: de,en-US;q=0.7,en;q=0.3',
|
||||||
|
'-H', 'Cache-Control: no-cache',
|
||||||
|
'-H', 'Pragma: no-cache',
|
||||||
|
MAKEMKV_BETA_KEY_API_URL
|
||||||
|
],
|
||||||
{
|
{
|
||||||
timeout: MAKEMKV_BETA_KEY_API_TIMEOUT_MS,
|
timeout: MAKEMKV_BETA_KEY_API_TIMEOUT_MS,
|
||||||
maxBuffer: 1024 * 1024
|
maxBuffer: 1024 * 1024
|
||||||
@@ -392,12 +168,6 @@ function fetchCurrentBetaKeyViaCurl() {
|
|||||||
`curl fehlgeschlagen (${error.code || 'unknown'}): ${String(stderr || error.message || '').trim() || 'keine Details'}`
|
`curl fehlgeschlagen (${error.code || 'unknown'}): ${String(stderr || error.message || '').trim() || 'keine Details'}`
|
||||||
);
|
);
|
||||||
resolvedError.statusCode = 502;
|
resolvedError.statusCode = 502;
|
||||||
if (/\b429\b/.test(String(stderr || ''))) {
|
|
||||||
resolvedError.httpStatus = 429;
|
|
||||||
}
|
|
||||||
if (/\b403\b/.test(String(stderr || ''))) {
|
|
||||||
resolvedError.httpStatus = 403;
|
|
||||||
}
|
|
||||||
reject(resolvedError);
|
reject(resolvedError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -412,10 +182,32 @@ function fetchCurrentBetaKeyViaCurl() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchCurrentBetaKeyViaFetch() {
|
||||||
|
const response = await fetch(MAKEMKV_BETA_KEY_API_URL, {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': MAKEMKV_BETA_KEY_API_USER_AGENT,
|
||||||
|
'From': MAKEMKV_BETA_KEY_API_FROM,
|
||||||
|
'Accept': 'text/plain, text/html;q=0.9, */*;q=0.8',
|
||||||
|
'Accept-Language': 'de,en-US;q=0.7,en;q=0.3',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
'Pragma': 'no-cache'
|
||||||
|
},
|
||||||
|
signal: AbortSignal.timeout(MAKEMKV_BETA_KEY_API_TIMEOUT_MS)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const error = new Error(`HTTP ${response.status}`);
|
||||||
|
error.statusCode = 502;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rawBody = await response.text();
|
||||||
|
return parseBetaKeyResponse(rawBody);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
MAKEMKV_BETA_KEY_API_URL,
|
MAKEMKV_BETA_KEY_API_URL,
|
||||||
fetchCurrentBetaKey,
|
fetchCurrentBetaKey,
|
||||||
getCachedBetaKey,
|
|
||||||
getMakeMKVConfigDir,
|
getMakeMKVConfigDir,
|
||||||
getMakeMKVSettingsFilePath,
|
getMakeMKVSettingsFilePath,
|
||||||
normalizeRegistrationKey,
|
normalizeRegistrationKey,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const settingsService = require('./settingsService');
|
||||||
const logger = require('./logger').child('MUSICBRAINZ');
|
const logger = require('./logger').child('MUSICBRAINZ');
|
||||||
|
|
||||||
const MB_BASE = 'https://musicbrainz.org/ws/2';
|
const MB_BASE = 'https://musicbrainz.org/ws/2';
|
||||||
@@ -73,17 +74,6 @@ function normalizeRelease(release) {
|
|||||||
artist: artistFromTrack || artistFromRecording || artistCredit || null
|
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
|
// Always generate the CAA URL when an id is present; the browser/onError
|
||||||
// handles 404s for releases that have no front cover.
|
// 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
|
? release['label-info'].map((li) => li?.label?.name).filter(Boolean).join(', ') || null
|
||||||
: null,
|
: null,
|
||||||
coverArtUrl,
|
coverArtUrl,
|
||||||
tracks: normalizedTracks,
|
tracks: normalizedTracks
|
||||||
trackCount
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class MusicBrainzService {
|
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();
|
const q = String(query || '').trim();
|
||||||
if (!q) {
|
if (!q) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const expectedTrackCountRaw = Number(options?.trackCount);
|
|
||||||
const expectedTrackCount = Number.isFinite(expectedTrackCountRaw) && expectedTrackCountRaw > 0
|
const enabled = await this.isEnabled();
|
||||||
? Math.trunc(expectedTrackCountRaw)
|
if (!enabled) {
|
||||||
: null;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
logger.info('search:start', { query: q });
|
logger.info('search:start', { query: q });
|
||||||
|
|
||||||
const url = new URL(`${MB_BASE}/release`);
|
const url = new URL(`${MB_BASE}/release`);
|
||||||
@@ -128,23 +124,11 @@ class MusicBrainzService {
|
|||||||
try {
|
try {
|
||||||
const data = await mbFetch(url.toString());
|
const data = await mbFetch(url.toString());
|
||||||
const releases = Array.isArray(data.releases) ? data.releases : [];
|
const releases = Array.isArray(data.releases) ? data.releases : [];
|
||||||
const normalizedReleases = releases.map(normalizeRelease).filter(Boolean);
|
const results = releases.map(normalizeRelease).filter(Boolean);
|
||||||
const results = expectedTrackCount
|
logger.info('search:done', { query: q, count: results.length });
|
||||||
? normalizedReleases.filter((release) => Number(release?.trackCount || 0) === expectedTrackCount)
|
|
||||||
: normalizedReleases;
|
|
||||||
logger.info('search:done', {
|
|
||||||
query: q,
|
|
||||||
expectedTrackCount,
|
|
||||||
sourceCount: normalizedReleases.length,
|
|
||||||
count: results.length
|
|
||||||
});
|
|
||||||
return results;
|
return results;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('search:failed', {
|
logger.warn('search:failed', { query: q, error: String(error?.message || error) });
|
||||||
query: q,
|
|
||||||
expectedTrackCount,
|
|
||||||
error: String(error?.message || error)
|
|
||||||
});
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,6 +143,11 @@ class MusicBrainzService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enabled = await this.isEnabled();
|
||||||
|
if (!enabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
logger.info('getById:start', { mbId: id });
|
logger.info('getById:start', { mbId: id });
|
||||||
|
|
||||||
const url = new URL(`${MB_BASE}/release/${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();
|
||||||
+919
-2660
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,6 @@ const { spawnTrackedProcess } = require('./processRunner');
|
|||||||
const { errorToMeta } = require('../utils/errorMeta');
|
const { errorToMeta } = require('../utils/errorMeta');
|
||||||
|
|
||||||
const CHAIN_NAME_MAX_LENGTH = 120;
|
const CHAIN_NAME_MAX_LENGTH = 120;
|
||||||
const CHAIN_DESCRIPTION_MAX_LENGTH = 50;
|
|
||||||
const STEP_TYPE_SCRIPT = 'script';
|
const STEP_TYPE_SCRIPT = 'script';
|
||||||
const STEP_TYPE_WAIT = 'wait';
|
const STEP_TYPE_WAIT = 'wait';
|
||||||
const VALID_STEP_TYPES = new Set([STEP_TYPE_SCRIPT, STEP_TYPE_WAIT]);
|
const VALID_STEP_TYPES = new Set([STEP_TYPE_SCRIPT, STEP_TYPE_WAIT]);
|
||||||
@@ -27,31 +26,6 @@ function createValidationError(message, details = null) {
|
|||||||
return error;
|
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 = []) {
|
function mapChainRow(row, steps = []) {
|
||||||
if (!row) {
|
if (!row) {
|
||||||
return null;
|
return null;
|
||||||
@@ -59,8 +33,6 @@ function mapChainRow(row, steps = []) {
|
|||||||
return {
|
return {
|
||||||
id: Number(row.id),
|
id: Number(row.id),
|
||||||
name: String(row.name || ''),
|
name: String(row.name || ''),
|
||||||
description: normalizeChainDescription(row.description),
|
|
||||||
isFavorite: normalizeFavoriteFlag(row.is_favorite, 0) === 1,
|
|
||||||
orderIndex: Number(row.order_index || 0),
|
orderIndex: Number(row.order_index || 0),
|
||||||
steps: steps.map(mapStepRow),
|
steps: steps.map(mapStepRow),
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
@@ -84,27 +56,24 @@ function mapStepRow(row) {
|
|||||||
|
|
||||||
function terminateChildProcess(child, { immediate = false } = {}) {
|
function terminateChildProcess(child, { immediate = false } = {}) {
|
||||||
if (!child) {
|
if (!child) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
const signal = immediate ? 'SIGKILL' : 'SIGTERM';
|
const signal = immediate ? 'SIGKILL' : 'SIGTERM';
|
||||||
const pid = Number(child.pid);
|
const pid = Number(child.pid);
|
||||||
let signaled = false;
|
|
||||||
if (Number.isFinite(pid) && pid > 0) {
|
if (Number.isFinite(pid) && pid > 0) {
|
||||||
try {
|
try {
|
||||||
// For detached children this targets the full process group.
|
// For detached children this targets the full process group.
|
||||||
process.kill(-pid, signal);
|
process.kill(-pid, signal);
|
||||||
signaled = true;
|
return;
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
// ignore and continue with direct child signal
|
// Fall through to direct child signal.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
child.kill(signal);
|
child.kill(signal);
|
||||||
signaled = true;
|
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
// ignore
|
return;
|
||||||
}
|
}
|
||||||
return signaled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendTailText(currentValue, nextChunk, maxChars = 12000) {
|
function appendTailText(currentValue, nextChunk, maxChars = 12000) {
|
||||||
@@ -192,7 +161,7 @@ class ScriptChainService {
|
|||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const rows = await db.all(
|
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
|
FROM script_chains
|
||||||
ORDER BY order_index ASC, id ASC
|
ORDER BY order_index ASC, id ASC
|
||||||
`
|
`
|
||||||
@@ -241,7 +210,7 @@ class ScriptChainService {
|
|||||||
}
|
}
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const row = await db.get(
|
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]
|
[normalizedId]
|
||||||
);
|
);
|
||||||
if (!row) {
|
if (!row) {
|
||||||
@@ -263,7 +232,7 @@ class ScriptChainService {
|
|||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const placeholders = ids.map(() => '?').join(', ');
|
const placeholders = ids.map(() => '?').join(', ');
|
||||||
const rows = await db.all(
|
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
|
ids
|
||||||
);
|
);
|
||||||
const stepRows = await db.all(
|
const stepRows = await db.all(
|
||||||
@@ -296,16 +265,12 @@ class ScriptChainService {
|
|||||||
async createChain(payload = {}) {
|
async createChain(payload = {}) {
|
||||||
const body = payload && typeof payload === 'object' ? payload : {};
|
const body = payload && typeof payload === 'object' ? payload : {};
|
||||||
const name = String(body.name || '').trim();
|
const name = String(body.name || '').trim();
|
||||||
const description = normalizeChainDescription(body.description);
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
||||||
}
|
}
|
||||||
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
||||||
throw createValidationError('Skriptkettenname zu lang.', [{ field: 'name', message: `Maximal ${CHAIN_NAME_MAX_LENGTH} Zeichen.` }]);
|
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 steps = validateSteps(body.steps);
|
||||||
|
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
@@ -313,10 +278,10 @@ class ScriptChainService {
|
|||||||
const nextOrderIndex = await this._getNextOrderIndex(db);
|
const nextOrderIndex = await this._getNextOrderIndex(db);
|
||||||
const result = await db.run(
|
const result = await db.run(
|
||||||
`
|
`
|
||||||
INSERT INTO script_chains (name, description, is_favorite, order_index, created_at, updated_at)
|
INSERT INTO script_chains (name, order_index, created_at, updated_at)
|
||||||
VALUES (?, ?, 0, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
VALUES (?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||||
`,
|
`,
|
||||||
[name, description || null, nextOrderIndex]
|
[name, nextOrderIndex]
|
||||||
);
|
);
|
||||||
const chainId = result.lastID;
|
const chainId = result.lastID;
|
||||||
await this._saveSteps(db, chainId, steps);
|
await this._saveSteps(db, chainId, steps);
|
||||||
@@ -336,16 +301,12 @@ class ScriptChainService {
|
|||||||
}
|
}
|
||||||
const body = payload && typeof payload === 'object' ? payload : {};
|
const body = payload && typeof payload === 'object' ? payload : {};
|
||||||
const name = String(body.name || '').trim();
|
const name = String(body.name || '').trim();
|
||||||
const description = normalizeChainDescription(body.description);
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
throw createValidationError('Skriptkettenname darf nicht leer sein.', [{ field: 'name', message: 'Name darf nicht leer sein.' }]);
|
||||||
}
|
}
|
||||||
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
if (name.length > CHAIN_NAME_MAX_LENGTH) {
|
||||||
throw createValidationError('Skriptkettenname zu lang.', [{ field: 'name', message: `Maximal ${CHAIN_NAME_MAX_LENGTH} Zeichen.` }]);
|
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 steps = validateSteps(body.steps);
|
||||||
|
|
||||||
await this.getChainById(normalizedId);
|
await this.getChainById(normalizedId);
|
||||||
@@ -353,8 +314,8 @@ class ScriptChainService {
|
|||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
try {
|
try {
|
||||||
await db.run(
|
await db.run(
|
||||||
`UPDATE script_chains SET name = ?, description = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?`,
|
`UPDATE script_chains SET name = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?`,
|
||||||
[name, description || null, normalizedId]
|
[name, normalizedId]
|
||||||
);
|
);
|
||||||
await db.run(`DELETE FROM script_chain_steps WHERE chain_id = ?`, [normalizedId]);
|
await db.run(`DELETE FROM script_chain_steps WHERE chain_id = ?`, [normalizedId]);
|
||||||
await this._saveSteps(db, normalizedId, steps);
|
await this._saveSteps(db, normalizedId, steps);
|
||||||
@@ -378,25 +339,6 @@ class ScriptChainService {
|
|||||||
return existing;
|
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 = []) {
|
async reorderChains(orderedIds = []) {
|
||||||
const providedIds = Array.isArray(orderedIds)
|
const providedIds = Array.isArray(orderedIds)
|
||||||
? orderedIds.map(normalizeChainId).filter(Boolean)
|
? orderedIds.map(normalizeChainId).filter(Boolean)
|
||||||
@@ -501,7 +443,6 @@ class ScriptChainService {
|
|||||||
currentStepType: null,
|
currentStepType: null,
|
||||||
activeWaitResolve: null,
|
activeWaitResolve: null,
|
||||||
activeChild: null,
|
activeChild: null,
|
||||||
activeProcessHandle: null,
|
|
||||||
activeChildTermination: null
|
activeChildTermination: null
|
||||||
};
|
};
|
||||||
const emitRuntimeStep = (payload = {}) => {
|
const emitRuntimeStep = (payload = {}) => {
|
||||||
@@ -528,23 +469,6 @@ class ScriptChainService {
|
|||||||
message: 'Abbruch angefordert',
|
message: 'Abbruch angefordert',
|
||||||
currentStep: controlState.currentStepType ? `Abbruch läuft (${controlState.currentStepType})` : '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') {
|
if (typeof appendLog === 'function') {
|
||||||
try {
|
try {
|
||||||
await appendLog('SYSTEM', `Kette "${chain.name}" - Abbruch angefordert.`);
|
await appendLog('SYSTEM', `Kette "${chain.name}" - Abbruch angefordert.`);
|
||||||
@@ -552,6 +476,12 @@ class ScriptChainService {
|
|||||||
// ignore appendLog failures for control actions
|
// 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.' };
|
return { accepted: true, message: 'Abbruch angefordert.' };
|
||||||
};
|
};
|
||||||
const requestNextStep = async () => {
|
const requestNextStep = async () => {
|
||||||
@@ -732,7 +662,6 @@ class ScriptChainService {
|
|||||||
runtimeActivityService.appendActivityOutput(scriptActivityId, { stderr: line });
|
runtimeActivityService.appendActivityOutput(scriptActivityId, { stderr: line });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controlState.activeProcessHandle = processHandle;
|
|
||||||
let runError = null;
|
let runError = null;
|
||||||
let exitCode = 0;
|
let exitCode = 0;
|
||||||
let signal = null;
|
let signal = null;
|
||||||
@@ -747,7 +676,6 @@ class ScriptChainService {
|
|||||||
}
|
}
|
||||||
const termination = controlState.activeChildTermination;
|
const termination = controlState.activeChildTermination;
|
||||||
controlState.activeChild = null;
|
controlState.activeChild = null;
|
||||||
controlState.activeProcessHandle = null;
|
|
||||||
controlState.activeChildTermination = null;
|
controlState.activeChildTermination = null;
|
||||||
if (runError && exitCode === null && !termination) {
|
if (runError && exitCode === null && !termination) {
|
||||||
throw runError;
|
throw runError;
|
||||||
@@ -901,7 +829,6 @@ class ScriptChainService {
|
|||||||
break;
|
break;
|
||||||
} finally {
|
} finally {
|
||||||
controlState.activeChild = null;
|
controlState.activeChild = null;
|
||||||
controlState.activeProcessHandle = null;
|
|
||||||
controlState.activeChildTermination = null;
|
controlState.activeChildTermination = null;
|
||||||
if (prepared?.cleanup) {
|
if (prepared?.cleanup) {
|
||||||
await prepared.cleanup();
|
await prepared.cleanup();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const { getDb } = require('../db/database');
|
const { getDb } = require('../db/database');
|
||||||
@@ -7,7 +8,6 @@ const settingsService = require('./settingsService');
|
|||||||
const runtimeActivityService = require('./runtimeActivityService');
|
const runtimeActivityService = require('./runtimeActivityService');
|
||||||
const { streamLines } = require('./processRunner');
|
const { streamLines } = require('./processRunner');
|
||||||
const { errorToMeta } = require('../utils/errorMeta');
|
const { errorToMeta } = require('../utils/errorMeta');
|
||||||
const { tempDir } = require('../config');
|
|
||||||
|
|
||||||
const SCRIPT_NAME_MAX_LENGTH = 120;
|
const SCRIPT_NAME_MAX_LENGTH = 120;
|
||||||
const SCRIPT_BODY_MAX_LENGTH = 200000;
|
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');
|
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) {
|
function createValidationError(message, details = null) {
|
||||||
const error = new Error(message);
|
const error = new Error(message);
|
||||||
error.statusCode = 400;
|
error.statusCode = 400;
|
||||||
@@ -146,7 +125,6 @@ function mapScriptRow(row) {
|
|||||||
id: Number(row.id),
|
id: Number(row.id),
|
||||||
name: String(row.name || ''),
|
name: String(row.name || ''),
|
||||||
scriptBody: String(row.script_body || ''),
|
scriptBody: String(row.script_body || ''),
|
||||||
isFavorite: normalizeFavoriteFlag(row.is_favorite, 0) === 1,
|
|
||||||
orderIndex: Number(row.order_index || 0),
|
orderIndex: Number(row.order_index || 0),
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
updatedAt: row.updated_at
|
updatedAt: row.updated_at
|
||||||
@@ -347,7 +325,7 @@ class ScriptService {
|
|||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const rows = await db.all(
|
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
|
FROM scripts
|
||||||
ORDER BY order_index ASC, id ASC
|
ORDER BY order_index ASC, id ASC
|
||||||
`
|
`
|
||||||
@@ -363,7 +341,7 @@ class ScriptService {
|
|||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const row = await db.get(
|
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
|
FROM scripts
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
`,
|
`,
|
||||||
@@ -384,8 +362,8 @@ class ScriptService {
|
|||||||
const nextOrderIndex = await this._getNextOrderIndex(db);
|
const nextOrderIndex = await this._getNextOrderIndex(db);
|
||||||
const result = await db.run(
|
const result = await db.run(
|
||||||
`
|
`
|
||||||
INSERT INTO scripts (name, script_body, is_favorite, order_index, created_at, updated_at)
|
INSERT INTO scripts (name, script_body, order_index, created_at, updated_at)
|
||||||
VALUES (?, ?, 0, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
VALUES (?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||||
`,
|
`,
|
||||||
[normalized.name, normalized.scriptBody, nextOrderIndex]
|
[normalized.name, normalized.scriptBody, nextOrderIndex]
|
||||||
);
|
);
|
||||||
@@ -442,25 +420,6 @@ class ScriptService {
|
|||||||
return existing;
|
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 = []) {
|
async getScriptsByIds(rawIds = []) {
|
||||||
const ids = normalizeScriptIdList(rawIds);
|
const ids = normalizeScriptIdList(rawIds);
|
||||||
if (ids.length === 0) {
|
if (ids.length === 0) {
|
||||||
@@ -470,7 +429,7 @@ class ScriptService {
|
|||||||
const placeholders = ids.map(() => '?').join(', ');
|
const placeholders = ids.map(() => '?').join(', ');
|
||||||
const rows = await db.all(
|
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
|
FROM scripts
|
||||||
WHERE id IN (${placeholders})
|
WHERE id IN (${placeholders})
|
||||||
`,
|
`,
|
||||||
@@ -573,9 +532,8 @@ class ScriptService {
|
|||||||
async createExecutableScriptFile(script, context = {}) {
|
async createExecutableScriptFile(script, context = {}) {
|
||||||
const name = String(script?.name || '').trim() || `script-${script?.id || 'unknown'}`;
|
const name = String(script?.name || '').trim() || `script-${script?.id || 'unknown'}`;
|
||||||
const scriptBody = normalizeScriptBody(script?.scriptBody);
|
const scriptBody = normalizeScriptBody(script?.scriptBody);
|
||||||
fs.mkdirSync(tempDir, { recursive: true });
|
const tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'ripster-script-'));
|
||||||
const scriptTempDir = await fs.promises.mkdtemp(path.join(tempDir, 'ripster-script-'));
|
const scriptPath = path.join(tempDir, 'script.sh');
|
||||||
const scriptPath = path.join(scriptTempDir, 'script.sh');
|
|
||||||
const wrapped = buildScriptWrapper(scriptBody, {
|
const wrapped = buildScriptWrapper(scriptBody, {
|
||||||
...context,
|
...context,
|
||||||
scriptId: script?.id ?? context?.scriptId ?? '',
|
scriptId: script?.id ?? context?.scriptId ?? '',
|
||||||
@@ -590,19 +548,19 @@ class ScriptService {
|
|||||||
|
|
||||||
const cleanup = async () => {
|
const cleanup = async () => {
|
||||||
try {
|
try {
|
||||||
await fs.promises.rm(scriptTempDir, { recursive: true, force: true });
|
await fs.promises.rm(tempDir, { recursive: true, force: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('script:temp-cleanup-failed', {
|
logger.warn('script:temp-cleanup-failed', {
|
||||||
scriptId: script?.id ?? null,
|
scriptId: script?.id ?? null,
|
||||||
scriptName: name,
|
scriptName: name,
|
||||||
tempDir: scriptTempDir,
|
tempDir,
|
||||||
error: errorToMeta(error)
|
error: errorToMeta(error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tempDir: scriptTempDir,
|
tempDir,
|
||||||
scriptPath,
|
scriptPath,
|
||||||
cmd: '/usr/bin/env',
|
cmd: '/usr/bin/env',
|
||||||
args: ['bash', scriptPath],
|
args: ['bash', scriptPath],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { spawn, spawnSync } = require('child_process');
|
const { spawn, spawnSync } = require('child_process');
|
||||||
const { getDb } = require('../db/database');
|
const { getDb } = require('../db/database');
|
||||||
@@ -28,8 +29,7 @@ const {
|
|||||||
defaultDownloadDir: DEFAULT_DOWNLOAD_DIR,
|
defaultDownloadDir: DEFAULT_DOWNLOAD_DIR,
|
||||||
defaultConverterRawDir: DEFAULT_CONVERTER_RAW_DIR,
|
defaultConverterRawDir: DEFAULT_CONVERTER_RAW_DIR,
|
||||||
defaultConverterMovieDir: DEFAULT_CONVERTER_MOVIE_DIR,
|
defaultConverterMovieDir: DEFAULT_CONVERTER_MOVIE_DIR,
|
||||||
defaultConverterAudioDir: DEFAULT_CONVERTER_AUDIO_DIR,
|
defaultConverterAudioDir: DEFAULT_CONVERTER_AUDIO_DIR
|
||||||
tempDir: DEFAULT_TEMP_DIR
|
|
||||||
} = require('../config');
|
} = require('../config');
|
||||||
|
|
||||||
const DEFAULT_AUDIO_COPY_MASK = ['copy:aac', 'copy:ac3', 'copy:eac3', 'copy:truehd', 'copy:dts', 'copy:dtshd', 'copy:mp3', 'copy:flac'];
|
const DEFAULT_AUDIO_COPY_MASK = ['copy:aac', 'copy:ac3', 'copy:eac3', 'copy:truehd', 'copy:dts', 'copy:dtshd', 'copy:mp3', 'copy:flac'];
|
||||||
@@ -44,15 +44,11 @@ const HANDBRAKE_PRESET_RELEVANT_SETTING_KEYS = new Set([
|
|||||||
]);
|
]);
|
||||||
const SENSITIVE_SETTING_KEYS = new Set([
|
const SENSITIVE_SETTING_KEYS = new Set([
|
||||||
'makemkv_registration_key',
|
'makemkv_registration_key',
|
||||||
|
'omdb_api_key',
|
||||||
'tmdb_api_read_access_token',
|
'tmdb_api_read_access_token',
|
||||||
'pushover_token',
|
'pushover_token',
|
||||||
'pushover_user'
|
'pushover_user'
|
||||||
]);
|
]);
|
||||||
const LEGACY_HIDDEN_SETTING_KEYS = new Set([
|
|
||||||
'omdb_api_key',
|
|
||||||
'omdb_default_type',
|
|
||||||
'omdb_timeout_ms'
|
|
||||||
]);
|
|
||||||
const IMMUTABLE_SETTING_KEYS = new Set([
|
const IMMUTABLE_SETTING_KEYS = new Set([
|
||||||
'makemkv_command',
|
'makemkv_command',
|
||||||
'mediainfo_command',
|
'mediainfo_command',
|
||||||
@@ -150,14 +146,6 @@ const PROFILED_SETTINGS = {
|
|||||||
bluray: 'handbrake_extra_args_bluray',
|
bluray: 'handbrake_extra_args_bluray',
|
||||||
dvd: 'handbrake_extra_args_dvd'
|
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: {
|
output_extension: {
|
||||||
bluray: 'output_extension_bluray',
|
bluray: 'output_extension_bluray',
|
||||||
dvd: 'output_extension_dvd'
|
dvd: 'output_extension_dvd'
|
||||||
@@ -209,11 +197,6 @@ function normalizeBooleanSetting(rawValue, fallback = true) {
|
|||||||
return toBoolean(normalizedRaw);
|
return toBoolean(normalizedRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isHiddenSettingKey(key) {
|
|
||||||
const normalized = String(key || '').trim().toLowerCase();
|
|
||||||
return LEGACY_HIDDEN_SETTING_KEYS.has(normalized);
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyRuntimeServerConsoleLoggingSettingsFromMap(settingsMap = {}) {
|
function applyRuntimeServerConsoleLoggingSettingsFromMap(settingsMap = {}) {
|
||||||
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
|
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
|
||||||
const enabled = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY], true);
|
const enabled = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY], true);
|
||||||
@@ -316,38 +299,12 @@ function removeSelectionArgs(extraArgs) {
|
|||||||
|
|
||||||
const isAudioWithValue = AUDIO_SELECTION_KEYS_WITH_VALUE.has(key);
|
const isAudioWithValue = AUDIO_SELECTION_KEYS_WITH_VALUE.has(key);
|
||||||
const isAudioFlagOnly = AUDIO_SELECTION_KEYS_FLAG_ONLY.has(key);
|
const isAudioFlagOnly = AUDIO_SELECTION_KEYS_FLAG_ONLY.has(key);
|
||||||
const isSubtitleSelectionWithValue = SUBTITLE_SELECTION_KEYS_WITH_VALUE.has(key);
|
const isSubtitleWithValue = SUBTITLE_SELECTION_KEYS_WITH_VALUE.has(key)
|
||||||
const isSubtitleFlagWithValue = SUBTITLE_FLAG_KEYS_WITH_VALUE.has(key);
|
|| SUBTITLE_FLAG_KEYS_WITH_VALUE.has(key);
|
||||||
const isSubtitleWithValue = isSubtitleSelectionWithValue || isSubtitleFlagWithValue;
|
|
||||||
const isSubtitleFlagOnly = SUBTITLE_SELECTION_KEYS_FLAG_ONLY.has(key);
|
const isSubtitleFlagOnly = SUBTITLE_SELECTION_KEYS_FLAG_ONLY.has(key);
|
||||||
const isTitleWithValue = TITLE_SELECTION_KEYS_WITH_VALUE.has(key);
|
const isTitleWithValue = TITLE_SELECTION_KEYS_WITH_VALUE.has(key);
|
||||||
const skip = isAudioWithValue || isAudioFlagOnly || isSubtitleWithValue || isSubtitleFlagOnly || isTitleWithValue;
|
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) {
|
if (!skip) {
|
||||||
filtered.push(token);
|
filtered.push(token);
|
||||||
continue;
|
continue;
|
||||||
@@ -899,8 +856,7 @@ class SettingsService {
|
|||||||
|
|
||||||
async getSchemaRows() {
|
async getSchemaRows() {
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
const rows = await db.all('SELECT * FROM settings_schema ORDER BY category ASC, order_index ASC');
|
return db.all('SELECT * FROM settings_schema ORDER BY category ASC, order_index ASC');
|
||||||
return rows.filter((row) => !isHiddenSettingKey(row?.key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSettingsMap(options = {}) {
|
async getSettingsMap(options = {}) {
|
||||||
@@ -1056,9 +1012,7 @@ class SettingsService {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
return rows
|
return rows.map((row) => ({
|
||||||
.filter((row) => !isHiddenSettingKey(row?.key))
|
|
||||||
.map((row) => ({
|
|
||||||
key: row.key,
|
key: row.key,
|
||||||
category: row.category,
|
category: row.category,
|
||||||
label: row.label,
|
label: row.label,
|
||||||
@@ -1071,7 +1025,7 @@ class SettingsService {
|
|||||||
value: normalizeValueByType(row.type, row.current_value ?? row.default_value),
|
value: normalizeValueByType(row.type, row.current_value ?? row.default_value),
|
||||||
orderIndex: row.order_index,
|
orderIndex: row.order_index,
|
||||||
depends_on: row.depends_on ?? null
|
depends_on: row.depends_on ?? null
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFlatSettings(options = {}) {
|
async getFlatSettings(options = {}) {
|
||||||
@@ -1600,8 +1554,7 @@ class SettingsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const exportName = `ripster-export-${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
const exportName = `ripster-export-${Date.now()}-${Math.floor(Math.random() * 10000)}`;
|
||||||
fs.mkdirSync(DEFAULT_TEMP_DIR, { recursive: true });
|
const exportFile = path.join(os.tmpdir(), `${exportName}.json`);
|
||||||
const exportFile = path.join(DEFAULT_TEMP_DIR, `${exportName}.json`);
|
|
||||||
const args = [
|
const args = [
|
||||||
'--scan',
|
'--scan',
|
||||||
'-i',
|
'-i',
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const logger = require('./logger').child('TEMP_CLEANUP');
|
const logger = require('./logger').child('TEMP_CLEANUP');
|
||||||
const { tempDir } = require('../config');
|
|
||||||
|
|
||||||
const TMP_ROOT = tempDir;
|
const TMP_ROOT = os.tmpdir();
|
||||||
const SWEEP_INTERVAL_MS = 60 * 60 * 1000;
|
const SWEEP_INTERVAL_MS = 60 * 60 * 1000;
|
||||||
const STALE_ENTRY_MIN_AGE_MS = 12 * 60 * 60 * 1000;
|
const STALE_ENTRY_MIN_AGE_MS = 12 * 60 * 60 * 1000;
|
||||||
|
|
||||||
@@ -65,7 +65,6 @@ class TempCleanupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async runSweep(reason = 'manual') {
|
async runSweep(reason = 'manual') {
|
||||||
fs.mkdirSync(TMP_ROOT, { recursive: true });
|
|
||||||
const deleted = [];
|
const deleted = [];
|
||||||
const skipped = [];
|
const skipped = [];
|
||||||
const failed = [];
|
const failed = [];
|
||||||
|
|||||||
@@ -8,49 +8,6 @@ const TMDB_IMAGE_BASE_URL = 'https://image.tmdb.org/t/p';
|
|||||||
const TMDB_TIMEOUT_MS = 15000;
|
const TMDB_TIMEOUT_MS = 15000;
|
||||||
|
|
||||||
class TmdbService {
|
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) {
|
isAbortError(error) {
|
||||||
const name = String(error?.name || '').trim().toLowerCase();
|
const name = String(error?.name || '').trim().toLowerCase();
|
||||||
const message = String(error?.message || '').trim().toLowerCase();
|
const message = String(error?.message || '').trim().toLowerCase();
|
||||||
@@ -146,11 +103,9 @@ class TmdbService {
|
|||||||
|
|
||||||
async getConfig() {
|
async getConfig() {
|
||||||
const settings = await settingsService.getSettingsMap();
|
const settings = await settingsService.getSettingsMap();
|
||||||
const fallbackLanguages = this.parseLanguageList(settings.dvd_series_fallback_languages);
|
|
||||||
return {
|
return {
|
||||||
readAccessToken: String(settings.tmdb_api_read_access_token || '').trim() || null,
|
readAccessToken: String(settings.tmdb_api_read_access_token || '').trim() || null,
|
||||||
language: String(settings.dvd_series_language || 'de-DE').trim() || 'de-DE',
|
language: String(settings.dvd_series_language || 'de-DE').trim() || 'de-DE'
|
||||||
fallbackLanguages
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,45 +119,6 @@ class TmdbService {
|
|||||||
return String(explicitLanguage || config.language || 'de-DE').trim() || 'de-DE';
|
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 = {}) {
|
async request(pathName, options = {}) {
|
||||||
const config = await this.getConfig();
|
const config = await this.getConfig();
|
||||||
if (!config.readAccessToken) {
|
if (!config.readAccessToken) {
|
||||||
@@ -261,135 +177,47 @@ class TmdbService {
|
|||||||
if (!normalizedQuery || !(await this.isConfigured())) {
|
if (!normalizedQuery || !(await this.isConfigured())) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
const language = await this.resolveLanguage(options.language);
|
||||||
let lastFailureCode = null;
|
|
||||||
let lastFailureStatusCode = null;
|
|
||||||
let lastFailureMessage = null;
|
|
||||||
|
|
||||||
for (const language of languageCandidates) {
|
let data = null;
|
||||||
let data = null;
|
try {
|
||||||
try {
|
data = await this.request('/search/tv', {
|
||||||
data = await this.request('/search/tv', {
|
query: {
|
||||||
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,
|
query: normalizedQuery,
|
||||||
|
first_air_date_year: options.year || undefined,
|
||||||
language,
|
language,
|
||||||
error: lastFailureMessage,
|
page: options.page || 1,
|
||||||
failureCode,
|
include_adult: false
|
||||||
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', {
|
|
||||||
query: normalizedQuery,
|
|
||||||
error: lastFailureMessage,
|
|
||||||
failureCode: lastFailureCode,
|
|
||||||
statusCode: lastFailureStatusCode
|
|
||||||
});
|
});
|
||||||
}
|
} catch (error) {
|
||||||
return this.attachFailureCode([], lastFailureCode);
|
const failureCode = this.classifyRequestError(error);
|
||||||
}
|
logger.warn('search:failed', {
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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', {
|
|
||||||
query: normalizedQuery,
|
query: normalizedQuery,
|
||||||
error: lastFailureMessage,
|
error: error?.message || String(error),
|
||||||
failureCode: lastFailureCode,
|
failureCode,
|
||||||
statusCode: lastFailureStatusCode
|
statusCode: Number(error?.statusCode || 0) || null
|
||||||
});
|
});
|
||||||
|
return this.attachFailureCode([], failureCode);
|
||||||
}
|
}
|
||||||
return this.attachFailureCode([], lastFailureCode);
|
|
||||||
|
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);
|
||||||
|
return this.attachFailureCode(normalizedRows, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSeriesDetails(seriesId, options = {}) {
|
async getSeriesDetails(seriesId, options = {}) {
|
||||||
@@ -397,111 +225,24 @@ class TmdbService {
|
|||||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||||
return null;
|
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);
|
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: {
|
query: {
|
||||||
language
|
language,
|
||||||
|
append_to_response: appendToResponse.length > 0 ? appendToResponse.join(',') : undefined
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
logger.warn('movie:credits:failed', {
|
logger.warn('series:details:failed', {
|
||||||
movieId: Math.trunc(id),
|
seriesId: Math.trunc(id),
|
||||||
error: error?.message || String(error)
|
error: error?.message || String(error)
|
||||||
});
|
});
|
||||||
return null;
|
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) {
|
async getEpisodeGroups(seriesId) {
|
||||||
const id = Number(seriesId);
|
const id = Number(seriesId);
|
||||||
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
if (!Number.isFinite(id) || id <= 0 || !(await this.isConfigured())) {
|
||||||
@@ -522,31 +263,18 @@ class TmdbService {
|
|||||||
if (!normalizedId || !(await this.isConfigured())) {
|
if (!normalizedId || !(await this.isConfigured())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
const language = await this.resolveLanguage(options.language);
|
||||||
let fallbackDetails = null;
|
return this.request(`/tv/episode_group/${normalizedId}`, {
|
||||||
for (const language of languageCandidates) {
|
query: {
|
||||||
const details = await this.request(`/tv/episode_group/${normalizedId}`, {
|
language
|
||||||
query: {
|
}
|
||||||
language
|
}).catch((error) => {
|
||||||
}
|
logger.warn('episode-group:details:failed', {
|
||||||
}).catch((error) => {
|
groupId: normalizedId,
|
||||||
logger.warn('episode-group:details:failed', {
|
error: error?.message || String(error)
|
||||||
groupId: normalizedId,
|
|
||||||
language,
|
|
||||||
error: error?.message || String(error)
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
});
|
});
|
||||||
if (!details) {
|
return null;
|
||||||
continue;
|
});
|
||||||
}
|
|
||||||
const hasLocalizedPayload = Boolean(String(details?.name || '').trim() || String(details?.description || '').trim());
|
|
||||||
if (hasLocalizedPayload) {
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
fallbackDetails = fallbackDetails || details;
|
|
||||||
}
|
|
||||||
return fallbackDetails;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSeasonDetails(seriesId, seasonNumber, options = {}) {
|
async getSeasonDetails(seriesId, seasonNumber, options = {}) {
|
||||||
@@ -555,28 +283,12 @@ class TmdbService {
|
|||||||
if (!Number.isFinite(id) || id <= 0 || !Number.isFinite(season) || season < 0 || !(await this.isConfigured())) {
|
if (!Number.isFinite(id) || id <= 0 || !Number.isFinite(season) || season < 0 || !(await this.isConfigured())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const languageCandidates = await this.resolveLanguageCandidates(options);
|
const language = await this.resolveLanguage(options.language);
|
||||||
let fallbackDetails = null;
|
return this.request(`/tv/${Math.trunc(id)}/season/${Math.trunc(season)}`, {
|
||||||
for (const language of languageCandidates) {
|
query: {
|
||||||
const details = await this.request(`/tv/${Math.trunc(id)}/season/${Math.trunc(season)}`, {
|
language
|
||||||
query: {
|
|
||||||
language
|
|
||||||
}
|
|
||||||
}).catch(() => null);
|
|
||||||
if (!details) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
const hasLocalizedPayload = Boolean(
|
}).catch(() => null);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSeasonCredits(seriesId, seasonNumber, options = {}) {
|
async getSeasonCredits(seriesId, seasonNumber, options = {}) {
|
||||||
@@ -631,7 +343,10 @@ class TmdbService {
|
|||||||
const creators = Array.isArray(details?.created_by) ? details.created_by : [];
|
const creators = Array.isArray(details?.created_by) ? details.created_by : [];
|
||||||
const genres = Array.isArray(details?.genres) ? details.genres : [];
|
const genres = Array.isArray(details?.genres) ? details.genres : [];
|
||||||
const runtimeLabel = this.formatRuntimeLabel(details?.episode_run_time);
|
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 creatorNames = this.normalizeNameList(creators, { maxItems: 5 });
|
||||||
const actorNames = this.normalizeNameList(cast, { maxItems: 10 });
|
const actorNames = this.normalizeNameList(cast, { maxItems: 10 });
|
||||||
const genreNames = this.normalizeNameList(genres, { maxItems: 10 });
|
const genreNames = this.normalizeNameList(genres, { maxItems: 10 });
|
||||||
@@ -660,39 +375,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 = {}) {
|
buildSeriesMetadataCandidate(series = {}, options = {}) {
|
||||||
const season = series?.season && typeof series.season === 'object'
|
const season = series?.season && typeof series.season === 'object'
|
||||||
? series.season
|
? series.season
|
||||||
@@ -722,35 +404,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) {
|
buildSeasonSummariesFromSeriesDetails(seriesDetails = null) {
|
||||||
const details = seriesDetails && typeof seriesDetails === 'object' ? seriesDetails : {};
|
const details = seriesDetails && typeof seriesDetails === 'object' ? seriesDetails : {};
|
||||||
const seasons = Array.isArray(details.seasons) ? details.seasons : [];
|
const seasons = Array.isArray(details.seasons) ? details.seasons : [];
|
||||||
@@ -830,42 +483,6 @@ class TmdbService {
|
|||||||
}));
|
}));
|
||||||
return this.attachFailureCode(normalized, failureCode);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new TmdbService();
|
module.exports = new TmdbService();
|
||||||
@@ -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',
|
ro: 'ron',
|
||||||
uk: 'ukr',
|
uk: 'ukr',
|
||||||
ja: 'jpn',
|
ja: 'jpn',
|
||||||
jp: 'jpn',
|
|
||||||
ko: 'kor',
|
ko: 'kor',
|
||||||
zh: 'zho',
|
zh: 'zho',
|
||||||
ar: 'ara'
|
ar: 'ara'
|
||||||
@@ -874,29 +873,6 @@ function normalizeBurnBehavior(raw) {
|
|||||||
return 'none';
|
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) {
|
function buildBaseTrackSelectors(settings, presetProfile = null) {
|
||||||
const profile = presetProfile && typeof presetProfile === 'object' ? presetProfile : {};
|
const profile = presetProfile && typeof presetProfile === 'object' ? presetProfile : {};
|
||||||
const audioLanguages = Array.isArray(profile.audioLanguages)
|
const audioLanguages = Array.isArray(profile.audioLanguages)
|
||||||
@@ -905,14 +881,6 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
|||||||
const subtitleLanguages = Array.isArray(profile.subtitleLanguages)
|
const subtitleLanguages = Array.isArray(profile.subtitleLanguages)
|
||||||
? profile.subtitleLanguages.map((item) => normalizeSelectionLanguage(item)).filter(Boolean)
|
? 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)
|
const audioEncoders = Array.isArray(profile.audioEncoders)
|
||||||
? profile.audioEncoders.map((item) => String(item || '').trim().toLowerCase()).filter(Boolean)
|
? 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 baseAudioMode = normalizeTrackSelectionMode(profile.audioTrackSelectionBehavior, 'audio');
|
||||||
const baseSubtitleMode = normalizeTrackSelectionMode(profile.subtitleTrackSelectionBehavior, 'subtitle');
|
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 {
|
return {
|
||||||
preset: settings?.handbrake_preset || null,
|
preset: settings?.handbrake_preset || null,
|
||||||
@@ -947,11 +903,11 @@ function buildBaseTrackSelectors(settings, presetProfile = null) {
|
|||||||
presetProfileSource: profile.source || 'fallback',
|
presetProfileSource: profile.source || 'fallback',
|
||||||
presetProfileMessage: profile.message || null,
|
presetProfileMessage: profile.message || null,
|
||||||
audio: {
|
audio: {
|
||||||
mode: effectiveAudioMode,
|
mode: baseAudioMode,
|
||||||
languages: effectiveAudioLanguages.filter((item) => item !== 'none'),
|
languages: audioLanguages.filter((item) => item !== 'none'),
|
||||||
explicitIds: [],
|
explicitIds: [],
|
||||||
firstOnly: effectiveAudioMode === 'first',
|
firstOnly: baseAudioMode === 'first',
|
||||||
selectionSource: audioSelectionSource,
|
selectionSource: profile.source === 'preset-export' ? 'preset' : 'default',
|
||||||
encoders: audioEncoders,
|
encoders: audioEncoders,
|
||||||
encoderSource: audioEncoders.length > 0 ? (profile.source === 'preset-export' ? 'preset' : 'default') : 'default',
|
encoderSource: audioEncoders.length > 0 ? (profile.source === 'preset-export' ? 'preset' : 'default') : 'default',
|
||||||
copyMask: normalizedCopyMask.length > 0 ? normalizedCopyMask : [...DEFAULT_AUDIO_COPY_MASK],
|
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'
|
fallbackSource: profile.audioFallback ? (profile.source === 'preset-export' ? 'preset' : 'default') : 'default'
|
||||||
},
|
},
|
||||||
subtitle: {
|
subtitle: {
|
||||||
mode: effectiveSubtitleMode,
|
mode: baseSubtitleMode,
|
||||||
languages: effectiveSubtitleLanguages.filter((item) => item !== 'none'),
|
languages: subtitleLanguages.filter((item) => item !== 'none'),
|
||||||
explicitIds: [],
|
explicitIds: [],
|
||||||
firstOnly: effectiveSubtitleMode === 'first',
|
firstOnly: baseSubtitleMode === 'first',
|
||||||
selectionSource: subtitleSelectionSource,
|
selectionSource: profile.source === 'preset-export' ? 'preset' : 'default',
|
||||||
// Do not auto-burn subtitle tracks from exported preset metadata.
|
// Do not auto-burn subtitle tracks from exported preset metadata.
|
||||||
// Burn-in should only be activated via explicit CLI args/selection.
|
// Burn-in should only be activated via explicit CLI args/selection.
|
||||||
burnBehavior: 'none',
|
burnBehavior: 'none',
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ const LARGE_JUMP_THRESHOLD = 20;
|
|||||||
const DEFAULT_DURATION_SIMILARITY_SECONDS = 90;
|
const DEFAULT_DURATION_SIMILARITY_SECONDS = 90;
|
||||||
const RAW_MIRROR_DURATION_TOLERANCE_SECONDS = 2;
|
const RAW_MIRROR_DURATION_TOLERANCE_SECONDS = 2;
|
||||||
const RAW_MIRROR_SIZE_TOLERANCE_BYTES = 64 * 1024 * 1024;
|
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) {
|
function parseDurationSeconds(raw) {
|
||||||
const text = String(raw || '').trim();
|
const text = String(raw || '').trim();
|
||||||
@@ -137,83 +135,6 @@ function extractPlaylistMapping(line) {
|
|||||||
return null;
|
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) {
|
function parseAnalyzeTitles(lines) {
|
||||||
const titleMap = new Map();
|
const titleMap = new Map();
|
||||||
|
|
||||||
@@ -550,330 +471,7 @@ function buildSimilarityGroups(candidates, durationSimilaritySeconds) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clamp01(value) {
|
function computeSegmentMetrics(segmentNumbers) {
|
||||||
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) {
|
|
||||||
const numbers = Array.isArray(segmentNumbers)
|
const numbers = Array.isArray(segmentNumbers)
|
||||||
? segmentNumbers.filter((value) => Number.isFinite(value)).map((value) => Math.trunc(value))
|
? 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) {
|
function buildEvaluationLabel(metrics) {
|
||||||
if (!metrics || metrics.segmentCount === 0) {
|
if (!metrics || metrics.segmentCount === 0) {
|
||||||
return 'Keine Segmentliste aus TINFO:26 verfügbar';
|
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) {
|
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) {
|
if (metrics.backwardJumps > 0 || metrics.largeJumps > 0) {
|
||||||
return 'unklare Segmentstruktur - Sichtprüfung empfohlen';
|
return 'Auffällige Segmentreihenfolge';
|
||||||
}
|
}
|
||||||
return 'wahrscheinlich konsistente Segmentstruktur';
|
return 'wahrscheinlich korrekt (lineare Segmentfolge)';
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeRelativeScore(value, maxValue) {
|
function scoreCandidates(groupTitles) {
|
||||||
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 = {}) {
|
|
||||||
const titles = Array.isArray(groupTitles) ? groupTitles : [];
|
const titles = Array.isArray(groupTitles) ? groupTitles : [];
|
||||||
if (titles.length === 0) {
|
if (titles.length === 0) {
|
||||||
return [];
|
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
|
return titles
|
||||||
.map((title) => {
|
.map((title) => {
|
||||||
const metrics = computeSegmentMetrics(title, clusterMetricsByPlaylist);
|
const metrics = computeSegmentMetrics(title.segmentNumbers);
|
||||||
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 reasons = [
|
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_steps=${metrics.directSequenceSteps}`,
|
||||||
`sequence_coherence=${metrics.sequenceCoherence.toFixed(3)}`,
|
`sequence_coherence=${metrics.sequenceCoherence.toFixed(3)}`,
|
||||||
`backward_jumps=${metrics.backwardJumps}`,
|
`backward_jumps=${metrics.backwardJumps}`,
|
||||||
@@ -1323,34 +582,22 @@ function scoreCandidates(groupTitles, options = {}) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...title,
|
...title,
|
||||||
score: Number(totalScore.toFixed(4)),
|
score: Number(metrics.score || 0),
|
||||||
reasons,
|
reasons,
|
||||||
structuralMetrics: metrics,
|
structuralMetrics: metrics,
|
||||||
evaluationLabel: buildEvaluationLabel(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
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.sort((a, b) =>
|
.sort((a, b) =>
|
||||||
b.score - a.score
|
b.score - a.score
|
||||||
|| b.structuralMetrics.sequenceCoherence - a.structuralMetrics.sequenceCoherence
|
|| b.structuralMetrics.sequenceCoherence - a.structuralMetrics.sequenceCoherence
|
||||||
|| b.legacyStructureScore - a.legacyStructureScore
|
|
||||||
|| b.durationSeconds - a.durationSeconds
|
|| b.durationSeconds - a.durationSeconds
|
||||||
|| b.sizeBytes - a.sizeBytes
|
|| b.sizeBytes - a.sizeBytes
|
||||||
|| a.titleId - b.titleId
|
|| a.titleId - b.titleId
|
||||||
)
|
)
|
||||||
.map((item, index) => ({
|
.map((item, index) => ({
|
||||||
...item,
|
...item,
|
||||||
recommended: index === 0,
|
recommended: index === 0
|
||||||
clusterSummary: clusterSummaryRows.find((row) => row.id === item.clusterId) || null
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,18 +662,6 @@ function extractPlaylistMismatchWarnings(titles) {
|
|||||||
|
|
||||||
function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {}) {
|
function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {}) {
|
||||||
const parsedTitles = parseAnalyzeTitles(lines);
|
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 reportedTitleCount = parseReportedTitleCount(lines);
|
||||||
const minSeconds = Math.max(0, Math.round(Number(minLengthMinutes || 0) * 60));
|
const minSeconds = Math.max(0, Math.round(Number(minLengthMinutes || 0) * 60));
|
||||||
const durationSimilaritySeconds = Math.max(
|
const durationSimilaritySeconds = Math.max(
|
||||||
@@ -1434,7 +669,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
Math.round(Number(options.durationSimilaritySeconds || DEFAULT_DURATION_SIMILARITY_SECONDS))
|
Math.round(Number(options.durationSimilaritySeconds || DEFAULT_DURATION_SIMILARITY_SECONDS))
|
||||||
);
|
);
|
||||||
|
|
||||||
const candidatesRaw = parsedTitlesWithAliases
|
const candidatesRaw = parsedTitles
|
||||||
.filter((item) => Number(item.durationSeconds || 0) >= minSeconds)
|
.filter((item) => Number(item.durationSeconds || 0) >= minSeconds)
|
||||||
.sort((a, b) => b.durationSeconds - a.durationSeconds || b.sizeBytes - a.sizeBytes || a.titleId - b.titleId);
|
.sort((a, b) => b.durationSeconds - a.durationSeconds || b.sizeBytes - a.sizeBytes || a.titleId - b.titleId);
|
||||||
const candidates = suppressRawMirrorCandidates(candidatesRaw)
|
const candidates = suppressRawMirrorCandidates(candidatesRaw)
|
||||||
@@ -1451,24 +686,11 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
const multipleCandidatesDetected = candidatePlaylistsAll.length > 1;
|
const multipleCandidatesDetected = candidatePlaylistsAll.length > 1;
|
||||||
const manualDecisionRequired = multipleCandidatesDetected;
|
const manualDecisionRequired = multipleCandidatesDetected;
|
||||||
const decisionPool = manualDecisionRequired ? playlistBackedCandidates : [];
|
const decisionPool = manualDecisionRequired ? playlistBackedCandidates : [];
|
||||||
const evaluatedCandidates = decisionPool.length > 0
|
const evaluatedCandidates = decisionPool.length > 0 ? scoreCandidates(decisionPool) : [];
|
||||||
? scoreCandidates(decisionPool, { durationSimilaritySeconds })
|
|
||||||
: [];
|
|
||||||
const recommendation = evaluatedCandidates[0] || null;
|
const recommendation = evaluatedCandidates[0] || null;
|
||||||
const rankedCandidatePlaylists = uniqueOrdered(
|
const candidatePlaylists = manualDecisionRequired ? candidatePlaylistsAll : [];
|
||||||
evaluatedCandidates.map((item) => normalizePlaylistId(item?.playlistId)).filter(Boolean)
|
|
||||||
);
|
|
||||||
const candidatePlaylists = manualDecisionRequired
|
|
||||||
? uniqueOrdered([...rankedCandidatePlaylists, ...candidatePlaylistsAll])
|
|
||||||
: [];
|
|
||||||
const playlistSegments = buildPlaylistSegmentMap(decisionPool);
|
const playlistSegments = buildPlaylistSegmentMap(decisionPool);
|
||||||
const playlistToTitleId = buildPlaylistToTitleIdMap(parsedTitlesWithAliases);
|
const playlistToTitleId = buildPlaylistToTitleIdMap(parsedTitles);
|
||||||
const branchingClusters = uniqueOrdered(
|
|
||||||
evaluatedCandidates
|
|
||||||
.map((item) => item?.clusterSummary)
|
|
||||||
.filter((value) => value && typeof value === 'object')
|
|
||||||
.map((value) => JSON.stringify(value))
|
|
||||||
).map((value) => JSON.parse(value));
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
generatedAt: new Date().toISOString(),
|
generatedAt: new Date().toISOString(),
|
||||||
@@ -1476,7 +698,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
minLengthMinutes: Number(minLengthMinutes || 0),
|
minLengthMinutes: Number(minLengthMinutes || 0),
|
||||||
minLengthSeconds: minSeconds,
|
minLengthSeconds: minSeconds,
|
||||||
durationSimilaritySeconds,
|
durationSimilaritySeconds,
|
||||||
titles: parsedTitlesWithAliases,
|
titles: parsedTitles,
|
||||||
candidates,
|
candidates,
|
||||||
duplicateDurationGroups: similarityGroups,
|
duplicateDurationGroups: similarityGroups,
|
||||||
obfuscationDetected,
|
obfuscationDetected,
|
||||||
@@ -1487,7 +709,6 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
candidatePlaylists,
|
candidatePlaylists,
|
||||||
candidatePlaylistFiles: candidatePlaylists.map((item) => `${item}.mpls`),
|
candidatePlaylistFiles: candidatePlaylists.map((item) => `${item}.mpls`),
|
||||||
playlistToTitleId,
|
playlistToTitleId,
|
||||||
playlistAliasMap,
|
|
||||||
recommendation: recommendation
|
recommendation: recommendation
|
||||||
? {
|
? {
|
||||||
titleId: recommendation.titleId,
|
titleId: recommendation.titleId,
|
||||||
@@ -1500,7 +721,6 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
: null,
|
: null,
|
||||||
evaluatedCandidates,
|
evaluatedCandidates,
|
||||||
playlistSegments,
|
playlistSegments,
|
||||||
branchingClusters,
|
|
||||||
structuralAnalysis: {
|
structuralAnalysis: {
|
||||||
method: 'makemkv_tinfo_26',
|
method: 'makemkv_tinfo_26',
|
||||||
sourceCommand: 'makemkvcon -r info disc:0 --robot',
|
sourceCommand: 'makemkvcon -r info disc:0 --robot',
|
||||||
@@ -1511,7 +731,7 @@ function analyzePlaylistObfuscation(lines, minLengthMinutes = 60, options = {})
|
|||||||
...(reportedTitleCount !== null && reportedTitleCount !== parsedTitles.length
|
...(reportedTitleCount !== null && reportedTitleCount !== parsedTitles.length
|
||||||
? [`Titel-Anzahl abweichend: TCOUNT=${reportedTitleCount}, geparst=${parsedTitles.length}`]
|
? [`Titel-Anzahl abweichend: TCOUNT=${reportedTitleCount}, geparst=${parsedTitles.length}`]
|
||||||
: []),
|
: []),
|
||||||
...extractPlaylistMismatchWarnings(parsedTitlesWithAliases)
|
...extractPlaylistMismatchWarnings(parsedTitles)
|
||||||
].slice(0, 60)
|
].slice(0, 60)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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] }
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
Whitespace-only changes.
+11
-120
@@ -32,7 +32,6 @@ CREATE TABLE jobs (
|
|||||||
poster_url TEXT,
|
poster_url TEXT,
|
||||||
omdb_json TEXT,
|
omdb_json TEXT,
|
||||||
selected_from_omdb INTEGER DEFAULT 0,
|
selected_from_omdb INTEGER DEFAULT 0,
|
||||||
migrate_tmdb INTEGER NOT NULL DEFAULT 0,
|
|
||||||
start_time TEXT,
|
start_time TEXT,
|
||||||
end_time TEXT,
|
end_time TEXT,
|
||||||
status TEXT NOT NULL,
|
status TEXT NOT NULL,
|
||||||
@@ -99,7 +98,6 @@ CREATE TABLE scripts (
|
|||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name TEXT NOT NULL UNIQUE,
|
name TEXT NOT NULL UNIQUE,
|
||||||
script_body TEXT NOT NULL,
|
script_body TEXT NOT NULL,
|
||||||
is_favorite INTEGER NOT NULL DEFAULT 0,
|
|
||||||
order_index INTEGER NOT NULL DEFAULT 0,
|
order_index INTEGER NOT NULL DEFAULT 0,
|
||||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
@@ -111,8 +109,6 @@ CREATE INDEX idx_scripts_order_index ON scripts(order_index, id);
|
|||||||
CREATE TABLE script_chains (
|
CREATE TABLE script_chains (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
name TEXT NOT NULL UNIQUE,
|
name TEXT NOT NULL UNIQUE,
|
||||||
description TEXT,
|
|
||||||
is_favorite INTEGER NOT NULL DEFAULT 0,
|
|
||||||
order_index INTEGER NOT NULL DEFAULT 0,
|
order_index INTEGER NOT NULL DEFAULT 0,
|
||||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
@@ -135,25 +131,6 @@ CREATE TABLE script_chain_steps (
|
|||||||
|
|
||||||
CREATE INDEX idx_script_chain_steps_chain ON script_chain_steps(chain_id, position);
|
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 (
|
CREATE TABLE pipeline_state (
|
||||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||||
state TEXT NOT NULL,
|
state TEXT NOT NULL,
|
||||||
@@ -209,25 +186,12 @@ CREATE TABLE user_presets (
|
|||||||
|
|
||||||
CREATE INDEX idx_user_presets_media_type ON user_presets(media_type);
|
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 (
|
CREATE TABLE IF NOT EXISTS aax_activation_bytes (
|
||||||
checksum TEXT PRIMARY KEY,
|
checksum TEXT PRIMARY KEY,
|
||||||
activation_bytes TEXT NOT NULL,
|
activation_bytes TEXT NOT NULL,
|
||||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
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 (
|
CREATE TABLE IF NOT EXISTS user_prefs (
|
||||||
key TEXT PRIMARY KEY,
|
key TEXT PRIMARY KEY,
|
||||||
value TEXT,
|
value TEXT,
|
||||||
@@ -444,10 +408,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);
|
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_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)
|
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);
|
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');
|
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_command', 'HandBrakeCLI');
|
||||||
@@ -456,6 +416,10 @@ INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, des
|
|||||||
VALUES ('handbrake_restart_delete_incomplete_output', 'Tools', 'Encode-Neustart: unvollständige Ausgabe löschen', 'boolean', 1, 'Wenn aktiv, wird bei "Encode neu starten" der bisherige (nicht erfolgreiche) Output vor Start entfernt.', 'true', '[]', '{}', 220);
|
VALUES ('handbrake_restart_delete_incomplete_output', 'Tools', 'Encode-Neustart: unvollständige Ausgabe löschen', 'boolean', 1, 'Wenn aktiv, wird bei "Encode neu starten" der bisherige (nicht erfolgreiche) Output vor Start entfernt.', 'true', '[]', '{}', 220);
|
||||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_restart_delete_incomplete_output', 'true');
|
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_restart_delete_incomplete_output', 'true');
|
||||||
|
|
||||||
|
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||||
|
VALUES ('handbrake_pre_metadata_scan_enabled', 'Tools', 'Vorab-HandBrake-Scan vor Metadaten', 'boolean', 1, 'Wenn deaktiviert, wird der erste HandBrake-Scan vor der Metadatenauswahl übersprungen.', 'true', '[]', '{}', 221);
|
||||||
|
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('handbrake_pre_metadata_scan_enabled', 'true');
|
||||||
|
|
||||||
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index)
|
||||||
VALUES ('pipeline_max_parallel_jobs', 'Tools', 'Max. parallele Film/Video Encodes', 'number', 1, 'Maximale Anzahl parallel laufender Film/Video Encode-Jobs. Gilt zusätzlich zum Gesamtlimit.', '1', '[]', '{"min":1,"max":12}', 225);
|
VALUES ('pipeline_max_parallel_jobs', 'Tools', 'Max. parallele Film/Video Encodes', 'number', 1, 'Maximale Anzahl parallel laufender Film/Video Encode-Jobs. Gilt zusätzlich zum Gesamtlimit.', '1', '[]', '{"min":1,"max":12}', 225);
|
||||||
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('pipeline_max_parallel_jobs', '1');
|
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('pipeline_max_parallel_jobs', '1');
|
||||||
@@ -506,50 +470,10 @@ 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);
|
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_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)
|
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);
|
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');
|
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)
|
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);
|
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_values (key, value) VALUES ('output_template_bluray', '${title} (${year})/${title} (${year})');
|
||||||
@@ -589,50 +513,10 @@ 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);
|
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_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)
|
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);
|
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');
|
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)
|
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);
|
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_values (key, value) VALUES ('output_template_dvd', '${title} (${year})/${title} (${year})');
|
||||||
@@ -738,11 +622,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);
|
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_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)
|
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);
|
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_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)
|
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);
|
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');
|
INSERT OR IGNORE INTO settings_values (key, value) VALUES ('coverart_recovery_enabled', 'true');
|
||||||
|
|||||||
+2
-2
@@ -114,9 +114,9 @@ Importiert einen RAW-Ordner als Job und triggert optional die Analyse des Import
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 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-/Filmdaten nachträglich zu.
|
||||||
|
|
||||||
## POST /api/history/:id/cd/assign
|
## POST /api/history/:id/cd/assign
|
||||||
|
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ Erzwingt Rescan für ein konkretes Laufwerk.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## GET /api/pipeline/tmdb/movie/search?q=<query>
|
## GET /api/pipeline/omdb/search?q=<query>
|
||||||
|
|
||||||
TMDb-Filmsuche.
|
OMDb-Titelsuche.
|
||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
|
||||||
@@ -111,7 +111,7 @@ Features:
|
|||||||
|
|
||||||
- Job-Liste/Detail inkl. Log-Tail
|
- Job-Liste/Detail inkl. Log-Tail
|
||||||
- Orphan-RAW-Erkennung und Import
|
- Orphan-RAW-Erkennung und Import
|
||||||
- TMDb-Neuzuordnung
|
- OMDb-Nachzuweisung
|
||||||
- Dateilöschung (`raw|movie|both`)
|
- Dateilöschung (`raw|movie|both`)
|
||||||
- Job-Löschung (`none|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)
|
- `audnexService.js` (Audnex-API für Audiobook-Metadaten)
|
||||||
- `coverArtRecoveryService.js` (Cover-Art-Wiederherstellung)
|
- `coverArtRecoveryService.js` (Cover-Art-Wiederherstellung)
|
||||||
- `thumbnailService.js` (Vorschaubild-Generierung)
|
- `thumbnailService.js` (Vorschaubild-Generierung)
|
||||||
- `tmdbService.js` (Film-/Serien-Metadaten-Suche)
|
- `omdbService.js` (OMDb-Metadaten-Suche)
|
||||||
- `logger.js` (rotierende Datei-Logs)
|
- `logger.js` (rotierende Datei-Logs)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ Frontend: React + PrimeReact + Vite.
|
|||||||
|
|
||||||
## Hauptseiten
|
## Hauptseiten
|
||||||
|
|
||||||
|
### `JobsInboxPage.jsx`
|
||||||
|
|
||||||
|
Zentrale Job-Inbox:
|
||||||
|
|
||||||
|
- einheitliche Liste über Ripper-, Converter- und Audiobook-Jobs
|
||||||
|
- View-/Status-Filter, Suche, Paginierung
|
||||||
|
- Schnellsprung in passende Detailseite (`Ripper`/`Converter`)
|
||||||
|
|
||||||
### `RipperPage.jsx`
|
### `RipperPage.jsx`
|
||||||
|
|
||||||
Pipeline-Steuerung:
|
Pipeline-Steuerung:
|
||||||
@@ -34,7 +42,7 @@ Historie:
|
|||||||
|
|
||||||
- Job-Liste/Filter
|
- Job-Liste/Filter
|
||||||
- Job-Details + Logs
|
- Job-Details + Logs
|
||||||
- TMDb-Neuzuordnung
|
- OMDb-Nachzuweisung
|
||||||
- Re-Encode/Restart-Workflows
|
- Re-Encode/Restart-Workflows
|
||||||
|
|
||||||
### `ConverterPage.jsx`
|
### `ConverterPage.jsx`
|
||||||
@@ -78,7 +86,7 @@ Expert-Modus:
|
|||||||
## Wichtige Komponenten
|
## Wichtige Komponenten
|
||||||
|
|
||||||
- `PipelineStatusCard.jsx` — Pipeline-Status-Anzeige mit Progress
|
- `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)
|
- `MediaInfoReviewPanel.jsx` — Track-Auswahl-Interface (Video/Audio/Untertitel)
|
||||||
- `JobDetailDialog.jsx` — Job-Detailansicht mit Logs
|
- `JobDetailDialog.jsx` — Job-Detailansicht mit Logs
|
||||||
- `CronJobsTab.jsx` — Cron-Job-Verwaltung
|
- `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-makemkv` | – | MakeMKV-Installation überspringen |
|
||||||
| `--no-handbrake` | – | HandBrake-Installation überspringen |
|
| `--no-handbrake` | – | HandBrake-Installation überspringen |
|
||||||
| `--no-nginx` | – | nginx-Einrichtung ü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) |
|
| `--reinstall` | – | Bestehende Installation aktualisieren (Daten bleiben erhalten) |
|
||||||
| `-h`, `--help` | – | Hilfe anzeigen |
|
| `-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.
|
|
||||||
@@ -4,148 +4,99 @@ Diese Seite ist die Betriebs-Checkliste vor dem ersten produktiven Lauf.
|
|||||||
|
|
||||||
## Ziel der Ersteinrichtung
|
## Ziel der Ersteinrichtung
|
||||||
|
|
||||||
Vor dem ersten Job sollten fünf Bereiche sauber gesetzt sein:
|
Vor dem ersten Job müssen drei Dinge stabil sein:
|
||||||
|
|
||||||
1. Pfade und Templates
|
1. Pfade stimmen (RAW, Output, Logs)
|
||||||
2. Laufwerk und Disc-Erkennung
|
2. Tools sind aufrufbar (MakeMKV, HandBrake, MediaInfo)
|
||||||
3. Metadatenzugang über TMDb
|
3. Metadatenzugänge funktionieren (OMDb, optional TMDb/MusicBrainz)
|
||||||
4. Encode-Standards und Queue-Regeln
|
|
||||||
5. optionale Automatisierung und Benachrichtigungen
|
|
||||||
|
|
||||||
## Empfohlene Reihenfolge
|
## Empfohlene Reihenfolge
|
||||||
|
|
||||||
### 1. Basis in `Settings -> Konfiguration`
|
### 1) Basis in `Settings -> Konfiguration`
|
||||||
|
|
||||||
Prüfe zuerst diese Kernfelder:
|
Setze zuerst:
|
||||||
|
|
||||||
- RAW- und Zielordner für Blu-ray, DVD, CD, Audiobooks und Converter
|
- `Raw-Ordner` und `Film-/Serien-Ordner`
|
||||||
- `Log Ordner`
|
- `Log Ordner`
|
||||||
- `TMDb Read Access Token`
|
|
||||||
- `MakeMKV Kommando`, `HandBrake Kommando`, `Mediainfo Kommando`
|
- `MakeMKV Kommando`, `HandBrake Kommando`, `Mediainfo Kommando`
|
||||||
- `FFmpeg Kommando`, `FFprobe Kommando`, `cdparanoia Kommando`, `mkvmerge Kommando`, falls du die jeweiligen Workflows nutzt
|
- `OMDb API Key`
|
||||||
|
|
||||||
Danach speichern.
|
Dann speichern.
|
||||||
|
|
||||||
### 2. Pfade und Templates bewusst festlegen
|
### 2) Profile pro Medium festziehen
|
||||||
|
|
||||||
Wichtig für den Alltag:
|
Ripster löst viele Werte profilspezifisch auf (`bluray`, `dvd`, `cd`, `audiobook`).
|
||||||
|
|
||||||
- Film-Workflows nutzen die RAW- und Film-Ausgabeordner sowie die Film-Output-Templates
|
Pflichtprüfung:
|
||||||
- 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`
|
|
||||||
|
|
||||||
Wenn du auf NAS, USB oder mit anderen Benutzern/Gruppen schreiben willst, prüfe auch die jeweils zugehörigen `Eigentümer ...`-Felder.
|
- RAW-Pfade je Profil
|
||||||
|
- Output-Pfade je Profil
|
||||||
|
- HandBrake-Preset je Profil
|
||||||
|
- Output-Templates je Profil
|
||||||
|
|
||||||
### 3. Laufwerk und automatische Erkennung prüfen
|
Für Serien zusätzlich:
|
||||||
|
|
||||||
Relevant:
|
- `RAW-Ordner (Blu-ray/DVD Serie)`
|
||||||
|
- `Serien-Ordner (Blu-ray/DVD)`
|
||||||
|
- Serien-Templates (Episode/Multi-Episode)
|
||||||
|
|
||||||
- `Laufwerksmodus`
|
### 3) Queue-Verhalten definieren
|
||||||
- `Explizite Laufwerke`, falls du nicht mit Auto-Discovery arbeiten willst
|
|
||||||
- `Automatische Disk-Erkennung`
|
|
||||||
- `Polling Intervall (ms)` im Expertenmodus
|
|
||||||
- `Laufwerk nach Rip auswerfen`
|
|
||||||
|
|
||||||
Empfehlung:
|
Stelle ein:
|
||||||
|
|
||||||
- Einzelnes Standardlaufwerk: `auto`
|
- `Max. parallele Film/Video Encodes`
|
||||||
- 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. parallele Audio CD Jobs`
|
||||||
- `Max. Encodes gesamt (medienunabhängig)`
|
- `Max. Encodes gesamt`
|
||||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
- optional `Audio CDs: Queue-Reihenfolge überspringen`
|
||||||
|
|
||||||
Damit steuerst du, wie aggressiv Ripster mehrere Jobs gleichzeitig startet.
|
Damit steuerst du Durchsatz, Priorität und Lastverteilung.
|
||||||
|
|
||||||
### 7. Optional: User-Presets und Standard-Zuordnungen
|
### 4) Metadatenquellen absichern
|
||||||
|
|
||||||
Unter `Settings -> Encode-Presets` kannst du:
|
Film:
|
||||||
|
|
||||||
- eigene HandBrake-User-Presets anlegen
|
- OMDb-Key prüfen
|
||||||
- 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.
|
Serien:
|
||||||
|
|
||||||
### 8. Optional: Benachrichtigungen
|
- TMDb Read Access Token setzen
|
||||||
|
- Sprache/Fallback-Sprachen festlegen
|
||||||
|
|
||||||
Prüfe:
|
CD/Audiodaten:
|
||||||
|
|
||||||
- `PushOver aktiviert`
|
- `MusicBrainz aktiviert` nach Bedarf
|
||||||
- Token/User/optional Device
|
|
||||||
- Event-Toggles wie `Bei manueller Auswahl senden`, `Bei Rip-Start senden`, `Bei Erfolg senden`
|
|
||||||
|
|
||||||
Danach in `Settings` den Button `PushOver Test` ausführen.
|
### 5) Optional: Benachrichtigungen
|
||||||
|
|
||||||
### 9. Optional: Automatisierung
|
- PushOver-Zugangsdaten setzen
|
||||||
|
- `PushOver Test` ausführen
|
||||||
|
- Event-Toggles pro Phase prüfen
|
||||||
|
|
||||||
Erst wenn die Grundkonfiguration stabil ist:
|
### 6) Optional: Automatisierung
|
||||||
|
|
||||||
1. Skripte anlegen und testen
|
1. Skripte testen
|
||||||
2. Skriptketten aufbauen
|
2. Skriptketten bauen/testen
|
||||||
3. Cronjobs aktivieren
|
3. Cronjobs erst danach aktivieren
|
||||||
|
|
||||||
## Funktionsprüfung
|
## Funktionsprüfung (Kurztest)
|
||||||
|
|
||||||
Ein sinnvoller Kurztest:
|
1. Disc in `Ripper` erkennen lassen.
|
||||||
|
2. `Analyse starten`.
|
||||||
1. Disc in `Ripper` erkennen lassen
|
3. Metadaten übernehmen.
|
||||||
2. `Analyse starten`
|
4. Bis `Bereit zum Encodieren` laufen.
|
||||||
3. TMDb-Metadaten übernehmen
|
5. Encode starten und Abschluss in `Historie` prüfen.
|
||||||
4. ggf. Playlist-/RAW-Entscheidung durchlaufen
|
|
||||||
5. bis `Bereit zum Encodieren` kommen
|
|
||||||
6. Encode starten
|
|
||||||
7. Ergebnis in `Historie` prüfen
|
|
||||||
|
|
||||||
## Typische Konfigurationsfehler
|
## Typische Konfigurationsfehler
|
||||||
|
|
||||||
| Symptom | Häufige Ursache |
|
| Symptom | Häufige Ursache |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Disc wird nicht erkannt | Laufwerksmodus oder Auto-Erkennung passt nicht |
|
| Job bleibt früh auf Fehler | Toolkommando falsch oder nicht im PATH |
|
||||||
| Playlist-Auswahl wirkt unplausibel | `Minimale Titellänge` oder `TMDb Runtime-Abzug ...` ist zu streng/zu locker |
|
| RAW/Output landet am falschen Ort | Profilpfade nicht gesetzt, Fallback greift |
|
||||||
| falsche Spuren sind in der Review vorausgewählt | Review-Sprachfilter oder HandBrake-Args greifen unerwartet |
|
| Serienausgabe landet bei Filmen | Serienpfade/Serientemplates fehlen |
|
||||||
| Ausgabe landet am falschen Ort | Profilpfade oder Templates greifen über Fallback |
|
| Queue verhält sich unerwartet | Gesamtlimit und Lane-Limits widersprechen sich |
|
||||||
| Queue verhält sich unerwartet | `Parallele Jobs`, CD-Limit und Gesamtlimit widersprechen sich |
|
|
||||||
|
|
||||||
## Weiter
|
## Weiter
|
||||||
|
|
||||||
- [Erster Lauf](quickstart.md)
|
- [Erster Lauf](quickstart.md)
|
||||||
- [GUI-Seiten](../gui/index.md)
|
- [GUI-Seiten](../gui/index.md)
|
||||||
- [Workflows aus Nutzersicht](../workflows/index.md)
|
- [Workflows aus Nutzersicht](../workflows/index.md)
|
||||||
- [Alle Einstellungen](../configuration/settings-reference.md)
|
|
||||||
@@ -1,119 +1,107 @@
|
|||||||
# Installation
|
# 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`
|
## Unterstützte Systeme und Anforderungen
|
||||||
- kein `curl | bash`
|
|
||||||
- du musst die Tools nicht manuell vorinstallieren, sofern du sie nicht bewusst mit `--no-*` auslässt
|
|
||||||
|
|
||||||
## Voraussetzungen
|
- unterstützt laut Script: `debian`, `ubuntu`, `linuxmint`, `pop`
|
||||||
|
- Ausführung als `root` (oder via `sudo`)
|
||||||
- unterstütztes Linux-System
|
|
||||||
- Root-Rechte oder `sudo`
|
|
||||||
- Internetzugang während der Installation
|
- Internetzugang während der Installation
|
||||||
|
|
||||||
Der Installer erkennt aktuell:
|
## Schritt-für-Schritt
|
||||||
|
|
||||||
- Debian
|
### 1. Installationsskript herunterladen
|
||||||
- Ubuntu
|
|
||||||
- Linux Mint
|
|
||||||
- Pop!_OS
|
|
||||||
|
|
||||||
## Standardinstallation
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wget -qO setup.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/setup.sh
|
wget -qO install.sh https://raw.githubusercontent.com/Mboehmlaender/ripster/main/install.sh
|
||||||
bash setup.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Ohne `--branch` fragt `setup.sh` interaktiv nach dem gewünschten Branch.
|
### 2. Installation ausführen
|
||||||
|
|
||||||
Die typischen Branches sind:
|
|
||||||
|
|
||||||
- `main`: stabiles Release
|
|
||||||
- `dev`: aktueller Entwicklungsstand
|
|
||||||
|
|
||||||
## Installation mit Branch oder Optionen
|
|
||||||
|
|
||||||
Beispiele:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash setup.sh --branch main
|
sudo bash install.sh
|
||||||
bash setup.sh --branch dev
|
|
||||||
bash setup.sh --branch dev --dir /opt/ripster --user ripster --port 3001 --host 192.168.1.10
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`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 |
|
### 3. Dienststatus prüfen
|
||||||
|---|---|---|
|
|
||||||
| `--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
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo systemctl status ripster-backend
|
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
|
```bash
|
||||||
sudo journalctl -u ripster-backend -f
|
sudo bash install.sh --branch dev
|
||||||
sudo systemctl restart ripster-backend
|
sudo bash install.sh --port 8080 --host ripster.local
|
||||||
|
sudo bash install.sh --reinstall
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update einer bestehenden Installation
|
## Betrieb im Alltag
|
||||||
|
|
||||||
Standard:
|
|
||||||
|
|
||||||
```bash
|
```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
|
sudo bash /opt/ripster/install.sh --reinstall
|
||||||
```
|
```
|
||||||
|
|
||||||
Wenn die Installation mit abweichenden Kernparametern eingerichtet wurde, dieselben Parameter wieder mitgeben:
|
## Häufige Stolperstellen
|
||||||
|
|
||||||
```bash
|
- Laufwerk nicht zugreifbar: Laufwerksrechte/Gruppen prüfen
|
||||||
sudo bash /opt/ripster/install.sh --reinstall --dir /opt/ripster --user ripster --port 3001 --host 192.168.1.10
|
- CLI-Tool fehlt wegen `--no-*`: Tool nachinstallieren oder Befehl in Settings korrigieren
|
||||||
```
|
- UI nicht erreichbar: nginx-Status und Firewall prüfen
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Danach weiter
|
## Danach weiter
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,19 @@
|
|||||||
# Voraussetzungen
|
# 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
|
### Pflicht
|
||||||
|
|
||||||
- unterstütztes Linux-System
|
- unterstütztes Linux-System (laut Script: Debian, Ubuntu, Linux Mint, Pop!_OS)
|
||||||
- Root-Rechte oder `sudo`
|
- `root`-Rechte
|
||||||
- Internetzugang während der Installation
|
- Internetzugang während der Installation
|
||||||
- optisches Laufwerk, wenn du Disc-Workflows nutzen willst
|
- optisches Laufwerk für Disc-Betrieb
|
||||||
|
|
||||||
Der Installer unterstützt aktuell:
|
`install.sh` installiert die benötigten Tools selbst (u. a. Node.js, MakeMKV, HandBrakeCLI, MediaInfo), sofern sie nicht explizit per `--no-*` übersprungen werden.
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
### Laufwerk kurz prüfen
|
### Laufwerk kurz prüfen
|
||||||
|
|
||||||
@@ -34,25 +22,27 @@ ls /dev/sr*
|
|||||||
lsblk | grep rom
|
lsblk | grep rom
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Wenn nötig Rechte setzen (Beispiel):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chmod a+rw /dev/sr0
|
||||||
|
```
|
||||||
|
|
||||||
### Optional vorab
|
### Optional vorab
|
||||||
|
|
||||||
- TMDb Read Access Token für Film-/Serien-Metadaten
|
- OMDb API-Key (kann auch nach Installation in den `Settings` gesetzt werden)
|
||||||
- PushOver-Zugangsdaten für Benachrichtigungen
|
- PushOver-Zugangsdaten (optional)
|
||||||
|
|
||||||
Beides kann auch erst nach der Installation in `Settings` gesetzt werden.
|
## Entwicklungsmodus (nur für Dev)
|
||||||
|
|
||||||
## Entwicklungsmodus
|
|
||||||
|
|
||||||
Wenn du lokal entwickelst (`./start.sh`, `npm run dev`), gelten zusätzliche Voraussetzungen:
|
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`
|
- `makemkvcon`, `HandBrakeCLI`, `mediainfo` im `PATH`
|
||||||
|
|
||||||
Details: [Entwicklungsumgebung](../deployment/development.md)
|
Details: [Entwicklungsumgebung](../deployment/development.md)
|
||||||
|
|
||||||
## Abschluss-Checkliste
|
## Abschluss-Checkliste
|
||||||
|
|
||||||
- [ ] Linux + Root/Sudo + Internet vorhanden
|
- [ ] Produktionsbetrieb: Linux + root + Internet + Laufwerk vorhanden
|
||||||
- [ ] optisches Laufwerk vorhanden, falls Disc-Ripping genutzt werden soll
|
- [ ] Dev-Modus (nur falls benötigt): Node.js und CLI-Tools verfügbar
|
||||||
- [ ] 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
|
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
# Erster Lauf
|
# Erster Lauf
|
||||||
|
|
||||||
Dieser Ablauf führt einen typischen Disc-Job von Erkennung bis fertiger Datei durch.
|
Dieser Ablauf führt einen vollständigen Disc-Job von Erkennung bis fertiger Datei durch.
|
||||||
|
|
||||||
## 1. Disc erkennen
|
## 1) Disc erkennen
|
||||||
|
|
||||||
1. `Ripper` öffnen
|
1. `Ripper` öffnen.
|
||||||
2. Disc einlegen
|
2. Disc einlegen.
|
||||||
3. auf `Medium erkannt` warten
|
3. Auf `Medium erkannt` warten.
|
||||||
|
|
||||||
Prüfen:
|
Prüfen:
|
||||||
|
|
||||||
- `Disk-Information` zeigt Device, Label und Laufwerksstatus
|
- `Disk-Information` zeigt Device/Label.
|
||||||
- falls nicht: `Laufwerk neu lesen`
|
- Falls nicht: `Laufwerk neu lesen`.
|
||||||
|
|
||||||
Relevante Settings:
|
## 2) Analyse starten
|
||||||
|
|
||||||
- `Laufwerksmodus`
|
|
||||||
- `Automatische Disk-Erkennung`
|
|
||||||
- `Polling Intervall (ms)`
|
|
||||||
|
|
||||||
## 2. Analyse starten
|
|
||||||
|
|
||||||
Aktion:
|
Aktion:
|
||||||
|
|
||||||
@@ -28,124 +22,69 @@ Aktion:
|
|||||||
Erwartung:
|
Erwartung:
|
||||||
|
|
||||||
- Status `Analyse`
|
- Status `Analyse`
|
||||||
- danach der Metadaten-Dialog
|
- danach Metadaten-Dialog
|
||||||
|
|
||||||
Relevantes Setting:
|
## 3) Metadaten bestätigen
|
||||||
|
|
||||||
- `Minimale Titellänge (Minuten)` beeinflusst bereits, welche Titel/Playlists Ripster später als relevant betrachtet
|
|
||||||
|
|
||||||
## 3. Metadaten in TMDb bestätigen
|
|
||||||
|
|
||||||
Im Dialog:
|
Im Dialog:
|
||||||
|
|
||||||
1. Treffer suchen oder filtern
|
1. Treffer suchen/auswählen.
|
||||||
2. Film oder Serie auswählen
|
2. Bei Serie zusätzlich Disc-Nummer setzen.
|
||||||
3. bei Serien zusätzlich `Disc-Nummer` setzen
|
3. `Auswahl übernehmen`.
|
||||||
4. `Auswahl übernehmen`
|
|
||||||
|
|
||||||
Mögliche Abzweigungen:
|
Mögliche Abzweigungen:
|
||||||
|
|
||||||
- Duplikatfilm: `Übernahme erzwingen` oder `Multipart movie`
|
- Duplikatfilm -> `Übernahme erzwingen` oder `Multipart movie`
|
||||||
- vorhandenes RAW: Entscheidungsdialog `weiterverwenden` oder `neu rippen`
|
- vorhandenes RAW -> Entscheidungsdialog (weiterverwenden oder neu rippen)
|
||||||
|
|
||||||
Relevante Settings:
|
## 4) Rip/Review-Phase
|
||||||
|
|
||||||
- `TMDb Read Access Token`
|
Normalfall:
|
||||||
- `Film-Sprache`
|
|
||||||
- `Fallback Sprache`
|
|
||||||
|
|
||||||
## 4. RAW- und Playlist-Entscheidungen
|
- `Startbereit` -> `Rippen` -> `Mediainfo-Pruefung`
|
||||||
|
|
||||||
Je nach Disc-Situation geht es jetzt unterschiedlich weiter.
|
Mögliche Alternativen:
|
||||||
|
|
||||||
### Normalfall
|
- vorhandenes RAW: direkter Sprung in Prüfung
|
||||||
|
- Blu-ray/DVD-Entscheidung nötig: `Warte auf Auswahl` für Playlist/Titel
|
||||||
|
|
||||||
`Startbereit` -> `Rippen` -> `Mediainfo-Prüfung`
|
## 5) Encode-Review abschließen
|
||||||
|
|
||||||
### Vorhandenes RAW
|
Bei `Bereit zum Encodieren`:
|
||||||
|
|
||||||
Kein neuer Rip, sondern erst eine Entscheidung:
|
- Titel festlegen
|
||||||
|
- Audio-/Subtitle-Spuren prüfen
|
||||||
- vorhandenes RAW weiterverwenden
|
- optional Preset auswählen
|
||||||
- RAW löschen und Rip neu starten
|
- optional Pre-/Post-Skripte wählen
|
||||||
- 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:
|
Dann:
|
||||||
|
|
||||||
- `Encoding starten`
|
- `Encoding starten`
|
||||||
|
|
||||||
Relevante Settings:
|
## 6) Encoding überwachen
|
||||||
|
|
||||||
- `HandBrake Preset` und `HandBrake Extra Args` je Medium
|
|
||||||
- `Review Audio-Sprachen (...)`
|
|
||||||
- `Review UT-Sprachen (...)`
|
|
||||||
- `Ausgabeformat`
|
|
||||||
- Standard-Zuordnungen unter `Settings -> Encode-Presets`
|
|
||||||
|
|
||||||
## 6. Encoding überwachen
|
|
||||||
|
|
||||||
Während `Encodieren`:
|
Während `Encodieren`:
|
||||||
|
|
||||||
- Fortschritt/ETA im Ripper
|
- Fortschritt/ETA im Ripper
|
||||||
- Queue-Status beobachten
|
- Queue- und Runtime-Status beobachten
|
||||||
- bei Bedarf `Hardware`-Ansicht öffnen
|
- optional Logkontrolle in Historie
|
||||||
|
|
||||||
Relevante Settings:
|
## 7) Ergebnis verifizieren
|
||||||
|
|
||||||
- `Parallele Jobs`
|
|
||||||
- `Max. parallele Audio CD Jobs`
|
|
||||||
- `Max. Encodes gesamt (medienunabhängig)`
|
|
||||||
- `Hardware Monitoring aktiviert`
|
|
||||||
- `Hardware Monitoring Intervall (ms)`
|
|
||||||
|
|
||||||
## 7. Ergebnis verifizieren
|
|
||||||
|
|
||||||
Nach `Fertig`:
|
Nach `Fertig`:
|
||||||
|
|
||||||
1. `Historie` öffnen
|
1. `Historie` öffnen.
|
||||||
2. Jobdetail prüfen
|
2. Jobdetail prüfen.
|
||||||
3. Output-Pfad und Log kontrollieren
|
3. Output-Pfad und Log plausibilisieren.
|
||||||
|
|
||||||
Kontrollpunkte:
|
Kontrollpunkte:
|
||||||
|
|
||||||
- finale Datei liegt am erwarteten Template-Pfad
|
- finale Datei am erwarteten Template-Pfad
|
||||||
- RAW-Ordner ist finalisiert
|
- RAW-Ordnerzustand finalisiert (kein `Incomplete_`)
|
||||||
- optional `.nfo` wurde erzeugt, falls aktiviert
|
|
||||||
|
|
||||||
Relevante Settings:
|
## 8) Typische Folgeaktionen
|
||||||
|
|
||||||
- Film-Output-Templates oder Serien-Templates
|
- falsche Metadaten: `OMDb neu zuordnen`
|
||||||
- `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`
|
- andere Trackauswahl: `Review neu starten`
|
||||||
- erneuter Encode aus RAW: `RAW neu encodieren`
|
- erneuter Encode aus RAW: `RAW neu encodieren`
|
||||||
- gleicher Plan erneut: `Encode neu starten`
|
- gleicher Plan erneut: `Encode neu starten`
|
||||||
- Rip erneut versuchen: `Retry Rippen`
|
|
||||||
+41
-81
@@ -1,108 +1,68 @@
|
|||||||
# Audiobooks
|
# Audiobooks
|
||||||
|
|
||||||
Die Seite `Audiobooks` ist der spezialisierte Workflow für Audible-`*.aax`-Dateien.
|
Die Seite `Audiobooks` ist der spezialisierte AAX-Workflow.
|
||||||
|
|
||||||
## Seitenstruktur
|
## Ablaufübersicht
|
||||||
|
|
||||||
Die Oberfläche besteht aus zwei Hauptbereichen:
|
Die Oberfläche ist in drei Bereiche gegliedert:
|
||||||
|
|
||||||
1. `Audiobooks Upload`
|
1. `Audiobooks Upload`
|
||||||
2. `Audiobook Jobs`
|
2. `Audiobook Jobs`
|
||||||
|
3. `Audiobook Output Explorer`
|
||||||
|
|
||||||
## 1. Audiobooks Upload
|
## 1) Audiobooks Upload
|
||||||
|
|
||||||
Der Upload akzeptiert ausschließlich `.aax`.
|
Der Upload verarbeitet ausschließlich AAX-Dateien.
|
||||||
|
|
||||||
### Bedienung
|
Direkt nach Upload passieren im Hintergrund:
|
||||||
|
|
||||||
- Datei auswählen oder per Drag-and-Drop ablegen
|
- Probe/Metadatenanalyse (ffprobe)
|
||||||
- Upload starten
|
- Anlage eines RAW-Ordners per `Audiobook RAW Template`
|
||||||
- Auswahl entfernen oder laufenden Upload abbrechen
|
- Ablage der AAX-Datei im RAW-Pfad
|
||||||
|
- Initiale Jobkonfiguration (Format, Kapitel, Metadaten)
|
||||||
|
|
||||||
Während des Uploads zeigt die UI:
|
Wichtige Parameter:
|
||||||
|
|
||||||
- Prozentfortschritt
|
- Zielformat (`m4b`, `mp3`, `flac`)
|
||||||
- übertragene und gesamte Bytes
|
- optionaler Sofortstart
|
||||||
- Statusmeldung
|
|
||||||
|
|
||||||
### Ablauf nach erfolgreichem Upload
|
Toolabhängigkeit:
|
||||||
|
|
||||||
- die AAX-Datei wird geprüft
|
- `ffprobe_command` für Metadaten/Kapitel
|
||||||
- Ripster versucht Metadata, Kapitel und Activation-Bytes-Kontext aufzubauen
|
- `ffmpeg_command` für Encode/Cover-Extraktion
|
||||||
- ein Audiobook-Job wird angelegt
|
|
||||||
- der Job startet direkt oder wird in die Queue eingereiht
|
|
||||||
|
|
||||||
## 2. Audiobook Jobs
|
## 2) Audiobook Jobs
|
||||||
|
|
||||||
Die Seite zeigt aktive Jobs. Abgeschlossene Jobs findest du in der `Historie`.
|
Jobkarten zeigen Zustand, Fortschritt und verfügbare Aktionen.
|
||||||
|
|
||||||
Ein Job kann eingeklappt oder ausgeklappt werden und zeigt:
|
Typische Aktionen:
|
||||||
|
|
||||||
- Titel, Autor, Sprecher, Jahr
|
- `Starten`
|
||||||
- Kapitelanzahl
|
- `Abbrechen`
|
||||||
- Fortschritt und ETA
|
- `Retry`
|
||||||
- bei Split-Ausgabe den Kapitelstatus
|
- `Löschen`
|
||||||
|
- `Im Ripper` (Kontextwechsel)
|
||||||
|
|
||||||
## Konfigurierbare Job-Parameter
|
Die Karten werden regelmäßig aktualisiert und durch WebSocket-Ereignisse ergänzt.
|
||||||
|
|
||||||
Im ausgeklappten Job kannst du setzen:
|
## 3) Audiobook Output Explorer
|
||||||
|
|
||||||
- Ausgabeformat `m4b`, `mp3` oder `flac`
|
Read-only Explorer des Audiobook-Outputpfads:
|
||||||
- formatspezifische Optionen
|
|
||||||
- Kapitelnamen
|
|
||||||
- Pre-Encode-Skripte und -Ketten
|
|
||||||
- Post-Encode-Skripte und -Ketten
|
|
||||||
|
|
||||||
### Formatverhalten
|
- Ordner-/Dateistruktur
|
||||||
|
- Zeitstempel/Größen
|
||||||
|
- schnelle Ergebnisprüfung ohne Dateisystemwechsel
|
||||||
|
|
||||||
- `m4b`: eine Datei mit Kapitelmarken
|
## Pfad- und Template-Logik
|
||||||
- `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.
|
| Bereich | Gesteuert durch |
|
||||||
|
|---|---|
|
||||||
|
| RAW-Ablage | `raw_dir_audiobook` + `audiobook_raw_template` |
|
||||||
|
| Finale Ausgabe | `movie_dir_audiobook` + `output_template_audiobook` |
|
||||||
|
| Dateiformat | Jobkonfiguration (`m4b`, `mp3`, `flac`) |
|
||||||
|
|
||||||
## Activation Bytes
|
## Typische Probleme
|
||||||
|
|
||||||
Wenn Ripster für eine Datei keine Activation Bytes verwenden kann, wird im Workflow eine manuelle Eingabe nötig.
|
- Upload wird abgelehnt: Eingabedatei ist keine AAX-Datei.
|
||||||
|
- Start schlägt fehl: `ffmpeg`/`ffprobe` nicht aufrufbar.
|
||||||
Wichtig:
|
- Unerwartete Pfade: Templates enthalten ungültige oder zu generische Platzhalter.
|
||||||
|
|
||||||
- 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
|
|
||||||
+45
-65
@@ -1,49 +1,39 @@
|
|||||||
# Converter
|
# 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 Seite `Converter` verarbeitet bereits vorhandene Dateien (Video, Audio, ISO) ohne Laufwerks-Rip.
|
||||||
|
|
||||||
## Betriebsmodell
|
## Betriebsmodell
|
||||||
|
|
||||||
Der Converter arbeitet auf dem in `Settings` festgelegten `Converter Raw-Ordner`.
|
Der Converter arbeitet auf dem Eingangspfad `converter_raw_dir`:
|
||||||
|
|
||||||
Dort landen:
|
- Uploads landen dort
|
||||||
|
- Explorer-Aktionen arbeiten dort
|
||||||
- Uploads
|
- daraus werden Converter-Jobs erstellt
|
||||||
- neu angelegte Ordner
|
|
||||||
- umbenannte oder verschobene Dateien
|
|
||||||
- alle Dateien, aus denen später Converter-Jobs entstehen
|
|
||||||
|
|
||||||
Wichtig:
|
Wichtig:
|
||||||
|
|
||||||
- Upload erzeugt nicht automatisch einen Job
|
- Upload erzeugt nicht automatisch einen Job.
|
||||||
- die Joberstellung erfolgt bewusst aus der Explorer-Auswahl
|
- Joberstellung erfolgt explizit über Auswahl im Explorer.
|
||||||
|
|
||||||
## Datei-Explorer
|
## Datei-Explorer
|
||||||
|
|
||||||
Der Explorer zeigt den kompletten Baum unter `Converter Raw-Ordner`.
|
Der Explorer zeigt den kompletten Baum unter `converter_raw_dir`.
|
||||||
|
|
||||||
Aktionen:
|
Aktionen:
|
||||||
|
|
||||||
| Aktion | Wirkung |
|
| Aktion | Wirkung |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `Upload` | schreibt neue Dateien in den Converter-RAW-Baum |
|
| `Upload` | Dateien werden in den Raw-Baum geschrieben |
|
||||||
| `Ordner erstellen` | legt Unterordner an |
|
| `Ordner erstellen` | legt Unterordner im Raw-Baum an |
|
||||||
| `Umbenennen` | benennt Datei oder Ordner um |
|
| `Umbenennen` | benennt Datei/Ordner im Raw-Baum um |
|
||||||
| `Verschieben` | verschiebt Einträge innerhalb des Raw-Baums |
|
| `Verschieben` | verschiebt innerhalb des Raw-Baums |
|
||||||
| `Löschen` | entfernt Datei oder Ordner dauerhaft |
|
| `Löschen` | entfernt Datei/Ordner dauerhaft |
|
||||||
| `Scannen` | synchronisiert Dateisystem und Converter-Datenbank |
|
| `Scannen` | synchronisiert Explorer und DB-Zuordnungen |
|
||||||
|
|
||||||
### Upload- und Scan-Regeln
|
Upload-Regeln:
|
||||||
|
|
||||||
- Dateiendungen müssen in `Erlaubte Datei-Endungen` enthalten sein
|
- Dateiendung muss in `Erlaubte Datei-Endungen*` enthalten sein
|
||||||
- neue Dateien erscheinen sofort nach manuellem Scan
|
- bei Verstoß wird der Upload abgelehnt
|
||||||
- mit Polling auch automatisch
|
|
||||||
|
|
||||||
Relevante Settings:
|
|
||||||
|
|
||||||
- `Erlaubte Datei-Endungen`
|
|
||||||
- `Auto-Scan (Polling)`
|
|
||||||
- `Polling-Intervall (Sekunden)`
|
|
||||||
|
|
||||||
## Joberstellung aus Explorer-Auswahl
|
## Joberstellung aus Explorer-Auswahl
|
||||||
|
|
||||||
@@ -54,75 +44,65 @@ Es gibt zwei Audio-Strategien:
|
|||||||
|
|
||||||
Verhalten:
|
Verhalten:
|
||||||
|
|
||||||
- Video und ISO werden immer als Einzeljobs angelegt
|
- Video/ISO werden grundsätzlich als Einzeljobs angelegt.
|
||||||
- Audio kann als gemeinsamer Album-/Ordner-Job erzeugt werden
|
- Audio kann als Shared-Job mit mehreren Eingabedateien erzeugt werden.
|
||||||
|
|
||||||
Shared-Audio-Job:
|
Shared-Audio-Job:
|
||||||
|
|
||||||
- hält mehrere `inputPaths`
|
- hält mehrere `inputPaths`
|
||||||
- kann vor dem Start erweitert oder reduziert werden
|
- kann vor Start erweitert/reduziert werden (nur Audio-Dateien)
|
||||||
|
|
||||||
## Job-Konfiguration
|
## Job-Konfiguration
|
||||||
|
|
||||||
Vor dem Start je Job einstellbar:
|
Vor Start je Job einstellbar:
|
||||||
|
|
||||||
- `converterMediaType`
|
- `converterMediaType` (`video`, `audio`, `iso`)
|
||||||
- `outputFormat`
|
- `outputFormat`
|
||||||
- Metadaten
|
- Metadaten
|
||||||
- Track-/Titelwahl bei Video/ISO
|
- Track-/Titelwahl (bei video/iso)
|
||||||
- User-Preset und HandBrake-Preset bei Video
|
|
||||||
- Pre-/Post-Encode-Skripte und Ketten
|
- Pre-/Post-Encode-Skripte und Ketten
|
||||||
|
|
||||||
Spezifika:
|
Spezifika:
|
||||||
|
|
||||||
- Video/ISO durchlaufen eine Review ähnlich zum Disc-Flow
|
- Video/ISO laufen durch Mediainfo/Review ähnlich zum Disc-Flow.
|
||||||
- Audio wird direkt über Format und Audio-Optionen konfiguriert
|
- Audio kann direkt mit Formatoptionen konfiguriert werden.
|
||||||
|
|
||||||
## Ausgabe-Pfade
|
## Ausgabe-Pfade
|
||||||
|
|
||||||
### Video / ISO
|
### Video/ISO
|
||||||
|
|
||||||
- Zielordner: `Converter Ausgabe (Video)`
|
- Root: `converter_movie_dir`
|
||||||
- Dateiname: `Output-Template (Video)`
|
- Dateiname: `Output-Template (Video)`
|
||||||
- Endung: aus dem gewählten Ausgabeformat
|
- Endung: aus gewähltem Output-Format
|
||||||
|
|
||||||
### Audio
|
### Audio
|
||||||
|
|
||||||
- Zielordner: `Converter Ausgabe (Audio)`
|
- Root: `converter_audio_dir`
|
||||||
- Dateiname/Ordner: `Output-Template (Audio)`
|
- Dateiname/Ordner: `Output-Template (Audio)`
|
||||||
- bei Shared- oder Folder-Jobs entsteht eine Ordnerstruktur mit mehreren Track-Dateien
|
- bei Shared-/Folder-Job: Ausgabe als Ordnerstruktur mit Trackdateien
|
||||||
|
|
||||||
Relevante Settings:
|
|
||||||
|
|
||||||
- `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
|
## Queue und Start
|
||||||
|
|
||||||
Converter-Jobs laufen über dieselbe globale Pipeline-Queue wie Ripper und Audiobooks.
|
Converter-Jobs laufen über dieselbe Pipeline-/Queue-Logik:
|
||||||
|
|
||||||
Das bedeutet:
|
- sofortiger Start wenn Limits frei
|
||||||
|
- sonst Queue-Eintrag
|
||||||
|
|
||||||
- sofortiger Start, wenn Limits frei sind
|
Parallelität richtet sich nach den globalen Encode-Limits in `Settings`.
|
||||||
- sonst Einreihung in die Warteschlange
|
|
||||||
|
## Auto-Scan (Polling)
|
||||||
|
|
||||||
|
Mit aktiviertem Polling:
|
||||||
|
|
||||||
|
- `converter_raw_dir` wird zyklisch gescannt
|
||||||
|
- neue Dateien erscheinen automatisch im Explorer
|
||||||
|
|
||||||
Relevante Settings:
|
Relevante Settings:
|
||||||
|
|
||||||
- `Parallele Jobs`
|
- `Auto-Scan (Polling)`
|
||||||
- `Max. Encodes gesamt (medienunabhängig)`
|
- `Polling-Intervall (Sekunden)`
|
||||||
|
|
||||||
## 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
|
## Abgrenzung zu Audiobooks
|
||||||
|
|
||||||
- `Converter`: beliebige Audio-, Video- und ISO-Dateien
|
- `Converter`: beliebige Audio/Video/ISO-Dateien
|
||||||
- `Audiobooks`: spezialisierter AAX-Workflow mit Activation Bytes, Kapitelmetadaten und Kapiteltemplates
|
- `Audiobooks`: dedizierter AAX-Workflow mit Kapitel-/Audiobook-Metadaten
|
||||||
@@ -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
|
|
||||||
+38
-37
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Filter und Arbeitsmittel:
|
Filter und Arbeitsmittel:
|
||||||
|
|
||||||
- Suche
|
- Suche (Titel, IMDb, Kontextbegriffe)
|
||||||
- Statusfilter
|
- Statusfilter
|
||||||
- Mediumfilter
|
- Mediumfilter
|
||||||
- Sortierung
|
- Sortierung
|
||||||
@@ -14,61 +14,62 @@ Filter und Arbeitsmittel:
|
|||||||
|
|
||||||
Jeder Eintrag zeigt auf einen Blick:
|
Jeder Eintrag zeigt auf einen Blick:
|
||||||
|
|
||||||
- Titel, Jahr, Poster oder Cover
|
- Titel, Jahr, Poster
|
||||||
- Status und Zeitstempel
|
- Status und Zeitstempel
|
||||||
- RAW- und Output-Verfügbarkeit
|
- RAW-/Output-Verfügbarkeit
|
||||||
- Medien- und Containerhinweise
|
- Medien- und ggf. Containerhinweise
|
||||||
|
|
||||||
## Detaildialog
|
## Detaildialog: Was dort zusammenläuft
|
||||||
|
|
||||||
Der Detaildialog bündelt:
|
Der Detaildialog bündelt:
|
||||||
|
|
||||||
- Metadaten
|
- Metadaten (Film oder Serie)
|
||||||
- Jobstatus und Fehlertexte
|
- Jobstatus und Fehlertexte
|
||||||
- RAW- und Output-Pfade
|
- RAW-/Output-Pfade
|
||||||
- Encode-Plan und Trackauswahl
|
- Encode-Plan und Trackauswahl
|
||||||
- ausgeführte Kommandos
|
- ausgeführte Kommandodetails
|
||||||
- Prozesslog
|
- Prozesslog (`Tail` oder vollständig)
|
||||||
- verfügbare Folgeaktionen
|
|
||||||
|
|
||||||
Bei Seriencontainern und Multipart-Jobs wird container- und child-orientiert dargestellt.
|
Bei Seriencontainern wird disk-/child-orientiert dargestellt, nicht nur als Einzeljob.
|
||||||
|
|
||||||
## Nachbearbeitungsaktionen
|
## Nachbearbeitungsaktionen und Wirkung
|
||||||
|
|
||||||
| Aktion | Typischer Einsatz | Technische Wirkung |
|
| 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 |
|
| `OMDb neu zuordnen` | falsches Match, Titel/Jahr korrigieren | Metadatenfelder werden neu geschrieben; Folder-Rename wird best effort angestoßen |
|
||||||
| `Review neu starten` | neue Track-/Titelbewertung nötig | Review wird aus vorhandenem RAW neu aufgebaut |
|
| `Review neu starten` | neue Track-/Titelbewertung nötig | Mediainfo/Review wird aus RAW neu aufgebaut |
|
||||||
| `RAW neu encodieren` | neuer Encode mit vorhandenem RAW | startet Encode ohne neuen Disc-Rip |
|
| `RAW neu encodieren` | neuer Encode aus vorhandenem RAW | startet Encode ohne neuen Laufwerks-Rip |
|
||||||
| `Encode neu starten` | gleiche bestätigte Auswahl erneut fahren | letzter bestätigter Plan wird geladen |
|
| `Encode neu starten` | gleiche bestätigte Auswahl erneut fahren | letzter bestätigter Plan wird geladen, optional mit Bereinigung unvollständiger Ausgabe |
|
||||||
| `Retry Rippen` | Rip oder Analyse erneut anstoßen | neuer Rip-Lauf inklusive RAW-Phase |
|
| `Retry Rippen` | Rip/Analyse neu anstoßen | neuer Rip-Lauf, inkl. erneuter RAW-Phase |
|
||||||
|
|
||||||
Relevante Settings:
|
Löschaktionen im Dialog:
|
||||||
|
|
||||||
- `Encode-Neustart: unvollständige Ausgabe löschen`
|
- `RAW löschen`
|
||||||
- `NFO nach Encode erzeugen`
|
- `Movie löschen`
|
||||||
|
- `Beides löschen`
|
||||||
|
- `Historieneintrag löschen`
|
||||||
|
|
||||||
## Löschaktionen und Vorschau
|
## Löschvorschau und selektives Löschen
|
||||||
|
|
||||||
Vor dem endgültigen Löschen zeigt Ripster eine Vorschau mit:
|
Vor endgültigem Löschen zeigt Ripster eine Vorschau mit:
|
||||||
|
|
||||||
- RAW-Kandidaten
|
- `RAW`-Kandidaten
|
||||||
- Movie-/Episode-Kandidaten
|
- `Movie`-/Episoden-Kandidaten
|
||||||
- Related-Scope für Container, Kinder und verbundene Jobs
|
- Related-Scope (Container/Kinder/verbundene Jobs)
|
||||||
|
|
||||||
Wichtige Punkte:
|
Wichtige Punkte:
|
||||||
|
|
||||||
- Pfade sind selektierbar
|
- Pfade sind selektierbar.
|
||||||
- bei mehreren RAW-Kandidaten muss mindestens ein RAW-Pfad gewählt werden
|
- Für RAW-Löschung muss bei Mehrfachkandidaten mindestens ein RAW-Pfad gewählt werden.
|
||||||
- Schutzlogik verhindert Löschungen außerhalb erlaubter Root-Verzeichnisse
|
- Schutzlogik verhindert Löschungen außerhalb erlaubter Root-Verzeichnisse.
|
||||||
|
|
||||||
## Serien- und Multipart-Sicht
|
## Serien- und Multipart-Sicht in der Historie
|
||||||
|
|
||||||
### Serien
|
### Serien
|
||||||
|
|
||||||
- Container zeigt den aggregierten Zustand der Child-Jobs
|
- Container zeigt aggregierten Zustand aus Child-Jobs.
|
||||||
- Disk- und Episodenaktionen können child-spezifisch ausgeführt werden
|
- Disk-/Episode-Aktionen können child-spezifisch ausgeführt werden.
|
||||||
- `Im Ripper öffnen` hilft bei offenen Reviews
|
- `Im Ripper öffnen` hilft bei `Bereit zum Encodieren`-Kindern.
|
||||||
|
|
||||||
### Multipart
|
### Multipart
|
||||||
|
|
||||||
@@ -78,11 +79,11 @@ Wichtige Punkte:
|
|||||||
|
|
||||||
## Logs sinnvoll nutzen
|
## Logs sinnvoll nutzen
|
||||||
|
|
||||||
- `Tail laden` für schnellen Fehlerkontext
|
- `Tail laden (800)` für schnellen Fehlerkontext
|
||||||
- `Vollständiges Log laden` für tiefe Analyse
|
- `Vollständiges Log laden` für forensische Analyse
|
||||||
|
|
||||||
Empfehlung:
|
Empfehlung:
|
||||||
|
|
||||||
1. erst den Tail prüfen
|
1. Erst Tail prüfen.
|
||||||
2. dann die Stelle im Log eingrenzen
|
2. Bei Pfad-/Toolproblemen vollständiges Log laden.
|
||||||
3. anschließend die passende Wiederanlauf-Aktion wählen
|
3. Danach passende Wiederanlauf-Aktion wählen.
|
||||||
+15
-23
@@ -6,37 +6,29 @@ Dieses Kapitel ist das Bedienhandbuch für die Oberflächen im Alltag.
|
|||||||
|
|
||||||
| Seite | Rolle im Betrieb | Typischer Einsatz |
|
| Seite | Rolle im Betrieb | Typischer Einsatz |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| [Ripper](ripper.md) | Live-Steuerung der Disc-Pipeline | Disc erkennen, Analyse starten, Entscheidungen treffen, Queue steuern |
|
| [Jobs](jobs.md) | zentrale Inbox | Gesamtlage prüfen und in Fachseite springen |
|
||||||
| [Hardware](hardware.md) | Detailansicht für Live-Monitoring | CPU/RAM/GPU und Verlauf prüfen |
|
| [Ripper](ripper.md) | Live-Steuerung der Pipeline | Disc-Flow starten, Queue steuern, Review freigeben |
|
||||||
| [Audiobooks](audiobooks.md) | AAX-Spezialflow | Upload, Kapitelprüfung und Encode von Audiobooks |
|
| [Audiobooks](audiobooks.md) | AAX-Spezialflow | Upload, Konfiguration und Encode von Audiobooks |
|
||||||
| [Settings](settings.md) | Konfiguration und Automatisierung | Pfade, Tools, Queue, Presets, Skripte, Cron |
|
| [Settings](settings.md) | Konfiguration/Automatisierung | Pfade, Tools, Queue-Limits, Skripte, Cron |
|
||||||
| [Historie](history.md) | Nachbearbeitung und Kontrolle | Logs, Re-Encode, TMDb-Neuzuordnung, Löschvorschau |
|
| [Historie](history.md) | Nachbearbeitung und Kontrolle | Logs, Re-Encode, Löschvorschau, Recovery-Aktionen |
|
||||||
| [Converter](converter.md) | dateibasierte Konvertierung | Video/Audio/ISO ohne Disc-Rip verarbeiten |
|
| [Converter](converter.md) | dateibasierte Konvertierung | Video/Audio/ISO ohne Disc-Rip verarbeiten |
|
||||||
| [Downloads](downloads.md) | ZIP-Exports | RAW/Output aus der Historie bereitstellen |
|
| [Downloads](downloads.md) | ZIP-Exports | RAW/Output aus Historie bereitstellen |
|
||||||
| [Database (Expert)](database.md) | Recovery-Sicht | orphan RAW finden, prüfen und importieren |
|
| [Database (Expert)](database.md) | Recovery-Sicht | orphan RAW finden und importieren |
|
||||||
| [TMDb Migration](tmdb-migration.md) | Sonderseite für Altbestände | alte Jobs gesammelt auf TMDb umstellen |
|
|
||||||
|
|
||||||
## Empfohlener Tagesablauf
|
## Empfohlener Tagesablauf
|
||||||
|
|
||||||
1. `Ripper`, `Converter` oder `Audiobooks`: neue Arbeit starten
|
1. `Jobs`: Statuslage und Auffälligkeiten prüfen.
|
||||||
2. `Historie`: Ergebnisse kontrollieren und ggf. nachbearbeiten
|
2. `Ripper` oder `Converter`/`Audiobooks`: neue Arbeit starten.
|
||||||
3. `Downloads`: Artefakte für externe Übergabe vorbereiten
|
3. `Historie`: Ergebnisse validieren und ggf. nachbearbeiten.
|
||||||
4. `Settings`: Regeln, Presets oder Limits nur kontrolliert anpassen
|
4. `Downloads`: Exporte für externe Übergabe erzeugen.
|
||||||
5. `Hardware`: bei Lastspitzen oder Batch-Läufen den Verlauf prüfen
|
5. `Settings`: Regeln und Limits nur kontrolliert anpassen.
|
||||||
|
|
||||||
## Navigation
|
## Navigation
|
||||||
|
|
||||||
Direkt in der Top-Navigation:
|
Direkt in der Top-Navigation:
|
||||||
|
|
||||||
- `Ripper`
|
- `Jobs`, `Ripper`, `Converter`, `Audiobooks`, `Settings`, `Historie`, `Downloads`
|
||||||
- `Converter`
|
|
||||||
- `Audiobooks`
|
|
||||||
- `Settings`
|
|
||||||
- `Historie`
|
|
||||||
- `Downloads`
|
|
||||||
|
|
||||||
Zusatzansichten:
|
Nur per URL:
|
||||||
|
|
||||||
- `Hardware` unter `/hardware`
|
- `Database` unter `/database`
|
||||||
- `Database` unter `/database` und im Expertenmodus zusätzlich in der Navigation
|
|
||||||
- `TMDb Migration` unter `/tmdb-migration` als Direktlink
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Jobs
|
||||||
|
|
||||||
|
`Jobs` ist die zentrale Inbox über alle Jobarten und dient als schneller Einstieg in den Tagesbetrieb.
|
||||||
|
|
||||||
|
## Zweck der Seite
|
||||||
|
|
||||||
|
Die Liste vereinheitlicht:
|
||||||
|
|
||||||
|
- Disc-/Ripper-Jobs
|
||||||
|
- Converter-Jobs
|
||||||
|
- Audiobook-Jobs
|
||||||
|
|
||||||
|
Dadurch kannst du unabhängig von der Fachseite zuerst den Gesamtzustand prüfen.
|
||||||
|
|
||||||
|
## Filterlogik
|
||||||
|
|
||||||
|
### View-Filter
|
||||||
|
|
||||||
|
- `Alle Jobs`
|
||||||
|
- `Ripper-View`
|
||||||
|
- `Converter-View`
|
||||||
|
- `Audiobooks`
|
||||||
|
|
||||||
|
### Status-Filter
|
||||||
|
|
||||||
|
- `Alle`
|
||||||
|
- `Aktiv`
|
||||||
|
- `Fehler/Abbruch`
|
||||||
|
|
||||||
|
Zusätzlich:
|
||||||
|
|
||||||
|
- Freitextsuche
|
||||||
|
- Paginierung
|
||||||
|
|
||||||
|
## Was ein Jobeintrag zeigt
|
||||||
|
|
||||||
|
- Job-ID und Titel
|
||||||
|
- Statusbadge
|
||||||
|
- Jobtypbadge (z. B. Blu-ray, DVD, Converter Audio, Audiobook)
|
||||||
|
- Aktualisierungszeit
|
||||||
|
|
||||||
|
Die Ansicht wird periodisch aktualisiert und ergänzt sich mit WebSocket-Events.
|
||||||
|
|
||||||
|
## Schnellaktion pro Zeile
|
||||||
|
|
||||||
|
- `Im Ripper öffnen` für Disc-/Audiobook-nahe Jobs
|
||||||
|
- `Im Converter öffnen` für Converter-Jobs
|
||||||
|
|
||||||
|
So kommst du ohne Umwege in die Oberfläche mit den passenden Detailaktionen.
|
||||||
|
|
||||||
|
## Empfohlener Einsatz
|
||||||
|
|
||||||
|
1. In `Jobs` Störungen und Auslastung identifizieren.
|
||||||
|
2. Danach gezielt in `Ripper`, `Converter` oder `Historie` springen.
|
||||||
+67
-126
@@ -1,76 +1,68 @@
|
|||||||
# Ripper
|
# Ripper
|
||||||
|
|
||||||
Die Seite `Ripper` ist die Live-Steuerung der Disc-Pipeline. Hier laufen Disc-Erkennung, Queue, manuelle Entscheidungen, Review und aktive Jobs zusammen.
|
Die Seite `Ripper` ist die Live-Steuerung der Pipeline. Hier laufen Disc-Erkennung, Queue-Steuerung, Review und Encode-Start zusammen.
|
||||||
|
|
||||||
## Seitenaufbau
|
## Seitenaufbau und Betriebslogik
|
||||||
|
|
||||||
Die wichtigsten Bereiche:
|
Die Bereiche erscheinen in dieser Reihenfolge:
|
||||||
|
|
||||||
1. `Hardware`
|
1. `Hardware Monitoring`
|
||||||
2. `Job Queue`
|
2. `Job Queue`
|
||||||
3. `Skript- / Cron-Status`
|
3. `Skript- / Cron-Status`
|
||||||
4. `Job Übersicht`
|
4. `Job Übersicht`
|
||||||
5. `Disk-Information`
|
5. `Disk-Information`
|
||||||
|
|
||||||
## 1. Hardware
|
## 1) Hardware Monitoring
|
||||||
|
|
||||||
Die Hardware-Karte zeigt live:
|
Zeigt kontinuierlich:
|
||||||
|
|
||||||
- CPU
|
- CPU / RAM
|
||||||
- RAM
|
- GPU (wenn verfügbar)
|
||||||
- GPU, falls vorhanden
|
- freie Speicherstände konfigurierter Pfade
|
||||||
- freie Speicherstände der konfigurierten Pfade
|
|
||||||
|
|
||||||
Aktionen:
|
Nutzen im Betrieb:
|
||||||
|
|
||||||
- Klick auf das Hardware-Symbol öffnet die Seite [Hardware](hardware.md)
|
- Engpässe vor Jobfehlern erkennen
|
||||||
|
- Pfadfüllstände vor Start großer Batchs prüfen
|
||||||
|
|
||||||
Relevante Settings:
|
Gesteuert über `Settings`:
|
||||||
|
|
||||||
- `Hardware Monitoring aktiviert`
|
- `Hardware Monitoring aktiviert`
|
||||||
- `Hardware Monitoring Intervall (ms)`
|
- `Hardware Monitoring Intervall (ms)`
|
||||||
- `Externe Speicher`
|
|
||||||
|
|
||||||
## 2. Job Queue
|
## 2) Job Queue
|
||||||
|
|
||||||
Es gibt zwei operative Zonen:
|
Es gibt zwei operative Zonen:
|
||||||
|
|
||||||
- laufende Jobs
|
- `Laufende Jobs`
|
||||||
- Warteschlange
|
- `Warteschlange`
|
||||||
|
|
||||||
Mögliche Queue-Einträge:
|
Mögliche Queue-Einträge:
|
||||||
|
|
||||||
- normale Job-Starts
|
- Job-Startaktionen (`Start`, `Retry Rippen`, `RAW neu encodieren`, `Encode neu starten`, `Review neu berechnen`, `Audio CD starten`)
|
||||||
- `Retry Rippen`
|
- Nicht-Job-Einträge (`Skript`, `Skriptkette`, `Warten`)
|
||||||
- `RAW neu encodieren`
|
|
||||||
- `Encode neu starten`
|
|
||||||
- `Review neu starten`
|
|
||||||
- `Audio CD starten`
|
|
||||||
- `Skript`
|
|
||||||
- `Skriptkette`
|
|
||||||
- `Warten`
|
|
||||||
|
|
||||||
Wichtige Regeln:
|
Wichtige Regeln:
|
||||||
|
|
||||||
- Reihenfolge ist per Drag-and-Drop änderbar
|
- Queue-Reihenfolge ist per Drag-and-Drop änderbar.
|
||||||
- `Warten` blockiert nachfolgende Starts, bis keine aktive Verarbeitung mehr läuft
|
- `Warten` blockiert nachfolgende Queue-Starts bis kein aktiver Prozess mehr läuft.
|
||||||
- Queue-Einträge können auch ohne Medienjob existieren
|
- `Skript` und `Skriptkette` werden als Queue-Einträge mitgeführt.
|
||||||
|
|
||||||
Relevante Settings:
|
Parallelität kommt aus `Settings`:
|
||||||
|
|
||||||
- `Parallele Jobs`
|
- `Max. parallele Film/Video Encodes`
|
||||||
- `Max. parallele Audio CD Jobs`
|
- `Max. parallele Audio CD Jobs`
|
||||||
- `Max. Encodes gesamt (medienunabhängig)`
|
- `Max. Encodes gesamt`
|
||||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
- optional `Audio CDs: Queue-Reihenfolge überspringen`
|
||||||
|
|
||||||
## 3. Skript- / Cron-Status
|
## 3) Skript- / Cron-Status
|
||||||
|
|
||||||
Zeigt Runtime-Aktivitäten:
|
Zeigt Runtime-Aktivitäten:
|
||||||
|
|
||||||
- laufende Skripte
|
- laufende Skripte
|
||||||
- laufende Ketten
|
- laufende Ketten
|
||||||
- Cron-Ausführungen
|
- Cron-Ausführungen
|
||||||
- kürzlich abgeschlossene Aktivitäten
|
- letzte abgeschlossene Aktivitäten
|
||||||
|
|
||||||
Aktionen:
|
Aktionen:
|
||||||
|
|
||||||
@@ -78,103 +70,66 @@ Aktionen:
|
|||||||
- `Abbrechen`
|
- `Abbrechen`
|
||||||
- `Liste leeren`
|
- `Liste leeren`
|
||||||
|
|
||||||
## 4. Job Übersicht
|
## 4) Job Übersicht
|
||||||
|
|
||||||
Die Jobliste ist der zentrale Arbeitsbereich. Ein Klick öffnet den jeweiligen `Pipeline-Status`.
|
Die Jobliste ist der zentrale Arbeitsbereich. Ein Klick öffnet den jeweiligen `Pipeline-Status`.
|
||||||
|
|
||||||
### Zustandsabhängige Hauptaktionen
|
### Badges und Kontext
|
||||||
|
|
||||||
| Zustand | Typische Aktion | Ergebnis |
|
Neben Status/Fortschritt zeigt die Liste je nach Job:
|
||||||
|
|
||||||
|
- Serienkontext (`Serien-Container`, Staffel/Disk)
|
||||||
|
- Multipart-Kontext (`Multipart Movie`, Disc-Nr.)
|
||||||
|
- Queue-/Subjob-Kontext bei Serien-Episoden
|
||||||
|
|
||||||
|
### Zustandsabhängige Aktionen
|
||||||
|
|
||||||
|
| Zustand | Hauptaktion im Ripper | Ergebnis |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `Medium erkannt` | `Analyse starten` | MakeMKV-Analyse beginnt |
|
| `Medium erkannt`, `Bereit` | `Analyse starten` | startet MakeMKV-Analyse |
|
||||||
| `Metadatenauswahl` | `Metadaten öffnen` | TMDb-Dialog für Film/Serie |
|
| `Metadatenauswahl` | `Metadaten öffnen` | Film/Serie auswählen, Provider festlegen |
|
||||||
| `Warte auf Auswahl` | Entscheidung bestätigen | Flow geht an die passende Stelle weiter |
|
| `Warte auf Auswahl` | Playlist/Titel/RAW-Entscheidung bestätigen | setzt Flow fort zur Prüfung |
|
||||||
| `Startbereit` | `Job starten` | Rip oder RAW-basierte Prüfung startet |
|
| `Startbereit` | `Job starten` | startet Rip oder RAW-basierte Prüfung |
|
||||||
| `Bereit zum Encodieren` | `Encoding starten` | HandBrake startet mit bestätigter Auswahl |
|
| `Bereit zum Encodieren` | `Encoding starten` | startet HandBrake mit bestätigter Auswahl |
|
||||||
| laufend | `Abbrechen` | Job wird gestoppt |
|
| Laufend (`Analyse`, `Rippen`, `Encodieren`) | `Abbrechen` | setzt Job auf `Abgebrochen` |
|
||||||
| `Fehler` / `Abgebrochen` | `Retry Rippen` | neuer Rip-Anlauf |
|
| `Fehler`, `Abgebrochen` | `Retry Rippen` | neuer Rip-Anlauf |
|
||||||
|
|
||||||
### Was `Warte auf Auswahl` heute bedeuten kann
|
Zusatzaktionen je nach Zustand und Jobtyp:
|
||||||
|
|
||||||
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`
|
||||||
|
- `RAW neu encodieren`
|
||||||
|
- `Aus Queue löschen`
|
||||||
|
|
||||||
#### Vorhandenes RAW
|
### Review-Bereich (`Bereit zum Encodieren`)
|
||||||
|
|
||||||
Ripster hat zu den Metadaten bereits ein passendes RAW gefunden. Dann entscheidest du:
|
Hier wird die effektive Encode-Entscheidung festgelegt:
|
||||||
|
|
||||||
- mit RAW weiterarbeiten
|
- Titelwahl
|
||||||
- RAW löschen und neu rippen
|
- Audio-/Subtitle-Trackselektion
|
||||||
- in passenden Film-Fällen optional Multipart mit Orphan-RAW bilden
|
- User-Preset
|
||||||
|
- Pre-/Post-Encode-Skripte und Ketten
|
||||||
|
- HandBrake-Kommandovorschau
|
||||||
|
|
||||||
#### Playlist-Auswahl
|
Ohne Bestätigung dieses Blocks startet kein produktiver Encode.
|
||||||
|
|
||||||
Bei mehrdeutigen Blu-rays oder bestimmten DVD-Fällen musst du eine Playlist bestätigen. Die Liste zeigt unter anderem:
|
### RAW-Ordnerphasen (sichtbar über Logs/Details)
|
||||||
|
|
||||||
- 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:
|
Der Ripper arbeitet mit drei RAW-Zuständen:
|
||||||
|
|
||||||
- `Incomplete_...` während eines unvollständigen Rips
|
- `Incomplete_...` während unvollständigem Rip
|
||||||
- `Rip_Complete_...` nach erfolgreichem Rip, vor dem finalen Encode
|
- `Rip_Complete_...` nach erfolgreich abgeschlossenem Rip, vor Encode
|
||||||
- ohne Prefix nach erfolgreichem Encode
|
- ohne Prefix nach erfolgreichem Encode
|
||||||
|
|
||||||
Das ist wichtig für:
|
Das ist wichtig für Recovery und Delete-Vorschau.
|
||||||
|
|
||||||
- Recovery
|
## 5) Disk-Information
|
||||||
- RAW-Wiederverwendung
|
|
||||||
- Delete-Preview in `Historie`
|
|
||||||
|
|
||||||
## Disk-Information
|
|
||||||
|
|
||||||
Zeigt aktuelle Laufwerksdaten:
|
Zeigt aktuelle Laufwerksdaten:
|
||||||
|
|
||||||
- Device-Pfad
|
- Device-Pfad
|
||||||
- Modell
|
- Modell
|
||||||
- Disc-Label
|
- Disc-Label / Mount
|
||||||
- Mount-Informationen
|
|
||||||
|
|
||||||
Aktionen:
|
Aktionen:
|
||||||
|
|
||||||
@@ -184,13 +139,13 @@ Aktionen:
|
|||||||
|
|
||||||
Hinweis:
|
Hinweis:
|
||||||
|
|
||||||
- `Laufwerk neu lesen` ist nicht mehr an einen festen Pipeline-State gebunden
|
- `Laufwerk neu lesen` ist nicht mehr an einen festen Pipeline-State gebunden.
|
||||||
|
|
||||||
## Wichtige Dialoge
|
## Wichtige Dialoge
|
||||||
|
|
||||||
### Metadaten auswählen
|
### Metadaten auswählen
|
||||||
|
|
||||||
Im Dialog bestätigst du Film- oder Serienmetadaten aus TMDb.
|
Im Dialog werden Film-/Serienmetadaten bestätigt.
|
||||||
|
|
||||||
Sonderfälle:
|
Sonderfälle:
|
||||||
|
|
||||||
@@ -199,7 +154,7 @@ Sonderfälle:
|
|||||||
|
|
||||||
### Vorhandenes RAW erkannt
|
### Vorhandenes RAW erkannt
|
||||||
|
|
||||||
Wenn zu den Metadaten bereits RAW existiert, fordert Ripster eine explizite Entscheidung:
|
Wenn passendes RAW existiert, fordert der Dialog eine explizite Entscheidung:
|
||||||
|
|
||||||
- vorhandenes RAW verwenden
|
- vorhandenes RAW verwenden
|
||||||
- RAW verwerfen/löschen und neu rippen
|
- RAW verwerfen/löschen und neu rippen
|
||||||
@@ -211,17 +166,3 @@ Du kannst gezielt ab Position einfügen:
|
|||||||
- Skript
|
- Skript
|
||||||
- Skriptkette
|
- Skriptkette
|
||||||
- Wartezeit
|
- 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)
|
|
||||||
+63
-239
@@ -1,283 +1,107 @@
|
|||||||
# Settings
|
# 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 alle Betriebsparameter von Ripster: Pfade, Tools, Queue-Limits, Metadatenquellen, 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
|
## Tab-Überblick
|
||||||
|
|
||||||
| Tab | Zweck |
|
| Tab | Hauptzweck |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `Konfiguration` | alle fachlichen Einstellungen aus der GUI |
|
| `Konfiguration` | globale und profilspezifische Laufzeitsettings |
|
||||||
| `Scripte` | einzelne Bash-Skripte anlegen, testen und sortieren |
|
| `Scripte` | einzelne Skripte verwalten und testen |
|
||||||
| `Skriptketten` | mehrstufige Abläufe aus Skript- und Warte-Schritten bauen |
|
| `Skriptketten` | mehrstufige Abläufe aus Skript/Warten |
|
||||||
| `Encode-Presets` | eigene Video-Presets und Standard-Zuordnungen pflegen |
|
| `Encode-Presets` | wiederverwendbare HandBrake-Profile für Review |
|
||||||
| `Cronjobs` | zeitgesteuerte Ausführung von Skripten oder Ketten |
|
| `Cronjobs` | zeitgesteuerte Ausführung von Skript/Kette |
|
||||||
|
|
||||||
## Tab `Konfiguration`
|
## Tab `Konfiguration`
|
||||||
|
|
||||||
### Bedienlogik
|
### Bedienprinzip
|
||||||
|
|
||||||
1. Felder ändern
|
1. Werte ändern.
|
||||||
2. `Änderungen speichern` klicken
|
2. `Änderungen speichern`.
|
||||||
3. erst dann gelten die neuen Werte für künftige Starts, Reviews oder Scheduler
|
3. erst danach sind Werte für neue Aktionen wirksam.
|
||||||
|
|
||||||
Ausnahmen:
|
Zusätzliche Bedienhilfen:
|
||||||
|
|
||||||
- `Expertenmodus` wird sofort gespeichert
|
- `Neu laden` verwirft lokale Formzustände
|
||||||
- Buttons wie `PushOver Test`, `Coverarts prüfen` oder der MakeMKV-Betakey-Import lösen direkte Aktionen aus
|
- `Änderungen verwerfen` setzt auf zuletzt gespeicherten Stand
|
||||||
|
- `PushOver Test` validiert Benachrichtigungszugang sofort
|
||||||
|
|
||||||
### Toolbar-Aktionen
|
### Was wirkt unmittelbar, was erst bei neuem Job?
|
||||||
|
|
||||||
- `Änderungen speichern`: schreibt nur geänderte Felder
|
- Queue-/Parallelität wirkt auf neue Queue-Entscheidungen und Pump-Läufe.
|
||||||
- `Änderungen verwerfen`: setzt den Formularzustand zurück
|
- Tool-/Pfad-/Template-Änderungen wirken vollständig auf neu gestartete Schritte.
|
||||||
- `Neu laden`: lädt Schema und Werte neu
|
- Bereits laufende Prozesse übernehmen Änderungen in der Regel nicht rückwirkend.
|
||||||
- `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
|
### Welche Bereiche im Alltag kritisch sind
|
||||||
|
|
||||||
#### Benachrichtigungen
|
| Bereich | Kritisch für |
|
||||||
|
|---|---|
|
||||||
Hier steuerst du zwei Dinge:
|
| `Pfade` | wo RAW, finale Ausgaben, Converter/Audiobook-Dateien landen |
|
||||||
|
| `Tools` | ob Analyze/Rip/Encode ausführbar sind |
|
||||||
- ob und wohin Ripster PushOver-Nachrichten sendet
|
| `Metadaten` | Film-/Serienzuordnung und Episode-Mapping |
|
||||||
- bei welchen Ereignissen Ripster überhaupt benachrichtigt
|
| `Queue-Limits` | Durchsatz und Reihenfolgeverhalten |
|
||||||
|
| `Monitoring` | Sichtbarkeit von Last und Speicherengpässen |
|
||||||
Wichtig:
|
| `Benachrichtigungen` | PushOver-Ereignisse je Pipelinephase |
|
||||||
|
|
||||||
- `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`
|
|
||||||
|
|
||||||
## Tab `Scripte`
|
## Tab `Scripte`
|
||||||
|
|
||||||
Funktionen:
|
Funktionen:
|
||||||
|
|
||||||
- Skript anlegen
|
- anlegen, bearbeiten, löschen
|
||||||
- Skript bearbeiten
|
- testen (`Test`)
|
||||||
- Skript löschen
|
- sortieren
|
||||||
- Skript testen
|
|
||||||
- Reihenfolge per Drag-and-Drop ändern
|
|
||||||
- Favorit markieren
|
|
||||||
|
|
||||||
Das Testergebnis zeigt:
|
Testausführung liefert:
|
||||||
|
|
||||||
- Erfolg oder Fehler
|
|
||||||
- Exit-Code
|
- Exit-Code
|
||||||
- Dauer
|
- Dauer
|
||||||
- stdout/stderr
|
- stdout/stderr
|
||||||
- Timeout, falls `Script-Test Timeout (ms)` greift
|
|
||||||
|
|
||||||
## 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
|
|
||||||
|
|
||||||
Wichtig:
|
Wichtig:
|
||||||
|
|
||||||
- dieselben Skripte können sowohl in Jobs als auch in Ketten und Cronjobs wiederverwendet werden
|
- Nur erfolgreiche Skripte sollten in produktive Pre-/Post-Listen übernommen werden.
|
||||||
|
|
||||||
|
## Tab `Skriptketten`
|
||||||
|
|
||||||
|
Ketten bestehen aus Schritten:
|
||||||
|
|
||||||
|
- `Skript`
|
||||||
|
- `Warten`
|
||||||
|
|
||||||
|
Typischer Einsatz:
|
||||||
|
|
||||||
|
- externe Hooks vor/nach Encode
|
||||||
|
- gestaffelte Abläufe mit Pausen
|
||||||
|
|
||||||
|
In der Queue erscheinen Ketten als eigene Einträge und werden dort ausgeführt.
|
||||||
|
|
||||||
## Tab `Encode-Presets`
|
## Tab `Encode-Presets`
|
||||||
|
|
||||||
Hier werden Video-Standards für Disc- und Converter-Workflows verwaltet.
|
Ein Preset bündelt:
|
||||||
|
|
||||||
### Standard-Zuordnungen
|
- optionales HandBrake-Preset (`-Z`)
|
||||||
|
- optionale Extra-Args
|
||||||
|
- Medienziel (Universell/Blu-ray/DVD/Sonstiges)
|
||||||
|
|
||||||
Es gibt vier feste Slots:
|
Im Ripper-Review kannst du Presets pro Job auswählen, statt Parameter jedes Mal neu zu setzen.
|
||||||
|
|
||||||
- `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
|
|
||||||
|
|
||||||
## Tab `Cronjobs`
|
## Tab `Cronjobs`
|
||||||
|
|
||||||
Funktionen:
|
Funktionen:
|
||||||
|
|
||||||
- Cronjob anlegen, bearbeiten, löschen
|
- Cronjob anlegen und bearbeiten
|
||||||
- Cron-Ausdruck live validieren
|
- Quelle wählen (`Skript` oder `Skriptkette`)
|
||||||
- Quelle wählen: `Skript` oder `Skriptkette`
|
- Cron-Ausdruck prüfen
|
||||||
- Aktiv- und PushOver-Status pro Job setzen
|
|
||||||
- `Jetzt ausführen`
|
- `Jetzt ausführen`
|
||||||
- Lauf-Logs öffnen
|
- Job-Logs ansehen
|
||||||
|
- Aktivierung/Pushover toggeln
|
||||||
|
|
||||||
Die Runtime-Aktivitäten der laufenden Cronjobs werden zusätzlich live angezeigt.
|
Empfehlung:
|
||||||
|
|
||||||
## Expertenbereich: Activation Bytes Cache
|
1. Skript/Kette manuell testen.
|
||||||
|
2. Dann Cron aktivieren.
|
||||||
|
3. Erste automatische Läufe aktiv im Runtime-Status kontrollieren.
|
||||||
|
|
||||||
Dieser Block wird nur im Expertenmodus angezeigt.
|
## Verbindung zur Einstellungsreferenz
|
||||||
|
|
||||||
Er zeigt lokal bekannte AAX-Activation-Bytes mit:
|
Die vollständige Wirkung jeder einzelnen Einstellung steht in [Einstellungsreferenz](../configuration/settings-reference.md).
|
||||||
|
|
||||||
- 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,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.
|
|
||||||
@@ -44,8 +44,7 @@ Dann muss eine Playlist bestätigt werden, bevor der Workflow weiterläuft.
|
|||||||
|
|
||||||
| Feld in `Settings` | Wirkung |
|
| Feld in `Settings` | Wirkung |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `Minimale Titellänge (Minuten)` | Mindestlaufzeit für Kandidaten aus MakeMKV/Playlist-Analyse |
|
| `Minimale Titellaenge (Minuten)` | Mindestlaufzeit für Kandidaten |
|
||||||
| `TMDb Runtime-Abzug für Playlistfilter (%)` | lockert bei Bedarf die untere Laufzeitgrenze relativ zur TMDb-Laufzeit, damit leicht kürzere Hauptfassungen Kandidaten bleiben |
|
|
||||||
|
|
||||||
Default ist aktuell `60` Minuten.
|
Default ist aktuell `60` Minuten.
|
||||||
|
|
||||||
@@ -53,14 +52,7 @@ Default ist aktuell `60` Minuten.
|
|||||||
|
|
||||||
## UI-Verhalten
|
## UI-Verhalten
|
||||||
|
|
||||||
Bei manueller Entscheidung zeigt der `Ripper` Kandidaten mit:
|
Bei manueller Entscheidung zeigt das Ripper Kandidaten inkl. Score/Bewertung und markiert eine Empfehlung.
|
||||||
|
|
||||||
- Playlist-Datei
|
|
||||||
- Titel-ID
|
|
||||||
- Laufzeit
|
|
||||||
- Score
|
|
||||||
- Empfehlung
|
|
||||||
- Segment- und Audio-Vorschau
|
|
||||||
|
|
||||||
Nach Bestätigung:
|
Nach Bestätigung:
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# HandBrake
|
# HandBrake
|
||||||
|
|
||||||
Ripster verwendet `HandBrakeCLI` für Scan und Encode. Die mitgelieferte Datei
|
Ripster verwendet `HandBrakeCLI` für Scan und Encode.
|
||||||
`bin/HandBrakeCLI` ist ein separat ausführbares Drittanbieterprogramm und steht
|
|
||||||
unter `GPL-2.0-only`; die Ripster-Lizenz ersetzt diese Lizenz nicht.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -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
|
- Preset nicht gefunden: Preset-Namen mit `HandBrakeCLI -z` prüfen
|
||||||
- sehr langsames Encoding: Preset/Extra-Args prüfen (z. B. `--encoder-preset`)
|
- sehr langsames Encoding: Preset/Extra-Args prüfen (z. B. `--encoder-preset`)
|
||||||
|
|
||||||
Das Produktions-Installer-Script `install.sh` bietet eine Option zur Installation
|
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.
|
||||||
des gebündelten HandBrakeCLI-Binaries. Buildinformationen, Prüfsummen,
|
|
||||||
Lizenzhinweise und der Status des korrespondierenden Quellcodes liegen unter
|
|
||||||
`third_party/handbrake/`.
|
|
||||||
@@ -34,10 +34,6 @@ makemkvcon backup <source> <rawDir> --decrypt
|
|||||||
|
|
||||||
## Registrierungsschlüssel (optional)
|
## 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, synchronisiert Ripster ihn nach:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+123
-282
@@ -1,366 +1,207 @@
|
|||||||
# Workflows aus Nutzersicht
|
# 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 die produktiven Abläufe als Handbuch: welche Entscheidung an welcher Stelle fällt, welche Objekte dabei entstehen (Job, Container, Child-Job) und welche Dateien in welchen Ordnern landen.
|
||||||
|
|
||||||
## Gemeinsame Grundlagen
|
## Gemeinsame Grundlagen
|
||||||
|
|
||||||
### Typische Statuskette
|
### Statuskette im Normalfall
|
||||||
|
|
||||||
`Medium erkannt` -> `Analyse` -> `Metadatenauswahl` -> `Startbereit` -> `Rippen` -> `Mediainfo-Prüfung` -> `Bereit zum Encodieren` -> `Encodieren` -> `Fertig`
|
`Medium erkannt` -> `Analyse` -> `Metadatenauswahl` -> `Startbereit` -> `Rippen` -> `Mediainfo-Pruefung` -> `Bereit zum Encodieren` -> `Encodieren` -> `Fertig`
|
||||||
|
|
||||||
Wichtige Abweichungen:
|
Abweichungen:
|
||||||
|
|
||||||
- bei vorhandenem RAW: Sprung direkt in RAW-Entscheidung oder Review
|
- bei Blu-ray/DVD mit nötiger Playlistwahl: `Mediainfo-Pruefung` -> `Warte auf Auswahl` -> zurück in `Mediainfo-Pruefung`
|
||||||
- bei mehrdeutigen Blu-rays/DVDs: `Warte auf Auswahl` für Playlist- oder Titelauswahl
|
- bei vorhandenem RAW: `Startbereit` springt direkt in Review/Prüfung ohne neuen Laufwerks-Rip
|
||||||
- bei Fehler oder Abbruch: `Fehler` oder `Abgebrochen` mit Folgeaktionen
|
- bei Fehler/Abbruch: `Fehler` oder `Abgebrochen` mit Wiederanlauf-Aktionen
|
||||||
- bei Audio-CDs und Audiobooks: eigener Spezialflow innerhalb derselben Gesamtpipeline
|
|
||||||
|
|
||||||
### Welche Settings fast überall hineinspielen
|
### Job- und Container-Typen
|
||||||
|
|
||||||
Die wichtigsten globalen Einflussfaktoren:
|
| Typ | Zweck | Was enthält der Typ? |
|
||||||
|
|---|---|---|
|
||||||
|
| Normaler Disc-Job | Einzel-Film oder einzelne Disc | RAW-Pfad, Output-Pfad, Logs, Review |
|
||||||
|
| `dvd_series_container` | logischer Serien-Container (pro Serie/Staffel) | Metadatenanker, aggregierter Status über Kinder |
|
||||||
|
| `dvd_series_child` | einzelne Serien-Disc oder Serien-Episode-Job | eigentliche RAW-/Encode-Arbeit |
|
||||||
|
| `multipart_movie_container` | logischer Multipart-Film-Container | Zusammenfassung für mehrere Film-Discs |
|
||||||
|
| `multipart_movie_child` | einzelne Disc innerhalb Multipart-Film | Disc-spezifische RAW-/Encode-Daten |
|
||||||
|
|
||||||
- `Parallele Jobs`
|
Wichtig:
|
||||||
- `Max. parallele Audio CD Jobs`
|
|
||||||
- `Max. Encodes gesamt (medienunabhängig)`
|
|
||||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
|
||||||
- `PushOver`-Ereignisse
|
|
||||||
- Pfade, Templates und Owner-Felder
|
|
||||||
|
|
||||||
Für Disc-Video zusätzlich:
|
- Container sind primär Ordnungs- und Statusobjekte.
|
||||||
|
- Dateien (RAW/Output) hängen an den Child-Jobs.
|
||||||
|
|
||||||
- `Minimale Titellänge (Minuten)`
|
## Workflow A: Film (Blu-ray/DVD)
|
||||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
|
||||||
- `HandBrake Preset`
|
|
||||||
- `HandBrake Extra Args`
|
|
||||||
- `Review Audio-Sprachen (...)`
|
|
||||||
- `Review UT-Sprachen (...)`
|
|
||||||
- Standard-Zuordnungen aus `Settings -> Encode-Presets`
|
|
||||||
|
|
||||||
## Workflow A: Film von Disc (Blu-ray / DVD)
|
### 1) Disc analysieren und Film-Metadaten wählen
|
||||||
|
|
||||||
### 1. Disc analysieren und TMDb-Metadaten wählen
|
1. Im `Ripper` `Analyse starten`.
|
||||||
|
2. Im Metadaten-Dialog Film auswählen (OMDb bzw. manuelle Film-Metadaten).
|
||||||
1. Im `Ripper` `Analyse starten`
|
3. `Auswahl übernehmen`.
|
||||||
2. im Metadaten-Dialog Film auswählen
|
|
||||||
3. `Auswahl übernehmen`
|
|
||||||
|
|
||||||
Wirkung:
|
Wirkung:
|
||||||
|
|
||||||
- der Job wird als Film-Workflow geführt
|
- der Job wird als Film-Workflow geführt
|
||||||
- Film-Metadaten, Poster und Fingerprint werden gesetzt
|
- Film-Fingerprint für Duplikaterkennung wird gebildet (IMDb oder Titel/Jahr)
|
||||||
|
|
||||||
Relevante Settings:
|
### 2) Duplikatfall entscheiden
|
||||||
|
|
||||||
- `TMDb Read Access Token`
|
Wenn Film mit gleichem Fingerprint bereits existiert, gibt es zwei Wege:
|
||||||
- `Film-Sprache`
|
|
||||||
- `Fallback Sprache`
|
|
||||||
|
|
||||||
### 2. Duplikatfall entscheiden
|
1. `Übernahme erzwingen` (`allow_new`): neuer unabhängiger Film-Job
|
||||||
|
2. `Multipart movie`: neuer Job wird mit bestehendem Job in einem Multipart-Container verknüpft
|
||||||
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:
|
Bei Multipart gilt:
|
||||||
|
|
||||||
- beide Discs brauchen unterschiedliche Disc-Nummern
|
- beide Discs brauchen unterschiedliche `Disc-Nummer`
|
||||||
- gleiche Disc-Nummern blockieren den Vorgang
|
- gleiche Disc-Nummer blockiert den Vorgang (`MULTIPART_DISC_ALREADY_EXISTS`)
|
||||||
|
|
||||||
### 3. RAW-Verzeichnis und RAW-Entscheidung
|
### 3) RAW-Verzeichnis entsteht
|
||||||
|
|
||||||
Wenn noch kein passendes RAW vorhanden ist:
|
Ordnername basiert auf Metadaten plus Job-ID:
|
||||||
|
|
||||||
- Ripster legt ein neues RAW-Verzeichnis an
|
- `Incomplete_<Titel> (<Jahr>) - RAW - job-<id>`
|
||||||
|
|
||||||
Wenn bereits ein passendes RAW gefunden wird:
|
Zustandswechsel des RAW-Ordners:
|
||||||
|
|
||||||
- der Job geht in `Warte auf Auswahl`
|
- beim Start: `Incomplete_...`
|
||||||
- du entscheidest, ob das vorhandene RAW weiterverwendet oder neu gerippt wird
|
- nach erfolgreichem Rip: `Rip_Complete_...`
|
||||||
|
- nach erfolgreichem Encode: Prefix wird entfernt (final)
|
||||||
|
|
||||||
Relevante Settings:
|
### 4) Review und Encode
|
||||||
|
|
||||||
- `Raw Ausgabeordner (Blu-ray)` und `Raw Ausgabeordner (DVD)`
|
In `Bereit zum Encodieren`:
|
||||||
- `Eigentümer Raw-Ordner (Blu-ray)` und `Eigentümer Raw-Ordner (DVD)`
|
|
||||||
|
|
||||||
### 4. Playlist- oder Titelauswahl
|
- Titel wählen
|
||||||
|
- Audio-/Subtitle-Spuren festlegen
|
||||||
|
- optional User-Preset
|
||||||
|
- optional Pre-/Post-Encode-Skripte oder Ketten
|
||||||
|
|
||||||
Bei bestimmten Discs ist nach der Metadatenphase eine manuelle Auswahl nötig:
|
Beim Start:
|
||||||
|
|
||||||
- Playlist-Auswahl
|
- temporäre Ausgabe in `Incomplete_job-<id>/<Datei>.<ext>`
|
||||||
- HandBrake-Titelauswahl
|
- nach Erfolg Verschiebung in finalen Zielpfad aus Film-Template
|
||||||
- bei Serien-Grenzfällen PlayAll- oder Doppelfolgen-Entscheidung
|
|
||||||
|
|
||||||
Das ist der aktuelle `playlistflow`.
|
## Workflow B: Serie (Blu-ray/DVD)
|
||||||
|
|
||||||
Relevante Settings:
|
### 1) Serienmodus aktivieren
|
||||||
|
|
||||||
- `Minimale Titellänge (Minuten)`
|
1. Disc analysieren.
|
||||||
- `TMDb Runtime-Abzug für Playlistfilter (%)`
|
2. Im Metadaten-Dialog Serienmetadaten wählen (TMDb-basiert).
|
||||||
- `Bei manueller Auswahl senden`
|
3. `Disc-Nummer` setzen (Pflicht, ab 1).
|
||||||
|
|
||||||
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:
|
Wirkung:
|
||||||
|
|
||||||
- Ripster arbeitet als Serien-Workflow
|
- Workflow-Kind wird `series`
|
||||||
- Seriencontainer wird gesucht oder angelegt
|
- Seriencontainer wird gesucht/angelegt
|
||||||
- der Job wird als Child unter diesem Container geführt
|
- aktueller Job wird als `dvd_series_child` darunter geführt
|
||||||
|
|
||||||
### 2. Serien-RAW und Staffelkontext
|
### 2) Seriencontainer und Disc-Konflikte
|
||||||
|
|
||||||
Für Serien bevorzugt Ripster eigene Serien-RAW-Verzeichnisse:
|
Beim Speichern wird geprüft:
|
||||||
|
|
||||||
- `RAW-Ordner (Blu-ray Serie)`
|
- existiert für Serie/Staffel bereits ein Container?
|
||||||
- `RAW-Ordner (DVD Serie)`
|
- existiert in diesem Container bereits dieselbe `Disc-Nummer`?
|
||||||
|
|
||||||
Falls leer:
|
Wenn ja, wird blockiert (`SERIES_DISC_ALREADY_EXISTS`).
|
||||||
|
|
||||||
- Fallback auf `Raw Ausgabeordner (Blu-ray)` bzw. `Raw Ausgabeordner (DVD)`
|
### 3) Serien-RAW-Pfad
|
||||||
|
|
||||||
### 3. Episodenprüfung und Multi-Episode-Fälle
|
Für Serien wird ein eigener RAW-Pfad bevorzugt:
|
||||||
|
|
||||||
In der Review werden Episoden oder Mehrfachfolgen aufgelöst.
|
- Blu-ray: `raw_dir_bluray_series` (Fallback: `raw_dir_bluray`)
|
||||||
|
- DVD: `raw_dir_dvd_series` (Fallback: `raw_dir_dvd`)
|
||||||
|
|
||||||
Ausgabevarianten:
|
RAW-Namensbasis enthält Staffel/Disc (`SxDy`) und wird ebenfalls mit den Prefix-Phasen geführt:
|
||||||
|
|
||||||
- Einzel-Episode
|
- `Incomplete_...` -> `Rip_Complete_...` -> final
|
||||||
- Multi-Episode-Datei
|
|
||||||
|
|
||||||
Relevante Settings:
|
### 4) Serien-Review und Episoden-Ausgabe
|
||||||
|
|
||||||
- `Output Template (Blu-ray Serie, Episode)`
|
Beim Review werden Episoden-/Titelzuordnungen genutzt. Je nach Auswahl:
|
||||||
- `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
|
- Einzel-Episode: Episode-Template
|
||||||
|
- Multi-Episode-Titel: Multi-Episode-Template
|
||||||
|
|
||||||
Auch Serien können vor der Review in eine Playlist- oder Titelauswahl laufen.
|
Ausgabepfad:
|
||||||
|
|
||||||
Zusätzlich wirken:
|
- Root: `series_dir_*` (Fallback auf `movie_dir_*`)
|
||||||
|
- Dateiname/Unterordner aus Serien-Template
|
||||||
|
|
||||||
- `Review Audio-Sprachen (Blu-ray Serie)` / `Review Audio-Sprachen (DVD Serie)`
|
### 5) Multi-Episode-Disc als Batch
|
||||||
- `Review UT-Sprachen (Blu-ray Serie)` / `Review UT-Sprachen (DVD Serie)`
|
|
||||||
- Serien-Default-Presets unter `Settings -> Encode-Presets`
|
Wenn mehrere Episoden-Titel aus einer Disc encodiert werden:
|
||||||
|
|
||||||
|
- Ripster erzeugt Episode-Child-Jobs
|
||||||
|
- der ursprüngliche Disc-Job dient als Batch-Anker
|
||||||
|
- RAW-Finalisierung erfolgt erst, wenn alle Episode-Encodes abgeschlossen sind
|
||||||
|
|
||||||
## Workflow C: Multipart-Film
|
## Workflow C: Multipart-Film
|
||||||
|
|
||||||
### Wann der Flow gedacht ist
|
### Wann dieser Flow gedacht ist
|
||||||
|
|
||||||
- gleicher Film auf mehreren Discs
|
- gleicher Film auf mehreren Discs (z. B. Disc 1/Disc 2)
|
||||||
- die Discs sollen in Historie und Detailansichten zusammengehören
|
- Zusammengehörigkeit soll in Historie und Detailansichten sichtbar sein
|
||||||
|
|
||||||
### Ablauf
|
### Ablauf
|
||||||
|
|
||||||
1. Film-Metadaten wählen
|
1. Film-Metadaten wählen.
|
||||||
2. Duplikatdialog `Multipart movie`
|
2. Duplikatdialog -> `Multipart movie`.
|
||||||
3. Disc-Nummern für bestehenden und neuen Job festlegen
|
3. Disc-Nummern für bestehenden und neuen Job festlegen.
|
||||||
|
|
||||||
Wirkung:
|
Wirkung:
|
||||||
|
|
||||||
- `multipart_movie_container` wird angelegt oder wiederverwendet
|
- `multipart_movie_container` wird angelegt oder wiederverwendet
|
||||||
- die Discs werden als Child-Jobs darunter geführt
|
- beteiligte Jobs werden `multipart_movie_child`
|
||||||
- zusätzlich wird ein Merge-Job vorbereitet
|
- Container führt gemeinsame Metadaten, Kinder führen je Disc die eigentlichen Artefakte
|
||||||
|
|
||||||
Relevante Settings:
|
## Workflow D: Vorhandenes RAW / RAW-Import
|
||||||
|
|
||||||
- `mkvmerge_command`
|
### Fall 1: RAW bereits vorhanden bei Metadatenübernahme
|
||||||
- Film-Output-Templates
|
|
||||||
- Queue-Limits, falls mehrere Discs parallel weiterverarbeitet werden
|
|
||||||
|
|
||||||
## Workflow D: Audio-CD
|
Nach Metadaten-Übernahme erkennt Ripster passende RAW-Ordner und setzt den Job auf Entscheidungsstatus.
|
||||||
|
|
||||||
### 1. TOC lesen und Metadaten wählen
|
Möglichkeiten:
|
||||||
|
|
||||||
1. Audio-CD analysieren
|
- vorhandenes RAW weiterverwenden (kein neuer Rip)
|
||||||
2. Tracks prüfen
|
- RAW löschen/ignorieren und neu rippen
|
||||||
3. Metadaten aus MusicBrainz übernehmen oder manuell anpassen
|
|
||||||
|
|
||||||
### 2. Trackauswahl und Format
|
### Fall 2: Orphan-RAW aus `/database`
|
||||||
|
|
||||||
Vor dem Start legst du fest:
|
1. In `Database` `RAW prüfen`.
|
||||||
|
2. Bei orphan RAW `Job anlegen`.
|
||||||
|
3. Job wird in Historie erzeugt und wie "Disk analysieren aus RAW" weiterverarbeitet.
|
||||||
|
|
||||||
- welche Tracks übernommen werden
|
## Workflow E: Nachbearbeitung bestehender Jobs
|
||||||
- welches Ausgabeformat gilt
|
|
||||||
- welche Formatoptionen genutzt werden
|
|
||||||
- welche Pre-/Post-Encode-Skripte oder Ketten mitlaufen
|
|
||||||
|
|
||||||
### 3. Rip und Encode
|
In `Historie` (Detaildialog):
|
||||||
|
|
||||||
Die CD läuft anschließend als Track-für-Track-Flow:
|
| Aktion | Wirkung |
|
||||||
|
|---|---|
|
||||||
|
| `OMDb neu zuordnen` | Metadaten neu schreiben, Folder-Rename wird best effort angestoßen |
|
||||||
|
| `Review neu starten` | Titel-/Spurprüfung aus aktuellem RAW neu aufbauen |
|
||||||
|
| `RAW neu encodieren` | Encode erneut aus vorhandenem RAW starten |
|
||||||
|
| `Encode neu starten` | letzte bestätigte Review-Einstellungen wiederverwenden |
|
||||||
|
| `Retry Rippen` | Rip/Analyse neu starten; alter Job-RAW kann bereinigt werden |
|
||||||
|
|
||||||
`CD-Metadatenauswahl` -> `CD-Startbereit` -> `CD-Rippen` -> `CD-Encodieren` -> `Fertig`
|
## Wo landet was? (Artefakt-Matrix)
|
||||||
|
|
||||||
Relevante Settings:
|
| Artefakt | Film | Serie | Multipart |
|
||||||
|
|---|---|---|---|
|
||||||
|
| RAW | `raw_dir_*` | bevorzugt `raw_dir_*_series` | pro Child-Job im normalen Film-RAW-Schema |
|
||||||
|
| Finale Ausgabe | `movie_dir_*` + Film-Template | `series_dir_*` (Fallback `movie_dir_*`) + Serien-Templates | pro Child-Job normaler Film-Output |
|
||||||
|
| Container-Datensatz | nein | ja (`dvd_series_container`) | ja (`multipart_movie_container`) |
|
||||||
|
| Löschvorschau in Historie | einzelner Job oder Related Scope | Container-/Child-bezogen mit Pfadauswahl | Container-/Child-bezogen mit Pfadauswahl |
|
||||||
|
|
||||||
- `CD RAW-Ordner`
|
## Queue-Verhalten im Alltag
|
||||||
- `CD Output-Ordner`
|
|
||||||
- `Eigentümer CD RAW-Ordner`
|
Die Startfreigabe hängt an vier Settings:
|
||||||
- `Eigentümer CD Output-Ordner`
|
|
||||||
- `CD Output Template`
|
- `Max. parallele Film/Video Encodes`
|
||||||
- `cdparanoia Kommando`
|
|
||||||
- `Max. parallele Audio CD Jobs`
|
- `Max. parallele Audio CD Jobs`
|
||||||
|
- `Max. Encodes gesamt`
|
||||||
- `Audio CDs: Queue-Reihenfolge überspringen`
|
- `Audio CDs: Queue-Reihenfolge überspringen`
|
||||||
|
|
||||||
## Workflow E: Converter
|
Praxis:
|
||||||
|
|
||||||
### 1. Dateien bereitstellen
|
- Film/Video- und Audio/CD laufen in getrennten Lanes
|
||||||
|
- Gesamtlimit begrenzt beide gemeinsam
|
||||||
Dateien gelangen in den Converter über:
|
- Queue kann neben Jobs auch `Skript`, `Kette`, `Warten` enthalten
|
||||||
|
|
||||||
- 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`
|
|
||||||
- `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",
|
"name": "ripster-frontend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ripster-frontend",
|
"name": "ripster-frontend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"license": "GPL-2.0-or-later",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chart.js": "^4.5.1",
|
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
"primereact": "^10.9.2",
|
"primereact": "^10.9.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
@@ -705,11 +703,6 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@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": {
|
"node_modules/@remix-run/router": {
|
||||||
"version": "1.23.2",
|
"version": "1.23.2",
|
||||||
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz",
|
"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": {
|
"node_modules/convert-source-map": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||||
|
|||||||
+1
-11
@@ -1,16 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ripster-frontend",
|
"name": "ripster-frontend",
|
||||||
"version": "1.0.0-1",
|
"version": "0.16.1-1",
|
||||||
"private": true,
|
"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",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -18,7 +9,6 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chart.js": "^4.5.1",
|
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
"primereact": "^10.9.2",
|
"primereact": "^10.9.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
+154
-252
@@ -1,8 +1,8 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Navigate, Outlet, Routes, Route, useLocation, useNavigate } from 'react-router-dom';
|
import { Navigate, Outlet, Routes, Route, useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
|
import { ProgressBar } from 'primereact/progressbar';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { ConfirmDialog } from 'primereact/confirmdialog';
|
import { ConfirmDialog } from 'primereact/confirmdialog';
|
||||||
import { api } from './api/client';
|
import { api } from './api/client';
|
||||||
@@ -13,9 +13,8 @@ import HistoryPage from './pages/HistoryPage';
|
|||||||
import DatabasePage from './pages/DatabasePage';
|
import DatabasePage from './pages/DatabasePage';
|
||||||
import DownloadsPage from './pages/DownloadsPage';
|
import DownloadsPage from './pages/DownloadsPage';
|
||||||
import ConverterPage from './pages/ConverterPage';
|
import ConverterPage from './pages/ConverterPage';
|
||||||
|
import JobsInboxPage from './pages/JobsInboxPage';
|
||||||
import AudiobooksPage from './pages/AudiobooksPage';
|
import AudiobooksPage from './pages/AudiobooksPage';
|
||||||
import TmdbMigrationPage from './pages/TmdbMigrationPage';
|
|
||||||
import HardwarePage from './pages/HardwarePage';
|
|
||||||
|
|
||||||
function normalizeJobId(value) {
|
function normalizeJobId(value) {
|
||||||
const parsed = Number(value);
|
const parsed = Number(value);
|
||||||
@@ -25,20 +24,6 @@ function normalizeJobId(value) {
|
|||||||
return Math.trunc(parsed);
|
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) {
|
function clampPercent(value) {
|
||||||
const parsed = Number(value);
|
const parsed = Number(value);
|
||||||
if (!Number.isFinite(parsed)) {
|
if (!Number.isFinite(parsed)) {
|
||||||
@@ -51,57 +36,28 @@ function normalizeStage(value) {
|
|||||||
return String(value || '').trim().toUpperCase();
|
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) {
|
function isTerminalStage(value) {
|
||||||
const normalized = normalizeStage(value);
|
const normalized = normalizeStage(value);
|
||||||
return normalized === 'FINISHED' || normalized === 'ERROR' || normalized === 'CANCELLED';
|
return normalized === 'FINISHED' || normalized === 'ERROR' || normalized === 'CANCELLED';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInteractiveReviewStage(value) {
|
function formatBytes(value) {
|
||||||
const normalized = normalizeStage(value);
|
const parsed = Number(value);
|
||||||
return normalized === 'METADATA_LOOKUP'
|
if (!Number.isFinite(parsed) || parsed < 0) {
|
||||||
|| normalized === 'METADATA_SELECTION'
|
return 'n/a';
|
||||||
|| normalized === 'WAITING_FOR_USER_DECISION'
|
|
||||||
|| normalized === 'READY_TO_ENCODE';
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseTimestamp(value) {
|
|
||||||
if (!value) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
const ts = Date.parse(String(value));
|
if (parsed === 0) {
|
||||||
return Number.isFinite(ts) ? ts : 0;
|
return '0 B';
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
const prevQueueTs = parseTimestamp(prevQueue.updatedAt);
|
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
||||||
const incomingQueueTs = parseTimestamp(incomingQueue.updatedAt);
|
let unitIndex = 0;
|
||||||
const queue = incomingQueueTs >= prevQueueTs ? incomingQueue : prevQueue;
|
let current = parsed;
|
||||||
return {
|
while (current >= 1024 && unitIndex < units.length - 1) {
|
||||||
...prev,
|
current /= 1024;
|
||||||
...incoming,
|
unitIndex += 1;
|
||||||
queue
|
}
|
||||||
};
|
const digits = unitIndex <= 1 ? 0 : 2;
|
||||||
|
return `${current.toFixed(digits)} ${units[unitIndex]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createInitialAudiobookUploadState() {
|
function createInitialAudiobookUploadState() {
|
||||||
@@ -114,14 +70,28 @@ function createInitialAudiobookUploadState() {
|
|||||||
statusText: null,
|
statusText: null,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
jobId: null,
|
jobId: null,
|
||||||
uploadSessionId: null,
|
|
||||||
fileLastModified: null,
|
|
||||||
fileFingerprint: null,
|
|
||||||
startedAt: null,
|
startedAt: null,
|
||||||
finishedAt: 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) {
|
function getDownloadIndicatorMeta(summary) {
|
||||||
const activeCount = Number(summary?.activeCount || 0);
|
const activeCount = Number(summary?.activeCount || 0);
|
||||||
const failedCount = Number(summary?.failedCount || 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() {
|
function App() {
|
||||||
const appVersion = __APP_VERSION__;
|
const appVersion = __APP_VERSION__;
|
||||||
const [pipeline, setPipeline] = useState({ state: 'IDLE', progress: 0, context: {} });
|
const [pipeline, setPipeline] = useState({ state: 'IDLE', progress: 0, context: {} });
|
||||||
@@ -164,20 +129,11 @@ function App() {
|
|||||||
const [historyJobsRefreshToken, setHistoryJobsRefreshToken] = useState(0);
|
const [historyJobsRefreshToken, setHistoryJobsRefreshToken] = useState(0);
|
||||||
const [downloadsRefreshToken, setDownloadsRefreshToken] = useState(0);
|
const [downloadsRefreshToken, setDownloadsRefreshToken] = useState(0);
|
||||||
const [downloadSummary, setDownloadSummary] = useState(null);
|
const [downloadSummary, setDownloadSummary] = useState(null);
|
||||||
|
const [pendingRipperJobId, setPendingRipperJobId] = useState(null);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const globalToastRef = useRef(null);
|
const globalToastRef = useRef(null);
|
||||||
const prevCdDrivesRef = useRef({});
|
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),
|
// 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
|
// or when a CD drive transitions away from an active job, force both
|
||||||
@@ -219,148 +175,90 @@ function App() {
|
|||||||
prevCdDrivesRef.current = current;
|
prevCdDrivesRef.current = current;
|
||||||
}, [pipeline?.cdDrives]);
|
}, [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 refreshPipeline = async () => {
|
||||||
const response = await api.getPipelineState();
|
const response = await api.getPipelineState();
|
||||||
setPipeline(response.pipeline);
|
setPipeline(response.pipeline);
|
||||||
const monitoringPayload = response?.hardwareMonitoring || null;
|
setHardwareMonitoring(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();
|
|
||||||
}
|
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearAudiobookUpload = () => {
|
||||||
|
setAudiobookUpload(createInitialAudiobookUploadState());
|
||||||
|
};
|
||||||
|
|
||||||
const handleAudiobookUpload = async (file, payload = {}) => {
|
const handleAudiobookUpload = async (file, payload = {}) => {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
throw new Error('Bitte zuerst eine AAX-Datei auswählen.');
|
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 fallbackTotalBytes = Number.isFinite(Number(file.size)) && Number(file.size) > 0
|
||||||
const abortController = new AbortController();
|
? Number(file.size)
|
||||||
audiobookUploadAbortRef.current = abortController;
|
: 0;
|
||||||
|
|
||||||
setAudiobookUpload({
|
setAudiobookUpload({
|
||||||
phase: 'uploading',
|
phase: 'uploading',
|
||||||
fileName,
|
fileName: String(file.name || '').trim() || 'upload.aax',
|
||||||
loadedBytes: 0,
|
loadedBytes: 0,
|
||||||
totalBytes,
|
totalBytes: fallbackTotalBytes,
|
||||||
progressPercent: 0,
|
progressPercent: 0,
|
||||||
statusText: 'AAX-Datei wird hochgeladen ...',
|
statusText: 'AAX-Datei wird hochgeladen ...',
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
jobId: null,
|
jobId: null,
|
||||||
uploadSessionId: null,
|
|
||||||
fileLastModified: Number.isFinite(Number(file.lastModified))
|
|
||||||
? Math.trunc(Number(file.lastModified))
|
|
||||||
: null,
|
|
||||||
fileFingerprint: null,
|
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: null
|
finishedAt: null
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await api.uploadAudiobook(file, payload, {
|
const response = await api.uploadAudiobook(file, payload, {
|
||||||
signal: abortController.signal,
|
|
||||||
onProgress: ({ loaded, total, percent }) => {
|
onProgress: ({ loaded, total, percent }) => {
|
||||||
const loadedBytes = Number.isFinite(Number(loaded)) ? Number(loaded) : 0;
|
const nextLoaded = Number.isFinite(Number(loaded)) && Number(loaded) >= 0
|
||||||
const totalSize = Number.isFinite(Number(total)) && Number(total) > 0 ? Number(total) : totalBytes;
|
? Number(loaded)
|
||||||
const progressPercent = Number.isFinite(Number(percent))
|
: 0;
|
||||||
|
const nextTotal = Number.isFinite(Number(total)) && Number(total) > 0
|
||||||
|
? Number(total)
|
||||||
|
: fallbackTotalBytes;
|
||||||
|
const nextPercent = Number.isFinite(Number(percent))
|
||||||
? clampPercent(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) => ({
|
setAudiobookUpload((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
phase: 'uploading',
|
phase: transferComplete ? 'processing' : 'uploading',
|
||||||
loadedBytes,
|
loadedBytes: nextLoaded,
|
||||||
totalBytes: totalSize,
|
totalBytes: nextTotal,
|
||||||
progressPercent,
|
progressPercent: nextPercent,
|
||||||
statusText: 'AAX-Datei wird hochgeladen ...',
|
statusText: transferComplete
|
||||||
errorMessage: null
|
? 'Upload abgeschlossen, AAX wird serverseitig verarbeitet ...'
|
||||||
|
: 'AAX-Datei wird hochgeladen ...'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const uploadedJobId = extractUploadJobIdFromResponse(response);
|
|
||||||
const started = Boolean(response?.result?.started);
|
const uploadedJobId = normalizeJobId(response?.result?.jobId);
|
||||||
const queued = Boolean(response?.result?.queued);
|
|
||||||
await refreshPipeline().catch(() => null);
|
await refreshPipeline().catch(() => null);
|
||||||
setRipperJobsRefreshToken((prev) => prev + 1);
|
setRipperJobsRefreshToken((prev) => prev + 1);
|
||||||
setHistoryJobsRefreshToken((prev) => prev + 1);
|
setHistoryJobsRefreshToken((prev) => prev + 1);
|
||||||
|
if (uploadedJobId) {
|
||||||
|
setPendingRipperJobId(uploadedJobId);
|
||||||
|
}
|
||||||
|
|
||||||
setAudiobookUpload((prev) => ({
|
setAudiobookUpload((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
phase: 'completed',
|
phase: 'completed',
|
||||||
loadedBytes: prev.totalBytes || totalBytes,
|
loadedBytes: prev.totalBytes || prev.loadedBytes || fallbackTotalBytes,
|
||||||
totalBytes: prev.totalBytes || totalBytes,
|
totalBytes: prev.totalBytes || fallbackTotalBytes,
|
||||||
progressPercent: 100,
|
progressPercent: 100,
|
||||||
statusText: uploadedJobId
|
statusText: uploadedJobId
|
||||||
? (
|
? `Upload abgeschlossen. Job #${uploadedJobId} ist bereit fuer den naechsten Schritt.`
|
||||||
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.',
|
: 'Upload abgeschlossen.',
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
jobId: uploadedJobId,
|
jobId: uploadedJobId,
|
||||||
finishedAt: new Date().toISOString()
|
finishedAt: new Date().toISOString()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error?.name === 'AbortError') {
|
|
||||||
setAudiobookUpload(createInitialAudiobookUploadState());
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
setAudiobookUpload((prev) => ({
|
setAudiobookUpload((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
phase: 'error',
|
phase: 'error',
|
||||||
@@ -369,20 +267,17 @@ function App() {
|
|||||||
finishedAt: new Date().toISOString()
|
finishedAt: new Date().toISOString()
|
||||||
}));
|
}));
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
|
||||||
if (audiobookUploadAbortRef.current === abortController) {
|
|
||||||
audiobookUploadAbortRef.current = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelAudiobookUpload = () => {
|
const handleRipperJobFocusConsumed = (jobId) => {
|
||||||
const activeAbortController = audiobookUploadAbortRef.current;
|
const normalizedJobId = normalizeJobId(jobId);
|
||||||
if (activeAbortController) {
|
if (!normalizedJobId) {
|
||||||
activeAbortController.abort();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setAudiobookUpload(createInitialAudiobookUploadState());
|
setPendingRipperJobId((prev) => (
|
||||||
|
normalizeJobId(prev) === normalizedJobId ? null : prev
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -399,24 +294,12 @@ function App() {
|
|||||||
setExpertMode(val === 'true' || val === true);
|
setExpertMode(val === 'true' || val === true);
|
||||||
})
|
})
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
return () => {
|
|
||||||
clearHardwareWarmupRetry();
|
|
||||||
};
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useWebSocket({
|
useWebSocket({
|
||||||
onMessage: (message) => {
|
onMessage: (message) => {
|
||||||
if (message.type === 'WS_CONNECTED') {
|
|
||||||
refreshPipeline().catch(() => null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'PIPELINE_STATE_CHANGED') {
|
if (message.type === 'PIPELINE_STATE_CHANGED') {
|
||||||
setPipeline((prev) => mergePipelineStatePreservingNewestQueue(prev, message.payload));
|
setPipeline(message.payload);
|
||||||
const nextState = normalizeStage(message?.payload?.state);
|
|
||||||
if (isTerminalStage(nextState) || isInteractiveReviewStage(nextState)) {
|
|
||||||
setRipperJobsRefreshToken((token) => token + 1);
|
|
||||||
setHistoryJobsRefreshToken((token) => token + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'PIPELINE_PROGRESS') {
|
if (message.type === 'PIPELINE_PROGRESS') {
|
||||||
@@ -432,24 +315,17 @@ function App() {
|
|||||||
const isCdProgressStage = progressStage === 'CD_ANALYZING'
|
const isCdProgressStage = progressStage === 'CD_ANALYZING'
|
||||||
|| progressStage === 'CD_RIPPING'
|
|| progressStage === 'CD_RIPPING'
|
||||||
|| progressStage === 'CD_ENCODING';
|
|| progressStage === 'CD_ENCODING';
|
||||||
const incomingIsRunning = isRunningStage(progressStage);
|
|
||||||
const incomingIsTerminal = isTerminalStage(progressStage);
|
const incomingIsTerminal = isTerminalStage(progressStage);
|
||||||
const prevActiveJobId = normalizeJobId(prev?.activeJobId || prev?.context?.jobId);
|
const prevActiveJobId = normalizeJobId(prev?.activeJobId || prev?.context?.jobId);
|
||||||
const prevJobProgress = normalizedProgressJobId
|
const prevJobProgress = normalizedProgressJobId
|
||||||
? (prev?.jobProgress?.[normalizedProgressJobId] || null)
|
? (prev?.jobProgress?.[normalizedProgressJobId] || null)
|
||||||
: null;
|
: null;
|
||||||
const prevJobProgressState = normalizeStage(prevJobProgress?.state);
|
const prevJobProgressState = normalizeStage(prevJobProgress?.state);
|
||||||
const prevJobProgressIsRunning = isRunningStage(prevJobProgressState);
|
|
||||||
const prevJobProgressIsTerminal = isTerminalStage(prevJobProgressState);
|
const prevJobProgressIsTerminal = isTerminalStage(prevJobProgressState);
|
||||||
const matchingCdDriveEntry = normalizedProgressJobId
|
const matchingCdDriveEntry = normalizedProgressJobId
|
||||||
? Object.values(prev?.cdDrives || {}).find((driveState) => normalizeJobId(driveState?.jobId) === normalizedProgressJobId)
|
? Object.values(prev?.cdDrives || {}).find((driveState) => normalizeJobId(driveState?.jobId) === normalizedProgressJobId)
|
||||||
: null;
|
: null;
|
||||||
const matchingCdDriveState = normalizeStage(matchingCdDriveEntry?.state);
|
|
||||||
const matchingCdDriveIsRunning = isRunningStage(matchingCdDriveState);
|
|
||||||
const matchingCdDriveIsTerminal = isTerminalStage(matchingCdDriveEntry?.state);
|
const matchingCdDriveIsTerminal = isTerminalStage(matchingCdDriveEntry?.state);
|
||||||
const previousGlobalStage = normalizeStage(prev?.state);
|
|
||||||
const previousGlobalIsRunning = isRunningStage(previousGlobalStage);
|
|
||||||
const previousGlobalIsTerminal = isTerminalStage(previousGlobalStage);
|
|
||||||
const hasKnownBinding = Boolean(
|
const hasKnownBinding = Boolean(
|
||||||
normalizedProgressJobId
|
normalizedProgressJobId
|
||||||
&& (
|
&& (
|
||||||
@@ -458,43 +334,16 @@ function App() {
|
|||||||
|| matchingCdDriveEntry
|
|| 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
|
// Ignore late/stale progress packets that arrive after a terminal state
|
||||||
// or regress a job from an interactive/ready state back into an
|
// or for jobs that are no longer bound in pipeline state.
|
||||||
// earlier running stage because an older progress packet arrived late.
|
|
||||||
if (
|
if (
|
||||||
normalizedProgressJobId
|
normalizedProgressJobId
|
||||||
&& !incomingIsTerminal
|
&& !incomingIsTerminal
|
||||||
&& !allowRunningTransitionFromTerminal
|
|
||||||
&& (
|
&& (
|
||||||
prevJobProgressIsTerminal
|
prevJobProgressIsTerminal
|
||||||
|| matchingCdDriveIsTerminal
|
|| matchingCdDriveIsTerminal
|
||||||
|| isUnknownRunningProgress
|
|| !hasKnownBinding
|
||||||
|| regressesStableJobState
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return prev;
|
return prev;
|
||||||
@@ -503,9 +352,7 @@ function App() {
|
|||||||
if (progressJobId != null) {
|
if (progressJobId != null) {
|
||||||
const previousJobProgress = prev?.jobProgress?.[progressJobId] || {};
|
const previousJobProgress = prev?.jobProgress?.[progressJobId] || {};
|
||||||
const previousJobStage = normalizeStage(previousJobProgress?.state);
|
const previousJobStage = normalizeStage(previousJobProgress?.state);
|
||||||
const keepPreviousJobStage = isTerminalStage(previousJobStage)
|
const keepPreviousJobStage = isTerminalStage(previousJobStage) && !incomingIsTerminal;
|
||||||
&& !incomingIsTerminal
|
|
||||||
&& !allowRunningTransitionFromTerminal;
|
|
||||||
const mergedJobContext = contextPatch
|
const mergedJobContext = contextPatch
|
||||||
? {
|
? {
|
||||||
...(previousJobProgress?.context && typeof previousJobProgress.context === 'object'
|
...(previousJobProgress?.context && typeof previousJobProgress.context === 'object'
|
||||||
@@ -529,9 +376,8 @@ function App() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (progressJobId === prev?.activeJobId || progressJobId == null) {
|
if (progressJobId === prev?.activeJobId || progressJobId == null) {
|
||||||
const keepPreviousGlobalStage = isTerminalStage(previousGlobalStage)
|
const previousGlobalStage = normalizeStage(prev?.state);
|
||||||
&& !incomingIsTerminal
|
const keepPreviousGlobalStage = isTerminalStage(previousGlobalStage) && !incomingIsTerminal;
|
||||||
&& !allowRunningTransitionFromTerminal;
|
|
||||||
next.state = keepPreviousGlobalStage ? prev?.state : (payload.state ?? prev?.state);
|
next.state = keepPreviousGlobalStage ? prev?.state : (payload.state ?? prev?.state);
|
||||||
next.progress = keepPreviousGlobalStage ? prev?.progress : (payload.progress ?? prev?.progress);
|
next.progress = keepPreviousGlobalStage ? prev?.progress : (payload.progress ?? prev?.progress);
|
||||||
next.eta = keepPreviousGlobalStage ? prev?.eta : (payload.eta ?? prev?.eta);
|
next.eta = keepPreviousGlobalStage ? prev?.eta : (payload.eta ?? prev?.eta);
|
||||||
@@ -632,15 +478,10 @@ function App() {
|
|||||||
const val = setting?.value;
|
const val = setting?.value;
|
||||||
setExpertMode(val === 'true' || val === true);
|
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') {
|
if (message.type === 'SETTINGS_BULK_UPDATED') {
|
||||||
const keys = message.payload?.keys || [];
|
const keys = message.payload?.keys || [];
|
||||||
const normalizedKeys = keys.map((key) => String(key || '').trim().toLowerCase());
|
|
||||||
if (keys.includes('ui_expert_mode')) {
|
if (keys.includes('ui_expert_mode')) {
|
||||||
api.getSettings({ forceRefresh: true })
|
api.getSettings({ forceRefresh: true })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -650,9 +491,6 @@ function App() {
|
|||||||
})
|
})
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
}
|
}
|
||||||
if (normalizedKeys.some((key) => HARDWARE_MONITOR_SETTING_KEYS.has(key))) {
|
|
||||||
refreshPipeline().catch(() => null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'DOWNLOADS_UPDATED') {
|
if (message.type === 'DOWNLOADS_UPDATED') {
|
||||||
@@ -691,6 +529,7 @@ function App() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const nav = [
|
const nav = [
|
||||||
|
{ label: 'Jobs', path: '/jobs' },
|
||||||
{ label: 'Ripper', path: '/ripper' },
|
{ label: 'Ripper', path: '/ripper' },
|
||||||
{ label: 'Converter', path: '/converter' },
|
{ label: 'Converter', path: '/converter' },
|
||||||
{ label: 'Audiobooks', path: '/audiobooks' },
|
{ label: 'Audiobooks', path: '/audiobooks' },
|
||||||
@@ -699,6 +538,18 @@ function App() {
|
|||||||
{ label: 'Downloads', path: '/downloads' },
|
{ label: 'Downloads', path: '/downloads' },
|
||||||
...(expertMode ? [{ label: 'Database', path: '/database' }] : [])
|
...(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 downloadIndicator = getDownloadIndicatorMeta(downloadSummary);
|
||||||
const isNavActive = (path) => {
|
const isNavActive = (path) => {
|
||||||
if (path === '/ripper') {
|
if (path === '/ripper') {
|
||||||
@@ -738,6 +589,57 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</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.trunc(uploadProgress)} Prozent`}
|
||||||
|
>
|
||||||
|
<ProgressBar value={uploadProgress} showValue={false} />
|
||||||
|
<small>
|
||||||
|
{uploadPhase === 'processing'
|
||||||
|
? `100% | ${uploadBytesLabel || 'Upload abgeschlossen'}`
|
||||||
|
: uploadBytesLabel
|
||||||
|
? `${Math.trunc(uploadProgress)}% | ${uploadBytesLabel}`
|
||||||
|
: `${Math.trunc(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">
|
<main className="app-main">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route
|
||||||
@@ -749,28 +651,28 @@ function App() {
|
|||||||
lastDiscEvent={lastDiscEvent}
|
lastDiscEvent={lastDiscEvent}
|
||||||
refreshPipeline={refreshPipeline}
|
refreshPipeline={refreshPipeline}
|
||||||
jobsRefreshToken={ripperJobsRefreshToken}
|
jobsRefreshToken={ripperJobsRefreshToken}
|
||||||
|
pendingExpandedJobId={pendingRipperJobId}
|
||||||
|
onPendingExpandedJobHandled={handleRipperJobFocusConsumed}
|
||||||
downloadSummary={downloadSummary}
|
downloadSummary={downloadSummary}
|
||||||
>
|
>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</RipperPage>
|
</RipperPage>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Route index element={<Navigate to="ripper" replace />} />
|
<Route index element={<Navigate to="jobs" replace />} />
|
||||||
<Route path="ripper" element={null} />
|
<Route path="ripper" element={null} />
|
||||||
<Route path="settings" element={<SettingsPage />} />
|
<Route path="settings" element={<SettingsPage />} />
|
||||||
<Route path="history" element={<HistoryPage refreshToken={historyJobsRefreshToken} />} />
|
<Route path="history" element={<HistoryPage refreshToken={historyJobsRefreshToken} />} />
|
||||||
<Route path="tmdb-migration" element={<TmdbMigrationPage />} />
|
|
||||||
<Route path="downloads" element={<DownloadsPage refreshToken={downloadsRefreshToken} />} />
|
<Route path="downloads" element={<DownloadsPage refreshToken={downloadsRefreshToken} />} />
|
||||||
<Route path="database" element={<DatabasePage />} />
|
<Route path="database" element={<DatabasePage />} />
|
||||||
|
<Route path="jobs" element={<JobsInboxPage />} />
|
||||||
<Route path="converter" element={<ConverterPage />} />
|
<Route path="converter" element={<ConverterPage />} />
|
||||||
<Route path="hardware" element={<HardwarePage hardwareMonitoring={hardwareMonitoring} />} />
|
|
||||||
<Route
|
<Route
|
||||||
path="audiobooks"
|
path="audiobooks"
|
||||||
element={
|
element={
|
||||||
<AudiobooksPage
|
<AudiobooksPage
|
||||||
audiobookUpload={audiobookUpload}
|
audiobookUpload={audiobookUpload}
|
||||||
onAudiobookUpload={handleAudiobookUpload}
|
onAudiobookUpload={handleAudiobookUpload}
|
||||||
onCancelAudiobookUpload={handleCancelAudiobookUpload}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+14
-106
@@ -267,12 +267,6 @@ async function requestWithXhr(path, options = {}) {
|
|||||||
|
|
||||||
xhr.onerror = () => {
|
xhr.onerror = () => {
|
||||||
settle(() => {
|
settle(() => {
|
||||||
if (Number(xhr.status || 0) === 0) {
|
|
||||||
const abortLikeError = new Error('Request unterbrochen.');
|
|
||||||
abortLikeError.name = 'AbortError';
|
|
||||||
reject(abortLikeError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject(new Error('Netzwerkfehler'));
|
reject(new Error('Netzwerkfehler'));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -388,13 +382,6 @@ export const api = {
|
|||||||
forceRefresh: options.forceRefresh
|
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 = {}) {
|
async applyMakeMKVBetaKey(payload = {}) {
|
||||||
const result = await request('/settings/makemkv/beta-key/apply', {
|
const result = await request('/settings/makemkv/beta-key/apply', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -435,14 +422,6 @@ export const api = {
|
|||||||
afterMutationInvalidate(['/settings/scripts']);
|
afterMutationInvalidate(['/settings/scripts']);
|
||||||
return result;
|
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) {
|
async deleteScript(scriptId) {
|
||||||
const result = await request(`/settings/scripts/${encodeURIComponent(scriptId)}`, {
|
const result = await request(`/settings/scripts/${encodeURIComponent(scriptId)}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
@@ -487,14 +466,6 @@ export const api = {
|
|||||||
afterMutationInvalidate(['/settings/script-chains']);
|
afterMutationInvalidate(['/settings/script-chains']);
|
||||||
return result;
|
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) {
|
async deleteScriptChain(chainId) {
|
||||||
const result = await request(`/settings/script-chains/${encodeURIComponent(chainId)}`, {
|
const result = await request(`/settings/script-chains/${encodeURIComponent(chainId)}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
@@ -549,21 +520,6 @@ export const api = {
|
|||||||
getPipelineState() {
|
getPipelineState() {
|
||||||
return request('/pipeline/state');
|
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() {
|
getRuntimeActivities() {
|
||||||
return request('/runtime/activities');
|
return request('/runtime/activities');
|
||||||
},
|
},
|
||||||
@@ -608,8 +564,8 @@ export const api = {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
searchTmdbMovie(q) {
|
searchOmdb(q) {
|
||||||
return request(`/pipeline/tmdb/movie/search?q=${encodeURIComponent(q)}`);
|
return request(`/pipeline/omdb/search?q=${encodeURIComponent(q)}`);
|
||||||
},
|
},
|
||||||
searchTmdbSeries(q, seasonNumber = null) {
|
searchTmdbSeries(q, seasonNumber = null) {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
@@ -619,14 +575,8 @@ export const api = {
|
|||||||
}
|
}
|
||||||
return request(`/pipeline/tmdb/series/search?${params.toString()}`);
|
return request(`/pipeline/tmdb/series/search?${params.toString()}`);
|
||||||
},
|
},
|
||||||
searchMusicBrainz(q, options = {}) {
|
searchMusicBrainz(q) {
|
||||||
const params = new URLSearchParams();
|
return request(`/pipeline/cd/musicbrainz/search?q=${encodeURIComponent(q)}`);
|
||||||
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()}`);
|
|
||||||
},
|
},
|
||||||
getMusicBrainzRelease(mbId) {
|
getMusicBrainzRelease(mbId) {
|
||||||
return request(`/pipeline/cd/musicbrainz/release/${encodeURIComponent(String(mbId || '').trim())}`);
|
return request(`/pipeline/cd/musicbrainz/release/${encodeURIComponent(String(mbId || '').trim())}`);
|
||||||
@@ -678,6 +628,9 @@ export const api = {
|
|||||||
getAudiobookJobs() {
|
getAudiobookJobs() {
|
||||||
return request('/pipeline/audiobook/jobs');
|
return request('/pipeline/audiobook/jobs');
|
||||||
},
|
},
|
||||||
|
getAudiobookOutputTree() {
|
||||||
|
return request('/pipeline/audiobook/output-tree');
|
||||||
|
},
|
||||||
async selectMetadata(payload) {
|
async selectMetadata(payload) {
|
||||||
const result = await request('/pipeline/select-metadata', {
|
const result = await request('/pipeline/select-metadata', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -747,12 +700,9 @@ export const api = {
|
|||||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async retryJob(jobId, options = {}) {
|
async retryJob(jobId) {
|
||||||
const body = {};
|
|
||||||
if (options.createNewJob) body.createNewJob = true;
|
|
||||||
const result = await request(`/pipeline/retry/${jobId}`, {
|
const result = await request(`/pipeline/retry/${jobId}`, {
|
||||||
method: 'POST',
|
method: 'POST'
|
||||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
|
||||||
});
|
});
|
||||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||||
return result;
|
return result;
|
||||||
@@ -780,7 +730,6 @@ export const api = {
|
|||||||
if (options.keepBoth) body.keepBoth = true;
|
if (options.keepBoth) body.keepBoth = true;
|
||||||
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
||||||
if (options.reuseCurrentJob) body.reuseCurrentJob = true;
|
if (options.reuseCurrentJob) body.reuseCurrentJob = true;
|
||||||
if (options.createNewJob) body.createNewJob = true;
|
|
||||||
const result = await request(`/pipeline/restart-review/${jobId}`, {
|
const result = await request(`/pipeline/restart-review/${jobId}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
||||||
@@ -793,7 +742,6 @@ export const api = {
|
|||||||
if (options.keepBoth) body.keepBoth = true;
|
if (options.keepBoth) body.keepBoth = true;
|
||||||
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
if (Array.isArray(options.deleteFolders) && options.deleteFolders.length > 0) body.deleteFolders = options.deleteFolders;
|
||||||
if (options.restartMode) body.restartMode = options.restartMode;
|
if (options.restartMode) body.restartMode = options.restartMode;
|
||||||
if (options.createNewJob) body.createNewJob = true;
|
|
||||||
const result = await request(`/pipeline/restart-encode/${jobId}`, {
|
const result = await request(`/pipeline/restart-encode/${jobId}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined
|
||||||
@@ -868,24 +816,6 @@ export const api = {
|
|||||||
const suffix = query.toString() ? `?${query.toString()}` : '';
|
const suffix = query.toString() ? `?${query.toString()}` : '';
|
||||||
return request(`/history${suffix}`);
|
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() {
|
getOrphanRawFolders() {
|
||||||
return request('/history/orphan-raw');
|
return request('/history/orphan-raw');
|
||||||
},
|
},
|
||||||
@@ -897,16 +827,8 @@ export const api = {
|
|||||||
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
afterMutationInvalidate(['/history', '/pipeline/queue']);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async deleteOrphanRawFolder(rawPath) {
|
async assignJobOmdb(jobId, payload = {}) {
|
||||||
const result = await request('/history/orphan-raw/delete', {
|
const result = await request(`/history/${jobId}/omdb/assign`, {
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ rawPath })
|
|
||||||
});
|
|
||||||
afterMutationInvalidate(['/history']);
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
async assignJobMetadata(jobId, payload = {}) {
|
|
||||||
const result = await request(`/history/${jobId}/metadata/assign`, {
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(payload || {})
|
body: JSON.stringify(payload || {})
|
||||||
});
|
});
|
||||||
@@ -1090,26 +1012,12 @@ export const api = {
|
|||||||
forceRefresh: options.forceRefresh
|
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 = {}) {
|
async createUserPreset(payload = {}) {
|
||||||
const result = await request('/settings/user-presets', {
|
const result = await request('/settings/user-presets', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload)
|
||||||
});
|
});
|
||||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
afterMutationInvalidate(['/settings/user-presets']);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateUserPreset(id, payload = {}) {
|
async updateUserPreset(id, payload = {}) {
|
||||||
@@ -1117,14 +1025,14 @@ export const api = {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload)
|
||||||
});
|
});
|
||||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
afterMutationInvalidate(['/settings/user-presets']);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async deleteUserPreset(id) {
|
async deleteUserPreset(id) {
|
||||||
const result = await request(`/settings/user-presets/${encodeURIComponent(id)}`, {
|
const result = await request(`/settings/user-presets/${encodeURIComponent(id)}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
});
|
});
|
||||||
afterMutationInvalidate(['/settings/user-presets', '/settings/user-preset-defaults']);
|
afterMutationInvalidate(['/settings/user-presets']);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { Dialog } from 'primereact/dialog';
|
|||||||
import { Dropdown } from 'primereact/dropdown';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
import { Slider } from 'primereact/slider';
|
import { Slider } from 'primereact/slider';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
|
import { ProgressBar } from 'primereact/progressbar';
|
||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import { AUDIOBOOK_FORMATS, AUDIOBOOK_FORMAT_SCHEMAS, getDefaultAudiobookFormatOptions } from '../config/audiobookFormatSchemas';
|
import { AUDIOBOOK_FORMATS, AUDIOBOOK_FORMAT_SCHEMAS, getDefaultAudiobookFormatOptions } from '../config/audiobookFormatSchemas';
|
||||||
import { api } from '../api/client';
|
|
||||||
import { getStatusLabel, getStatusSeverity } from '../utils/statusPresentation';
|
import { getStatusLabel, getStatusSeverity } from '../utils/statusPresentation';
|
||||||
|
|
||||||
function normalizeJobId(value) {
|
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 }) {
|
function FormatField({ field, value, onChange, disabled }) {
|
||||||
if (field.type === 'slider') {
|
if (field.type === 'slider') {
|
||||||
return (
|
return (
|
||||||
@@ -230,6 +128,7 @@ export default function AudiobookConfigPanel({
|
|||||||
pipeline,
|
pipeline,
|
||||||
onStart,
|
onStart,
|
||||||
onCancel,
|
onCancel,
|
||||||
|
onRetry,
|
||||||
onDeleteJob,
|
onDeleteJob,
|
||||||
busy
|
busy
|
||||||
}) {
|
}) {
|
||||||
@@ -250,18 +149,6 @@ export default function AudiobookConfigPanel({
|
|||||||
const [formatOptions, setFormatOptions] = useState(() => buildFormatOptions(initialFormat, audiobookConfig?.formatOptions));
|
const [formatOptions, setFormatOptions] = useState(() => buildFormatOptions(initialFormat, audiobookConfig?.formatOptions));
|
||||||
const [editableChapters, setEditableChapters] = useState(() => normalizeEditableChapters(chapters));
|
const [editableChapters, setEditableChapters] = useState(() => normalizeEditableChapters(chapters));
|
||||||
const [descriptionDialogVisible, setDescriptionDialogVisible] = useState(false);
|
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(() => {
|
useEffect(() => {
|
||||||
const nextFormat = normalizeFormat(audiobookConfig?.format);
|
const nextFormat = normalizeFormat(audiobookConfig?.format);
|
||||||
@@ -273,51 +160,13 @@ export default function AudiobookConfigPanel({
|
|||||||
setEditableChapters(normalizeEditableChapters(chapters));
|
setEditableChapters(normalizeEditableChapters(chapters));
|
||||||
}, [jobId, JSON.stringify(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 schema = AUDIOBOOK_FORMAT_SCHEMAS[format] || AUDIOBOOK_FORMAT_SCHEMAS.mp3;
|
||||||
const canStart = Boolean(jobId) && (
|
const canStart = Boolean(jobId) && (state === 'READY_TO_START' || state === 'ERROR' || state === 'CANCELLED');
|
||||||
state === 'READY_TO_START'
|
|
||||||
|| state === 'READY_TO_ENCODE'
|
|
||||||
|| state === 'ERROR'
|
|
||||||
|| state === 'CANCELLED'
|
|
||||||
);
|
|
||||||
const isRunning = state === 'ENCODING';
|
const isRunning = state === 'ENCODING';
|
||||||
const isFinished = state === 'FINISHED';
|
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 isSplitOutput = format === 'mp3' || format === 'flac';
|
||||||
const showEditableChapters = !(isSplitOutput && isRunning);
|
|
||||||
const currentChapter = context?.currentChapter && typeof context.currentChapter === 'object' ? context.currentChapter : null;
|
const currentChapter = context?.currentChapter && typeof context.currentChapter === 'object' ? context.currentChapter : null;
|
||||||
const completedChapterCount = Number(context?.completedChapterCount ?? -1);
|
const completedChapterCount = Number(context?.completedChapterCount ?? -1);
|
||||||
const chapterTotal = Number(currentChapter?.total || editableChapters.length || 0);
|
const chapterTotal = Number(currentChapter?.total || editableChapters.length || 0);
|
||||||
@@ -333,88 +182,6 @@ export default function AudiobookConfigPanel({
|
|||||||
[schema, formatOptions]
|
[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 (
|
return (
|
||||||
<div className="audiobook-config-panel">
|
<div className="audiobook-config-panel">
|
||||||
<div className="audiobook-config-head">
|
<div className="audiobook-config-head">
|
||||||
@@ -450,8 +217,11 @@ export default function AudiobookConfigPanel({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="ripper-job-badges">
|
<div className="audiobook-config-tags">
|
||||||
<Tag value={statusLabel} severity={statusSeverity} />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -493,316 +263,78 @@ export default function AudiobookConfigPanel({
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showEditableChapters ? (
|
<div className="audiobook-config-chapters">
|
||||||
<div className="audiobook-config-chapters">
|
<h4>Kapitel</h4>
|
||||||
<h4>Kapitel</h4>
|
{editableChapters.length === 0 ? (
|
||||||
{editableChapters.length === 0 ? (
|
<small>Keine Kapitel in der Quelle erkannt.</small>
|
||||||
<small>Keine Kapitel in der Quelle erkannt.</small>
|
) : (
|
||||||
) : (
|
<div className="audiobook-chapter-list">
|
||||||
<div className="audiobook-chapter-list">
|
{editableChapters.map((chapter, index) => (
|
||||||
{editableChapters.map((chapter, index) => (
|
<div key={`${chapter.index}-${index}`} className="audiobook-chapter-row audiobook-chapter-row-editable">
|
||||||
<div key={`${chapter.index}-${index}`} className="audiobook-chapter-row audiobook-chapter-row-editable">
|
<div className="audiobook-chapter-row-head">
|
||||||
<div className="audiobook-chapter-row-head">
|
<strong>#{chapter.index || index + 1}</strong>
|
||||||
<strong>#{chapter.index || index + 1}</strong>
|
<small>
|
||||||
<small>
|
{formatChapterTime(chapter.startSeconds)} - {formatChapterTime(chapter.endSeconds)}
|
||||||
{formatChapterTime(chapter.startSeconds)} - {formatChapterTime(chapter.endSeconds)}
|
</small>
|
||||||
</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>
|
</div>
|
||||||
))}
|
<InputText
|
||||||
</div>
|
value={chapter.title}
|
||||||
)}
|
onChange={(event) => {
|
||||||
</div>
|
const nextTitle = event.target.value;
|
||||||
) : null}
|
setEditableChapters((prev) => prev.map((entry, entryIndex) => (
|
||||||
|
entryIndex === index
|
||||||
|
? { ...entry, title: nextTitle }
|
||||||
|
: entry
|
||||||
|
)));
|
||||||
|
}}
|
||||||
|
disabled={busy || isRunning}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{isRunning ? (
|
||||||
|
<div className="ripper-job-row-progress" aria-label={`Audiobook Fortschritt ${Math.trunc(progress)}%`}>
|
||||||
|
<ProgressBar value={progress} showValue={false} />
|
||||||
|
<small>{Math.trunc(progress)}%{currentChapter ? ` | Kapitel ${currentChapter.index}/${currentChapter.total}: ${currentChapter.title}` : ''}</small>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{isSplitOutput && (isRunning || isFinished) && editableChapters.length > 0 ? (
|
{isSplitOutput && (isRunning || isFinished) && editableChapters.length > 0 ? (
|
||||||
<div className="audiobook-chapter-status">
|
<div className="audiobook-chapter-status">
|
||||||
<strong>Kapitel-Status ({completedChapterCount >= 0 ? completedChapterCount : (isFinished ? editableChapters.length : 0)}/{chapterTotal || editableChapters.length} fertig)</strong>
|
<strong>Kapitel-Status ({completedChapterCount >= 0 ? completedChapterCount : (isFinished ? editableChapters.length : 0)}/{chapterTotal || editableChapters.length} fertig)</strong>
|
||||||
<div className="cd-track-selection">
|
<div className="audiobook-chapter-status-list">
|
||||||
<div className="cd-track-list">
|
{editableChapters.map((chapter, idx) => {
|
||||||
<table className="cd-track-table">
|
const chIdx = chapter.index || idx + 1;
|
||||||
<thead>
|
const isDone = isFinished || (completedChapterCount >= 0 && chIdx <= completedChapterCount);
|
||||||
<tr>
|
const isActive = !isDone && currentChapter?.index === chIdx;
|
||||||
<th className="check">Auswahl</th>
|
const statusIcon = isDone ? 'pi pi-check-circle' : isActive ? 'pi pi-spin pi-spinner' : 'pi pi-circle';
|
||||||
<th className="num">Nr</th>
|
const statusClass = isDone ? 'chapter-status-done' : isActive ? 'chapter-status-active' : 'chapter-status-pending';
|
||||||
<th className="title">Titel</th>
|
return (
|
||||||
<th className="duration">Länge</th>
|
<div key={chIdx} className={`audiobook-chapter-status-row ${statusClass}`}>
|
||||||
<th className="status">Rip</th>
|
<i className={statusIcon} />
|
||||||
<th className="status">Encode</th>
|
<span className="chapter-status-nr">#{String(chIdx).padStart(2, '0')}</span>
|
||||||
</tr>
|
<span className="chapter-status-title">{chapter.title}</span>
|
||||||
</thead>
|
</div>
|
||||||
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="encode-automation-grid">
|
{outputPath ? (
|
||||||
<div className="post-script-box">
|
<div className="audiobook-output-path">
|
||||||
<h4>Pre-Rip Ausführungen (optional)</h4>
|
<strong>Ausgabe:</strong> <code>{outputPath}</code>
|
||||||
{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>
|
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<div className="post-script-box">
|
<div className="actions-row">
|
||||||
<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' }}>
|
|
||||||
{canStart ? (
|
{canStart ? (
|
||||||
<Button
|
<Button
|
||||||
label={(state === 'READY_TO_START' || state === 'READY_TO_ENCODE')
|
label={state === 'READY_TO_START' ? 'Encoding starten' : 'Mit diesen Einstellungen starten'}
|
||||||
? 'Encode starten'
|
|
||||||
: 'Mit diesen Einstellungen starten'}
|
|
||||||
icon="pi pi-play"
|
icon="pi pi-play"
|
||||||
severity="success"
|
severity="success"
|
||||||
onClick={() => onStart?.({
|
onClick={() => onStart?.({
|
||||||
@@ -815,23 +347,7 @@ export default function AudiobookConfigPanel({
|
|||||||
endSeconds: chapter.endSeconds,
|
endSeconds: chapter.endSeconds,
|
||||||
startMs: chapter.startMs,
|
startMs: chapter.startMs,
|
||||||
endMs: chapter.endMs
|
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}
|
loading={busy}
|
||||||
disabled={!jobId}
|
disabled={!jobId}
|
||||||
@@ -849,15 +365,28 @@ export default function AudiobookConfigPanel({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<Button
|
{isRunning ? (
|
||||||
label="Abbrechen"
|
<Button
|
||||||
severity="secondary"
|
label="Abbrechen"
|
||||||
outlined
|
icon="pi pi-stop"
|
||||||
onClick={() => onCancel?.()}
|
severity="danger"
|
||||||
loading={busy}
|
onClick={() => onCancel?.()}
|
||||||
disabled={!jobId}
|
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>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
<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 { FileUpload } from 'primereact/fileupload';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
import { ProgressBar } from 'primereact/progressbar';
|
import { ProgressBar } from 'primereact/progressbar';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
|
|
||||||
@@ -31,30 +32,15 @@ function normalizeJobId(value) {
|
|||||||
return Math.trunc(parsed);
|
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({
|
export default function AudiobookUploadPanel({
|
||||||
audiobookUpload,
|
audiobookUpload,
|
||||||
onAudiobookUpload,
|
onAudiobookUpload,
|
||||||
onCancelUpload = null,
|
|
||||||
onUploaded = null
|
onUploaded = null
|
||||||
}) {
|
}) {
|
||||||
const toastRef = useRef(null);
|
const toastRef = useRef(null);
|
||||||
const fileUploadRef = useRef(null);
|
const fileUploadRef = useRef(null);
|
||||||
const fallbackFileInputRef = useRef(null);
|
|
||||||
const [uploadFile, setUploadFile] = useState(null);
|
const [uploadFile, setUploadFile] = useState(null);
|
||||||
|
const [statusVisible, setStatusVisible] = useState(false);
|
||||||
|
|
||||||
const phase = String(audiobookUpload?.phase || 'idle').trim().toLowerCase();
|
const phase = String(audiobookUpload?.phase || 'idle').trim().toLowerCase();
|
||||||
const uploadBusy = phase === 'uploading' || phase === 'processing';
|
const uploadBusy = phase === 'uploading' || phase === 'processing';
|
||||||
@@ -63,15 +49,40 @@ export default function AudiobookUploadPanel({
|
|||||||
: 0;
|
: 0;
|
||||||
const loadedBytes = Number(audiobookUpload?.loadedBytes || 0);
|
const loadedBytes = Number(audiobookUpload?.loadedBytes || 0);
|
||||||
const totalBytes = Number(audiobookUpload?.totalBytes || 0);
|
const totalBytes = Number(audiobookUpload?.totalBytes || 0);
|
||||||
const progressLabel = phase === 'processing'
|
const fileName = String(audiobookUpload?.fileName || '').trim()
|
||||||
? '100% | Upload fertig, Job wird vorbereitet ...'
|
|| String(uploadFile?.name || '').trim()
|
||||||
: totalBytes > 0
|
|| null;
|
||||||
? `${Math.trunc(progress)}% | ${formatBytes(loadedBytes)} / ${formatBytes(totalBytes)}`
|
const statusTone = phase === 'error'
|
||||||
: `${Math.trunc(progress)}%`;
|
? 'danger'
|
||||||
const hasHeaderStatus = phase !== 'idle' || Boolean(uploadFile);
|
: phase === 'completed'
|
||||||
const canStartUpload = Boolean(uploadFile) && !uploadBusy;
|
? 'success'
|
||||||
const canCancelUpload = uploadBusy && typeof onCancelUpload === 'function';
|
: phase === 'processing'
|
||||||
const canClearSelection = Boolean(uploadFile) && !uploadBusy;
|
? '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 () => {
|
const handleUpload = async () => {
|
||||||
if (!uploadFile) {
|
if (!uploadFile) {
|
||||||
@@ -85,7 +96,7 @@ export default function AudiobookUploadPanel({
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await onAudiobookUpload?.(uploadFile, { startImmediately: false });
|
const response = await onAudiobookUpload?.(uploadFile, { startImmediately: false });
|
||||||
const uploadedJobId = extractUploadJobIdFromResponse(response);
|
const uploadedJobId = normalizeJobId(response?.result?.jobId);
|
||||||
if (uploadedJobId) {
|
if (uploadedJobId) {
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
@@ -105,15 +116,6 @@ export default function AudiobookUploadPanel({
|
|||||||
fileUploadRef.current?.clear?.();
|
fileUploadRef.current?.clear?.();
|
||||||
onUploaded?.(uploadedJobId, response);
|
onUploaded?.(uploadedJobId, response);
|
||||||
} catch (error) {
|
} 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({
|
toastRef.current?.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Upload fehlgeschlagen',
|
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 (
|
return (
|
||||||
<div className="audiobook-upload-panel">
|
<div className="audiobook-upload-panel">
|
||||||
<Toast ref={toastRef} position="top-right" />
|
<Toast ref={toastRef} position="top-right" />
|
||||||
@@ -199,91 +135,66 @@ export default function AudiobookUploadPanel({
|
|||||||
customUpload
|
customUpload
|
||||||
uploadHandler={() => void handleUpload()}
|
uploadHandler={() => void handleUpload()}
|
||||||
disabled={uploadBusy}
|
disabled={uploadBusy}
|
||||||
onSelect={(event) => {
|
onSelect={(event) => setUploadFile(event.files[0] || null)}
|
||||||
handleFileSelected(event.files[0] || null);
|
onClear={() => setUploadFile(null)}
|
||||||
}}
|
onRemove={() => setUploadFile(null)}
|
||||||
onClear={() => {
|
|
||||||
handleFileCleared();
|
|
||||||
}}
|
|
||||||
onRemove={() => {
|
|
||||||
handleFileCleared();
|
|
||||||
}}
|
|
||||||
chooseOptions={{ icon: 'pi pi-images', iconOnly: true, className: 'p-button-rounded p-button-outlined' }}
|
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' }}
|
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' }}
|
cancelOptions={{ icon: 'pi pi-times', iconOnly: true, className: 'p-button-rounded p-button-outlined p-button-danger' }}
|
||||||
headerTemplate={(options) => (
|
itemTemplate={(file, options) => (
|
||||||
<div className={options.className}>
|
<div className="aax-file-item">
|
||||||
<div className="audiobook-upload-header">
|
<i className="pi pi-headphones aax-file-icon" />
|
||||||
<div className="audiobook-upload-header-actions">
|
<div className="aax-file-info">
|
||||||
<Button
|
<span className="aax-file-name" title={file.name}>{file.name}</span>
|
||||||
icon="pi pi-images"
|
<small>{options.formatSize}</small>
|
||||||
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>
|
|
||||||
</div>
|
</div>
|
||||||
|
<Button
|
||||||
|
icon="pi pi-times"
|
||||||
|
text
|
||||||
|
rounded
|
||||||
|
severity="danger"
|
||||||
|
size="small"
|
||||||
|
onClick={options.onRemove}
|
||||||
|
disabled={uploadBusy}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
itemTemplate={(file, options) => (
|
|
||||||
renderFileRow(file, () => {
|
|
||||||
options.onRemove?.();
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
emptyTemplate={() => (
|
emptyTemplate={() => (
|
||||||
uploadFile
|
<div className="aax-drop-zone">
|
||||||
? renderFileRow(uploadFile, () => {
|
<i className="pi pi-headphones aax-drop-icon" />
|
||||||
// handled by handleFileItemAction
|
<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}
|
{statusVisible ? (
|
||||||
type="file"
|
<div className={`audiobook-upload-status tone-${statusTone}`}>
|
||||||
accept=".aax,audio/vnd.audible.aax"
|
<div className="audiobook-upload-status-head">
|
||||||
style={{ display: 'none' }}
|
<strong>{statusLabel}</strong>
|
||||||
onChange={(event) => {
|
<Tag value={statusLabel} severity={statusTone} />
|
||||||
const file = event.target?.files?.[0] || null;
|
</div>
|
||||||
handleFileSelected(file);
|
{audiobookUpload?.statusText ? <small>{audiobookUpload.statusText}</small> : null}
|
||||||
if (event.target) {
|
{fileName ? (
|
||||||
event.target.value = '';
|
<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.trunc(progress)} Prozent`}
|
||||||
|
>
|
||||||
|
<ProgressBar value={progress} showValue={false} />
|
||||||
|
<small>
|
||||||
|
{phase === 'processing'
|
||||||
|
? '100% | Upload fertig, Job wird vorbereitet ...'
|
||||||
|
: totalBytes > 0
|
||||||
|
? `${Math.trunc(progress)}% | ${formatBytes(loadedBytes)} / ${formatBytes(totalBytes)}`
|
||||||
|
: `${Math.trunc(progress)}%`}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -142,10 +142,7 @@ export default function CdMetadataDialog({
|
|||||||
const searchRunId = searchRunRef.current + 1;
|
const searchRunId = searchRunRef.current + 1;
|
||||||
searchRunRef.current = searchRunId;
|
searchRunRef.current = searchRunId;
|
||||||
try {
|
try {
|
||||||
const expectedTrackCount = Array.isArray(tocTracks) ? tocTracks.length : 0;
|
const searchResults = await onSearch(trimmedQuery);
|
||||||
const searchResults = await onSearch(trimmedQuery, {
|
|
||||||
trackCount: expectedTrackCount > 0 ? expectedTrackCount : null
|
|
||||||
});
|
|
||||||
const normalizedResults = Array.isArray(searchResults) ? searchResults : [];
|
const normalizedResults = Array.isArray(searchResults) ? searchResults : [];
|
||||||
await Promise.all(normalizedResults.map((item) => preloadCoverImage(item?.coverArtUrl)));
|
await Promise.all(normalizedResults.map((item) => preloadCoverImage(item?.coverArtUrl)));
|
||||||
if (searchRunRef.current !== searchRunId) {
|
if (searchRunRef.current !== searchRunId) {
|
||||||
@@ -267,7 +264,6 @@ export default function CdMetadataDialog({
|
|||||||
emptyMessage="Keine Treffer"
|
emptyMessage="Keine Treffer"
|
||||||
>
|
>
|
||||||
<Column header="Album" body={mbTitleBody} />
|
<Column header="Album" body={mbTitleBody} />
|
||||||
<Column field="trackCount" header="Tracks" style={{ width: '6rem' }} />
|
|
||||||
<Column field="year" header="Jahr" style={{ width: '6rem' }} />
|
<Column field="year" header="Jahr" style={{ width: '6rem' }} />
|
||||||
<Column field="country" header="Land" style={{ width: '6rem' }} />
|
<Column field="country" header="Land" style={{ width: '6rem' }} />
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ export default function CdRipConfigPanel({
|
|||||||
const selectedMeta = context.selectedMetadata || {};
|
const selectedMeta = context.selectedMetadata || {};
|
||||||
const state = String(pipeline?.state || '').trim().toUpperCase();
|
const state = String(pipeline?.state || '').trim().toUpperCase();
|
||||||
const jobId = normalizePosition(context?.jobId);
|
const jobId = normalizePosition(context?.jobId);
|
||||||
const isPostRipWorkflow = context?.skipRip === true;
|
|
||||||
|
|
||||||
const isRipping = state === 'CD_RIPPING' || state === 'CD_ENCODING';
|
const isRipping = state === 'CD_RIPPING' || state === 'CD_ENCODING';
|
||||||
const isFinished = state === 'FINISHED';
|
const isFinished = state === 'FINISHED';
|
||||||
@@ -663,7 +662,6 @@ export default function CdRipConfigPanel({
|
|||||||
|| ''
|
|| ''
|
||||||
) || null;
|
) || null;
|
||||||
const devicePath = normalizeTrackText(context?.devicePath) || '-';
|
const devicePath = normalizeTrackText(context?.devicePath) || '-';
|
||||||
const rawPath = normalizeTrackText(context?.rawPath) || '-';
|
|
||||||
const outputPath = normalizeTrackText(context?.outputPath) || '-';
|
const outputPath = normalizeTrackText(context?.outputPath) || '-';
|
||||||
const formatValue = String(cdRipConfig?.format || '').trim().toLowerCase();
|
const formatValue = String(cdRipConfig?.format || '').trim().toLowerCase();
|
||||||
const formatLabel = (Array.isArray(CD_FORMATS)
|
const formatLabel = (Array.isArray(CD_FORMATS)
|
||||||
@@ -797,9 +795,7 @@ export default function CdRipConfigPanel({
|
|||||||
displayValueTemplate={(value) => formatProgressLabel(value)}
|
displayValueTemplate={(value) => formatProgressLabel(value)}
|
||||||
/>
|
/>
|
||||||
<small>
|
<small>
|
||||||
{isPostRipWorkflow
|
{`Fortschritt: ${formatProgressLabel(wholeProgress)} | ${livePhaseLabel} ${completedRipCount}/${selectedTrackRows.length || effectiveTrackRows.length} Rip | ${completedEncodeCount}/${selectedTrackRows.length || effectiveTrackRows.length} Encode`}
|
||||||
? `Fortschritt: ${formatProgressLabel(wholeProgress)} | ${livePhaseLabel} ${completedRipCount}/${selectedTrackRows.length || effectiveTrackRows.length} Rip | ${completedEncodeCount}/${selectedTrackRows.length || effectiveTrackRows.length} Encode`
|
|
||||||
: `Fortschritt: ${formatProgressLabel(wholeProgress)}`}
|
|
||||||
</small>
|
</small>
|
||||||
<small>{eta ? `ETA ${eta}` : 'ETA unbekannt'}</small>
|
<small>{eta ? `ETA ${eta}` : 'ETA unbekannt'}</small>
|
||||||
</div>
|
</div>
|
||||||
@@ -896,30 +892,25 @@ export default function CdRipConfigPanel({
|
|||||||
<div><strong>Jahr:</strong> {albumYear}</div>
|
<div><strong>Jahr:</strong> {albumYear}</div>
|
||||||
<div><strong>MusicBrainz:</strong> {musicBrainzId}</div>
|
<div><strong>MusicBrainz:</strong> {musicBrainzId}</div>
|
||||||
<div><strong>Status:</strong> {stateLabel}</div>
|
<div><strong>Status:</strong> {stateLabel}</div>
|
||||||
{!isRipping ? <div><strong>Format:</strong> {formatLabel}</div> : null}
|
<div><strong>Format:</strong> {formatLabel}</div>
|
||||||
{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>Rip fertig:</strong> {completedRipCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
<div><strong>Aktueller Track:</strong> {liveCurrentTrackPosition ? String(liveCurrentTrackPosition).padStart(2, '0') : '-'}</div>
|
||||||
<div><strong>Encode fertig:</strong> {completedEncodeCount} / {selectedTrackRows.length || effectiveTrackRows.length}</div>
|
<div><strong>Pre-Skripte:</strong> {preScriptNames.length > 0 ? preScriptNames.join(' | ') : '-'}</div>
|
||||||
<div><strong>Aktueller Track:</strong> {liveCurrentTrackPosition ? String(liveCurrentTrackPosition).padStart(2, '0') : '-'}</div>
|
<div><strong>Pre-Ketten:</strong> {preChainNames.length > 0 ? preChainNames.join(' | ') : '-'}</div>
|
||||||
<div><strong>Pre-Skripte:</strong> {preScriptNames.length > 0 ? preScriptNames.join(' | ') : '-'}</div>
|
<div><strong>Post-Skripte:</strong> {postScriptNames.length > 0 ? postScriptNames.join(' | ') : '-'}</div>
|
||||||
<div><strong>Pre-Ketten:</strong> {preChainNames.length > 0 ? preChainNames.join(' | ') : '-'}</div>
|
<div><strong>Post-Ketten:</strong> {postChainNames.length > 0 ? postChainNames.join(' | ') : '-'}</div>
|
||||||
<div><strong>Post-Skripte:</strong> {postScriptNames.length > 0 ? postScriptNames.join(' | ') : '-'}</div>
|
<div><strong>Auswahl:</strong> {selectedTrackNumbers || '-'}</div>
|
||||||
<div><strong>Post-Ketten:</strong> {postChainNames.length > 0 ? postChainNames.join(' | ') : '-'}</div>
|
<div><strong>Gesamtdauer:</strong> {formatTotalDuration(selectedTrackDurationSec)}</div>
|
||||||
<div><strong>Auswahl:</strong> {selectedTrackNumbers || '-'}</div>
|
<div><strong>Laufwerk:</strong> {devicePath}</div>
|
||||||
<div><strong>Gesamtdauer:</strong> {formatTotalDuration(selectedTrackDurationSec)}</div>
|
<div><strong>Output-Pfad:</strong> {outputPath}</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}
|
|
||||||
{lastState ? <div><strong>Letzter Pipeline-State:</strong> {lastStateLabel}</div> : null}
|
{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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isPostRipWorkflow && displayTrackRows.length > 0 ? (
|
{displayTrackRows.length > 0 ? (
|
||||||
<div className="cd-track-selection">
|
<div className="cd-track-selection">
|
||||||
<strong>Zu rippende Tracks ({displayTrackRows.length})</strong>
|
<strong>Zu rippende Tracks ({displayTrackRows.length})</strong>
|
||||||
<div className="cd-track-list">
|
<div className="cd-track-list">
|
||||||
@@ -960,58 +951,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 (
|
return (
|
||||||
<div className="cd-rip-config-panel">
|
<div className="cd-rip-config-panel">
|
||||||
<h4 style={{ marginTop: 0, marginBottom: '0.75rem' }}>CD-Rip Konfiguration</h4>
|
<h4 style={{ marginTop: 0, marginBottom: '0.75rem' }}>CD-Rip Konfiguration</h4>
|
||||||
@@ -1143,16 +1082,15 @@ export default function CdRipConfigPanel({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="encode-automation-grid">
|
<div className="post-script-box">
|
||||||
<div className="post-script-box">
|
<h4>Pre-Rip Ausführungen (optional)</h4>
|
||||||
<h4>Pre-Rip Ausführungen (optional)</h4>
|
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
) : null}
|
||||||
) : null}
|
{preRipItems.length === 0 ? (
|
||||||
{preRipItems.length === 0 ? (
|
<small>Keine Pre-Rip Ausführungen ausgewählt.</small>
|
||||||
<small>Keine Pre-Rip Ausführungen ausgewählt.</small>
|
) : null}
|
||||||
) : null}
|
{preRipItems.map((item, rowIndex) => {
|
||||||
{preRipItems.map((item, rowIndex) => {
|
|
||||||
const isScript = item?.type === 'script';
|
const isScript = item?.type === 'script';
|
||||||
const usedScriptIds = new Set(
|
const usedScriptIds = new Set(
|
||||||
preRipItems
|
preRipItems
|
||||||
@@ -1178,8 +1116,8 @@ export default function CdRipConfigPanel({
|
|||||||
value: normalizeChainId(entry?.id),
|
value: normalizeChainId(entry?.id),
|
||||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||||
})).filter((entry) => entry.value !== null);
|
})).filter((entry) => entry.value !== null);
|
||||||
return (
|
return (
|
||||||
<div key={`cd-pre-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
<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'} />
|
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||||
<div className="cd-encode-item-order">
|
<div className="cd-encode-item-order">
|
||||||
<Button
|
<Button
|
||||||
@@ -1229,43 +1167,43 @@ export default function CdRipConfigPanel({
|
|||||||
onClick={() => removeEncodeItem('pre', rowIndex)}
|
onClick={() => removeEncodeItem('pre', rowIndex)}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<div className="actions-row">
|
<div className="actions-row">
|
||||||
{scriptCatalog.length > preRipItems.filter((entry) => entry?.type === 'script').length ? (
|
{scriptCatalog.length > preRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||||
<Button
|
<Button
|
||||||
label="Skript hinzufügen"
|
label="Skript hinzufügen"
|
||||||
icon="pi pi-code"
|
icon="pi pi-code"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => addEncodeItem('pre', 'script')}
|
onClick={() => addEncodeItem('pre', 'script')}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{chainCatalog.length > preRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
{chainCatalog.length > preRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||||
<Button
|
<Button
|
||||||
label="Kette hinzufügen"
|
label="Kette hinzufügen"
|
||||||
icon="pi pi-link"
|
icon="pi pi-link"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => addEncodeItem('pre', 'chain')}
|
onClick={() => addEncodeItem('pre', 'chain')}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
|
||||||
<small>Ausführung vor dem Rippen, strikt nacheinander. Bei Fehler wird der CD-Rip abgebrochen.</small>
|
|
||||||
</div>
|
</div>
|
||||||
|
<small>Ausführung vor dem Rippen, strikt nacheinander. Bei Fehler wird der CD-Rip abgebrochen.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="post-script-box">
|
<div className="post-script-box">
|
||||||
<h4>Post-Rip Ausführungen (optional)</h4>
|
<h4>Post-Rip Ausführungen (optional)</h4>
|
||||||
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
{scriptCatalog.length === 0 && chainCatalog.length === 0 ? (
|
||||||
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
<small>Keine Skripte oder Ketten konfiguriert. In den Settings anlegen.</small>
|
||||||
) : null}
|
) : null}
|
||||||
{postRipItems.length === 0 ? (
|
{postRipItems.length === 0 ? (
|
||||||
<small>Keine Post-Rip Ausführungen ausgewählt.</small>
|
<small>Keine Post-Rip Ausführungen ausgewählt.</small>
|
||||||
) : null}
|
) : null}
|
||||||
{postRipItems.map((item, rowIndex) => {
|
{postRipItems.map((item, rowIndex) => {
|
||||||
const isScript = item?.type === 'script';
|
const isScript = item?.type === 'script';
|
||||||
const usedScriptIds = new Set(
|
const usedScriptIds = new Set(
|
||||||
postRipItems
|
postRipItems
|
||||||
@@ -1291,8 +1229,8 @@ export default function CdRipConfigPanel({
|
|||||||
value: normalizeChainId(entry?.id),
|
value: normalizeChainId(entry?.id),
|
||||||
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
disabled: usedChainIds.has(String(normalizeChainId(entry?.id)))
|
||||||
})).filter((entry) => entry.value !== null);
|
})).filter((entry) => entry.value !== null);
|
||||||
return (
|
return (
|
||||||
<div key={`cd-post-${rowIndex}-${item?.type}-${item?.id}`} className="post-script-row editable">
|
<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'} />
|
<i className={`post-script-type-icon pi ${isScript ? 'pi-code' : 'pi-link'}`} title={isScript ? 'Skript' : 'Kette'} />
|
||||||
<div className="cd-encode-item-order">
|
<div className="cd-encode-item-order">
|
||||||
<Button
|
<Button
|
||||||
@@ -1342,33 +1280,32 @@ export default function CdRipConfigPanel({
|
|||||||
onClick={() => removeEncodeItem('post', rowIndex)}
|
onClick={() => removeEncodeItem('post', rowIndex)}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<div className="actions-row">
|
<div className="actions-row">
|
||||||
{scriptCatalog.length > postRipItems.filter((entry) => entry?.type === 'script').length ? (
|
{scriptCatalog.length > postRipItems.filter((entry) => entry?.type === 'script').length ? (
|
||||||
<Button
|
<Button
|
||||||
label="Skript hinzufügen"
|
label="Skript hinzufügen"
|
||||||
icon="pi pi-code"
|
icon="pi pi-code"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => addEncodeItem('post', 'script')}
|
onClick={() => addEncodeItem('post', 'script')}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{chainCatalog.length > postRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
{chainCatalog.length > postRipItems.filter((entry) => entry?.type === 'chain').length ? (
|
||||||
<Button
|
<Button
|
||||||
label="Kette hinzufügen"
|
label="Kette hinzufügen"
|
||||||
icon="pi pi-link"
|
icon="pi pi-link"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => addEncodeItem('post', 'chain')}
|
onClick={() => addEncodeItem('post', 'chain')}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
|
||||||
<small>Ausführung nach erfolgreichem Rippen/Encodieren, strikt nacheinander.</small>
|
|
||||||
</div>
|
</div>
|
||||||
|
<small>Ausführung nach erfolgreichem Rippen/Encodieren, strikt nacheinander.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
|
|||||||
@@ -154,59 +154,6 @@ function deriveAudioTracks(plan) {
|
|||||||
return [];
|
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 ────────────────────────────────────────────────────────────
|
// ── Status helpers ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function mediaTypeBadge(type) {
|
function mediaTypeBadge(type) {
|
||||||
@@ -313,10 +260,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
|
|
||||||
// ── Video metadata ──────────────────────────────────────────────────────────
|
// ── Video metadata ──────────────────────────────────────────────────────────
|
||||||
const [videoMetadata, setVideoMetadata] = useState(() => ({
|
const [videoMetadata, setVideoMetadata] = useState(() => ({
|
||||||
...buildVideoMetadataPayload(
|
title: String(planMetadata?.title || job.title || job.detected_title || '').trim(),
|
||||||
planMetadata,
|
year: Number.isFinite(Number(planMetadata?.year)) ? Math.trunc(Number(planMetadata.year)) : null,
|
||||||
String(job.title || job.detected_title || '').trim()
|
imdbId: String(planMetadata?.imdbId || '').trim() || null,
|
||||||
)
|
poster: String(planMetadata?.poster || '').trim() || null
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// ── Script / Chain catalog ──────────────────────────────────────────────────
|
// ── Script / Chain catalog ──────────────────────────────────────────────────
|
||||||
@@ -431,10 +378,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
coverUrl: coverUrl || null
|
coverUrl: coverUrl || null
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
...buildVideoMetadataPayload(
|
title: String(videoMetadata?.title || job.title || job.detected_title || '').trim() || null,
|
||||||
videoMetadata,
|
year: Number.isFinite(Number(videoMetadata?.year)) ? Math.trunc(Number(videoMetadata.year)) : null,
|
||||||
String(job.title || job.detected_title || '').trim()
|
imdbId: String(videoMetadata?.imdbId || '').trim() || null,
|
||||||
)
|
poster: String(videoMetadata?.poster || '').trim() || null
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -489,13 +436,12 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
jobId: job.id,
|
jobId: job.id,
|
||||||
detectedTitle: videoMetadata?.title || job.title || job.detected_title || '',
|
detectedTitle: videoMetadata?.title || job.title || job.detected_title || '',
|
||||||
selectedMetadata: {
|
selectedMetadata: {
|
||||||
...videoMetadata,
|
|
||||||
title: videoMetadata?.title || job.title || job.detected_title || '',
|
title: videoMetadata?.title || job.title || job.detected_title || '',
|
||||||
year: videoMetadata?.year || null,
|
year: videoMetadata?.year || null,
|
||||||
imdbId: videoMetadata?.imdbId || null,
|
imdbId: videoMetadata?.imdbId || null,
|
||||||
poster: videoMetadata?.poster || null
|
poster: videoMetadata?.poster || null
|
||||||
},
|
},
|
||||||
metadataCandidates: []
|
omdbCandidates: []
|
||||||
}), [job.id, job.title, job.detected_title, videoMetadata]);
|
}), [job.id, job.title, job.detected_title, videoMetadata]);
|
||||||
|
|
||||||
const cdMetadataDialogContext = useMemo(() => ({
|
const cdMetadataDialogContext = useMemo(() => ({
|
||||||
@@ -508,50 +454,31 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
}), [job.id, audioTracks, trackFields]);
|
}), [job.id, audioTracks, trackFields]);
|
||||||
|
|
||||||
// ── Dialog handlers ─────────────────────────────────────────────────────────
|
// ── Dialog handlers ─────────────────────────────────────────────────────────
|
||||||
const handleMetadataSearch = async (query, options = {}) => {
|
const handleOmdbSearch = async (query) => {
|
||||||
try {
|
try {
|
||||||
const filterRaw = String(options?.resultFilter || '').trim().toLowerCase();
|
const response = await api.searchOmdb(query);
|
||||||
const includeMovies = filterRaw !== 'series';
|
return Array.isArray(response?.results) ? response.results : [];
|
||||||
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];
|
|
||||||
} catch { return []; }
|
} catch { return []; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMetadataSubmit = async (payload) => {
|
const handleOmdbSubmit = async (payload) => {
|
||||||
setSearchDialogBusy(true);
|
setSearchDialogBusy(true);
|
||||||
try {
|
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);
|
setMetadataDialogVisible(false);
|
||||||
} finally {
|
} finally {
|
||||||
setSearchDialogBusy(false);
|
setSearchDialogBusy(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMusicBrainzSearchDialog = async (query, options = {}) => {
|
const handleMusicBrainzSearchDialog = async (query) => {
|
||||||
try {
|
try {
|
||||||
const response = await api.searchMusicBrainz(query, {
|
const response = await api.searchMusicBrainz(query);
|
||||||
trackCount: Number(options?.trackCount || 0) > 0 ? Math.trunc(Number(options.trackCount)) : null
|
|
||||||
});
|
|
||||||
return Array.isArray(response?.results) ? response.results : [];
|
return Array.isArray(response?.results) ? response.results : [];
|
||||||
} catch { return []; }
|
} catch { return []; }
|
||||||
};
|
};
|
||||||
@@ -715,10 +642,10 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
coverUrl: coverUrl || null
|
coverUrl: coverUrl || null
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
...buildVideoMetadataPayload(
|
title: String(videoMetadata?.title || job.title || job.detected_title || '').trim() || null,
|
||||||
videoMetadata,
|
year: Number.isFinite(Number(videoMetadata?.year)) ? Math.trunc(Number(videoMetadata.year)) : null,
|
||||||
String(job.title || job.detected_title || '').trim()
|
imdbId: String(videoMetadata?.imdbId || '').trim() || null,
|
||||||
)
|
poster: String(videoMetadata?.poster || '').trim() || null
|
||||||
};
|
};
|
||||||
|
|
||||||
await api.startConverterJob(job.id, {
|
await api.startConverterJob(job.id, {
|
||||||
@@ -953,10 +880,8 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Pre / Post Ausführungen */}
|
{/* Pre / Post Ausführungen */}
|
||||||
<div className="encode-automation-grid">
|
{renderEncodeSection('pre', preItems)}
|
||||||
{renderEncodeSection('pre', preItems)}
|
{renderEncodeSection('post', postItems)}
|
||||||
{renderEncodeSection('post', postItems)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Aktionen */}
|
{/* Aktionen */}
|
||||||
<div className="actions-row" style={{ marginTop: '1rem' }}>
|
<div className="actions-row" style={{ marginTop: '1rem' }}>
|
||||||
@@ -1100,8 +1025,8 @@ function InlineConfig({ job, plan, onStarted, onDeleted, onCancelled, onInputsCh
|
|||||||
visible={metadataDialogVisible}
|
visible={metadataDialogVisible}
|
||||||
context={metadataDialogContext}
|
context={metadataDialogContext}
|
||||||
onHide={() => setMetadataDialogVisible(false)}
|
onHide={() => setMetadataDialogVisible(false)}
|
||||||
onSubmit={handleMetadataSubmit}
|
onSubmit={handleOmdbSubmit}
|
||||||
onSearch={handleMetadataSearch}
|
onSearch={handleOmdbSearch}
|
||||||
busy={searchDialogBusy}
|
busy={searchDialogBusy}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { Dropdown } from 'primereact/dropdown';
|
|||||||
import { InputSwitch } from 'primereact/inputswitch';
|
import { InputSwitch } from 'primereact/inputswitch';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { api } from '../api/client';
|
import { api } from '../api/client';
|
||||||
import { useWebSocket } from '../hooks/useWebSocket';
|
|
||||||
import { confirmModal } from '../utils/confirmModal';
|
import { confirmModal } from '../utils/confirmModal';
|
||||||
|
|
||||||
// ── Hilfsfunktionen ──────────────────────────────────────────────────────────
|
// ── Hilfsfunktionen ──────────────────────────────────────────────────────────
|
||||||
@@ -62,7 +61,7 @@ const EMPTY_FORM = {
|
|||||||
|
|
||||||
// ── Hauptkomponente ───────────────────────────────────────────────────────────
|
// ── Hauptkomponente ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export default function CronJobsTab() {
|
export default function CronJobsTab({ onWsMessage }) {
|
||||||
const toastRef = useRef(null);
|
const toastRef = useRef(null);
|
||||||
|
|
||||||
const [jobs, setJobs] = useState([]);
|
const [jobs, setJobs] = useState([]);
|
||||||
@@ -90,7 +89,6 @@ export default function CronJobsTab() {
|
|||||||
|
|
||||||
// Aktionen Busy-State per Job-ID
|
// Aktionen Busy-State per Job-ID
|
||||||
const [busyId, setBusyId] = useState(null);
|
const [busyId, setBusyId] = useState(null);
|
||||||
const wsReloadTimerRef = useRef(null);
|
|
||||||
|
|
||||||
// ── Daten laden ──────────────────────────────────────────────────────────────
|
// ── 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 activeCronRunByJobId = useMemo(() => {
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
for (const item of activeCronRuns) {
|
for (const item of activeCronRuns) {
|
||||||
@@ -158,28 +146,11 @@ export default function CronJobsTab() {
|
|||||||
return map;
|
return map;
|
||||||
}, [activeCronRuns]);
|
}, [activeCronRuns]);
|
||||||
|
|
||||||
useEffect(() => () => {
|
// WebSocket: Cronjob-Updates empfangen
|
||||||
if (wsReloadTimerRef.current) {
|
useEffect(() => {
|
||||||
clearTimeout(wsReloadTimerRef.current);
|
if (!onWsMessage) return;
|
||||||
wsReloadTimerRef.current = null;
|
// onWsMessage ist eine Funktion, die wir anmelden
|
||||||
}
|
}, [onWsMessage]);
|
||||||
}, []);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── Cron-Ausdruck validieren (debounced) ─────────────────────────────────────
|
// ── Cron-Ausdruck validieren (debounced) ─────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ const GENERAL_TOOL_KEYS = new Set([
|
|||||||
'makemkv_command',
|
'makemkv_command',
|
||||||
'makemkv_registration_key',
|
'makemkv_registration_key',
|
||||||
'makemkv_min_length_minutes',
|
'makemkv_min_length_minutes',
|
||||||
'playlist_tmdb_runtime_subtract_percent',
|
|
||||||
'mediainfo_command',
|
'mediainfo_command',
|
||||||
'handbrake_command',
|
'handbrake_command',
|
||||||
'ffmpeg_command',
|
'ffmpeg_command',
|
||||||
'mkvmerge_command',
|
'mkvmerge_command',
|
||||||
'ffprobe_command',
|
'ffprobe_command',
|
||||||
'handbrake_restart_delete_incomplete_output',
|
'handbrake_restart_delete_incomplete_output',
|
||||||
|
'handbrake_pre_metadata_scan_enabled',
|
||||||
'script_test_timeout_ms'
|
'script_test_timeout_ms'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -58,11 +58,7 @@ const ALWAYS_HIDDEN_SETTING_KEYS = new Set([
|
|||||||
'makemkv_rip_mode',
|
'makemkv_rip_mode',
|
||||||
'makemkv_rip_mode_bluray',
|
'makemkv_rip_mode_bluray',
|
||||||
'makemkv_rip_mode_dvd',
|
'makemkv_rip_mode_dvd',
|
||||||
'makemkv_backup_mode',
|
'makemkv_backup_mode'
|
||||||
'handbrake_review_audio_languages_bluray',
|
|
||||||
'handbrake_review_subtitle_languages_bluray',
|
|
||||||
'handbrake_review_audio_languages_dvd',
|
|
||||||
'handbrake_review_subtitle_languages_dvd'
|
|
||||||
]);
|
]);
|
||||||
const EXPERT_ONLY_SETTING_KEYS = new Set([
|
const EXPERT_ONLY_SETTING_KEYS = new Set([
|
||||||
'pushover_device',
|
'pushover_device',
|
||||||
@@ -82,9 +78,6 @@ const EXPERT_ONLY_SETTING_KEYS = new Set([
|
|||||||
'cdparanoia_command',
|
'cdparanoia_command',
|
||||||
'script_test_timeout_ms'
|
'script_test_timeout_ms'
|
||||||
]);
|
]);
|
||||||
const EXPERT_ONLY_CATEGORY_NAMES = new Set([
|
|
||||||
'logging'
|
|
||||||
]);
|
|
||||||
|
|
||||||
function toBoolean(value) {
|
function toBoolean(value) {
|
||||||
if (typeof value === 'boolean') {
|
if (typeof value === 'boolean') {
|
||||||
@@ -443,14 +436,6 @@ function filterSettingsByVisibility(settings, expertModeEnabled) {
|
|||||||
return list.filter((setting) => !shouldHideSettingByExpertMode(setting?.key, 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) {
|
function buildToolSections(settings) {
|
||||||
const list = Array.isArray(settings) ? settings : [];
|
const list = Array.isArray(settings) ? settings : [];
|
||||||
const generalBucket = {
|
const generalBucket = {
|
||||||
@@ -670,159 +655,60 @@ function isReadonlySetting(setting) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function MakeMKVBetaKeyHint({ disabled = false, onNotify = null, onSettingApplied = null }) {
|
function MakeMKVBetaKeyHint({ onApply, disabled = false }) {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [checking, setChecking] = useState(false);
|
|
||||||
const [applying, setApplying] = useState(false);
|
|
||||||
const [betaKey, setBetaKey] = useState('');
|
const [betaKey, setBetaKey] = useState('');
|
||||||
const [validUntil, setValidUntil] = useState('');
|
|
||||||
const [fetchedAt, setFetchedAt] = useState('');
|
|
||||||
const [appliedKey, setAppliedKey] = useState('');
|
|
||||||
const [error, setError] = 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(() => {
|
useEffect(() => {
|
||||||
void loadCachedState();
|
let active = true;
|
||||||
|
setLoading(true);
|
||||||
|
setError('');
|
||||||
|
|
||||||
|
api.getMakeMKVBetaKey({ forceRefresh: true })
|
||||||
|
.then((response) => {
|
||||||
|
if (!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setBetaKey(String(response?.betaKey || '').trim());
|
||||||
|
})
|
||||||
|
.catch((loadError) => {
|
||||||
|
if (!active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setBetaKey('');
|
||||||
|
setError(loadError?.message || 'Betakey konnte nicht geladen werden.');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if (active) {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
active = false;
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
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 (
|
return (
|
||||||
<div className="makemkv-beta-key-box">
|
<div className="makemkv-beta-key-box">
|
||||||
<div className="makemkv-beta-key-head">
|
<div className="makemkv-beta-key-head">
|
||||||
<span className="makemkv-beta-key-title">Betakey</span>
|
<span className="makemkv-beta-key-title">Betakey</span>
|
||||||
<div className="settings-inline-actions">
|
<Button
|
||||||
<Button
|
type="button"
|
||||||
type="button"
|
size="small"
|
||||||
size="small"
|
text
|
||||||
text
|
label="übernehmen"
|
||||||
label="prüfen"
|
disabled={disabled || loading || !betaKey}
|
||||||
disabled={disabled || loading || checking || applying}
|
onClick={() => onApply?.(betaKey)}
|
||||||
onClick={() => void handleCheck()}
|
/>
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
text
|
|
||||||
label="übernehmen"
|
|
||||||
disabled={disabled || loading || checking || applying || !betaKey || betaKey === appliedKey}
|
|
||||||
onClick={() => void handleApply()}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<small className="setting-description">Zwischengespeicherter Betakey wird geladen…</small>
|
<small className="setting-description">Aktueller Betakey wird geladen…</small>
|
||||||
) : null}
|
) : null}
|
||||||
{!loading && error ? (
|
{!loading && error ? (
|
||||||
<small className="error-text">{error}</small>
|
<small className="error-text">{error}</small>
|
||||||
) : null}
|
) : 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 ? (
|
{!loading && !error && betaKey ? (
|
||||||
<code className="makemkv-beta-key-value">{betaKey}</code>
|
<code className="makemkv-beta-key-value">{betaKey}</code>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -830,42 +716,6 @@ function MakeMKVBetaKeyHint({ disabled = false, onNotify = null, onSettingApplie
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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({
|
function SettingField({
|
||||||
setting,
|
setting,
|
||||||
value,
|
value,
|
||||||
@@ -877,9 +727,7 @@ function SettingField({
|
|||||||
ownerDirty,
|
ownerDirty,
|
||||||
onChange,
|
onChange,
|
||||||
variant = 'default',
|
variant = 'default',
|
||||||
disabled = false,
|
disabled = false
|
||||||
onNotify = null,
|
|
||||||
onSettingApplied = null
|
|
||||||
}) {
|
}) {
|
||||||
const ownerKey = ownerSetting?.key;
|
const ownerKey = ownerSetting?.key;
|
||||||
const pathHasValue = Boolean(String(value ?? '').trim());
|
const pathHasValue = Boolean(String(value ?? '').trim());
|
||||||
@@ -998,8 +846,7 @@ function SettingField({
|
|||||||
{normalizeSettingKey(setting?.key) === 'makemkv_registration_key' ? (
|
{normalizeSettingKey(setting?.key) === 'makemkv_registration_key' ? (
|
||||||
<MakeMKVBetaKeyHint
|
<MakeMKVBetaKeyHint
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
onNotify={onNotify}
|
onApply={(nextKey) => onChange?.(setting.key, nextKey)}
|
||||||
onSettingApplied={onSettingApplied}
|
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{error ? (
|
{error ? (
|
||||||
@@ -1040,16 +887,7 @@ function SettingField({
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function PathCategoryTab({
|
function PathCategoryTab({ settings, values, errors, dirtyKeys, onChange, effectivePaths }) {
|
||||||
settings,
|
|
||||||
values,
|
|
||||||
errors,
|
|
||||||
dirtyKeys,
|
|
||||||
onChange,
|
|
||||||
effectivePaths,
|
|
||||||
onNotify,
|
|
||||||
onSettingApplied
|
|
||||||
}) {
|
|
||||||
const list = Array.isArray(settings) ? settings : [];
|
const list = Array.isArray(settings) ? settings : [];
|
||||||
const settingsByKey = new Map(list.map((s) => [s.key, s]));
|
const settingsByKey = new Map(list.map((s) => [s.key, s]));
|
||||||
|
|
||||||
@@ -1256,8 +1094,6 @@ function PathCategoryTab({
|
|||||||
ownerError={ownerError}
|
ownerError={ownerError}
|
||||||
ownerDirty={ownerDirty}
|
ownerDirty={ownerDirty}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onNotify={onNotify}
|
|
||||||
onSettingApplied={onSettingApplied}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -1277,14 +1113,11 @@ export default function DynamicSettingsForm({
|
|||||||
dirtyKeys,
|
dirtyKeys,
|
||||||
onChange,
|
onChange,
|
||||||
effectivePaths,
|
effectivePaths,
|
||||||
activationBytes = [],
|
onNotify
|
||||||
onNotify,
|
|
||||||
onSettingApplied
|
|
||||||
}) {
|
}) {
|
||||||
const safeCategories = Array.isArray(categories) ? categories : [];
|
const safeCategories = Array.isArray(categories) ? categories : [];
|
||||||
const expertModeEnabled = toBoolean(values?.[EXPERT_MODE_SETTING_KEY]);
|
const expertModeEnabled = toBoolean(values?.[EXPERT_MODE_SETTING_KEY]);
|
||||||
const visibleCategories = safeCategories
|
const visibleCategories = safeCategories
|
||||||
.filter((category) => !shouldHideCategoryByExpertMode(category?.category, expertModeEnabled))
|
|
||||||
.map((category) => ({
|
.map((category) => ({
|
||||||
...category,
|
...category,
|
||||||
settings: filterSettingsByVisibility(category?.settings, expertModeEnabled)
|
settings: filterSettingsByVisibility(category?.settings, expertModeEnabled)
|
||||||
@@ -1364,8 +1197,6 @@ export default function DynamicSettingsForm({
|
|||||||
dirtyKeys={dirtyKeys}
|
dirtyKeys={dirtyKeys}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
effectivePaths={effectivePaths}
|
effectivePaths={effectivePaths}
|
||||||
onNotify={onNotify}
|
|
||||||
onSettingApplied={onSettingApplied}
|
|
||||||
/>
|
/>
|
||||||
) : (() => {
|
) : (() => {
|
||||||
const sections = buildSectionsForCategory(category?.category, category?.settings || []);
|
const sections = buildSectionsForCategory(category?.category, category?.settings || []);
|
||||||
@@ -1374,7 +1205,6 @@ export default function DynamicSettingsForm({
|
|||||||
const pushoverEnabled = toBoolean(values?.[PUSHOVER_ENABLED_SETTING_KEY]);
|
const pushoverEnabled = toBoolean(values?.[PUSHOVER_ENABLED_SETTING_KEY]);
|
||||||
|
|
||||||
const isDriveCategory = normalizeText(category?.category) === 'laufwerk';
|
const isDriveCategory = normalizeText(category?.category) === 'laufwerk';
|
||||||
const isToolsCategory = normalizeText(category?.category) === 'tools';
|
|
||||||
return (
|
return (
|
||||||
<div className="settings-sections">
|
<div className="settings-sections">
|
||||||
{isDriveCategory && <DetectedDrivesInfo expertModeEnabled={expertModeEnabled} onNotify={onNotify} />}
|
{isDriveCategory && <DetectedDrivesInfo expertModeEnabled={expertModeEnabled} onNotify={onNotify} />}
|
||||||
@@ -1447,8 +1277,6 @@ export default function DynamicSettingsForm({
|
|||||||
onChange={onChangeFn}
|
onChange={onChangeFn}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onNotify={onNotify}
|
|
||||||
onSettingApplied={onSettingApplied}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1505,7 +1333,6 @@ export default function DynamicSettingsForm({
|
|||||||
})()}
|
})()}
|
||||||
</section>
|
</section>
|
||||||
))}
|
))}
|
||||||
{isToolsCategory ? <ActivationBytesCacheBox entries={activationBytes} /> : null}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})()}
|
})()}
|
||||||
|
|||||||
@@ -641,39 +641,24 @@ function statusBadgeMeta(status, queued = false, options = {}) {
|
|||||||
if (normalized === 'READY_TO_ENCODE' || normalized === 'READY_TO_START') {
|
if (normalized === 'READY_TO_ENCODE' || normalized === 'READY_TO_START') {
|
||||||
return { label, icon: 'pi-play-circle', tone: 'info' };
|
return { label, icon: 'pi-play-circle', tone: 'info' };
|
||||||
}
|
}
|
||||||
if (normalized === 'CD_READY_TO_RIP') {
|
|
||||||
return { label, icon: 'pi-play-circle', tone: 'info' };
|
|
||||||
}
|
|
||||||
if (normalized === 'WAITING_FOR_USER_DECISION') {
|
if (normalized === 'WAITING_FOR_USER_DECISION') {
|
||||||
return { label, icon: 'pi-exclamation-circle', tone: 'warning' };
|
return { label, icon: 'pi-exclamation-circle', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'METADATA_SELECTION') {
|
if (normalized === 'METADATA_SELECTION') {
|
||||||
return { label, icon: 'pi-list', tone: 'warning' };
|
return { label, icon: 'pi-list', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'CD_METADATA_SELECTION') {
|
|
||||||
return { label, icon: 'pi-list', tone: 'warning' };
|
|
||||||
}
|
|
||||||
if (normalized === 'ANALYZING') {
|
if (normalized === 'ANALYZING') {
|
||||||
return { label, icon: 'pi-search', tone: 'warning' };
|
return { label, icon: 'pi-search', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'CD_ANALYZING') {
|
|
||||||
return { label, icon: 'pi-search', tone: 'warning' };
|
|
||||||
}
|
|
||||||
if (normalized === 'RIPPING') {
|
if (normalized === 'RIPPING') {
|
||||||
return { label, icon: 'pi-download', tone: 'warning' };
|
return { label, icon: 'pi-download', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'CD_RIPPING') {
|
|
||||||
return { label, icon: 'pi-download', tone: 'warning' };
|
|
||||||
}
|
|
||||||
if (normalized === 'MEDIAINFO_CHECK') {
|
if (normalized === 'MEDIAINFO_CHECK') {
|
||||||
return { label, icon: 'pi-sliders-h', tone: 'warning' };
|
return { label, icon: 'pi-sliders-h', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'ENCODING') {
|
if (normalized === 'ENCODING') {
|
||||||
return { label, icon: 'pi-cog', tone: 'warning' };
|
return { label, icon: 'pi-cog', tone: 'warning' };
|
||||||
}
|
}
|
||||||
if (normalized === 'CD_ENCODING') {
|
|
||||||
return { label, icon: 'pi-cog', tone: 'warning' };
|
|
||||||
}
|
|
||||||
if (normalized === 'MERGING') {
|
if (normalized === 'MERGING') {
|
||||||
return { label, icon: 'pi-spinner pi-spin', tone: 'warning' };
|
return { label, icon: 'pi-spinner pi-spin', tone: 'warning' };
|
||||||
}
|
}
|
||||||
@@ -684,25 +669,6 @@ function normalizePathForCompare(value) {
|
|||||||
return String(value || '').trim().replace(/[\\/]+$/, '');
|
return String(value || '').trim().replace(/[\\/]+$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIncompleteRawPath(value) {
|
|
||||||
const normalized = String(value || '').trim().replace(/[\\]+/g, '/');
|
|
||||||
if (!normalized) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const segments = normalized.split('/').filter(Boolean);
|
|
||||||
const baseName = segments[segments.length - 1] || '';
|
|
||||||
return /^incomplete_/i.test(baseName);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isIncompleteOutputPath(value) {
|
|
||||||
const normalized = String(value || '').trim().replace(/[\\]+/g, '/');
|
|
||||||
if (!normalized) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return /(^|\/)incomplete_job-\d+(\/|$)/i.test(normalized)
|
|
||||||
|| /(^|\/)incomplete_merge_[^/]+_job_\d+(\/|$)/i.test(normalized);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildMergeToolLogFallback(job = null) {
|
function buildMergeToolLogFallback(job = null) {
|
||||||
const handbrakeInfo = job?.handbrakeInfo && typeof job.handbrakeInfo === 'object'
|
const handbrakeInfo = job?.handbrakeInfo && typeof job.handbrakeInfo === 'object'
|
||||||
? job.handbrakeInfo
|
? job.handbrakeInfo
|
||||||
@@ -729,13 +695,19 @@ function buildMergeToolLogFallback(job = null) {
|
|||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function metadataField(value) {
|
function omdbField(value) {
|
||||||
const raw = String(value || '').trim();
|
const raw = String(value || '').trim();
|
||||||
return raw || '-';
|
return raw || '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function omdbRottenTomatoesScore(omdbInfo) {
|
||||||
|
const ratings = Array.isArray(omdbInfo?.Ratings) ? omdbInfo.Ratings : [];
|
||||||
|
const entry = ratings.find((item) => String(item?.Source || '').trim().toLowerCase() === 'rotten tomatoes');
|
||||||
|
return omdbField(entry?.Value);
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeMetadataProvider(value) {
|
function normalizeMetadataProvider(value) {
|
||||||
return String(value || '').trim().toLowerCase() || 'tmdb';
|
return String(value || '').trim().toLowerCase() || 'omdb';
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveJobMetadataContext(job) {
|
function resolveJobMetadataContext(job) {
|
||||||
@@ -762,7 +734,7 @@ function resolveJobMetadataContext(job) {
|
|||||||
const metadataProvider = normalizeMetadataProvider(
|
const metadataProvider = normalizeMetadataProvider(
|
||||||
mergedSelectedMetadata?.metadataProvider
|
mergedSelectedMetadata?.metadataProvider
|
||||||
|| analyzeContext?.metadataProvider
|
|| analyzeContext?.metadataProvider
|
||||||
|| 'tmdb'
|
|| 'omdb'
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
analyzeContext,
|
analyzeContext,
|
||||||
@@ -772,13 +744,7 @@ function resolveJobMetadataContext(job) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uniqueNameList(values, maxItems = 10) {
|
function uniqueNameList(values, maxItems = 10) {
|
||||||
const source = Array.isArray(values)
|
const source = Array.isArray(values) ? values : [];
|
||||||
? values
|
|
||||||
: (typeof values === 'string'
|
|
||||||
? values.split(',')
|
|
||||||
: (values && typeof values === 'object'
|
|
||||||
? [values]
|
|
||||||
: []));
|
|
||||||
const limit = Math.max(1, Number(maxItems || 10));
|
const limit = Math.max(1, Number(maxItems || 10));
|
||||||
const output = [];
|
const output = [];
|
||||||
const seen = new Set();
|
const seen = new Set();
|
||||||
@@ -821,34 +787,53 @@ function formatRuntimeLabel(value) {
|
|||||||
return text || null;
|
return text || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveMetadataDetailsForDisplay(job) {
|
function resolveMetadataDetailsForDisplay(job, omdbInfo = {}) {
|
||||||
const metadataContext = resolveJobMetadataContext(job);
|
const metadataContext = resolveJobMetadataContext(job);
|
||||||
|
const provider = metadataContext.metadataProvider;
|
||||||
const selectedMetadata = metadataContext.selectedMetadata;
|
const selectedMetadata = metadataContext.selectedMetadata;
|
||||||
const tmdbDetails = selectedMetadata?.tmdbDetails && typeof selectedMetadata.tmdbDetails === 'object'
|
const tmdbDetails = selectedMetadata?.tmdbDetails && typeof selectedMetadata.tmdbDetails === 'object'
|
||||||
? selectedMetadata.tmdbDetails
|
? selectedMetadata.tmdbDetails
|
||||||
: {};
|
: {};
|
||||||
const genre = uniqueNameList(tmdbDetails?.genres || tmdbDetails?.genre, 3).join(', ') || null;
|
const isTmdbProvider = provider === 'tmdb' || provider === 'themoviedb';
|
||||||
const actors = uniqueNameList(tmdbDetails?.seasonCast || tmdbDetails?.actors, 6).join(', ') || null;
|
|
||||||
const director = uniqueNameList(tmdbDetails?.createdBy || tmdbDetails?.director, 3).join(', ') || null;
|
if (isTmdbProvider) {
|
||||||
const runtime = tmdbDetails?.seasonRuntime || tmdbDetails?.runtime || formatRuntimeLabel(selectedMetadata?.episodeRunTime);
|
const genre = uniqueNameList(tmdbDetails?.genres || tmdbDetails?.genre, 3).join(', ') || null;
|
||||||
const ratingNumber = Number(tmdbDetails?.seasonVoteAverage ?? tmdbDetails?.voteAverage ?? selectedMetadata?.voteAverage);
|
const actors = uniqueNameList(tmdbDetails?.seasonCast || tmdbDetails?.actors, 6).join(', ') || null;
|
||||||
const tmdbRating = Number.isFinite(ratingNumber) && ratingNumber > 0
|
const director = uniqueNameList(tmdbDetails?.createdBy || tmdbDetails?.director, 3).join(', ') || null;
|
||||||
? ratingNumber.toFixed(1)
|
const runtime = tmdbDetails?.seasonRuntime || tmdbDetails?.runtime || formatRuntimeLabel(selectedMetadata?.episodeRunTime);
|
||||||
: null;
|
const ratingNumber = Number(tmdbDetails?.seasonVoteAverage ?? tmdbDetails?.voteAverage ?? selectedMetadata?.voteAverage);
|
||||||
const imdbId = String(selectedMetadata?.imdbId || tmdbDetails?.imdbId || '').trim() || null;
|
const tmdbRating = Number.isFinite(ratingNumber) && ratingNumber > 0
|
||||||
const hasMatch = Boolean(selectedMetadata?.tmdbId || tmdbDetails?.tmdbId);
|
? ratingNumber.toFixed(1)
|
||||||
|
: null;
|
||||||
|
const imdbId = String(selectedMetadata?.imdbId || tmdbDetails?.imdbId || '').trim() || null;
|
||||||
|
const hasMatch = Boolean(selectedMetadata?.tmdbId || tmdbDetails?.tmdbId);
|
||||||
|
|
||||||
|
return {
|
||||||
|
provider: 'tmdb',
|
||||||
|
title: 'TMDb Details',
|
||||||
|
matchLabel: 'TMDb Match',
|
||||||
|
hasMatch,
|
||||||
|
imdbId,
|
||||||
|
director: director || '-',
|
||||||
|
actors: actors || '-',
|
||||||
|
runtime: runtime || '-',
|
||||||
|
genre: genre || '-',
|
||||||
|
tmdbRating: tmdbRating || '-'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
provider: 'tmdb',
|
provider: 'omdb',
|
||||||
title: 'TMDb Details',
|
title: 'OMDb Details',
|
||||||
matchLabel: 'TMDb Match',
|
matchLabel: 'OMDb Match',
|
||||||
hasMatch,
|
hasMatch: Boolean(job?.selected_from_omdb),
|
||||||
imdbId,
|
imdbId: String(job?.imdb_id || '').trim() || null,
|
||||||
director: director || '-',
|
director: omdbField(omdbInfo?.Director),
|
||||||
actors: actors || '-',
|
actors: omdbField(omdbInfo?.Actors),
|
||||||
runtime: runtime || '-',
|
runtime: omdbField(omdbInfo?.Runtime),
|
||||||
genre: genre || '-',
|
genre: omdbField(omdbInfo?.Genre),
|
||||||
tmdbRating: tmdbRating || '-'
|
rottenTomatoes: omdbRottenTomatoesScore(omdbInfo),
|
||||||
|
imdbRating: omdbField(omdbInfo?.imdbRating)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,7 +1058,7 @@ export default function JobDetailDialog({
|
|||||||
detailLoading = false,
|
detailLoading = false,
|
||||||
onLoadLog,
|
onLoadLog,
|
||||||
logLoadingMode = null,
|
logLoadingMode = null,
|
||||||
onAssignMetadata,
|
onAssignOmdb,
|
||||||
onAssignCdMetadata,
|
onAssignCdMetadata,
|
||||||
onGenerateNfo,
|
onGenerateNfo,
|
||||||
onAcknowledgeError,
|
onAcknowledgeError,
|
||||||
@@ -1091,7 +1076,7 @@ export default function JobDetailDialog({
|
|||||||
onRestoreMultipartMerge,
|
onRestoreMultipartMerge,
|
||||||
onCancel,
|
onCancel,
|
||||||
isQueued = false,
|
isQueued = false,
|
||||||
metadataAssignBusy = false,
|
omdbAssignBusy = false,
|
||||||
cdMetadataAssignBusy = false,
|
cdMetadataAssignBusy = false,
|
||||||
acknowledgeErrorBusy = false,
|
acknowledgeErrorBusy = false,
|
||||||
generateNfoBusy = false,
|
generateNfoBusy = false,
|
||||||
@@ -1249,7 +1234,8 @@ export default function JobDetailDialog({
|
|||||||
job?.rawStatus?.exists
|
job?.rawStatus?.exists
|
||||||
&& job?.rawStatus?.isEmpty !== true
|
&& job?.rawStatus?.isEmpty !== true
|
||||||
&& !running
|
&& !running
|
||||||
&& (isAudiobook || !blockMetadataAndReviewUntilRetry)
|
&& mediaType !== 'audiobook'
|
||||||
|
&& !blockMetadataAndReviewUntilRetry
|
||||||
&& typeof onRestartReview === 'function'
|
&& typeof onRestartReview === 'function'
|
||||||
);
|
);
|
||||||
const converterPlan = isConverter && job?.encodePlan && typeof job.encodePlan === 'object'
|
const converterPlan = isConverter && job?.encodePlan && typeof job.encodePlan === 'object'
|
||||||
@@ -1342,8 +1328,9 @@ export default function JobDetailDialog({
|
|||||||
queueLocked,
|
queueLocked,
|
||||||
{ label: isMultipartMergeJob && statusUpper === 'ENCODING' ? 'Merging' : '' }
|
{ label: isMultipartMergeJob && statusUpper === 'ENCODING' ? 'Merging' : '' }
|
||||||
);
|
);
|
||||||
|
const omdbInfo = job?.omdbInfo && typeof job.omdbInfo === 'object' ? job.omdbInfo : {};
|
||||||
const metadataContext = resolveJobMetadataContext(job);
|
const metadataContext = resolveJobMetadataContext(job);
|
||||||
const metadataDetails = resolveMetadataDetailsForDisplay(job);
|
const metadataDetails = resolveMetadataDetailsForDisplay(job, omdbInfo);
|
||||||
const seriesDiscNumber = isDvdSeries ? resolveSeriesDiscNumber(job) : null;
|
const seriesDiscNumber = isDvdSeries ? resolveSeriesDiscNumber(job) : null;
|
||||||
const seriesDiscLabel = seriesDiscNumber ? `Disk ${seriesDiscNumber}` : 'Disk unbekannt';
|
const seriesDiscLabel = seriesDiscNumber ? `Disk ${seriesDiscNumber}` : 'Disk unbekannt';
|
||||||
const isSeriesContainer = isDvdSeries && jobKindRaw === 'dvd_series_container';
|
const isSeriesContainer = isDvdSeries && jobKindRaw === 'dvd_series_container';
|
||||||
@@ -1468,15 +1455,17 @@ export default function JobDetailDialog({
|
|||||||
&& Number(multipartMergeSummary?.inputReady || 0) >= Number(multipartMergeSummary?.inputExpected || 0)
|
&& Number(multipartMergeSummary?.inputReady || 0) >= Number(multipartMergeSummary?.inputExpected || 0)
|
||||||
);
|
);
|
||||||
const displayedImdbId = metadataDetails?.imdbId || job?.imdb_id || null;
|
const displayedImdbId = metadataDetails?.imdbId || job?.imdb_id || null;
|
||||||
const metadataJsonTitle = 'TMDb Info';
|
const metadataJsonTitle = metadataDetails.provider === 'tmdb' ? 'TMDb Info' : 'OMDb Info';
|
||||||
const metadataJsonValue = metadataContext?.selectedMetadata?.tmdbDetails || metadataContext?.selectedMetadata || null;
|
const metadataJsonValue = metadataDetails.provider === 'tmdb'
|
||||||
|
? (metadataContext?.selectedMetadata?.tmdbDetails || metadataContext?.selectedMetadata || null)
|
||||||
|
: job?.omdbInfo;
|
||||||
const metadataAssignProvider = isDvdSeries
|
const metadataAssignProvider = isDvdSeries
|
||||||
? 'tmdb'
|
? 'tmdb'
|
||||||
: 'tmdb';
|
: (metadataDetails.provider === 'tmdb' ? 'tmdb' : 'omdb');
|
||||||
const metadataAssignButtonLabel = 'TMDb neu zuweisen';
|
const metadataAssignButtonLabel = metadataAssignProvider === 'tmdb' ? 'TMDb neu zuweisen' : 'OMDb neu zuweisen';
|
||||||
const metadataAssignActionDescription = metadataAssignProvider === 'tmdb'
|
const metadataAssignActionDescription = metadataAssignProvider === 'tmdb'
|
||||||
? 'Öffnet die TMDb-Suche, um Metadaten (Titel, Staffel/Episoden bzw. Film) neu zuzuweisen.'
|
? 'Öffnet die TMDb-Suche, um Serien-Metadaten (Titel, Staffel, Episoden, Poster) neu zuzuweisen.'
|
||||||
: 'Öffnet die TMDb-Suche, um Metadaten neu zuzuweisen.';
|
: 'Öffnet die OMDb-Suche, um Film-Metadaten (Titel, Jahr, Poster, IMDb-ID) neu zuzuweisen.';
|
||||||
const configuredSelection = buildConfiguredScriptAndChainSelection(job);
|
const configuredSelection = buildConfiguredScriptAndChainSelection(job);
|
||||||
const hasConfiguredSelection = configuredSelection.preScriptIds.length > 0
|
const hasConfiguredSelection = configuredSelection.preScriptIds.length > 0
|
||||||
|| configuredSelection.postScriptIds.length > 0
|
|| configuredSelection.postScriptIds.length > 0
|
||||||
@@ -1501,24 +1490,8 @@ export default function JobDetailDialog({
|
|||||||
|| ''
|
|| ''
|
||||||
).trim() || null;
|
).trim() || null;
|
||||||
const resolvedRawPath = job?.rawStatus?.path || job?.raw_path || null;
|
const resolvedRawPath = job?.rawStatus?.path || job?.raw_path || null;
|
||||||
const jobMediaType = resolveMediaType(job);
|
const canDownloadRaw = Boolean(resolvedRawPath && job?.rawStatus?.exists && typeof onDownloadArchive === 'function');
|
||||||
const isDiscMediaJob = ['dvd', 'bluray', 'cd'].includes(jobMediaType);
|
const canDownloadOutput = Boolean(job?.output_path && job?.outputStatus?.exists && typeof onDownloadArchive === 'function');
|
||||||
const jobStatusUpper = String(job?.status || '').trim().toUpperCase();
|
|
||||||
const outputDownloadReady = Boolean(
|
|
||||||
job?.output_path
|
|
||||||
&& job?.outputStatus?.exists
|
|
||||||
&& !isIncompleteOutputPath(job.output_path)
|
|
||||||
&& (job?.encodeSuccess || jobStatusUpper === 'FINISHED')
|
|
||||||
);
|
|
||||||
const rawDownloadReady = Boolean(
|
|
||||||
resolvedRawPath
|
|
||||||
&& job?.rawStatus?.exists
|
|
||||||
&& job?.rawStatus?.isEmpty !== true
|
|
||||||
&& !isIncompleteRawPath(resolvedRawPath)
|
|
||||||
&& (!isDiscMediaJob || Boolean(job?.ripSuccessful))
|
|
||||||
);
|
|
||||||
const canDownloadRaw = Boolean(rawDownloadReady && typeof onDownloadArchive === 'function');
|
|
||||||
const canDownloadOutput = Boolean(outputDownloadReady && typeof onDownloadArchive === 'function');
|
|
||||||
const outputFolders = (() => {
|
const outputFolders = (() => {
|
||||||
const baseFolders = Array.isArray(job?.outputFolders) ? job.outputFolders : [];
|
const baseFolders = Array.isArray(job?.outputFolders) ? job.outputFolders : [];
|
||||||
if (!isDiskContainer) {
|
if (!isDiskContainer) {
|
||||||
@@ -1534,9 +1507,7 @@ export default function JobDetailDialog({
|
|||||||
seen.add(outputPath);
|
seen.add(outputPath);
|
||||||
merged.push({
|
merged.push({
|
||||||
id: folder?.id ?? fallbackId ?? outputPath,
|
id: folder?.id ?? fallbackId ?? outputPath,
|
||||||
output_path: outputPath,
|
output_path: outputPath
|
||||||
job_id: normalizePositiveInteger(folder?.job_id ?? folder?.jobId ?? null) || null,
|
|
||||||
exists: folder?.exists === undefined ? undefined : Boolean(folder?.exists)
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
for (const folder of baseFolders) {
|
for (const folder of baseFolders) {
|
||||||
@@ -1545,17 +1516,11 @@ export default function JobDetailDialog({
|
|||||||
for (const child of childJobs) {
|
for (const child of childJobs) {
|
||||||
const childOutputFolders = Array.isArray(child?.outputFolders) ? child.outputFolders : [];
|
const childOutputFolders = Array.isArray(child?.outputFolders) ? child.outputFolders : [];
|
||||||
for (const childFolder of childOutputFolders) {
|
for (const childFolder of childOutputFolders) {
|
||||||
addFolder(
|
addFolder(childFolder, `child-folder-${child?.id || 'x'}-${String(childFolder?.output_path || '')}`);
|
||||||
{
|
|
||||||
...childFolder,
|
|
||||||
job_id: childFolder?.job_id ?? child?.id ?? null
|
|
||||||
},
|
|
||||||
`child-folder-${child?.id || 'x'}-${String(childFolder?.output_path || '')}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (child?.output_path) {
|
if (child?.output_path) {
|
||||||
addFolder(
|
addFolder(
|
||||||
{ output_path: child.output_path, job_id: child?.id ?? null },
|
{ output_path: child.output_path },
|
||||||
`child-output-${child?.id || 'x'}-${String(child.output_path || '')}`
|
`child-output-${child?.id || 'x'}-${String(child.output_path || '')}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1878,24 +1843,37 @@ export default function JobDetailDialog({
|
|||||||
<div className="job-meta-list">
|
<div className="job-meta-list">
|
||||||
<div className="job-meta-item">
|
<div className="job-meta-item">
|
||||||
<strong>Regisseur:</strong>
|
<strong>Regisseur:</strong>
|
||||||
<span>{metadataField(metadataDetails.director)}</span>
|
<span>{omdbField(metadataDetails.director)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="job-meta-item">
|
<div className="job-meta-item">
|
||||||
<strong>Schauspieler:</strong>
|
<strong>Schauspieler:</strong>
|
||||||
<span>{metadataField(metadataDetails.actors)}</span>
|
<span>{omdbField(metadataDetails.actors)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="job-meta-item">
|
<div className="job-meta-item">
|
||||||
<strong>Laufzeit:</strong>
|
<strong>Laufzeit:</strong>
|
||||||
<span>{metadataField(metadataDetails.runtime)}</span>
|
<span>{omdbField(metadataDetails.runtime)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="job-meta-item">
|
<div className="job-meta-item">
|
||||||
<strong>Genre:</strong>
|
<strong>Genre:</strong>
|
||||||
<span>{metadataField(metadataDetails.genre)}</span>
|
<span>{omdbField(metadataDetails.genre)}</span>
|
||||||
</div>
|
|
||||||
<div className="job-meta-item">
|
|
||||||
<strong>TMDb Rating:</strong>
|
|
||||||
<span>{metadataField(metadataDetails.tmdbRating)}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
{metadataDetails.provider === 'tmdb' ? (
|
||||||
|
<div className="job-meta-item">
|
||||||
|
<strong>TMDb Rating:</strong>
|
||||||
|
<span>{omdbField(metadataDetails.tmdbRating)}</span>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<div className="job-meta-item">
|
||||||
|
<strong>Rotten Tomatoes:</strong>
|
||||||
|
<span>{omdbField(metadataDetails.rottenTomatoes)}</span>
|
||||||
|
</div>
|
||||||
|
<div className="job-meta-item">
|
||||||
|
<strong>imdbRating:</strong>
|
||||||
|
<span>{omdbField(metadataDetails.imdbRating)}</span>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1976,16 +1954,7 @@ export default function JobDetailDialog({
|
|||||||
const childDiscNumber = resolveSeriesDiscNumber(child);
|
const childDiscNumber = resolveSeriesDiscNumber(child);
|
||||||
const childLabel = childDiscNumber ? `Disk ${childDiscNumber} RAW:` : 'Disk RAW:';
|
const childLabel = childDiscNumber ? `Disk ${childDiscNumber} RAW:` : 'Disk RAW:';
|
||||||
const childRawPath = child?.raw_path || child?.output_path || null;
|
const childRawPath = child?.raw_path || child?.output_path || null;
|
||||||
const childMediaType = resolveMediaType(child);
|
const canDownloadChildRaw = Boolean(childRawPath && child?.rawStatus?.exists && typeof onDownloadArchive === 'function');
|
||||||
const childIsDiscMedia = ['dvd', 'bluray', 'cd'].includes(childMediaType);
|
|
||||||
const childRawDownloadReady = Boolean(
|
|
||||||
childRawPath
|
|
||||||
&& child?.rawStatus?.exists
|
|
||||||
&& child?.rawStatus?.isEmpty !== true
|
|
||||||
&& !isIncompleteRawPath(childRawPath)
|
|
||||||
&& (!childIsDiscMedia || Boolean(child?.ripSuccessful))
|
|
||||||
);
|
|
||||||
const canDownloadChildRaw = Boolean(childRawDownloadReady && typeof onDownloadArchive === 'function');
|
|
||||||
return (
|
return (
|
||||||
<PathField
|
<PathField
|
||||||
key={`child-raw-${child.id}`}
|
key={`child-raw-${child.id}`}
|
||||||
@@ -2004,19 +1973,6 @@ export default function JobDetailDialog({
|
|||||||
if (!folderPath) {
|
if (!folderPath) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const folderOwnerJobId = normalizePositiveInteger(folder?.job_id) || normalizePositiveInteger(job?.id);
|
|
||||||
const folderOwner = folderOwnerJobId === normalizePositiveInteger(job?.id)
|
|
||||||
? job
|
|
||||||
: (childJobs.find((child) => normalizePositiveInteger(child?.id) === folderOwnerJobId) || job);
|
|
||||||
const folderOwnerStatusUpper = String(folderOwner?.status || '').trim().toUpperCase();
|
|
||||||
const folderExists = folder?.exists !== undefined
|
|
||||||
? Boolean(folder?.exists)
|
|
||||||
: Boolean(folderOwner?.outputStatus?.exists);
|
|
||||||
const folderDownloadReady = Boolean(
|
|
||||||
folderExists
|
|
||||||
&& !isIncompleteOutputPath(folderPath)
|
|
||||||
&& (folderOwner?.encodeSuccess || folderOwnerStatusUpper === 'FINISHED')
|
|
||||||
);
|
|
||||||
const normalizedFolderPath = normalizePathForCompare(folderPath);
|
const normalizedFolderPath = normalizePathForCompare(folderPath);
|
||||||
const isMergeOutput = Boolean(
|
const isMergeOutput = Boolean(
|
||||||
(normalizedFolderPath && mergeOutputPathCandidates.has(normalizedFolderPath))
|
(normalizedFolderPath && mergeOutputPathCandidates.has(normalizedFolderPath))
|
||||||
@@ -2024,13 +1980,13 @@ export default function JobDetailDialog({
|
|||||||
);
|
);
|
||||||
const outputLabel = outputFolders.length > 1 ? `Output ${idx + 1}` : 'Output';
|
const outputLabel = outputFolders.length > 1 ? `Output ${idx + 1}` : 'Output';
|
||||||
const label = isMergeOutput ? `${outputLabel} (Merge):` : `${outputLabel}:`;
|
const label = isMergeOutput ? `${outputLabel} (Merge):` : `${outputLabel}:`;
|
||||||
const canDownloadFolder = Boolean(folderDownloadReady && typeof onDownloadOutputFolder === 'function');
|
const canDownloadFolder = Boolean(typeof onDownloadOutputFolder === 'function');
|
||||||
return (
|
return (
|
||||||
<PathField
|
<PathField
|
||||||
key={folder.id || folderPath}
|
key={folder.id || folderPath}
|
||||||
label={label}
|
label={label}
|
||||||
value={folderPath}
|
value={folderPath}
|
||||||
onDownload={canDownloadFolder ? () => onDownloadOutputFolder?.(job, folderPath, folderOwnerJobId) : null}
|
onDownload={canDownloadFolder ? () => onDownloadOutputFolder?.(job, folderPath) : null}
|
||||||
downloadDisabled={!canDownloadFolder}
|
downloadDisabled={!canDownloadFolder}
|
||||||
downloadLoading={downloadFolderBusyPath === folderPath}
|
downloadLoading={downloadFolderBusyPath === folderPath}
|
||||||
/>
|
/>
|
||||||
@@ -2654,7 +2610,7 @@ export default function JobDetailDialog({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{!isCd && !isAudiobook && !isConverter && !childActionState.childRetryRipRequired && typeof onAssignMetadata === 'function' ? (
|
{!isCd && !isAudiobook && !isConverter && !childActionState.childRetryRipRequired && typeof onAssignOmdb === 'function' ? (
|
||||||
<div className="actions-group">
|
<div className="actions-group">
|
||||||
<div className="actions-group-label"><i className="pi pi-search" /> Metadaten</div>
|
<div className="actions-group-label"><i className="pi pi-search" /> Metadaten</div>
|
||||||
<div className="action-item">
|
<div className="action-item">
|
||||||
@@ -2664,8 +2620,8 @@ export default function JobDetailDialog({
|
|||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => onAssignMetadata?.(child)}
|
onClick={() => onAssignOmdb?.(child)}
|
||||||
loading={metadataAssignBusy}
|
loading={omdbAssignBusy}
|
||||||
disabled={!childActionState.childCanAssignMetadata}
|
disabled={!childActionState.childCanAssignMetadata}
|
||||||
/>
|
/>
|
||||||
<span className="action-desc">{metadataAssignActionDescription}</span>
|
<span className="action-desc">{metadataAssignActionDescription}</span>
|
||||||
@@ -2961,7 +2917,7 @@ export default function JobDetailDialog({
|
|||||||
loading={actionBusy}
|
loading={actionBusy}
|
||||||
disabled={!canCdStartReview}
|
disabled={!canCdStartReview}
|
||||||
/>
|
/>
|
||||||
<span className="action-desc">Öffnet den Vorprüfungs-Workflow mit den zuletzt verwendeten CD-Metadaten: Trackauswahl und Ausgabeeinstellungen prüfen, dann Encode aus vorhandenen WAV-Daten starten.</span>
|
<span className="action-desc">Öffnet den Vorprüfungs-Workflow: MusicBrainz-Suche, Trackauswahl, Ausgabeeinstellungen — dann Encode aus vorhandenen WAV-Daten starten.</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="action-item">
|
<div className="action-item">
|
||||||
<Button
|
<Button
|
||||||
@@ -2977,39 +2933,6 @@ export default function JobDetailDialog({
|
|||||||
<span className="action-desc">Öffnet die MusicBrainz-Suche, um Album-Metadaten (Titel, Interpret, Tracks) neu zuzuweisen.</span>
|
<span className="action-desc">Öffnet die MusicBrainz-Suche, um Album-Metadaten (Titel, Interpret, Tracks) neu zuzuweisen.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : isAudiobook ? (
|
|
||||||
<div className="actions-group">
|
|
||||||
<div className="actions-group-label"><i className="pi pi-play-circle" /> Audiobook</div>
|
|
||||||
{typeof onReencode === 'function' ? (
|
|
||||||
<div className="action-item">
|
|
||||||
<Button
|
|
||||||
label="Encode neu starten"
|
|
||||||
icon="pi pi-sync"
|
|
||||||
severity="info"
|
|
||||||
size="small"
|
|
||||||
onClick={() => onReencode?.(job)}
|
|
||||||
loading={reencodeBusy}
|
|
||||||
disabled={!canReencode}
|
|
||||||
/>
|
|
||||||
<span className="action-desc">Startet FFmpeg direkt mit den zuletzt bestätigten Einstellungen neu. Es gibt dabei keinen Anpassungsschritt.</span>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{typeof onRestartReview === 'function' ? (
|
|
||||||
<div className="action-item">
|
|
||||||
<Button
|
|
||||||
label="Vorprüfung starten"
|
|
||||||
icon="pi pi-search"
|
|
||||||
severity="secondary"
|
|
||||||
outlined
|
|
||||||
size="small"
|
|
||||||
onClick={() => onRestartReview?.(job)}
|
|
||||||
loading={actionBusy}
|
|
||||||
disabled={!canRestartReview}
|
|
||||||
/>
|
|
||||||
<span className="action-desc">Legt den Job neu aus der Quelldatei an und öffnet ihn im Ripper, damit Einstellungen vor dem Encode angepasst werden können.</span>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
canShowGeneralEncodeActions ? (
|
canShowGeneralEncodeActions ? (
|
||||||
<div className="actions-group">
|
<div className="actions-group">
|
||||||
@@ -3102,7 +3025,7 @@ export default function JobDetailDialog({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{!isCd && !isAudiobook && !isConverter && !blockMetadataAndReviewUntilRetry && typeof onAssignMetadata === 'function' ? (
|
{!isCd && !isAudiobook && !isConverter && !blockMetadataAndReviewUntilRetry && typeof onAssignOmdb === 'function' ? (
|
||||||
<div className="actions-group">
|
<div className="actions-group">
|
||||||
<div className="actions-group-label"><i className="pi pi-search" /> Metadaten</div>
|
<div className="actions-group-label"><i className="pi pi-search" /> Metadaten</div>
|
||||||
<div className="action-item">
|
<div className="action-item">
|
||||||
@@ -3112,8 +3035,8 @@ export default function JobDetailDialog({
|
|||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => onAssignMetadata?.(job)}
|
onClick={() => onAssignOmdb?.(job)}
|
||||||
loading={metadataAssignBusy}
|
loading={omdbAssignBusy}
|
||||||
disabled={running}
|
disabled={running}
|
||||||
/>
|
/>
|
||||||
<span className="action-desc">{metadataAssignActionDescription}</span>
|
<span className="action-desc">{metadataAssignActionDescription}</span>
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -4,49 +4,7 @@ import { Button } from 'primereact/button';
|
|||||||
import { DataTable } from 'primereact/datatable';
|
import { DataTable } from 'primereact/datatable';
|
||||||
import { Column } from 'primereact/column';
|
import { Column } from 'primereact/column';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
function normalizeWorkflowKind(value) {
|
|
||||||
const raw = String(value || '').trim().toLowerCase();
|
|
||||||
if (['film', 'movie', 'feature'].includes(raw)) {
|
|
||||||
return 'film';
|
|
||||||
}
|
|
||||||
if (['series', 'tv', 'season', 'episode', 'tv_series', 'tv-season', 'tv_season'].includes(raw)) {
|
|
||||||
return 'series';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeResultType(value) {
|
|
||||||
const raw = String(value || '').trim().toLowerCase();
|
|
||||||
if (raw === 'series') {
|
|
||||||
return 'series';
|
|
||||||
}
|
|
||||||
if (raw === 'movie' || raw === 'film' || raw === 'movies') {
|
|
||||||
return 'movie';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeMetadataRow(row = {}) {
|
|
||||||
const workflowKind = normalizeWorkflowKind(
|
|
||||||
row?.workflowKind
|
|
||||||
|| row?.kind
|
|
||||||
|| row?.metadataKind
|
|
||||||
|| null
|
|
||||||
);
|
|
||||||
const metadataKindRaw = String(row?.metadataKind || '').trim().toLowerCase();
|
|
||||||
const metadataKind = metadataKindRaw || (workflowKind === 'series' ? 'series' : 'movie');
|
|
||||||
const resultType = normalizeResultType(row?.resultType)
|
|
||||||
|| (workflowKind === 'series' ? 'series' : (workflowKind === 'film' ? 'movie' : null))
|
|
||||||
|| ((metadataKind === 'series' || metadataKind === 'season') ? 'series' : 'movie');
|
|
||||||
const normalizedWorkflowKind = workflowKind || (resultType === 'series' ? 'series' : 'film');
|
|
||||||
return {
|
|
||||||
...row,
|
|
||||||
metadataKind,
|
|
||||||
resultType,
|
|
||||||
workflowKind: normalizedWorkflowKind
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function MetadataSelectionDialog({
|
export default function MetadataSelectionDialog({
|
||||||
visible,
|
visible,
|
||||||
@@ -134,6 +92,19 @@ export default function MetadataSelectionDialog({
|
|||||||
const preferred = stripped || separatorNormalized || raw;
|
const preferred = stripped || separatorNormalized || raw;
|
||||||
return toSearchTitleCase(preferred);
|
return toSearchTitleCase(preferred);
|
||||||
};
|
};
|
||||||
|
const normalizeWorkflowKind = (value) => {
|
||||||
|
const raw = String(value || '').trim().toLowerCase();
|
||||||
|
if (!raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (['film', 'movie', 'feature'].includes(raw)) {
|
||||||
|
return 'film';
|
||||||
|
}
|
||||||
|
if (['series', 'tv', 'season', 'episode'].includes(raw)) {
|
||||||
|
return 'series';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
const parseDiscNumber = (rawValue) => {
|
const parseDiscNumber = (rawValue) => {
|
||||||
const text = String(rawValue ?? '').trim();
|
const text = String(rawValue ?? '').trim();
|
||||||
if (!/^\d+$/.test(text)) {
|
if (!/^\d+$/.test(text)) {
|
||||||
@@ -145,7 +116,6 @@ export default function MetadataSelectionDialog({
|
|||||||
}
|
}
|
||||||
return Math.trunc(parsed);
|
return Math.trunc(parsed);
|
||||||
};
|
};
|
||||||
|
|
||||||
const [selected, setSelected] = useState(null);
|
const [selected, setSelected] = useState(null);
|
||||||
const [query, setQuery] = useState('');
|
const [query, setQuery] = useState('');
|
||||||
const [manualTitle, setManualTitle] = useState('');
|
const [manualTitle, setManualTitle] = useState('');
|
||||||
@@ -162,35 +132,46 @@ export default function MetadataSelectionDialog({
|
|||||||
const [conflictNewDiscNumber, setConflictNewDiscNumber] = useState('');
|
const [conflictNewDiscNumber, setConflictNewDiscNumber] = useState('');
|
||||||
const [conflictError, setConflictError] = useState('');
|
const [conflictError, setConflictError] = useState('');
|
||||||
const [seasonFilter, setSeasonFilter] = useState('');
|
const [seasonFilter, setSeasonFilter] = useState('');
|
||||||
const [resultFilter, setResultFilter] = useState('all');
|
|
||||||
const [discValidationError, setDiscValidationError] = useState('');
|
const [discValidationError, setDiscValidationError] = useState('');
|
||||||
const activeSearchRequestRef = useRef(0);
|
const activeSearchRequestRef = useRef(0);
|
||||||
const autoSearchDoneRef = useRef(false);
|
const autoSearchDoneRef = useRef(false);
|
||||||
const wasVisibleRef = useRef(false);
|
const contextWorkflowKind = normalizeWorkflowKind(
|
||||||
const lastVisibleContextIdentityRef = useRef(null);
|
context?.selectedMetadata?.workflowKind
|
||||||
|
|| context?.workflowKind
|
||||||
|
|| null
|
||||||
|
);
|
||||||
|
const contextSelectedMetadataProvider = String(
|
||||||
|
context?.selectedMetadata?.metadataProvider
|
||||||
|
|| ''
|
||||||
|
).trim().toLowerCase();
|
||||||
|
const contextMetadataProvider = (
|
||||||
|
contextWorkflowKind === 'series'
|
||||||
|
? 'tmdb'
|
||||||
|
: (contextWorkflowKind === 'film'
|
||||||
|
? 'omdb'
|
||||||
|
: (contextSelectedMetadataProvider || String(context?.metadataProvider || 'omdb').trim().toLowerCase()))
|
||||||
|
) || 'omdb';
|
||||||
|
const [selectedMetadataProvider, setSelectedMetadataProvider] = useState(contextMetadataProvider);
|
||||||
const mediaProfile = String(
|
const mediaProfile = String(
|
||||||
context?.mediaProfile
|
context?.mediaProfile
|
||||||
|| context?.selectedMetadata?.mediaProfile
|
|| context?.selectedMetadata?.mediaProfile
|
||||||
|| ''
|
|| ''
|
||||||
).trim().toLowerCase();
|
).trim().toLowerCase();
|
||||||
const metadataProvider = 'tmdb';
|
const metadataProvider = selectedMetadataProvider === 'tmdb' ? 'tmdb' : 'omdb';
|
||||||
const providerLabel = 'TMDb';
|
const providerOptions = mediaProfile === 'dvd'
|
||||||
const supportsExternalIdInput = false;
|
? [
|
||||||
const contextJobId = Number(context?.jobId || 0) || null;
|
{ label: 'Film (OMDb)', value: 'omdb' },
|
||||||
const contextIdentity = contextJobId
|
{ label: 'Serie (TMDb)', value: 'tmdb' }
|
||||||
? `job:${contextJobId}`
|
]
|
||||||
: `detected:${String(context?.detectedTitle || '').trim().toLowerCase()}`;
|
: [{ label: contextMetadataProvider === 'tmdb' ? 'TMDb' : 'OMDb', value: contextMetadataProvider }];
|
||||||
|
const providerLabel = metadataProvider === 'tmdb' ? 'TMDb' : 'OMDb';
|
||||||
|
const supportsExternalIdInput = metadataProvider === 'omdb';
|
||||||
|
const requiresDiscNumber = metadataProvider === 'tmdb' && (mediaProfile === 'dvd' || !mediaProfile);
|
||||||
|
const effectiveDiscNumber = parseDiscNumber(manualDiscNumber);
|
||||||
|
const hasValidDiscNumber = effectiveDiscNumber !== null;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
wasVisibleRef.current = false;
|
|
||||||
lastVisibleContextIdentityRef.current = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const openingNow = !wasVisibleRef.current;
|
|
||||||
const contextChanged = lastVisibleContextIdentityRef.current !== contextIdentity;
|
|
||||||
if (!openingNow && !contextChanged) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,88 +197,11 @@ export default function MetadataSelectionDialog({
|
|||||||
setConflictNewDiscNumber('');
|
setConflictNewDiscNumber('');
|
||||||
setConflictError('');
|
setConflictError('');
|
||||||
setSeasonFilter('');
|
setSeasonFilter('');
|
||||||
setResultFilter('all');
|
|
||||||
setDiscValidationError('');
|
setDiscValidationError('');
|
||||||
|
setSelectedMetadataProvider(contextMetadataProvider);
|
||||||
autoSearchDoneRef.current = false;
|
autoSearchDoneRef.current = false;
|
||||||
activeSearchRequestRef.current += 1;
|
activeSearchRequestRef.current += 1;
|
||||||
wasVisibleRef.current = true;
|
}, [visible, context]);
|
||||||
lastVisibleContextIdentityRef.current = contextIdentity;
|
|
||||||
}, [visible, contextIdentity, context]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (submitError) {
|
|
||||||
setSubmitError('');
|
|
||||||
}
|
|
||||||
}, [manualDiscNumber, seasonFilter, selected, resultFilter, conflictExistingDiscNumber, conflictNewDiscNumber]);
|
|
||||||
|
|
||||||
const rows = useMemo(() => {
|
|
||||||
const base = Array.isArray(context?.metadataCandidates)
|
|
||||||
? context.metadataCandidates
|
|
||||||
: [];
|
|
||||||
const sourceRows = hasSearchOverride ? extraResults : base;
|
|
||||||
const all = Array.isArray(sourceRows) ? sourceRows : [];
|
|
||||||
const map = new Map();
|
|
||||||
|
|
||||||
all.forEach((item) => {
|
|
||||||
const normalized = normalizeMetadataRow(item);
|
|
||||||
const rowType = normalizeResultType(normalized?.resultType) || 'movie';
|
|
||||||
const rowKey = String(
|
|
||||||
normalized?.providerId
|
|
||||||
|| `${rowType}:${normalized?.imdbId || normalized?.tmdbId || '-'}:${normalized?.seasonNumber || '-'}:${normalized?.title || '-'}:${normalized?.year || '-'}`
|
|
||||||
).trim();
|
|
||||||
if (!rowKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
map.set(rowKey, {
|
|
||||||
...normalized,
|
|
||||||
_metadataKey: rowKey
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return Array.from(map.values());
|
|
||||||
}, [context, extraResults, hasSearchOverride]);
|
|
||||||
|
|
||||||
const seriesRowsAvailable = useMemo(
|
|
||||||
() => rows.some((row) => normalizeResultType(row?.resultType) === 'series'),
|
|
||||||
[rows]
|
|
||||||
);
|
|
||||||
|
|
||||||
const selectedResultType = normalizeResultType(selected?.resultType)
|
|
||||||
|| (normalizeWorkflowKind(selected?.workflowKind) === 'series' ? 'series' : 'movie');
|
|
||||||
const selectedIsSeries = Boolean(selected) && selectedResultType === 'series';
|
|
||||||
const showSeasonFilter = resultFilter !== 'movies' && seriesRowsAvailable;
|
|
||||||
|
|
||||||
const filteredRows = useMemo(() => {
|
|
||||||
let output = [...rows];
|
|
||||||
|
|
||||||
if (resultFilter === 'movies') {
|
|
||||||
output = output.filter((row) => normalizeResultType(row?.resultType) !== 'series');
|
|
||||||
} else if (resultFilter === 'series') {
|
|
||||||
output = output.filter((row) => normalizeResultType(row?.resultType) === 'series');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showSeasonFilter) {
|
|
||||||
const normalizedFilter = String(seasonFilter || '').trim().toLowerCase();
|
|
||||||
if (normalizedFilter) {
|
|
||||||
output = output.filter((row) => {
|
|
||||||
if (normalizeResultType(row?.resultType) !== 'series') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const seasonNo = String(row?.seasonNumber ?? '').trim().toLowerCase();
|
|
||||||
const seasonName = String(row?.seasonName || '').trim().toLowerCase();
|
|
||||||
return seasonNo.includes(normalizedFilter) || seasonName.includes(normalizedFilter);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}, [rows, resultFilter, seasonFilter, showSeasonFilter]);
|
|
||||||
|
|
||||||
const effectiveDiscNumber = parseDiscNumber(manualDiscNumber);
|
|
||||||
const hasValidDiscNumber = effectiveDiscNumber !== null;
|
|
||||||
const requiresDiscNumber = metadataProvider === 'tmdb'
|
|
||||||
&& selectedIsSeries
|
|
||||||
&& (mediaProfile === 'dvd' || mediaProfile === 'bluray');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!discValidationError) {
|
if (!discValidationError) {
|
||||||
@@ -308,8 +212,56 @@ export default function MetadataSelectionDialog({
|
|||||||
}
|
}
|
||||||
}, [discValidationError, requiresDiscNumber, hasValidDiscNumber]);
|
}, [discValidationError, requiresDiscNumber, hasValidDiscNumber]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (submitError) {
|
||||||
|
setSubmitError('');
|
||||||
|
}
|
||||||
|
}, [manualDiscNumber, seasonFilter, selected, metadataProvider, conflictExistingDiscNumber, conflictNewDiscNumber]);
|
||||||
|
|
||||||
|
const rows = useMemo(() => {
|
||||||
|
const base = Array.isArray(context?.metadataCandidates)
|
||||||
|
? context.metadataCandidates
|
||||||
|
: (context?.omdbCandidates || []);
|
||||||
|
const sourceRows = hasSearchOverride ? extraResults : base;
|
||||||
|
const all = Array.isArray(sourceRows) ? sourceRows : [];
|
||||||
|
const map = new Map();
|
||||||
|
|
||||||
|
all.forEach((item) => {
|
||||||
|
const rowKey = String(
|
||||||
|
item?.providerId
|
||||||
|
|| item?.imdbId
|
||||||
|
|| item?.tmdbId
|
||||||
|
|| `${item?.title || '-'}::${item?.year || '-'}::${item?.seasonNumber || '-'}`
|
||||||
|
).trim();
|
||||||
|
if (!rowKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
map.set(rowKey, {
|
||||||
|
...item,
|
||||||
|
_metadataKey: rowKey
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(map.values());
|
||||||
|
}, [context, extraResults, hasSearchOverride]);
|
||||||
|
|
||||||
|
const filteredRows = useMemo(() => {
|
||||||
|
if (metadataProvider !== 'tmdb') {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
const normalizedFilter = String(seasonFilter || '').trim().toLowerCase();
|
||||||
|
if (!normalizedFilter) {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
return rows.filter((row) => {
|
||||||
|
const seasonNo = String(row?.seasonNumber ?? '').trim().toLowerCase();
|
||||||
|
const seasonName = String(row?.seasonName || '').trim().toLowerCase();
|
||||||
|
return seasonNo.includes(normalizedFilter) || seasonName.includes(normalizedFilter);
|
||||||
|
});
|
||||||
|
}, [metadataProvider, rows, seasonFilter]);
|
||||||
|
|
||||||
const titleWithPosterBody = (row) => (
|
const titleWithPosterBody = (row) => (
|
||||||
<div className="metadata-row">
|
<div className="omdb-row">
|
||||||
{row.poster && row.poster !== 'N/A' ? (
|
{row.poster && row.poster !== 'N/A' ? (
|
||||||
<img src={row.poster} alt={row.title} className="poster-thumb-lg" />
|
<img src={row.poster} alt={row.title} className="poster-thumb-lg" />
|
||||||
) : (
|
) : (
|
||||||
@@ -371,7 +323,7 @@ export default function MetadataSelectionDialog({
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible) {
|
if (!visible || autoSearchDoneRef.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof onSearch !== 'function') {
|
if (typeof onSearch !== 'function') {
|
||||||
@@ -382,12 +334,9 @@ export default function MetadataSelectionDialog({
|
|||||||
if (!trimmedQuery) {
|
if (!trimmedQuery) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (autoSearchDoneRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
autoSearchDoneRef.current = true;
|
autoSearchDoneRef.current = true;
|
||||||
void handleSearch();
|
void handleSearch();
|
||||||
}, [visible, query, onSearch]);
|
}, [visible, query, metadataProvider, onSearch]);
|
||||||
|
|
||||||
const handleSubmitError = (error, pendingPayload = null) => {
|
const handleSubmitError = (error, pendingPayload = null) => {
|
||||||
const details = Array.isArray(error?.details) ? error.details : [];
|
const details = Array.isArray(error?.details) ? error.details : [];
|
||||||
@@ -437,9 +386,6 @@ export default function MetadataSelectionDialog({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectionWorkflowKind = selectedIsSeries ? 'series' : 'film';
|
|
||||||
const manualWorkflowKind = resultFilter === 'series' ? 'series' : 'film';
|
|
||||||
|
|
||||||
const payload = selected
|
const payload = selected
|
||||||
? {
|
? {
|
||||||
jobId: context.jobId,
|
jobId: context.jobId,
|
||||||
@@ -447,36 +393,27 @@ export default function MetadataSelectionDialog({
|
|||||||
year: selected.year,
|
year: selected.year,
|
||||||
imdbId: selected.imdbId,
|
imdbId: selected.imdbId,
|
||||||
poster: selected.poster && selected.poster !== 'N/A' ? selected.poster : null,
|
poster: selected.poster && selected.poster !== 'N/A' ? selected.poster : null,
|
||||||
|
fromOmdb: metadataProvider === 'omdb',
|
||||||
metadataProvider,
|
metadataProvider,
|
||||||
workflowKind: selectionWorkflowKind,
|
workflowKind: metadataProvider === 'tmdb' ? 'series' : 'film',
|
||||||
providerId: selected.providerId || null,
|
providerId: selected.providerId || null,
|
||||||
tmdbId: selected.tmdbId || null,
|
tmdbId: selected.tmdbId || null,
|
||||||
metadataKind: selected.metadataKind || (selectedIsSeries ? 'series' : 'movie'),
|
metadataKind: selected.metadataKind || null,
|
||||||
voteAverage: Number.isFinite(Number(selected?.voteAverage))
|
seasonNumber: selected.seasonNumber || null,
|
||||||
? Number(Number(selected.voteAverage).toFixed(1))
|
seasonName: selected.seasonName || null,
|
||||||
: null,
|
episodeCount: selected.episodeCount || 0,
|
||||||
imdbRating: String(
|
episodes: Array.isArray(selected.episodes) ? selected.episodes : [],
|
||||||
selected?.imdbRating
|
|
||||||
|| selected?.tmdbDetails?.imdbRating
|
|
||||||
|| ''
|
|
||||||
).trim() || null,
|
|
||||||
tmdbDetails: selected?.tmdbDetails && typeof selected.tmdbDetails === 'object'
|
|
||||||
? selected.tmdbDetails
|
|
||||||
: null,
|
|
||||||
seasonNumber: selectedIsSeries ? (selected.seasonNumber || null) : null,
|
|
||||||
seasonName: selectedIsSeries ? (selected.seasonName || null) : null,
|
|
||||||
episodeCount: selectedIsSeries ? (selected.episodeCount || 0) : 0,
|
|
||||||
episodes: selectedIsSeries && Array.isArray(selected.episodes) ? selected.episodes : [],
|
|
||||||
...(effectiveDiscNumber ? { discNumber: effectiveDiscNumber } : {})
|
...(effectiveDiscNumber ? { discNumber: effectiveDiscNumber } : {})
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
jobId: context.jobId,
|
jobId: context.jobId,
|
||||||
title: manualTitle,
|
title: manualTitle,
|
||||||
year: manualYear,
|
year: manualYear,
|
||||||
imdbId: null,
|
imdbId: supportsExternalIdInput ? manualImdb : null,
|
||||||
poster: null,
|
poster: null,
|
||||||
|
fromOmdb: false,
|
||||||
metadataProvider,
|
metadataProvider,
|
||||||
workflowKind: manualWorkflowKind,
|
workflowKind: metadataProvider === 'tmdb' ? 'series' : 'film',
|
||||||
seasonNumber: null,
|
seasonNumber: null,
|
||||||
...(effectiveDiscNumber ? { discNumber: effectiveDiscNumber } : {})
|
...(effectiveDiscNumber ? { discNumber: effectiveDiscNumber } : {})
|
||||||
};
|
};
|
||||||
@@ -629,77 +566,69 @@ export default function MetadataSelectionDialog({
|
|||||||
header="Metadaten auswählen"
|
header="Metadaten auswählen"
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onHide={handleHideRequest}
|
onHide={handleHideRequest}
|
||||||
style={{ width: '58.25rem', maxWidth: '95vw', maxHeight: '950px' }}
|
style={{ width: '52rem', maxWidth: '95vw' }}
|
||||||
className="metadata-selection-dialog"
|
className="metadata-selection-dialog"
|
||||||
breakpoints={{ '1200px': '92vw', '768px': '96vw', '560px': '98vw' }}
|
breakpoints={{ '1200px': '92vw', '768px': '96vw', '560px': '98vw' }}
|
||||||
modal
|
modal
|
||||||
>
|
>
|
||||||
<div className="metadata-dialog-controls">
|
<div className="search-row">
|
||||||
<div className="search-row">
|
{providerOptions.length > 1 ? (
|
||||||
<InputText
|
<Dropdown
|
||||||
value={query}
|
value={metadataProvider}
|
||||||
onChange={(event) => setQuery(event.target.value)}
|
options={providerOptions}
|
||||||
onKeyDown={(event) => {
|
optionLabel="label"
|
||||||
if (event.key === 'Enter') {
|
optionValue="value"
|
||||||
event.preventDefault();
|
onChange={(event) => {
|
||||||
void handleSearch();
|
const nextProvider = String(event?.value || 'omdb').trim().toLowerCase() || 'omdb';
|
||||||
}
|
setSelectedMetadataProvider(nextProvider);
|
||||||
|
setSelected(null);
|
||||||
|
setExtraResults([]);
|
||||||
|
setHasSearchOverride(false);
|
||||||
|
setSearchError('');
|
||||||
|
setSubmitError('');
|
||||||
|
setDiscValidationError('');
|
||||||
}}
|
}}
|
||||||
placeholder="Titel suchen"
|
disabled={searchBusy || busy}
|
||||||
|
style={{ minWidth: '12.5rem' }}
|
||||||
/>
|
/>
|
||||||
<Button label={`${providerLabel} Suche`} icon="pi pi-search" onClick={handleSearch} loading={searchBusy} disabled={searchBusy || busy} />
|
) : null}
|
||||||
</div>
|
<InputText
|
||||||
|
value={query}
|
||||||
<div className={`metadata-filter-grid${showSeasonFilter ? '' : ' metadata-filter-grid-single'}`}>
|
onChange={(event) => setQuery(event.target.value)}
|
||||||
{showSeasonFilter ? (
|
onKeyDown={(event) => {
|
||||||
<InputText
|
if (event.key === 'Enter') {
|
||||||
value={seasonFilter}
|
event.preventDefault();
|
||||||
onChange={(event) => setSeasonFilter(event.target.value)}
|
void handleSearch();
|
||||||
placeholder="Staffel-Filter (optional, z.B. 1 oder 5.2)"
|
}
|
||||||
disabled={searchBusy || busy}
|
}}
|
||||||
/>
|
placeholder="Titel suchen"
|
||||||
) : null}
|
/>
|
||||||
<div className="metadata-filter-disc">
|
<Button label={`${providerLabel} Suche`} icon="pi pi-search" onClick={handleSearch} loading={searchBusy} disabled={searchBusy || busy} />
|
||||||
<InputText
|
</div>
|
||||||
value={manualDiscNumber}
|
<div className={`metadata-filter-grid${metadataProvider !== 'tmdb' ? ' metadata-filter-grid-single' : ''}`}>
|
||||||
onChange={(event) => setManualDiscNumber(event.target.value)}
|
{metadataProvider === 'tmdb' ? (
|
||||||
placeholder={requiresDiscNumber ? 'Disc-Nr (Pflicht)' : 'Disc-Nr (optional)'}
|
<InputText
|
||||||
inputMode="numeric"
|
value={seasonFilter}
|
||||||
disabled={searchBusy || busy}
|
onChange={(event) => setSeasonFilter(event.target.value)}
|
||||||
/>
|
placeholder="Staffel-Filter (optional, z.B. 1 oder 5.2)"
|
||||||
<small className="metadata-filter-subtitle">
|
|
||||||
{requiresDiscNumber
|
|
||||||
? 'Pflichtfeld für Serien-DVD/Blu-ray. Ohne Disc-Nummer können die Metadaten nicht übernommen werden.'
|
|
||||||
: 'Optional für Mapping und Output-Templates. Gespeichert werden nur Werte > 0.'}
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="metadata-result-filter-row">
|
|
||||||
<Button
|
|
||||||
label="Beides"
|
|
||||||
severity={resultFilter === 'all' ? 'primary' : 'secondary'}
|
|
||||||
outlined={resultFilter !== 'all'}
|
|
||||||
onClick={() => setResultFilter('all')}
|
|
||||||
disabled={searchBusy || busy}
|
disabled={searchBusy || busy}
|
||||||
/>
|
/>
|
||||||
<Button
|
) : null}
|
||||||
label="Filme"
|
<div className="metadata-filter-disc">
|
||||||
severity={resultFilter === 'movies' ? 'primary' : 'secondary'}
|
<InputText
|
||||||
outlined={resultFilter !== 'movies'}
|
value={manualDiscNumber}
|
||||||
onClick={() => setResultFilter('movies')}
|
onChange={(event) => setManualDiscNumber(event.target.value)}
|
||||||
disabled={searchBusy || busy}
|
placeholder={requiresDiscNumber ? 'Disc-Nr (Pflicht)' : 'Disc-Nr (optional)'}
|
||||||
/>
|
inputMode="numeric"
|
||||||
<Button
|
|
||||||
label="Serien"
|
|
||||||
severity={resultFilter === 'series' ? 'primary' : 'secondary'}
|
|
||||||
outlined={resultFilter !== 'series'}
|
|
||||||
onClick={() => setResultFilter('series')}
|
|
||||||
disabled={searchBusy || busy}
|
disabled={searchBusy || busy}
|
||||||
/>
|
/>
|
||||||
|
<small className="metadata-filter-subtitle">
|
||||||
|
{requiresDiscNumber
|
||||||
|
? 'Pflichtfeld fuer Serien-DVDs. Ohne Disk-Nummer koennen die Metadaten nicht uebernommen werden.'
|
||||||
|
: 'Optionale Disc-Nummer fuer internes Mapping und Output-Templates. Nur Werte groesser 0 werden gespeichert.'}
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{searchError ? <small className="error-text">{searchError}</small> : null}
|
{searchError ? <small className="error-text">{searchError}</small> : null}
|
||||||
{discValidationError ? <small className="error-text">{discValidationError}</small> : null}
|
{discValidationError ? <small className="error-text">{discValidationError}</small> : null}
|
||||||
{submitError ? <small className="error-text">{submitError}</small> : null}
|
{submitError ? <small className="error-text">{submitError}</small> : null}
|
||||||
@@ -721,16 +650,11 @@ export default function MetadataSelectionDialog({
|
|||||||
<Column header="Titel" body={titleWithPosterBody} />
|
<Column header="Titel" body={titleWithPosterBody} />
|
||||||
<Column field="year" header="Jahr" style={{ width: '8rem' }} />
|
<Column field="year" header="Jahr" style={{ width: '8rem' }} />
|
||||||
<Column
|
<Column
|
||||||
header="Typ"
|
header={metadataProvider === 'tmdb' ? 'Staffel' : 'IMDb'}
|
||||||
body={(row) => (normalizeResultType(row?.resultType) === 'series' ? 'Serie' : 'Film')}
|
body={(row) => (metadataProvider === 'tmdb'
|
||||||
style={{ width: '7rem' }}
|
|
||||||
/>
|
|
||||||
<Column
|
|
||||||
header="Staffel"
|
|
||||||
body={(row) => (normalizeResultType(row?.resultType) === 'series'
|
|
||||||
? (row.seasonNumber ? `S${row.seasonNumber}` : '-')
|
? (row.seasonNumber ? `S${row.seasonNumber}` : '-')
|
||||||
: '-')}
|
: (row.imdbId || '-'))}
|
||||||
style={{ width: '8rem' }}
|
style={{ width: '10rem' }}
|
||||||
/>
|
/>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -316,14 +316,6 @@ function normalizeSubtitleLanguageOrder(rawOrder = []) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeSubtitleSelectionMode(value, fallback = 'variants') {
|
|
||||||
const mode = String(value || '').trim().toLowerCase();
|
|
||||||
if (mode === 'track_ids' || mode === 'variants') {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveSubtitleTrackVariantFlags(track) {
|
function resolveSubtitleTrackVariantFlags(track) {
|
||||||
const subtitleType = String(track?.subtitleType || '').trim().toLowerCase();
|
const subtitleType = String(track?.subtitleType || '').trim().toLowerCase();
|
||||||
const isForcedOnly = Boolean(
|
const isForcedOnly = Boolean(
|
||||||
@@ -438,15 +430,6 @@ function buildDefaultTrackSelection(review) {
|
|||||||
const manualSubtitleLanguageOrder = manualSelectionMatchesTitle
|
const manualSubtitleLanguageOrder = manualSelectionMatchesTitle
|
||||||
? normalizeSubtitleLanguageOrder(manualSelection?.subtitleLanguageOrder || [])
|
? normalizeSubtitleLanguageOrder(manualSelection?.subtitleLanguageOrder || [])
|
||||||
: [];
|
: [];
|
||||||
const manualHasVariants = Object.keys(manualSubtitleVariantSelection).length > 0;
|
|
||||||
const subtitleSelectionMode = manualSelectionMatchesTitle
|
|
||||||
? normalizeSubtitleSelectionMode(
|
|
||||||
manualSelection?.subtitleSelectionMode,
|
|
||||||
manualHasVariants
|
|
||||||
? 'variants'
|
|
||||||
: (manualSubtitleTrackIds.length > 0 ? 'track_ids' : 'variants')
|
|
||||||
)
|
|
||||||
: 'variants';
|
|
||||||
|
|
||||||
selection[titleId] = {
|
selection[titleId] = {
|
||||||
audioTrackIds: manualAudioTrackIds.length > 0
|
audioTrackIds: manualAudioTrackIds.length > 0
|
||||||
@@ -464,8 +447,7 @@ function buildDefaultTrackSelection(review) {
|
|||||||
: defaultSubtitleVariantSelection.subtitleVariantSelection,
|
: defaultSubtitleVariantSelection.subtitleVariantSelection,
|
||||||
subtitleLanguageOrder: manualSubtitleLanguageOrder.length > 0
|
subtitleLanguageOrder: manualSubtitleLanguageOrder.length > 0
|
||||||
? manualSubtitleLanguageOrder
|
? manualSubtitleLanguageOrder
|
||||||
: defaultSubtitleVariantSelection.subtitleLanguageOrder,
|
: defaultSubtitleVariantSelection.subtitleLanguageOrder
|
||||||
subtitleSelectionMode
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,8 +460,7 @@ function defaultTrackSelectionForTitle(review, titleId) {
|
|||||||
audioTrackIds: [],
|
audioTrackIds: [],
|
||||||
subtitleTrackIds: [],
|
subtitleTrackIds: [],
|
||||||
subtitleVariantSelection: {},
|
subtitleVariantSelection: {},
|
||||||
subtitleLanguageOrder: [],
|
subtitleLanguageOrder: []
|
||||||
subtitleSelectionMode: 'variants'
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,22 +569,15 @@ function hasSeriesMetadataShape(source = null) {
|
|||||||
const metadata = source && typeof source === 'object' ? source : {};
|
const metadata = source && typeof source === 'object' ? source : {};
|
||||||
const seasonNumber = normalizePositiveInt(metadata?.seasonNumber ?? metadata?.season ?? null);
|
const seasonNumber = normalizePositiveInt(metadata?.seasonNumber ?? metadata?.season ?? null);
|
||||||
const episodes = Array.isArray(metadata?.episodes) ? metadata.episodes : [];
|
const episodes = Array.isArray(metadata?.episodes) ? metadata.episodes : [];
|
||||||
|
const metadataProvider = String(metadata?.metadataProvider || '').trim().toLowerCase();
|
||||||
const workflowKind = String(metadata?.workflowKind || metadata?.kind || '').trim().toLowerCase();
|
const workflowKind = String(metadata?.workflowKind || metadata?.kind || '').trim().toLowerCase();
|
||||||
const metadataKind = String(metadata?.metadataKind || '').trim().toLowerCase();
|
|
||||||
const episodeCount = Number(metadata?.episodeCount || 0) || 0;
|
|
||||||
if (['film', 'movie', 'feature'].includes(workflowKind) || ['film', 'movie', 'feature'].includes(metadataKind)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Boolean(
|
return Boolean(
|
||||||
seasonNumber
|
seasonNumber
|
||||||
|| episodeCount > 0
|
|
||||||
|| episodes.length > 0
|
|| episodes.length > 0
|
||||||
|
|| metadataProvider === 'tmdb'
|
||||||
|
|| metadataProvider === 'themoviedb'
|
||||||
|| workflowKind === 'series'
|
|| workflowKind === 'series'
|
||||||
|| workflowKind === 'season'
|
|| workflowKind === 'season'
|
||||||
|| workflowKind === 'tv'
|
|
||||||
|| metadataKind === 'series'
|
|
||||||
|| metadataKind === 'season'
|
|
||||||
|| metadataKind === 'tv'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,14 +631,24 @@ function resolveDiscWorkflowKind({
|
|||||||
return normalized;
|
return normalized;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
const providerCandidates = [
|
||||||
hasSeriesMetadataShape(selected)
|
selected?.metadataProvider,
|
||||||
|| hasSeriesMetadataShape(analyze)
|
analyze?.metadataProvider,
|
||||||
|| hasSeriesMetadataShape(pipelineCtx)
|
pipelineCtx?.metadataProvider
|
||||||
) {
|
];
|
||||||
return 'series';
|
for (const candidate of providerCandidates) {
|
||||||
|
const provider = String(candidate || '').trim().toLowerCase();
|
||||||
|
if (!provider) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (provider === 'tmdb' || provider === 'themoviedb') {
|
||||||
|
return 'series';
|
||||||
|
}
|
||||||
|
if (provider === 'omdb') {
|
||||||
|
return 'film';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return fallbackIsSeries ? 'series' : 'film';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDiscWorkflowBadgeLabel(mediaProfile, workflowKind) {
|
function getDiscWorkflowBadgeLabel(mediaProfile, workflowKind) {
|
||||||
@@ -672,10 +656,7 @@ function getDiscWorkflowBadgeLabel(mediaProfile, workflowKind) {
|
|||||||
if (normalizedMediaProfile !== 'dvd' && normalizedMediaProfile !== 'bluray') {
|
if (normalizedMediaProfile !== 'dvd' && normalizedMediaProfile !== 'bluray') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const kind = normalizeDiscWorkflowKind(workflowKind);
|
const kind = normalizeDiscWorkflowKind(workflowKind) || 'film';
|
||||||
if (!kind) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (normalizedMediaProfile === 'bluray') {
|
if (normalizedMediaProfile === 'bluray') {
|
||||||
return kind === 'series' ? 'Blu-ray-Serie' : 'Blu-ray-Film';
|
return kind === 'series' ? 'Blu-ray-Serie' : 'Blu-ray-Film';
|
||||||
}
|
}
|
||||||
@@ -848,20 +829,6 @@ function formatPercentNoDecimals(value) {
|
|||||||
return `${Math.trunc(Math.max(0, Math.min(100, parsed)))}%`;
|
return `${Math.trunc(Math.max(0, Math.min(100, parsed)))}%`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPlaylistTrackPreparationStatus(value) {
|
|
||||||
const normalized = String(value || '').trim().toUpperCase();
|
|
||||||
if (!normalized) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return normalized.includes('PLAYLIST')
|
|
||||||
&& normalized.includes('TRACKDATEN')
|
|
||||||
&& normalized.includes('VORBEREIT');
|
|
||||||
}
|
|
||||||
|
|
||||||
function isMediainfoCheckStatus(value) {
|
|
||||||
return String(value || '').trim().toUpperCase() === 'MEDIAINFO_CHECK';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSeriesBatchTagSeverity(status) {
|
function getSeriesBatchTagSeverity(status) {
|
||||||
const normalized = normalizeSeriesBatchStatus(status);
|
const normalized = normalizeSeriesBatchStatus(status);
|
||||||
if (normalized === 'FINISHED') {
|
if (normalized === 'FINISHED') {
|
||||||
@@ -1434,7 +1401,7 @@ function resolveProfiledSetting(settings, key, mediaProfile) {
|
|||||||
? ['dvd']
|
? ['dvd']
|
||||||
: mediaProfile === 'dvd'
|
: mediaProfile === 'dvd'
|
||||||
? ['bluray']
|
? ['bluray']
|
||||||
: ['bluray', 'dvd', 'cd', 'audiobook'];
|
: [];
|
||||||
for (const fb of fallbackProfiles) {
|
for (const fb of fallbackProfiles) {
|
||||||
const fbKey = `${key}_${fb}`;
|
const fbKey = `${key}_${fb}`;
|
||||||
if (settings?.[fbKey] != null && settings[fbKey] !== '') {
|
if (settings?.[fbKey] != null && settings[fbKey] !== '') {
|
||||||
@@ -1578,7 +1545,7 @@ export default function PipelineStatusCard({
|
|||||||
onAnalyze,
|
onAnalyze,
|
||||||
onReanalyze,
|
onReanalyze,
|
||||||
onOpenMetadata,
|
onOpenMetadata,
|
||||||
onReassignMetadata,
|
onReassignOmdb,
|
||||||
onStart,
|
onStart,
|
||||||
onRemoveFromQueue,
|
onRemoveFromQueue,
|
||||||
onRestartEncode,
|
onRestartEncode,
|
||||||
@@ -1635,29 +1602,17 @@ export default function PipelineStatusCard({
|
|||||||
const reviewMode = String(mediaInfoReview?.mode || '').trim().toLowerCase();
|
const reviewMode = String(mediaInfoReview?.mode || '').trim().toLowerCase();
|
||||||
const isPreRipReview = reviewMode === 'pre_rip' || Boolean(mediaInfoReview?.preRip);
|
const isPreRipReview = reviewMode === 'pre_rip' || Boolean(mediaInfoReview?.preRip);
|
||||||
const jobMediaProfile = resolvePipelineMediaProfile(pipeline, mediaInfoReview);
|
const jobMediaProfile = resolvePipelineMediaProfile(pipeline, mediaInfoReview);
|
||||||
const hasReviewRecoverableRaw = Boolean(
|
|
||||||
!['converter', 'audiobook'].includes(String(jobMediaProfile || '').trim().toLowerCase())
|
|
||||||
&& ripCompleted
|
|
||||||
&& (
|
|
||||||
jobRow?.raw_path
|
|
||||||
|| pipeline?.context?.rawPath
|
|
||||||
|| jobRow?.makemkvInfo?.rawPath
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const retryRipRecoveryRequired = Boolean(
|
const retryRipRecoveryRequired = Boolean(
|
||||||
!running
|
!running
|
||||||
&& retryJobId
|
&& retryJobId
|
||||||
&& typeof onRetry === 'function'
|
&& typeof onRetry === 'function'
|
||||||
&& !queueLocked
|
&& !queueLocked
|
||||||
&& !isOrphanCancelled
|
&& !isOrphanCancelled
|
||||||
&& !hasReviewRecoverableRaw
|
&& !['converter', 'audiobook'].includes(String(jobMediaProfile || '').trim().toLowerCase())
|
||||||
&& ['ERROR', 'CANCELLED'].includes(jobStatusUpper)
|
&& ['ERROR', 'CANCELLED'].includes(jobStatusUpper)
|
||||||
&& (
|
&& (
|
||||||
['RIPPING', 'CD_RIPPING'].includes(jobLastStateUpper)
|
['RIPPING', 'CD_RIPPING'].includes(jobLastStateUpper)
|
||||||
|| (
|
|| jobErrorMessageLower.includes('server-neustart')
|
||||||
jobErrorMessageLower.includes('server-neustart')
|
|
||||||
&& !hasReviewRecoverableRaw
|
|
||||||
)
|
|
||||||
|| jobErrorMessageLower.includes('rip ist unvollständig')
|
|| jobErrorMessageLower.includes('rip ist unvollständig')
|
||||||
|| jobErrorMessageLower.includes('rip-validierung fehlgeschlagen')
|
|| jobErrorMessageLower.includes('rip-validierung fehlgeschlagen')
|
||||||
)
|
)
|
||||||
@@ -1671,7 +1626,6 @@ export default function PipelineStatusCard({
|
|||||||
const [liveJobLog, setLiveJobLog] = useState('');
|
const [liveJobLog, setLiveJobLog] = useState('');
|
||||||
const [selectedEncodeTitleId, setSelectedEncodeTitleId] = useState(null);
|
const [selectedEncodeTitleId, setSelectedEncodeTitleId] = useState(null);
|
||||||
const [selectedEncodeTitleIds, setSelectedEncodeTitleIds] = useState([]);
|
const [selectedEncodeTitleIds, setSelectedEncodeTitleIds] = useState([]);
|
||||||
const [titleSelectionTouched, setTitleSelectionTouched] = useState(false);
|
|
||||||
const [selectedPlaylistId, setSelectedPlaylistId] = useState(null);
|
const [selectedPlaylistId, setSelectedPlaylistId] = useState(null);
|
||||||
const [selectedHandBrakeTitleIdsState, setSelectedHandBrakeTitleIdsState] = useState([]);
|
const [selectedHandBrakeTitleIdsState, setSelectedHandBrakeTitleIdsState] = useState([]);
|
||||||
const [trackSelectionByTitle, setTrackSelectionByTitle] = useState({});
|
const [trackSelectionByTitle, setTrackSelectionByTitle] = useState({});
|
||||||
@@ -1691,7 +1645,6 @@ export default function PipelineStatusCard({
|
|||||||
const [selectedUserPresetId, setSelectedUserPresetId] = useState(null);
|
const [selectedUserPresetId, setSelectedUserPresetId] = useState(null);
|
||||||
const [handBrakePresetOptions, setHandBrakePresetOptions] = useState([]);
|
const [handBrakePresetOptions, setHandBrakePresetOptions] = useState([]);
|
||||||
const [selectedHandBrakePreset, setSelectedHandBrakePreset] = useState('');
|
const [selectedHandBrakePreset, setSelectedHandBrakePreset] = useState('');
|
||||||
const [presetSelectionExplicitlyCleared, setPresetSelectionExplicitlyCleared] = useState(false);
|
|
||||||
const [selectedOutputFormat, setSelectedOutputFormat] = useState('mkv');
|
const [selectedOutputFormat, setSelectedOutputFormat] = useState('mkv');
|
||||||
const [converterConfigSaving, setConverterConfigSaving] = useState(false);
|
const [converterConfigSaving, setConverterConfigSaving] = useState(false);
|
||||||
const [converterConfigError, setConverterConfigError] = useState(null);
|
const [converterConfigError, setConverterConfigError] = useState(null);
|
||||||
@@ -1850,7 +1803,6 @@ export default function PipelineStatusCard({
|
|||||||
const effectiveSelected = defaultAllTitles
|
const effectiveSelected = defaultAllTitles
|
||||||
? normalizeTitleIdList(reviewTitles.map((title) => title?.id))
|
? normalizeTitleIdList(reviewTitles.map((title) => title?.id))
|
||||||
: selectedFromReview;
|
: selectedFromReview;
|
||||||
setTitleSelectionTouched(false);
|
|
||||||
setSelectedEncodeTitleIds(effectiveSelected);
|
setSelectedEncodeTitleIds(effectiveSelected);
|
||||||
setSelectedEncodeTitleId(effectiveSelected[0] || fromReview || null);
|
setSelectedEncodeTitleId(effectiveSelected[0] || fromReview || null);
|
||||||
setTrackSelectionByTitle(buildDefaultTrackSelection(mediaInfoReview));
|
setTrackSelectionByTitle(buildDefaultTrackSelection(mediaInfoReview));
|
||||||
@@ -1898,18 +1850,12 @@ export default function PipelineStatusCard({
|
|||||||
const nextOutputFormat = String(mediaInfoReview?.outputFormat || 'mkv').trim().toLowerCase() || 'mkv';
|
const nextOutputFormat = String(mediaInfoReview?.outputFormat || 'mkv').trim().toLowerCase() || 'mkv';
|
||||||
setSelectedOutputFormat(nextOutputFormat);
|
setSelectedOutputFormat(nextOutputFormat);
|
||||||
const userPresetId = Number(mediaInfoReview?.userPreset?.id);
|
const userPresetId = Number(mediaInfoReview?.userPreset?.id);
|
||||||
const settingsPresetName = String(mediaInfoReview?.selectors?.preset || '').trim();
|
|
||||||
setPresetSelectionExplicitlyCleared(false);
|
|
||||||
if (Number.isFinite(userPresetId) && userPresetId > 0) {
|
if (Number.isFinite(userPresetId) && userPresetId > 0) {
|
||||||
setSelectedUserPresetId(Math.trunc(userPresetId));
|
setSelectedUserPresetId(Math.trunc(userPresetId));
|
||||||
setSelectedHandBrakePreset('');
|
setSelectedHandBrakePreset('');
|
||||||
} else {
|
} else {
|
||||||
setSelectedUserPresetId(null);
|
setSelectedUserPresetId(null);
|
||||||
const hbPresetName = String(
|
const hbPresetName = String(mediaInfoReview?.userPreset?.handbrakePreset || '').trim();
|
||||||
mediaInfoReview?.userPreset?.handbrakePreset
|
|
||||||
|| settingsPresetName
|
|
||||||
|| ''
|
|
||||||
).trim();
|
|
||||||
setSelectedHandBrakePreset(hbPresetName);
|
setSelectedHandBrakePreset(hbPresetName);
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -1920,7 +1866,6 @@ export default function PipelineStatusCard({
|
|||||||
mediaInfoReview?.outputFormat,
|
mediaInfoReview?.outputFormat,
|
||||||
mediaInfoReview?.userPreset?.id,
|
mediaInfoReview?.userPreset?.id,
|
||||||
mediaInfoReview?.userPreset?.handbrakePreset,
|
mediaInfoReview?.userPreset?.handbrakePreset,
|
||||||
mediaInfoReview?.selectors?.preset,
|
|
||||||
selectedMetadata?.seasonNumber,
|
selectedMetadata?.seasonNumber,
|
||||||
selectedMetadata?.episodes,
|
selectedMetadata?.episodes,
|
||||||
selectedMetadata?.metadataProvider,
|
selectedMetadata?.metadataProvider,
|
||||||
@@ -1932,7 +1877,6 @@ export default function PipelineStatusCard({
|
|||||||
if (mediaInfoReview) {
|
if (mediaInfoReview) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTitleSelectionTouched(false);
|
|
||||||
setSelectedEncodeTitleIds([]);
|
setSelectedEncodeTitleIds([]);
|
||||||
setSelectedEncodeTitleId(null);
|
setSelectedEncodeTitleId(null);
|
||||||
setTrackSelectionByTitle({});
|
setTrackSelectionByTitle({});
|
||||||
@@ -1942,29 +1886,8 @@ export default function PipelineStatusCard({
|
|||||||
setPostEncodeItems([]);
|
setPostEncodeItems([]);
|
||||||
setSelectedUserPresetId(null);
|
setSelectedUserPresetId(null);
|
||||||
setSelectedHandBrakePreset('');
|
setSelectedHandBrakePreset('');
|
||||||
setPresetSelectionExplicitlyCleared(false);
|
|
||||||
}, [mediaInfoReview, retryJobId]);
|
}, [mediaInfoReview, retryJobId]);
|
||||||
|
|
||||||
const resolveEffectiveSelectedTitleIds = (reviewTitles = []) => {
|
|
||||||
const normalizedReviewTitles = Array.isArray(reviewTitles) ? reviewTitles : [];
|
|
||||||
const explicitSelectedIds = normalizeTitleIdList(selectedEncodeTitleIds);
|
|
||||||
if (titleSelectionTouched) {
|
|
||||||
return explicitSelectedIds;
|
|
||||||
}
|
|
||||||
const fallbackSelectedIds = normalizeTitleIdList([
|
|
||||||
...explicitSelectedIds,
|
|
||||||
selectedEncodeTitleId,
|
|
||||||
mediaInfoReview?.encodeInputTitleId,
|
|
||||||
...normalizedReviewTitles.filter((title) => Boolean(title?.selectedForEncode)).map((title) => title?.id)
|
|
||||||
]);
|
|
||||||
const selectedTitleIdsInReviewOrder = normalizedReviewTitles
|
|
||||||
.map((title) => normalizeTitleId(title?.id))
|
|
||||||
.filter((id) => id !== null && fallbackSelectedIds.includes(id));
|
|
||||||
return selectedTitleIdsInReviewOrder.length > 0
|
|
||||||
? selectedTitleIdsInReviewOrder
|
|
||||||
: fallbackSelectedIds;
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const normalizedSelectedIds = normalizeTitleIdList(selectedEncodeTitleIds);
|
const normalizedSelectedIds = normalizeTitleIdList(selectedEncodeTitleIds);
|
||||||
const primaryTitleId = normalizeTitleId(selectedEncodeTitleId);
|
const primaryTitleId = normalizeTitleId(selectedEncodeTitleId);
|
||||||
@@ -2004,7 +1927,11 @@ export default function PipelineStatusCard({
|
|||||||
const resolveEpisodeFillContext = () => {
|
const resolveEpisodeFillContext = () => {
|
||||||
const episodeRows = Array.isArray(selectedMetadataEpisodes) ? selectedMetadataEpisodes : [];
|
const episodeRows = Array.isArray(selectedMetadataEpisodes) ? selectedMetadataEpisodes : [];
|
||||||
const reviewTitles = Array.isArray(mediaInfoReview?.titles) ? mediaInfoReview.titles : [];
|
const reviewTitles = Array.isArray(mediaInfoReview?.titles) ? mediaInfoReview.titles : [];
|
||||||
const selectedTitleIds = resolveEffectiveSelectedTitleIds(reviewTitles);
|
const selectedTitleIds = normalizeTitleIdList([
|
||||||
|
...normalizeTitleIdList(selectedEncodeTitleIds),
|
||||||
|
...(Array.isArray(mediaInfoReview?.selectedTitleIds) ? mediaInfoReview.selectedTitleIds : []),
|
||||||
|
...reviewTitles.filter((title) => Boolean(title?.selectedForEncode)).map((title) => title?.id)
|
||||||
|
]);
|
||||||
const orderedTitles = reviewTitles
|
const orderedTitles = reviewTitles
|
||||||
.map((title) => ({
|
.map((title) => ({
|
||||||
id: normalizeTitleId(title?.id),
|
id: normalizeTitleId(title?.id),
|
||||||
@@ -2306,7 +2233,18 @@ export default function PipelineStatusCard({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reviewTitles = Array.isArray(mediaInfoReview?.titles) ? mediaInfoReview.titles : [];
|
const reviewTitles = Array.isArray(mediaInfoReview?.titles) ? mediaInfoReview.titles : [];
|
||||||
const effectiveSelectedTitleIds = resolveEffectiveSelectedTitleIds(reviewTitles);
|
const fallbackSelectedIds = normalizeTitleIdList([
|
||||||
|
...selectedEncodeTitleIds,
|
||||||
|
selectedEncodeTitleId,
|
||||||
|
mediaInfoReview?.encodeInputTitleId,
|
||||||
|
...reviewTitles.filter((title) => Boolean(title?.selectedForEncode)).map((title) => title?.id)
|
||||||
|
]);
|
||||||
|
const selectedTitleIdsInReviewOrder = reviewTitles
|
||||||
|
.map((title) => normalizeTitleId(title?.id))
|
||||||
|
.filter((id) => id !== null && fallbackSelectedIds.includes(id));
|
||||||
|
const effectiveSelectedTitleIds = selectedTitleIdsInReviewOrder.length > 0
|
||||||
|
? selectedTitleIdsInReviewOrder
|
||||||
|
: fallbackSelectedIds;
|
||||||
|
|
||||||
const hasEpisodeAssignmentPayload = (assignment) => {
|
const hasEpisodeAssignmentPayload = (assignment) => {
|
||||||
if (!assignment || typeof assignment !== 'object') {
|
if (!assignment || typeof assignment !== 'object') {
|
||||||
@@ -2356,16 +2294,10 @@ export default function PipelineStatusCard({
|
|||||||
const hasSelectedEncodeTitle = normalizeTitleIdList(selectedEncodeTitleIds).length > 0;
|
const hasSelectedEncodeTitle = normalizeTitleIdList(selectedEncodeTitleIds).length > 0;
|
||||||
const canConfirmReview = !reviewPlaylistDecisionRequired || hasSelectedEncodeTitle;
|
const canConfirmReview = !reviewPlaylistDecisionRequired || hasSelectedEncodeTitle;
|
||||||
const trimmedHandBrakePreset = String(selectedHandBrakePreset || '').trim();
|
const trimmedHandBrakePreset = String(selectedHandBrakePreset || '').trim();
|
||||||
const settingsPresetFallback = String(mediaInfoReview?.selectors?.preset || '').trim();
|
|
||||||
const settingsExtraArgsFallback = String(mediaInfoReview?.selectors?.extraArgs || '').trim();
|
|
||||||
const hasSelectedPreset = Boolean(selectedUserPresetId) || Boolean(trimmedHandBrakePreset);
|
const hasSelectedPreset = Boolean(selectedUserPresetId) || Boolean(trimmedHandBrakePreset);
|
||||||
const hasSettingsPresetForValidation = !presetSelectionExplicitlyCleared && Boolean(settingsPresetFallback);
|
|
||||||
const hasEffectiveSelectedPreset = hasSelectedPreset
|
|
||||||
|| hasSettingsPresetForValidation
|
|
||||||
|| Boolean(settingsExtraArgsFallback);
|
|
||||||
const converterMediaType = String(mediaInfoReview?.converterMediaType || 'video').trim().toLowerCase() || 'video';
|
const converterMediaType = String(mediaInfoReview?.converterMediaType || 'video').trim().toLowerCase() || 'video';
|
||||||
const showConverterConfig = jobMediaProfile === 'converter' && converterMediaType !== 'audio';
|
const showConverterConfig = jobMediaProfile === 'converter' && converterMediaType !== 'audio';
|
||||||
const requiresPresetSelection = showConverterConfig || jobMediaProfile === 'dvd' || jobMediaProfile === 'bluray';
|
const requiresPresetSelection = showConverterConfig;
|
||||||
const multipartSettingsLock = mediaInfoReview?.multipartSettingsLock
|
const multipartSettingsLock = mediaInfoReview?.multipartSettingsLock
|
||||||
&& typeof mediaInfoReview.multipartSettingsLock === 'object'
|
&& typeof mediaInfoReview.multipartSettingsLock === 'object'
|
||||||
? mediaInfoReview.multipartSettingsLock
|
? mediaInfoReview.multipartSettingsLock
|
||||||
@@ -2386,15 +2318,6 @@ export default function PipelineStatusCard({
|
|||||||
);
|
);
|
||||||
const allowTrackSelectionInReview = state === 'READY_TO_ENCODE' && allowReviewSelectionEdit;
|
const allowTrackSelectionInReview = state === 'READY_TO_ENCODE' && allowReviewSelectionEdit;
|
||||||
const allowEncodeItemSelectionInReview = state === 'READY_TO_ENCODE' && allowReviewSelectionEdit;
|
const allowEncodeItemSelectionInReview = state === 'READY_TO_ENCODE' && allowReviewSelectionEdit;
|
||||||
const alternativeTitleSelection = mediaInfoReview?.alternativeTitleSelection
|
|
||||||
&& typeof mediaInfoReview.alternativeTitleSelection === 'object'
|
|
||||||
? mediaInfoReview.alternativeTitleSelection
|
|
||||||
: null;
|
|
||||||
const hasAlternativeTitleSelection = Boolean(
|
|
||||||
alternativeTitleSelection?.enabled
|
|
||||||
&& Array.isArray(mediaInfoReview?.titles)
|
|
||||||
&& mediaInfoReview.titles.length > 1
|
|
||||||
);
|
|
||||||
|
|
||||||
// Filter user presets by job media profile ('all' presets always shown)
|
// Filter user presets by job media profile ('all' presets always shown)
|
||||||
const filteredUserPresets = (Array.isArray(userPresets) ? userPresets : []).filter((p) => {
|
const filteredUserPresets = (Array.isArray(userPresets) ? userPresets : []).filter((p) => {
|
||||||
@@ -2412,7 +2335,7 @@ export default function PipelineStatusCard({
|
|||||||
const canStartReadyJob = (isPreRipReview
|
const canStartReadyJob = (isPreRipReview
|
||||||
? Boolean(retryJobId)
|
? Boolean(retryJobId)
|
||||||
: Boolean(retryJobId && encodeInputPath))
|
: Boolean(retryJobId && encodeInputPath))
|
||||||
&& (!requiresPresetSelection || hasEffectiveSelectedPreset);
|
&& (!requiresPresetSelection || hasSelectedPreset);
|
||||||
const canRestartEncodeFromLastSettings = Boolean(
|
const canRestartEncodeFromLastSettings = Boolean(
|
||||||
(state === 'ERROR' || state === 'CANCELLED')
|
(state === 'ERROR' || state === 'CANCELLED')
|
||||||
&& retryJobId
|
&& retryJobId
|
||||||
@@ -2571,31 +2494,6 @@ export default function PipelineStatusCard({
|
|||||||
}
|
}
|
||||||
return dedup;
|
return dedup;
|
||||||
}, [playlistAnalysis, pipeline?.context?.playlistCandidates]);
|
}, [playlistAnalysis, pipeline?.context?.playlistCandidates]);
|
||||||
const alternativeTitleOptions = useMemo(() => {
|
|
||||||
if (!hasAlternativeTitleSelection) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const titles = Array.isArray(mediaInfoReview?.titles) ? mediaInfoReview.titles : [];
|
|
||||||
return titles
|
|
||||||
.map((title) => {
|
|
||||||
const titleId = normalizeTitleId(title?.id);
|
|
||||||
if (!titleId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const playlistFile = String(title?.playlistFile || '').trim();
|
|
||||||
const durationLabel = formatDurationClock(title?.durationSeconds) || null;
|
|
||||||
const parts = [
|
|
||||||
playlistFile || `Titel #${titleId}`,
|
|
||||||
durationLabel
|
|
||||||
].filter(Boolean);
|
|
||||||
return {
|
|
||||||
value: titleId,
|
|
||||||
label: parts.join(' | ')
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter(Boolean)
|
|
||||||
.sort((left, right) => Number(left.value) - Number(right.value));
|
|
||||||
}, [hasAlternativeTitleSelection, mediaInfoReview?.titles]);
|
|
||||||
|
|
||||||
const handBrakeTitleDecisionRequired = state === 'WAITING_FOR_USER_DECISION'
|
const handBrakeTitleDecisionRequired = state === 'WAITING_FOR_USER_DECISION'
|
||||||
&& Boolean(pipeline?.context?.handBrakeTitleDecisionRequired);
|
&& Boolean(pipeline?.context?.handBrakeTitleDecisionRequired);
|
||||||
@@ -3178,12 +3076,6 @@ export default function PipelineStatusCard({
|
|||||||
+ `${runningSeriesEpisode?.title ? ` - ${runningSeriesEpisode.title}` : ''}`
|
+ `${runningSeriesEpisode?.title ? ` - ${runningSeriesEpisode.title}` : ''}`
|
||||||
)
|
)
|
||||||
: (pipeline?.statusText || 'Bereit');
|
: (pipeline?.statusText || 'Bereit');
|
||||||
const showMediainfoIndeterminatePrimaryProgress = !hasSeriesBatchProgress
|
|
||||||
&& isMediainfoCheckStatus(state);
|
|
||||||
const showIndeterminatePrimaryProgress = showMediainfoIndeterminatePrimaryProgress || (
|
|
||||||
!hasSeriesBatchProgress
|
|
||||||
&& isPlaylistTrackPreparationStatus(pipeline?.statusText)
|
|
||||||
);
|
|
||||||
const ripIssueEntries = useMemo(
|
const ripIssueEntries = useMemo(
|
||||||
() => extractMakeMkvRipIssues(jobRow?.makemkvInfo),
|
() => extractMakeMkvRipIssues(jobRow?.makemkvInfo),
|
||||||
[jobRow?.makemkvInfo]
|
[jobRow?.makemkvInfo]
|
||||||
@@ -3530,7 +3422,18 @@ export default function PipelineStatusCard({
|
|||||||
.map((title) => [normalizeTitleId(title?.id), title])
|
.map((title) => [normalizeTitleId(title?.id), title])
|
||||||
.filter((entry) => entry[0] !== null)
|
.filter((entry) => entry[0] !== null)
|
||||||
);
|
);
|
||||||
const effectiveSelectedTitleIds = resolveEffectiveSelectedTitleIds(reviewTitles);
|
const fallbackSelectedIds = normalizeTitleIdList([
|
||||||
|
...selectedEncodeTitleIds,
|
||||||
|
selectedEncodeTitleId,
|
||||||
|
mediaInfoReview?.encodeInputTitleId,
|
||||||
|
...reviewTitles.filter((title) => Boolean(title?.selectedForEncode)).map((title) => title?.id)
|
||||||
|
]);
|
||||||
|
const selectedTitleIdsInReviewOrder = reviewTitles
|
||||||
|
.map((title) => normalizeTitleId(title?.id))
|
||||||
|
.filter((id) => id !== null && fallbackSelectedIds.includes(id));
|
||||||
|
const effectiveSelectedTitleIds = selectedTitleIdsInReviewOrder.length > 0
|
||||||
|
? selectedTitleIdsInReviewOrder
|
||||||
|
: fallbackSelectedIds;
|
||||||
const preferredPrimaryTitleId = normalizeTitleId(selectedEncodeTitleId)
|
const preferredPrimaryTitleId = normalizeTitleId(selectedEncodeTitleId)
|
||||||
|| normalizeTitleId(mediaInfoReview?.encodeInputTitleId)
|
|| normalizeTitleId(mediaInfoReview?.encodeInputTitleId)
|
||||||
|| null;
|
|| null;
|
||||||
@@ -3573,24 +3476,11 @@ export default function PipelineStatusCard({
|
|||||||
const hasExplicitVariantSelection = Object.keys(filteredVariantSelection).length > 0;
|
const hasExplicitVariantSelection = Object.keys(filteredVariantSelection).length > 0;
|
||||||
const filteredSubtitleTrackIds = normalizeTrackIdList(effectiveSelection?.subtitleTrackIds || [])
|
const filteredSubtitleTrackIds = normalizeTrackIdList(effectiveSelection?.subtitleTrackIds || [])
|
||||||
.filter((id) => !blockedSubtitleTrackIds.has(String(id)));
|
.filter((id) => !blockedSubtitleTrackIds.has(String(id)));
|
||||||
const subtitleSelectionMode = normalizeSubtitleSelectionMode(
|
|
||||||
effectiveSelection?.subtitleSelectionMode,
|
|
||||||
hasExplicitVariantSelection
|
|
||||||
? 'variants'
|
|
||||||
: (filteredSubtitleTrackIds.length > 0 ? 'track_ids' : 'variants')
|
|
||||||
);
|
|
||||||
selectedTrackSelection[titleId] = {
|
selectedTrackSelection[titleId] = {
|
||||||
audioTrackIds: normalizeTrackIdList(effectiveSelection?.audioTrackIds || []),
|
audioTrackIds: normalizeTrackIdList(effectiveSelection?.audioTrackIds || []),
|
||||||
subtitleSelectionMode,
|
subtitleTrackIds: hasExplicitVariantSelection ? [] : filteredSubtitleTrackIds,
|
||||||
subtitleTrackIds: subtitleSelectionMode === 'track_ids'
|
subtitleVariantSelection: filteredVariantSelection,
|
||||||
? filteredSubtitleTrackIds
|
subtitleLanguageOrder: normalizedLanguageOrder
|
||||||
: (hasExplicitVariantSelection ? [] : filteredSubtitleTrackIds),
|
|
||||||
...(subtitleSelectionMode === 'variants'
|
|
||||||
? {
|
|
||||||
subtitleVariantSelection: filteredVariantSelection,
|
|
||||||
subtitleLanguageOrder: normalizedLanguageOrder
|
|
||||||
}
|
|
||||||
: {})
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const episodeAssignments = {};
|
const episodeAssignments = {};
|
||||||
@@ -3704,19 +3594,13 @@ export default function PipelineStatusCard({
|
|||||||
|
|
||||||
{running && (
|
{running && (
|
||||||
<div className="progress-wrap">
|
<div className="progress-wrap">
|
||||||
{showIndeterminatePrimaryProgress ? (
|
<ProgressBar
|
||||||
<ProgressBar mode="indeterminate" showValue={false} />
|
value={primaryProgressValue}
|
||||||
) : (
|
showValue
|
||||||
<ProgressBar
|
displayValueTemplate={(value) => formatPercentNoDecimals(value)}
|
||||||
value={primaryProgressValue}
|
/>
|
||||||
showValue
|
|
||||||
displayValueTemplate={(value) => formatPercentNoDecimals(value)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<small>
|
<small>
|
||||||
{showIndeterminatePrimaryProgress
|
{primaryEta
|
||||||
? (showMediainfoIndeterminatePrimaryProgress ? 'Mediainfo-Prüfung läuft …' : 'Vorbereitung läuft …')
|
|
||||||
: primaryEta
|
|
||||||
? (hasSeriesBatchProgress ? `ETA aktuelle Episode ${primaryEta}` : `ETA ${primaryEta}`)
|
? (hasSeriesBatchProgress ? `ETA aktuelle Episode ${primaryEta}` : `ETA ${primaryEta}`)
|
||||||
: 'ETA unbekannt'}
|
: 'ETA unbekannt'}
|
||||||
</small>
|
</small>
|
||||||
@@ -3811,7 +3695,7 @@ export default function PipelineStatusCard({
|
|||||||
&& state !== 'IDLE'
|
&& state !== 'IDLE'
|
||||||
&& state !== 'DISC_DETECTED'
|
&& state !== 'DISC_DETECTED'
|
||||||
&& retryJobId
|
&& retryJobId
|
||||||
&& typeof onReassignMetadata === 'function'
|
&& typeof onReassignOmdb === 'function'
|
||||||
&& !isOrphanCancelled
|
&& !isOrphanCancelled
|
||||||
&& !blockMetadataAndReviewForRipRetry
|
&& !blockMetadataAndReviewForRipRetry
|
||||||
&& !(jobMediaProfile === 'converter' && state === 'READY_TO_START' && !selectedMetadata?.imdbId) ? (
|
&& !(jobMediaProfile === 'converter' && state === 'READY_TO_START' && !selectedMetadata?.imdbId) ? (
|
||||||
@@ -3820,7 +3704,7 @@ export default function PipelineStatusCard({
|
|||||||
icon="pi pi-search"
|
icon="pi pi-search"
|
||||||
severity="info"
|
severity="info"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => onReassignMetadata?.(retryJobId)}
|
onClick={() => onReassignOmdb?.(retryJobId)}
|
||||||
loading={busy}
|
loading={busy}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -3907,14 +3791,10 @@ export default function PipelineStatusCard({
|
|||||||
selectedPostEncodeScriptIds: selectedPostScriptIds,
|
selectedPostEncodeScriptIds: selectedPostScriptIds,
|
||||||
selectedPreEncodeScriptIds: selectedPreScriptIds,
|
selectedPreEncodeScriptIds: selectedPreScriptIds,
|
||||||
selectedPostEncodeChainIds: selectedPostChainIds,
|
selectedPostEncodeChainIds: selectedPostChainIds,
|
||||||
selectedPreEncodeChainIds: selectedPreChainIds
|
selectedPreEncodeChainIds: selectedPreChainIds,
|
||||||
|
selectedHandBrakePreset
|
||||||
};
|
};
|
||||||
startPayload.selectedUserPresetId = (
|
startPayload.selectedUserPresetId = selectedUserPresetId || null;
|
||||||
selectedUserPresetId !== null && selectedUserPresetId !== undefined
|
|
||||||
? selectedUserPresetId
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
startPayload.selectedHandBrakePreset = String(selectedHandBrakePreset || '').trim();
|
|
||||||
await onStart(retryJobId, startPayload);
|
await onStart(retryJobId, startPayload);
|
||||||
}}
|
}}
|
||||||
loading={busy}
|
loading={busy}
|
||||||
@@ -4259,7 +4139,7 @@ export default function PipelineStatusCard({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{(mediaInfoReview || state === 'READY_TO_ENCODE') && !(handBrakeTitleDecisionRequired && isSeriesPlayAllDecisionMode) ? (
|
{(state === 'READY_TO_ENCODE' || state === 'MEDIAINFO_CHECK' || mediaInfoReview) && !(handBrakeTitleDecisionRequired && isSeriesPlayAllDecisionMode) ? (
|
||||||
<div className="mediainfo-review-block">
|
<div className="mediainfo-review-block">
|
||||||
{!isDiscTitleSelectionRequired ? <h3>Titel-/Spurprüfung</h3> : null}
|
{!isDiscTitleSelectionRequired ? <h3>Titel-/Spurprüfung</h3> : null}
|
||||||
{state === 'READY_TO_ENCODE' && !queueLocked && !isDiscTitleSelectionRequired ? (
|
{state === 'READY_TO_ENCODE' && !queueLocked && !isDiscTitleSelectionRequired ? (
|
||||||
@@ -4270,6 +4150,16 @@ export default function PipelineStatusCard({
|
|||||||
{reviewPlaylistDecisionRequired ? ' Bitte den korrekten Titel per Checkbox auswählen.' : ''}
|
{reviewPlaylistDecisionRequired ? ' Bitte den korrekten Titel per Checkbox auswählen.' : ''}
|
||||||
</small>
|
</small>
|
||||||
) : null}
|
) : null}
|
||||||
|
{multipartSettingsLocked ? (
|
||||||
|
<div className="playlist-decision-block">
|
||||||
|
<h3>Multipart-Lock aktiv</h3>
|
||||||
|
<small>
|
||||||
|
Die Encode-Einstellungen wurden automatisch von der bereits vorhandenen Disc übernommen und sind gesperrt.
|
||||||
|
{multipartLockSourceJobId ? ` Quelle: Job #${multipartLockSourceJobId}.` : ''}
|
||||||
|
{multipartLockSourceDiscNumber ? ` Referenz-Disc: ${multipartLockSourceDiscNumber}.` : ''}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
{showConverterConfig ? (
|
{showConverterConfig ? (
|
||||||
<div style={{ marginTop: '0.75rem', marginBottom: '0.75rem', padding: '0.75rem', border: '1px solid var(--surface-border, #e0e0e0)', borderRadius: '6px', background: 'var(--surface-ground, #f8f8f8)' }}>
|
<div style={{ marginTop: '0.75rem', marginBottom: '0.75rem', padding: '0.75rem', border: '1px solid var(--surface-border, #e0e0e0)', borderRadius: '6px', background: 'var(--surface-ground, #f8f8f8)' }}>
|
||||||
<div style={{ display: 'grid', gap: '0.75rem', gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))' }}>
|
<div style={{ display: 'grid', gap: '0.75rem', gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))' }}>
|
||||||
@@ -4337,7 +4227,7 @@ export default function PipelineStatusCard({
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{allowConverterConfigEdit && !hasEffectiveSelectedPreset ? (
|
{allowConverterConfigEdit && !hasSelectedPreset ? (
|
||||||
<small style={{ display: 'block', marginTop: '0.5rem', color: 'var(--red-600)' }}>
|
<small style={{ display: 'block', marginTop: '0.5rem', color: 'var(--red-600)' }}>
|
||||||
Bitte wähle ein User- oder HandBrake-Preset aus, bevor das Encoding starten kann.
|
Bitte wähle ein User- oder HandBrake-Preset aus, bevor das Encoding starten kann.
|
||||||
</small>
|
</small>
|
||||||
@@ -4355,91 +4245,29 @@ export default function PipelineStatusCard({
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
{isSeriesDvdReview && hasMultiEpisodeInJob ? (
|
||||||
|
<div className="playlist-decision-block">
|
||||||
|
<h3>Hinweis Episoden-Zuordnung</h3>
|
||||||
|
<small>
|
||||||
|
Im Job wurden Hinweise zur Episoden-Zuordnung erkannt. Bitte Episodentitel und Episodenbereich prüfen, bevor das Encoding startet.
|
||||||
|
</small>
|
||||||
|
{episodeAssignmentWarningLines.map((line, index) => (
|
||||||
|
<small key={`episode-assignment-warning-${index}`}>{line}</small>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
<MediaInfoReviewPanel
|
<MediaInfoReviewPanel
|
||||||
review={mediaInfoReview}
|
review={mediaInfoReview}
|
||||||
presetDisplayValue={presetDisplayValue}
|
presetDisplayValue={presetDisplayValue}
|
||||||
commandOutputPath={commandOutputPath}
|
commandOutputPath={commandOutputPath}
|
||||||
commandOutputPathByTitle={commandOutputPathByTitle}
|
commandOutputPathByTitle={commandOutputPathByTitle}
|
||||||
topContent={(
|
|
||||||
<>
|
|
||||||
{hasAlternativeTitleSelection ? (
|
|
||||||
<div className="playlist-decision-block">
|
|
||||||
<h3>Alternative Titel gefunden</h3>
|
|
||||||
<small>
|
|
||||||
Es wurden weitere gleichlange oder längere Titel erkannt. Das kann auf alternative Schnittfassungen
|
|
||||||
oder Playlist-Varianten derselben Disc hindeuten. Bitte waehle hier den Titel aus, der fuer Tracks,
|
|
||||||
Untertitel, Infos und den HandBrakeCLI-Command verwendet werden soll.
|
|
||||||
</small>
|
|
||||||
<div style={{ marginTop: '0.75rem' }}>
|
|
||||||
<label style={{ display: 'block', marginBottom: '0.35rem', fontWeight: 600 }}>
|
|
||||||
Zu verwendender Titel
|
|
||||||
</label>
|
|
||||||
<Dropdown
|
|
||||||
value={normalizeTitleId(selectedEncodeTitleId) || normalizeTitleId(mediaInfoReview?.encodeInputTitleId) || null}
|
|
||||||
options={alternativeTitleOptions}
|
|
||||||
optionLabel="label"
|
|
||||||
optionValue="value"
|
|
||||||
onChange={(e) => {
|
|
||||||
const nextTitleId = normalizeTitleId(e?.value);
|
|
||||||
if (!nextTitleId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setSelectedEncodeTitleId(nextTitleId);
|
|
||||||
setSelectedEncodeTitleIds([nextTitleId]);
|
|
||||||
setTitleSelectionTouched(true);
|
|
||||||
}}
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
disabled={!allowReviewSelectionEdit || alternativeTitleOptions.length <= 1}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{multipartSettingsLocked ? (
|
|
||||||
<div className="playlist-decision-block">
|
|
||||||
<h3>Multipart-Lock aktiv</h3>
|
|
||||||
<small>
|
|
||||||
Die Encode-Einstellungen wurden automatisch von der bereits vorhandenen Disc übernommen und sind gesperrt.
|
|
||||||
{multipartLockSourceJobId ? ` Quelle: Job #${multipartLockSourceJobId}.` : ''}
|
|
||||||
{multipartLockSourceDiscNumber ? ` Referenz-Disc: ${multipartLockSourceDiscNumber}.` : ''}
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{isSeriesDvdReview && hasMultiEpisodeInJob ? (
|
|
||||||
<div className="playlist-decision-block">
|
|
||||||
<h3>Hinweis Episoden-Zuordnung</h3>
|
|
||||||
<small>
|
|
||||||
Im Job wurden Hinweise zur Episoden-Zuordnung erkannt. Bitte Episodentitel und Episodenbereich prüfen, bevor das Encoding startet.
|
|
||||||
</small>
|
|
||||||
{episodeAssignmentWarningLines.map((line, index) => (
|
|
||||||
<small key={`episode-assignment-warning-${index}`}>{line}</small>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{!showConverterConfig
|
|
||||||
&& requiresPresetSelection
|
|
||||||
&& allowReviewSelectionEdit
|
|
||||||
&& !hasEffectiveSelectedPreset
|
|
||||||
&& state === 'READY_TO_ENCODE'
|
|
||||||
&& mediaInfoReview ? (
|
|
||||||
<div className="playlist-decision-block">
|
|
||||||
<h3>Preset-Auswahl erforderlich</h3>
|
|
||||||
<small>
|
|
||||||
Es ist kein gültiges Preset/CLI-Setup aktiv. Bitte Preset auswählen oder gültige Extra-Args hinterlegen.
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
selectedEncodeTitleId={normalizeTitleId(selectedEncodeTitleId)}
|
selectedEncodeTitleId={normalizeTitleId(selectedEncodeTitleId)}
|
||||||
selectedEncodeTitleIds={normalizeTitleIdList(selectedEncodeTitleIds)}
|
selectedEncodeTitleIds={normalizeTitleIdList(selectedEncodeTitleIds)}
|
||||||
displayOnlySelectedTitle={hasAlternativeTitleSelection}
|
|
||||||
titleSelectionTouched={titleSelectionTouched}
|
|
||||||
allowTitleSelection={allowTitleSelectionInReview}
|
allowTitleSelection={allowTitleSelectionInReview}
|
||||||
compactTitleSelection={isDiscTitleSelectionRequired}
|
compactTitleSelection={isDiscTitleSelectionRequired}
|
||||||
onSelectEncodeTitle={(titleId) => {
|
onSelectEncodeTitle={(titleId) => {
|
||||||
const normalizedTitleId = normalizeTitleId(titleId);
|
const normalizedTitleId = normalizeTitleId(titleId);
|
||||||
setSelectedEncodeTitleId(normalizedTitleId);
|
setSelectedEncodeTitleId(normalizedTitleId);
|
||||||
setTitleSelectionTouched(true);
|
|
||||||
if (!normalizedTitleId) {
|
if (!normalizedTitleId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4450,7 +4278,6 @@ export default function PipelineStatusCard({
|
|||||||
if (!normalizedTitleId) {
|
if (!normalizedTitleId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTitleSelectionTouched(true);
|
|
||||||
setSelectedEncodeTitleIds((prev) => {
|
setSelectedEncodeTitleIds((prev) => {
|
||||||
const current = normalizeTitleIdList(prev);
|
const current = normalizeTitleIdList(prev);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
@@ -4483,8 +4310,7 @@ export default function PipelineStatusCard({
|
|||||||
audioTrackIds: [],
|
audioTrackIds: [],
|
||||||
subtitleTrackIds: [],
|
subtitleTrackIds: [],
|
||||||
subtitleVariantSelection: {},
|
subtitleVariantSelection: {},
|
||||||
subtitleLanguageOrder: [],
|
subtitleLanguageOrder: []
|
||||||
subtitleSelectionMode: 'variants'
|
|
||||||
};
|
};
|
||||||
const key = trackType === 'subtitle' ? 'subtitleTrackIds' : 'audioTrackIds';
|
const key = trackType === 'subtitle' ? 'subtitleTrackIds' : 'audioTrackIds';
|
||||||
const existing = normalizeTrackIdList(current?.[key] || []);
|
const existing = normalizeTrackIdList(current?.[key] || []);
|
||||||
@@ -4496,14 +4322,7 @@ export default function PipelineStatusCard({
|
|||||||
...prev,
|
...prev,
|
||||||
[normalizedTitleId]: {
|
[normalizedTitleId]: {
|
||||||
...current,
|
...current,
|
||||||
[key]: next,
|
[key]: next
|
||||||
...(trackType === 'subtitle'
|
|
||||||
? {
|
|
||||||
subtitleSelectionMode: 'track_ids',
|
|
||||||
subtitleVariantSelection: {},
|
|
||||||
subtitleLanguageOrder: []
|
|
||||||
}
|
|
||||||
: {})
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -4521,8 +4340,7 @@ export default function PipelineStatusCard({
|
|||||||
audioTrackIds: [],
|
audioTrackIds: [],
|
||||||
subtitleTrackIds: [],
|
subtitleTrackIds: [],
|
||||||
subtitleVariantSelection: {},
|
subtitleVariantSelection: {},
|
||||||
subtitleLanguageOrder: [],
|
subtitleLanguageOrder: []
|
||||||
subtitleSelectionMode: 'variants'
|
|
||||||
};
|
};
|
||||||
const currentMap = normalizeSubtitleVariantSelectionMap(current?.subtitleVariantSelection || {});
|
const currentMap = normalizeSubtitleVariantSelectionMap(current?.subtitleVariantSelection || {});
|
||||||
const nextMap = { ...currentMap };
|
const nextMap = { ...currentMap };
|
||||||
@@ -4550,7 +4368,6 @@ export default function PipelineStatusCard({
|
|||||||
...prev,
|
...prev,
|
||||||
[normalizedTitleId]: {
|
[normalizedTitleId]: {
|
||||||
...current,
|
...current,
|
||||||
subtitleSelectionMode: 'variants',
|
|
||||||
subtitleVariantSelection: nextMap,
|
subtitleVariantSelection: nextMap,
|
||||||
subtitleLanguageOrder: nextOrder
|
subtitleLanguageOrder: nextOrder
|
||||||
}
|
}
|
||||||
@@ -4634,29 +4451,8 @@ export default function PipelineStatusCard({
|
|||||||
postEncodeItems={postEncodeItems}
|
postEncodeItems={postEncodeItems}
|
||||||
userPresets={effectiveUserPresets}
|
userPresets={effectiveUserPresets}
|
||||||
selectedUserPresetId={selectedUserPresetId}
|
selectedUserPresetId={selectedUserPresetId}
|
||||||
onUserPresetChange={showConverterConfig || multipartSettingsLocked ? null : (presetId) => {
|
onUserPresetChange={showConverterConfig || multipartSettingsLocked ? null : (presetId) => setSelectedUserPresetId(presetId)}
|
||||||
const nextPresetId = Number.isFinite(Number(presetId)) && Number(presetId) > 0
|
|
||||||
? Math.trunc(Number(presetId))
|
|
||||||
: null;
|
|
||||||
setSelectedUserPresetId(nextPresetId);
|
|
||||||
if (nextPresetId) {
|
|
||||||
setSelectedHandBrakePreset('');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
selectedHandBrakePreset={selectedHandBrakePreset}
|
selectedHandBrakePreset={selectedHandBrakePreset}
|
||||||
onHandBrakePresetChange={showConverterConfig || multipartSettingsLocked ? null : (presetName) => {
|
|
||||||
const nextPresetName = String(presetName || '').trim();
|
|
||||||
setSelectedHandBrakePreset(nextPresetName);
|
|
||||||
if (nextPresetName) {
|
|
||||||
setSelectedUserPresetId(null);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
presetSelectionExplicitlyCleared={presetSelectionExplicitlyCleared}
|
|
||||||
onPresetTokenChange={showConverterConfig || multipartSettingsLocked ? null : (token) => {
|
|
||||||
const normalizedToken = String(token || '').trim().toLowerCase();
|
|
||||||
setPresetSelectionExplicitlyCleared(normalizedToken === 'none');
|
|
||||||
}}
|
|
||||||
handBrakePresetOptions={handBrakePresetOptions}
|
|
||||||
allowEncodeItemSelection={allowEncodeItemSelectionInReview}
|
allowEncodeItemSelection={allowEncodeItemSelectionInReview}
|
||||||
comparisonReviewItems={multipartComparisonReviews}
|
comparisonReviewItems={multipartComparisonReviews}
|
||||||
onAddPreEncodeItem={(itemType) => {
|
onAddPreEncodeItem={(itemType) => {
|
||||||
|
|||||||
@@ -9,21 +9,6 @@ function buildWsUrl() {
|
|||||||
return `${protocol}//${window.location.host}/ws`;
|
return `${protocol}//${window.location.host}/ws`;
|
||||||
}
|
}
|
||||||
|
|
||||||
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';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useWebSocket({ onMessage }) {
|
export function useWebSocket({ onMessage }) {
|
||||||
const onMessageRef = useRef(onMessage);
|
const onMessageRef = useRef(onMessage);
|
||||||
onMessageRef.current = onMessage;
|
onMessageRef.current = onMessage;
|
||||||
@@ -33,7 +18,7 @@ export function useWebSocket({ onMessage }) {
|
|||||||
let reconnectTimer;
|
let reconnectTimer;
|
||||||
let progressFlushTimer = null;
|
let progressFlushTimer = null;
|
||||||
let progressFlushRaf = null;
|
let progressFlushRaf = null;
|
||||||
const latestProgressMessagesByJob = new Map();
|
let latestProgressMessage = null;
|
||||||
let isUnmounted = false;
|
let isUnmounted = false;
|
||||||
|
|
||||||
const clearProgressFlush = () => {
|
const clearProgressFlush = () => {
|
||||||
@@ -50,14 +35,12 @@ export function useWebSocket({ onMessage }) {
|
|||||||
const flushProgressMessage = () => {
|
const flushProgressMessage = () => {
|
||||||
progressFlushRaf = null;
|
progressFlushRaf = null;
|
||||||
progressFlushTimer = null;
|
progressFlushTimer = null;
|
||||||
if (latestProgressMessagesByJob.size === 0) {
|
const message = latestProgressMessage;
|
||||||
|
latestProgressMessage = null;
|
||||||
|
if (!message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const messages = Array.from(latestProgressMessagesByJob.values());
|
onMessageRef.current?.(message);
|
||||||
latestProgressMessagesByJob.clear();
|
|
||||||
for (const message of messages) {
|
|
||||||
onMessageRef.current?.(message);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const scheduleProgressFlush = () => {
|
const scheduleProgressFlush = () => {
|
||||||
@@ -82,21 +65,10 @@ export function useWebSocket({ onMessage }) {
|
|||||||
try {
|
try {
|
||||||
const message = JSON.parse(event.data);
|
const message = JSON.parse(event.data);
|
||||||
if (message?.type === 'PIPELINE_PROGRESS') {
|
if (message?.type === 'PIPELINE_PROGRESS') {
|
||||||
const progressJobId = message?.payload?.activeJobId;
|
latestProgressMessage = message;
|
||||||
const jobKey = progressJobId == null ? '__global__' : String(progressJobId);
|
scheduleProgressFlush();
|
||||||
const progressStage = normalizeStage(message?.payload?.state);
|
|
||||||
if (isRunningStage(progressStage)) {
|
|
||||||
latestProgressMessagesByJob.set(jobKey, message);
|
|
||||||
scheduleProgressFlush();
|
|
||||||
} else {
|
|
||||||
latestProgressMessagesByJob.delete(jobKey);
|
|
||||||
clearProgressFlush();
|
|
||||||
flushProgressMessage();
|
|
||||||
onMessageRef.current?.(message);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
flushProgressMessage();
|
|
||||||
onMessageRef.current?.(message);
|
onMessageRef.current?.(message);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ignore invalid json
|
// ignore invalid json
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Card } from 'primereact/card';
|
import { Card } from 'primereact/card';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
@@ -9,6 +10,7 @@ import { api } from '../api/client';
|
|||||||
import { useWebSocket } from '../hooks/useWebSocket';
|
import { useWebSocket } from '../hooks/useWebSocket';
|
||||||
import AudiobookUploadPanel from '../components/AudiobookUploadPanel';
|
import AudiobookUploadPanel from '../components/AudiobookUploadPanel';
|
||||||
import AudiobookConfigPanel from '../components/AudiobookConfigPanel';
|
import AudiobookConfigPanel from '../components/AudiobookConfigPanel';
|
||||||
|
import AudiobookOutputExplorer from '../components/AudiobookOutputExplorer';
|
||||||
import { getStatusLabel, getStatusSeverity, normalizeStatus } from '../utils/statusPresentation';
|
import { getStatusLabel, getStatusSeverity, normalizeStatus } from '../utils/statusPresentation';
|
||||||
import { resolveMediaType } from '../utils/jobTaxonomy';
|
import { resolveMediaType } from '../utils/jobTaxonomy';
|
||||||
import { confirmModal } from '../utils/confirmModal';
|
import { confirmModal } from '../utils/confirmModal';
|
||||||
@@ -23,44 +25,6 @@ function normalizeJobId(value) {
|
|||||||
return Math.trunc(parsed);
|
return Math.trunc(parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasOwn(source, key) {
|
|
||||||
return source != null && Object.prototype.hasOwnProperty.call(source, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeLiveProgressForJob(job) {
|
|
||||||
const live = job?.liveProgress && typeof job.liveProgress === 'object' ? job.liveProgress : null;
|
|
||||||
if (!live) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const liveContext = live?.context && typeof live.context === 'object' ? live.context : {};
|
|
||||||
return {
|
|
||||||
progress: live?.progress ?? null,
|
|
||||||
eta: live?.eta ?? null,
|
|
||||||
statusText: live?.statusText ?? null,
|
|
||||||
state: live?.state ?? null,
|
|
||||||
currentChapter: liveContext?.currentChapter && typeof liveContext.currentChapter === 'object'
|
|
||||||
? liveContext.currentChapter
|
|
||||||
: null,
|
|
||||||
completedChapterCount: Number.isFinite(Number(liveContext?.completedChapterCount))
|
|
||||||
? Number(liveContext.completedChapterCount)
|
|
||||||
: null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
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 parseEncodePlan(job) {
|
function parseEncodePlan(job) {
|
||||||
if (job?.encodePlan && typeof job.encodePlan === 'object') {
|
if (job?.encodePlan && typeof job.encodePlan === 'object') {
|
||||||
return job.encodePlan;
|
return job.encodePlan;
|
||||||
@@ -107,22 +71,6 @@ function resolveAudiobookMetadata(job, encodePlan) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAudiobookJobMetaLine(jobId, metadata = {}, fallbackYear = null) {
|
|
||||||
const author = String(metadata?.author || metadata?.artist || '').trim() || null;
|
|
||||||
const narrator = String(metadata?.narrator || '').trim() || null;
|
|
||||||
const chapterCount = Array.isArray(metadata?.chapters) ? metadata.chapters.length : 0;
|
|
||||||
const year = Number.isFinite(Number(metadata?.year))
|
|
||||||
? Math.trunc(Number(metadata.year))
|
|
||||||
: (Number.isFinite(Number(fallbackYear)) ? Math.trunc(Number(fallbackYear)) : null);
|
|
||||||
return (
|
|
||||||
`#${jobId}`
|
|
||||||
+ (author ? ` | ${author}` : '')
|
|
||||||
+ (narrator ? ` | ${narrator}` : '')
|
|
||||||
+ (chapterCount > 0 ? ` | ${chapterCount} Kapitel` : '')
|
|
||||||
+ (year ? ` | ${year}` : '')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildAudiobookPipeline(job, progress = null) {
|
function buildAudiobookPipeline(job, progress = null) {
|
||||||
const encodePlan = parseEncodePlan(job);
|
const encodePlan = parseEncodePlan(job);
|
||||||
const selectedMetadata = resolveAudiobookMetadata(job, encodePlan);
|
const selectedMetadata = resolveAudiobookMetadata(job, encodePlan);
|
||||||
@@ -145,13 +93,7 @@ function buildAudiobookPipeline(job, progress = null) {
|
|||||||
format: String(encodePlan?.format || job?.handbrakeInfo?.format || 'mp3').trim().toLowerCase() || 'mp3',
|
format: String(encodePlan?.format || job?.handbrakeInfo?.format || 'mp3').trim().toLowerCase() || 'mp3',
|
||||||
formatOptions: encodePlan?.formatOptions && typeof encodePlan.formatOptions === 'object'
|
formatOptions: encodePlan?.formatOptions && typeof encodePlan.formatOptions === 'object'
|
||||||
? encodePlan.formatOptions
|
? encodePlan.formatOptions
|
||||||
: {},
|
: {}
|
||||||
preEncodeScriptIds: Array.isArray(encodePlan?.preEncodeScriptIds) ? encodePlan.preEncodeScriptIds : [],
|
|
||||||
postEncodeScriptIds: Array.isArray(encodePlan?.postEncodeScriptIds) ? encodePlan.postEncodeScriptIds : [],
|
|
||||||
preEncodeChainIds: Array.isArray(encodePlan?.preEncodeChainIds) ? encodePlan.preEncodeChainIds : [],
|
|
||||||
postEncodeChainIds: Array.isArray(encodePlan?.postEncodeChainIds) ? encodePlan.postEncodeChainIds : [],
|
|
||||||
preEncodeItems: Array.isArray(encodePlan?.preEncodeItems) ? encodePlan.preEncodeItems : [],
|
|
||||||
postEncodeItems: Array.isArray(encodePlan?.postEncodeItems) ? encodePlan.postEncodeItems : []
|
|
||||||
},
|
},
|
||||||
mediaInfoReview: reviewData,
|
mediaInfoReview: reviewData,
|
||||||
outputPath: String(job?.output_path || encodePlan?.outputPath || '').trim() || null,
|
outputPath: String(job?.output_path || encodePlan?.outputPath || '').trim() || null,
|
||||||
@@ -167,15 +109,16 @@ function buildAudiobookPipeline(job, progress = null) {
|
|||||||
|
|
||||||
export default function AudiobooksPage({
|
export default function AudiobooksPage({
|
||||||
audiobookUpload,
|
audiobookUpload,
|
||||||
onAudiobookUpload,
|
onAudiobookUpload
|
||||||
onCancelAudiobookUpload = null
|
|
||||||
}) {
|
}) {
|
||||||
const toastRef = useRef(null);
|
const toastRef = useRef(null);
|
||||||
|
const navigate = useNavigate();
|
||||||
const [jobs, setJobs] = useState([]);
|
const [jobs, setJobs] = useState([]);
|
||||||
const [loadingJobs, setLoadingJobs] = useState(false);
|
const [loadingJobs, setLoadingJobs] = useState(false);
|
||||||
const [expandedJobId, setExpandedJobId] = useState(undefined);
|
const [expandedJobId, setExpandedJobId] = useState(undefined);
|
||||||
const [jobProgress, setJobProgress] = useState({});
|
const [jobProgress, setJobProgress] = useState({});
|
||||||
const [actionBusyJobIds, setActionBusyJobIds] = useState(() => new Set());
|
const [actionBusyJobIds, setActionBusyJobIds] = useState(() => new Set());
|
||||||
|
const explorerRefreshToken = 0;
|
||||||
|
|
||||||
const setActionBusy = (jobId, busy) => {
|
const setActionBusy = (jobId, busy) => {
|
||||||
const normalizedJobId = normalizeJobId(jobId);
|
const normalizedJobId = normalizeJobId(jobId);
|
||||||
@@ -203,32 +146,21 @@ export default function AudiobooksPage({
|
|||||||
.sort((left, right) => Number(right?.id || 0) - Number(left?.id || 0));
|
.sort((left, right) => Number(right?.id || 0) - Number(left?.id || 0));
|
||||||
setJobs(audiobookRows);
|
setJobs(audiobookRows);
|
||||||
setJobProgress((prev) => {
|
setJobProgress((prev) => {
|
||||||
const next = {};
|
const next = { ...prev };
|
||||||
for (const job of audiobookRows) {
|
for (const job of audiobookRows) {
|
||||||
const jobId = normalizeJobId(job?.id);
|
const jobId = normalizeJobId(job?.id);
|
||||||
if (!jobId) {
|
if (!jobId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const status = String(job?.status || '').trim().toUpperCase();
|
const status = String(job?.status || '').trim().toUpperCase();
|
||||||
const isLiveStatus = ['ANALYZING', 'ENCODING'].includes(status);
|
if (!['ANALYZING', 'ENCODING'].includes(status)) {
|
||||||
if (!isLiveStatus) {
|
delete next[jobId];
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const serverProgress = normalizeLiveProgressForJob(job);
|
|
||||||
if (serverProgress) {
|
|
||||||
next[jobId] = serverProgress;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (prev?.[jobId] && typeof prev[jobId] === 'object') {
|
|
||||||
next[jobId] = prev[jobId];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
});
|
});
|
||||||
return audiobookRows;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('AudiobooksPage load jobs error:', error);
|
console.error('AudiobooksPage load jobs error:', error);
|
||||||
return [];
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingJobs(false);
|
setLoadingJobs(false);
|
||||||
}
|
}
|
||||||
@@ -251,31 +183,17 @@ export default function AudiobooksPage({
|
|||||||
if (!jobId) {
|
if (!jobId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setJobProgress((prev) => {
|
setJobProgress((prev) => ({
|
||||||
const previousEntry = prev?.[jobId] && typeof prev[jobId] === 'object' ? prev[jobId] : {};
|
...prev,
|
||||||
const contextPatch = payload?.contextPatch && typeof payload.contextPatch === 'object'
|
[jobId]: {
|
||||||
? payload.contextPatch
|
progress: payload?.progress ?? null,
|
||||||
: null;
|
eta: payload?.eta ?? null,
|
||||||
const nextCurrentChapter = hasOwn(contextPatch, 'currentChapter')
|
statusText: payload?.statusText ?? null,
|
||||||
? (contextPatch?.currentChapter ?? null)
|
state: payload?.state ?? null,
|
||||||
: (previousEntry?.currentChapter ?? null);
|
currentChapter: payload?.contextPatch?.currentChapter ?? null,
|
||||||
const nextCompletedChapterCount = hasOwn(contextPatch, 'completedChapterCount')
|
completedChapterCount: payload?.contextPatch?.completedChapterCount ?? null
|
||||||
? (Number.isFinite(Number(contextPatch?.completedChapterCount))
|
}
|
||||||
? Number(contextPatch.completedChapterCount)
|
}));
|
||||||
: null)
|
|
||||||
: (previousEntry?.completedChapterCount ?? null);
|
|
||||||
return {
|
|
||||||
...prev,
|
|
||||||
[jobId]: {
|
|
||||||
progress: payload?.progress ?? previousEntry?.progress ?? null,
|
|
||||||
eta: payload?.eta ?? previousEntry?.eta ?? null,
|
|
||||||
statusText: payload?.statusText ?? previousEntry?.statusText ?? null,
|
|
||||||
state: payload?.state ?? previousEntry?.state ?? null,
|
|
||||||
currentChapter: nextCurrentChapter,
|
|
||||||
completedChapterCount: nextCompletedChapterCount
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
message.type === 'PIPELINE_UPDATE'
|
message.type === 'PIPELINE_UPDATE'
|
||||||
@@ -344,7 +262,7 @@ export default function AudiobooksPage({
|
|||||||
}
|
}
|
||||||
setActionBusy(normalizedJobId, true);
|
setActionBusy(normalizedJobId, true);
|
||||||
try {
|
try {
|
||||||
await api.cancelPipeline(normalizedJobId);
|
await api.cancelJob(normalizedJobId);
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'info',
|
severity: 'info',
|
||||||
summary: 'Abbruch angefordert',
|
summary: 'Abbruch angefordert',
|
||||||
@@ -364,6 +282,39 @@ export default function AudiobooksPage({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRetry = async (jobId) => {
|
||||||
|
const normalizedJobId = normalizeJobId(jobId);
|
||||||
|
if (!normalizedJobId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setActionBusy(normalizedJobId, true);
|
||||||
|
try {
|
||||||
|
const response = await api.retryJob(normalizedJobId);
|
||||||
|
const retryJobId = normalizeJobId(response?.retryJob?.id);
|
||||||
|
toastRef.current?.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: 'Retry erstellt',
|
||||||
|
detail: retryJobId
|
||||||
|
? `Neuer Job #${retryJobId} wurde angelegt.`
|
||||||
|
: `Retry fuer Job #${normalizedJobId} wurde angelegt.`,
|
||||||
|
life: 3200
|
||||||
|
});
|
||||||
|
await loadJobs();
|
||||||
|
if (retryJobId) {
|
||||||
|
setExpandedJobId(retryJobId);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
toastRef.current?.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Retry fehlgeschlagen',
|
||||||
|
detail: error?.message || 'Bitte Logs pruefen.',
|
||||||
|
life: 4200
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setActionBusy(normalizedJobId, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleDelete = async (jobId) => {
|
const handleDelete = async (jobId) => {
|
||||||
const normalizedJobId = normalizeJobId(jobId);
|
const normalizedJobId = normalizeJobId(jobId);
|
||||||
if (!normalizedJobId) {
|
if (!normalizedJobId) {
|
||||||
@@ -406,14 +357,11 @@ export default function AudiobooksPage({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUploaded = async (uploadedJobId, response = null) => {
|
const handleUploaded = async (uploadedJobId) => {
|
||||||
const normalizedJobId = normalizeJobId(uploadedJobId)
|
const normalizedJobId = normalizeJobId(uploadedJobId);
|
||||||
|| extractUploadJobIdFromResponse(response);
|
await loadJobs();
|
||||||
const rows = await loadJobs();
|
if (normalizedJobId) {
|
||||||
const fallbackJobId = normalizeJobId(rows?.[0]?.id);
|
setExpandedJobId(normalizedJobId);
|
||||||
const targetJobId = normalizedJobId || fallbackJobId;
|
|
||||||
if (targetJobId) {
|
|
||||||
setExpandedJobId(targetJobId);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -445,7 +393,6 @@ export default function AudiobooksPage({
|
|||||||
<AudiobookUploadPanel
|
<AudiobookUploadPanel
|
||||||
audiobookUpload={audiobookUpload}
|
audiobookUpload={audiobookUpload}
|
||||||
onAudiobookUpload={onAudiobookUpload}
|
onAudiobookUpload={onAudiobookUpload}
|
||||||
onCancelUpload={onCancelAudiobookUpload}
|
|
||||||
onUploaded={handleUploaded}
|
onUploaded={handleUploaded}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -470,17 +417,7 @@ export default function AudiobooksPage({
|
|||||||
const progressValue = Number.isFinite(Number(pipelineForJob?.progress))
|
const progressValue = Number.isFinite(Number(pipelineForJob?.progress))
|
||||||
? Math.max(0, Math.min(100, Number(pipelineForJob.progress)))
|
? Math.max(0, Math.min(100, Number(pipelineForJob.progress)))
|
||||||
: 0;
|
: 0;
|
||||||
const isRunning = ['ANALYZING', 'ENCODING'].includes(state);
|
const showProgress = ['ANALYZING', 'ENCODING'].includes(state) && progressValue > 0;
|
||||||
const showProgress = isRunning || progressValue > 0;
|
|
||||||
const progressLabel = `${Math.trunc(progressValue)}%`;
|
|
||||||
const etaLabel = String(pipelineForJob?.eta || '').trim();
|
|
||||||
const currentChapter = pipelineForJob?.context?.currentChapter && typeof pipelineForJob.context.currentChapter === 'object'
|
|
||||||
? pipelineForJob.context.currentChapter
|
|
||||||
: null;
|
|
||||||
const chapterLabel = currentChapter?.index && currentChapter?.total
|
|
||||||
? ` | Kapitel ${currentChapter.index}/${currentChapter.total}${currentChapter.title ? `: ${currentChapter.title}` : ''}`
|
|
||||||
: '';
|
|
||||||
const metaLine = buildAudiobookJobMetaLine(jobId, pipelineForJob?.context?.selectedMetadata, job?.year);
|
|
||||||
|
|
||||||
if (!isExpanded) {
|
if (!isExpanded) {
|
||||||
return (
|
return (
|
||||||
@@ -490,30 +427,25 @@ export default function AudiobooksPage({
|
|||||||
className="ripper-job-row"
|
className="ripper-job-row"
|
||||||
onClick={() => setExpandedJobId(jobId)}
|
onClick={() => setExpandedJobId(jobId)}
|
||||||
>
|
>
|
||||||
{(job?.poster_url && job.poster_url !== 'N/A') ? (
|
<div className="poster-thumb ripper-job-poster-fallback">Kein Cover</div>
|
||||||
<img src={job.poster_url} alt={title} className="poster-thumb" />
|
|
||||||
) : (
|
|
||||||
<div className="poster-thumb ripper-job-poster-fallback">Kein Cover</div>
|
|
||||||
)}
|
|
||||||
<div className="ripper-job-row-content">
|
<div className="ripper-job-row-content">
|
||||||
<div className="ripper-job-row-main">
|
<div className="ripper-job-row-main">
|
||||||
<strong className="ripper-job-title-line">
|
<strong className="ripper-job-title-line">
|
||||||
<i className="pi pi-headphones media-indicator-icon" style={{ fontSize: '1rem', color: 'var(--rip-muted)' }} />
|
<i className="pi pi-headphones media-indicator-icon" style={{ fontSize: '1rem', color: 'var(--rip-muted)' }} />
|
||||||
<span>{title}</span>
|
<span>{title}</span>
|
||||||
</strong>
|
</strong>
|
||||||
<small>{metaLine}</small>
|
<small>#{jobId}</small>
|
||||||
</div>
|
</div>
|
||||||
<div className="ripper-job-badges">
|
<div className="ripper-job-badges">
|
||||||
<Tag value={getStatusLabel(state)} severity={getStatusSeverity(normalizeStatus(state))} />
|
<Tag value={getStatusLabel(state)} severity={getStatusSeverity(normalizeStatus(state))} />
|
||||||
|
<Tag value="Audiobook" severity="info" />
|
||||||
</div>
|
</div>
|
||||||
{showProgress ? (
|
{showProgress ? (
|
||||||
<div className="ripper-job-row-progress">
|
<div className="ripper-job-row-progress">
|
||||||
<ProgressBar value={progressValue} showValue={false} />
|
<ProgressBar value={progressValue} showValue={false} />
|
||||||
<small>{etaLabel ? `${progressLabel} | ETA ${etaLabel}` : `${progressLabel}${chapterLabel}`}</small>
|
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<i className="pi pi-angle-down" aria-hidden="true" />
|
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -521,22 +453,25 @@ export default function AudiobooksPage({
|
|||||||
return (
|
return (
|
||||||
<div key={jobId} className="ripper-job-expanded">
|
<div key={jobId} className="ripper-job-expanded">
|
||||||
<div className="ripper-job-expanded-head">
|
<div className="ripper-job-expanded-head">
|
||||||
{(job?.poster_url && job.poster_url !== 'N/A') ? (
|
<div className="poster-thumb ripper-job-poster-fallback">Kein Cover</div>
|
||||||
<img src={job.poster_url} alt={title} className="poster-thumb" />
|
|
||||||
) : (
|
|
||||||
<div className="poster-thumb ripper-job-poster-fallback">Kein Cover</div>
|
|
||||||
)}
|
|
||||||
<div className="ripper-job-expanded-title">
|
<div className="ripper-job-expanded-title">
|
||||||
<strong className="ripper-job-title-line">
|
<strong className="ripper-job-title-line">
|
||||||
<i className="pi pi-headphones media-indicator-icon" style={{ fontSize: '1rem', color: 'var(--rip-muted)' }} />
|
<i className="pi pi-headphones media-indicator-icon" style={{ fontSize: '1rem', color: 'var(--rip-muted)' }} />
|
||||||
<span>{title}</span>
|
<span>#{jobId} | {title}</span>
|
||||||
</strong>
|
</strong>
|
||||||
<small className="ripper-job-subtitle">{metaLine}</small>
|
|
||||||
<div className="ripper-job-badges">
|
<div className="ripper-job-badges">
|
||||||
<Tag value={getStatusLabel(state)} severity={getStatusSeverity(normalizeStatus(state))} />
|
<Tag value={getStatusLabel(state)} severity={getStatusSeverity(normalizeStatus(state))} />
|
||||||
|
<Tag value="Audiobook" severity="info" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
||||||
|
<Button
|
||||||
|
label="Im Ripper"
|
||||||
|
icon="pi pi-arrow-right"
|
||||||
|
severity="secondary"
|
||||||
|
outlined
|
||||||
|
onClick={() => navigate('/ripper')}
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="Einklappen"
|
label="Einklappen"
|
||||||
icon="pi pi-angle-up"
|
icon="pi pi-angle-up"
|
||||||
@@ -547,16 +482,11 @@ export default function AudiobooksPage({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{showProgress ? (
|
|
||||||
<div className="ripper-job-row-progress">
|
|
||||||
<ProgressBar value={progressValue} showValue={false} />
|
|
||||||
<small>{etaLabel ? `${progressLabel} | ETA ${etaLabel}` : `${progressLabel}${chapterLabel}`}</small>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
<AudiobookConfigPanel
|
<AudiobookConfigPanel
|
||||||
pipeline={pipelineForJob}
|
pipeline={pipelineForJob}
|
||||||
onStart={(config) => void handleAudiobookStart(jobId, config)}
|
onStart={(config) => void handleAudiobookStart(jobId, config)}
|
||||||
onCancel={() => void handleCancel(jobId)}
|
onCancel={() => void handleCancel(jobId)}
|
||||||
|
onRetry={() => void handleRetry(jobId)}
|
||||||
onDeleteJob={() => void handleDelete(jobId)}
|
onDeleteJob={() => void handleDelete(jobId)}
|
||||||
busy={busy}
|
busy={busy}
|
||||||
/>
|
/>
|
||||||
@@ -566,6 +496,13 @@ export default function AudiobooksPage({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
<Card
|
||||||
|
title="Audiobook Output Explorer"
|
||||||
|
subTitle="Read-only Explorer auf dem Audiobook-Ausgabeordner"
|
||||||
|
>
|
||||||
|
<AudiobookOutputExplorer refreshToken={explorerRefreshToken} />
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -507,7 +507,7 @@ export default function ConverterPage() {
|
|||||||
imdbId: row?.imdb_id || metadata?.imdbId || null,
|
imdbId: row?.imdb_id || metadata?.imdbId || null,
|
||||||
poster: row?.poster_url || metadata?.poster || null
|
poster: row?.poster_url || metadata?.poster || null
|
||||||
},
|
},
|
||||||
metadataCandidates: []
|
omdbCandidates: []
|
||||||
});
|
});
|
||||||
setMetadataDialogVisible(true);
|
setMetadataDialogVisible(true);
|
||||||
};
|
};
|
||||||
@@ -537,9 +537,9 @@ export default function ConverterPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMetadataSearch = async (query) => {
|
const handleOmdbSearch = async (query) => {
|
||||||
try {
|
try {
|
||||||
const response = await api.searchTmdbMovie(query);
|
const response = await api.searchOmdb(query);
|
||||||
return Array.isArray(response?.results) ? response.results : [];
|
return Array.isArray(response?.results) ? response.results : [];
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
return [];
|
return [];
|
||||||
@@ -911,13 +911,6 @@ export default function ConverterPage() {
|
|||||||
<div className="ripper-subpage-content">
|
<div className="ripper-subpage-content">
|
||||||
<Toast ref={toastRef} position="top-right" />
|
<Toast ref={toastRef} position="top-right" />
|
||||||
|
|
||||||
<div className="converter-beta-notice" role="note" aria-live="polite">
|
|
||||||
<i className="pi pi-exclamation-triangle" aria-hidden="true" />
|
|
||||||
<span>
|
|
||||||
Hinweis: Der Converter befindet sich aktuell im Beta-Stadium und ist noch nicht vollständig geprüft.
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Import-Ordner */}
|
{/* Import-Ordner */}
|
||||||
<Card title="Import-Ordner" subTitle="Dateien aus dem Raw-Ordner auswählen und als Job anlegen">
|
<Card title="Import-Ordner" subTitle="Dateien aus dem Raw-Ordner auswählen und als Job anlegen">
|
||||||
<ConverterFileExplorer
|
<ConverterFileExplorer
|
||||||
@@ -985,7 +978,7 @@ export default function ConverterPage() {
|
|||||||
onExpand={() => setExpandedJobId(Number(job.id))}
|
onExpand={() => setExpandedJobId(Number(job.id))}
|
||||||
onCollapse={() => setExpandedJobId(null)}
|
onCollapse={() => setExpandedJobId(null)}
|
||||||
onOpenMetadata={handleOpenMetadataDialog}
|
onOpenMetadata={handleOpenMetadataDialog}
|
||||||
onReassignMetadata={handleOpenMetadataDialog}
|
onReassignOmdb={handleOpenMetadataDialog}
|
||||||
onStart={handleStartPipelineJob}
|
onStart={handleStartPipelineJob}
|
||||||
onConfirmReview={handleConfirmReview}
|
onConfirmReview={handleConfirmReview}
|
||||||
onSelectPlaylist={handleSelectPlaylist}
|
onSelectPlaylist={handleSelectPlaylist}
|
||||||
@@ -1034,7 +1027,7 @@ export default function ConverterPage() {
|
|||||||
setMetadataDialogContext(null);
|
setMetadataDialogContext(null);
|
||||||
}}
|
}}
|
||||||
onSubmit={handleMetadataSubmit}
|
onSubmit={handleMetadataSubmit}
|
||||||
onSearch={handleMetadataSearch}
|
onSearch={handleOmdbSearch}
|
||||||
busy={metadataDialogBusy}
|
busy={metadataDialogBusy}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -1203,7 +1196,7 @@ function ConverterVideoJobCard({
|
|||||||
onExpand,
|
onExpand,
|
||||||
onCollapse,
|
onCollapse,
|
||||||
onOpenMetadata,
|
onOpenMetadata,
|
||||||
onReassignMetadata,
|
onReassignOmdb,
|
||||||
onStart,
|
onStart,
|
||||||
onConfirmReview,
|
onConfirmReview,
|
||||||
onSelectPlaylist,
|
onSelectPlaylist,
|
||||||
@@ -1289,7 +1282,7 @@ function ConverterVideoJobCard({
|
|||||||
jobRow={job}
|
jobRow={job}
|
||||||
pipeline={pipeline}
|
pipeline={pipeline}
|
||||||
onOpenMetadata={onOpenMetadata}
|
onOpenMetadata={onOpenMetadata}
|
||||||
onReassignMetadata={onReassignMetadata}
|
onReassignOmdb={onReassignOmdb}
|
||||||
onStart={onStart}
|
onStart={onStart}
|
||||||
onConfirmReview={onConfirmReview}
|
onConfirmReview={onConfirmReview}
|
||||||
onSelectPlaylist={onSelectPlaylist}
|
onSelectPlaylist={onSelectPlaylist}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export default function DatabasePage() {
|
|||||||
const [orphanRows, setOrphanRows] = useState([]);
|
const [orphanRows, setOrphanRows] = useState([]);
|
||||||
const [orphanLoading, setOrphanLoading] = useState(false);
|
const [orphanLoading, setOrphanLoading] = useState(false);
|
||||||
const [orphanImportBusyPath, setOrphanImportBusyPath] = useState(null);
|
const [orphanImportBusyPath, setOrphanImportBusyPath] = useState(null);
|
||||||
const [orphanDeleteBusyPath, setOrphanDeleteBusyPath] = useState(null);
|
|
||||||
const toastRef = useRef(null);
|
const toastRef = useRef(null);
|
||||||
const orphanLoadRequestRef = useRef(0);
|
const orphanLoadRequestRef = useRef(0);
|
||||||
|
|
||||||
@@ -131,50 +130,6 @@ export default function DatabasePage() {
|
|||||||
setOrphanImportBusyPath(null);
|
setOrphanImportBusyPath(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleDeleteOrphanRaw = async (row) => {
|
|
||||||
const target = String(row?.rawPath || row?.folderName || '-').trim() || '-';
|
|
||||||
const confirmed = await confirmModal({
|
|
||||||
header: 'RAW löschen',
|
|
||||||
message:
|
|
||||||
`RAW-Ordner "${target}" wirklich löschen?\n` +
|
|
||||||
'Der Ordner wird dauerhaft aus dem Dateisystem entfernt und verschwindet aus der /database-Liste.',
|
|
||||||
acceptLabel: 'RAW löschen',
|
|
||||||
rejectLabel: 'Abbrechen',
|
|
||||||
danger: true
|
|
||||||
});
|
|
||||||
if (!confirmed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setOrphanDeleteBusyPath(row.rawPath);
|
|
||||||
try {
|
|
||||||
const response = await api.deleteOrphanRawFolder(row.rawPath);
|
|
||||||
const deletedRawPath = String(response?.rawPath || row?.rawPath || '').trim();
|
|
||||||
const deletedFiles = Number(response?.filesDeleted || 0);
|
|
||||||
const deletedDirs = Number(response?.dirsRemoved || 0);
|
|
||||||
if (deletedRawPath) {
|
|
||||||
setOrphanRows((previousRows) => (
|
|
||||||
(Array.isArray(previousRows) ? previousRows : []).filter((entry) => String(entry?.rawPath || '').trim() !== deletedRawPath)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'RAW gelöscht',
|
|
||||||
detail: `Ordner entfernt | Dateien: ${deletedFiles}, Ordner: ${deletedDirs}`,
|
|
||||||
life: 3500
|
|
||||||
});
|
|
||||||
await loadOrphans({ silent: true });
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Löschen fehlgeschlagen',
|
|
||||||
detail: error.message,
|
|
||||||
life: 4500
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setOrphanDeleteBusyPath(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const orphanTitleBody = (row) => (
|
const orphanTitleBody = (row) => (
|
||||||
<div>
|
<div>
|
||||||
<div><strong>{row.title || '-'}</strong></div>
|
<div><strong>{row.title || '-'}</strong></div>
|
||||||
@@ -190,26 +145,14 @@ export default function DatabasePage() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const orphanActionBody = (row) => (
|
const orphanActionBody = (row) => (
|
||||||
<div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexWrap: 'wrap' }}>
|
<Button
|
||||||
<Button
|
label="Job anlegen"
|
||||||
label="Job anlegen"
|
icon="pi pi-plus"
|
||||||
icon="pi pi-plus"
|
size="small"
|
||||||
size="small"
|
onClick={() => handleImportOrphanRaw(row)}
|
||||||
onClick={() => handleImportOrphanRaw(row)}
|
loading={orphanImportBusyPath === row.rawPath}
|
||||||
loading={orphanImportBusyPath === row.rawPath}
|
disabled={Boolean(orphanImportBusyPath)}
|
||||||
disabled={Boolean(orphanImportBusyPath) || Boolean(orphanDeleteBusyPath)}
|
/>
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
label="RAW löschen"
|
|
||||||
icon="pi pi-trash"
|
|
||||||
severity="danger"
|
|
||||||
outlined
|
|
||||||
size="small"
|
|
||||||
onClick={() => handleDeleteOrphanRaw(row)}
|
|
||||||
loading={orphanDeleteBusyPath === row.rawPath}
|
|
||||||
disabled={Boolean(orphanImportBusyPath) || Boolean(orphanDeleteBusyPath)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -226,7 +169,7 @@ export default function DatabasePage() {
|
|||||||
icon="pi pi-search"
|
icon="pi pi-search"
|
||||||
onClick={loadOrphans}
|
onClick={loadOrphans}
|
||||||
loading={orphanLoading}
|
loading={orphanLoading}
|
||||||
disabled={Boolean(orphanImportBusyPath) || Boolean(orphanDeleteBusyPath)}
|
disabled={Boolean(orphanImportBusyPath)}
|
||||||
/>
|
/>
|
||||||
<Tag value={`${orphanRows.length} gefunden`} severity={orphanRows.length > 0 ? 'warning' : 'success'} />
|
<Tag value={`${orphanRows.length} gefunden`} severity={orphanRows.length > 0 ? 'warning' : 'success'} />
|
||||||
</div>
|
</div>
|
||||||
@@ -247,7 +190,7 @@ export default function DatabasePage() {
|
|||||||
<Column field="entryCount" header="Dateien" style={{ width: '8rem' }} />
|
<Column field="entryCount" header="Dateien" style={{ width: '8rem' }} />
|
||||||
<Column header="Pfad" body={orphanPathBody} style={{ minWidth: '22rem' }} />
|
<Column header="Pfad" body={orphanPathBody} style={{ minWidth: '22rem' }} />
|
||||||
<Column field="lastModifiedAt" header="Geändert" style={{ width: '16rem' }} />
|
<Column field="lastModifiedAt" header="Geändert" style={{ width: '16rem' }} />
|
||||||
<Column header="Aktion" body={orphanActionBody} style={{ minWidth: '18rem' }} />
|
<Column header="Aktion" body={orphanActionBody} style={{ width: '10rem' }} />
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -1,839 +0,0 @@
|
|||||||
import { useEffect, useMemo, useState } from 'react';
|
|
||||||
import 'chart.js/auto';
|
|
||||||
import { Card } from 'primereact/card';
|
|
||||||
import { Tag } from 'primereact/tag';
|
|
||||||
import { ProgressBar } from 'primereact/progressbar';
|
|
||||||
import { Chart } from 'primereact/chart';
|
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { api } from '../api/client';
|
|
||||||
|
|
||||||
function clampPercent(value) {
|
|
||||||
const parsed = Number(value);
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return Math.max(0, Math.min(100, parsed));
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatPercent(value) {
|
|
||||||
const parsed = Number(value);
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
return `${Math.round(parsed)}%`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatBytes(value) {
|
|
||||||
const bytes = Number(value);
|
|
||||||
if (!Number.isFinite(bytes) || bytes < 0) {
|
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
if (bytes === 0) {
|
|
||||||
return '0 B';
|
|
||||||
}
|
|
||||||
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
||||||
const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
|
|
||||||
const normalized = bytes / (1024 ** exponent);
|
|
||||||
return `${normalized.toFixed(normalized >= 100 ? 0 : (normalized >= 10 ? 1 : 2))} ${units[exponent]}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatUpdatedAt(value) {
|
|
||||||
const raw = String(value || '').trim();
|
|
||||||
if (!raw) {
|
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
const parsed = Date.parse(raw);
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
return new Date(parsed).toLocaleString('de-DE');
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeHardwareMonitoringPayload(rawPayload) {
|
|
||||||
const payload = rawPayload && typeof rawPayload === 'object' ? rawPayload : {};
|
|
||||||
return {
|
|
||||||
enabled: Boolean(payload.enabled),
|
|
||||||
intervalMs: Number(payload.intervalMs || 0),
|
|
||||||
updatedAt: payload.updatedAt || null,
|
|
||||||
sample: payload.sample && typeof payload.sample === 'object' ? payload.sample : null,
|
|
||||||
error: payload.error ? String(payload.error) : null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildGaugeDataset(value, color) {
|
|
||||||
const safe = clampPercent(value);
|
|
||||||
return {
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
data: [safe, Math.max(0, 100 - safe)],
|
|
||||||
backgroundColor: [color, 'rgba(255,255,255,0.08)'],
|
|
||||||
borderWidth: 0,
|
|
||||||
hoverOffset: 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const gaugeOptions = {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
cutout: '82%',
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
animation: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const HISTORY_WINDOWS = [
|
|
||||||
{ label: '1h', hours: 1 },
|
|
||||||
{ label: '6h', hours: 6 },
|
|
||||||
{ label: '24h', hours: 24 },
|
|
||||||
{ label: '4d', hours: 96 }
|
|
||||||
];
|
|
||||||
const HISTORY_STACK_BREAKPOINT = 1700;
|
|
||||||
const HISTORY_RESAMPLE_TARGET_POINTS = 720;
|
|
||||||
const HISTORY_INTERPOLATION_MIN_GAP_MS = 5 * 60 * 1000;
|
|
||||||
const HISTORY_INTERPOLATION_MAX_GAP_MS = 45 * 60 * 1000;
|
|
||||||
const HISTORY_INTERPOLATION_GAP_FACTOR = 6;
|
|
||||||
|
|
||||||
const CPU_SERIES_COLOR = '#c43d2f';
|
|
||||||
const GPU_SERIES_COLOR = '#c9961a';
|
|
||||||
const RAM_SERIES_COLOR = '#2e7d4f';
|
|
||||||
|
|
||||||
const historyChartOptions = {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
animation: false,
|
|
||||||
interaction: {
|
|
||||||
mode: 'index',
|
|
||||||
intersect: false
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
callbacks: {
|
|
||||||
title: (items) => {
|
|
||||||
const first = Array.isArray(items) ? items[0] : null;
|
|
||||||
const rawLabel = first?.label ?? first?.raw?.x ?? first?.parsed?.x ?? '';
|
|
||||||
return formatTickLabel(rawLabel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: {
|
|
||||||
ticks: {
|
|
||||||
autoSkip: true,
|
|
||||||
maxTicksLimit: 8,
|
|
||||||
color: '#6a4d38',
|
|
||||||
callback: function (value, index, ticks) {
|
|
||||||
const resolvedLabel = typeof this?.getLabelForValue === 'function'
|
|
||||||
? this.getLabelForValue(value)
|
|
||||||
: (
|
|
||||||
Array.isArray(ticks) && ticks[index]
|
|
||||||
? (ticks[index].label ?? ticks[index].value ?? value)
|
|
||||||
: value
|
|
||||||
);
|
|
||||||
return formatTickLabel(resolvedLabel);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(111,57,34,0.08)'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
beginAtZero: true,
|
|
||||||
ticks: {
|
|
||||||
color: '#6a4d38'
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
color: 'rgba(111,57,34,0.08)'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function toNumberOrNull(value) {
|
|
||||||
const parsed = Number(value);
|
|
||||||
return Number.isFinite(parsed) ? parsed : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatTickLabel(timestampIso) {
|
|
||||||
const parsed = Date.parse(String(timestampIso || ''));
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
const date = new Date(parsed);
|
|
||||||
return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDayMarkerLabel(timestampIso) {
|
|
||||||
const parsed = Date.parse(String(timestampIso || ''));
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
const date = new Date(parsed);
|
|
||||||
return `${String(date.getDate()).padStart(2, '0')}.${String(date.getMonth() + 1).padStart(2, '0')}.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toDayKeyFromTimestamp(timestampIso) {
|
|
||||||
const parsed = Date.parse(String(timestampIso || ''));
|
|
||||||
if (!Number.isFinite(parsed)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const date = new Date(parsed);
|
|
||||||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseTimestampMs(value) {
|
|
||||||
const parsed = Date.parse(String(value || ''));
|
|
||||||
return Number.isFinite(parsed) ? parsed : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeHistoryPoints(points = []) {
|
|
||||||
return (Array.isArray(points) ? points : [])
|
|
||||||
.map((point) => {
|
|
||||||
const timestampMs = parseTimestampMs(point?.capturedAt);
|
|
||||||
if (!Number.isFinite(timestampMs)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
capturedAt: new Date(timestampMs).toISOString(),
|
|
||||||
timestampMs,
|
|
||||||
cpuUsagePercent: toNumberOrNull(point?.cpuUsagePercent),
|
|
||||||
ramUsagePercent: toNumberOrNull(point?.ramUsagePercent),
|
|
||||||
gpuUsagePercent: toNumberOrNull(point?.gpuUsagePercent),
|
|
||||||
cpuTemperatureC: toNumberOrNull(point?.cpuTemperatureC),
|
|
||||||
gpuTemperatureC: toNumberOrNull(point?.gpuTemperatureC)
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter(Boolean)
|
|
||||||
.sort((left, right) => left.timestampMs - right.timestampMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
function interpolateMetric(prevPoint, nextPoint, metricKey, targetMs, maxGapMs) {
|
|
||||||
if (!prevPoint || !nextPoint) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (prevPoint.timestampMs === nextPoint.timestampMs) {
|
|
||||||
return toNumberOrNull(prevPoint[metricKey]);
|
|
||||||
}
|
|
||||||
const gapMs = nextPoint.timestampMs - prevPoint.timestampMs;
|
|
||||||
if (!Number.isFinite(gapMs) || gapMs <= 0 || gapMs > maxGapMs) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const prevValue = toNumberOrNull(prevPoint[metricKey]);
|
|
||||||
const nextValue = toNumberOrNull(nextPoint[metricKey]);
|
|
||||||
if (!Number.isFinite(prevValue) || !Number.isFinite(nextValue)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const ratio = (targetMs - prevPoint.timestampMs) / gapMs;
|
|
||||||
if (!Number.isFinite(ratio) || ratio < 0 || ratio > 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Number((prevValue + ((nextValue - prevValue) * ratio)).toFixed(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildResampledHistoryPoints(points = [], historyHours = 24) {
|
|
||||||
const normalized = normalizeHistoryPoints(points);
|
|
||||||
if (normalized.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const historyWindowMs = Math.max(1, Number(historyHours || 24)) * 60 * 60 * 1000;
|
|
||||||
const stepMsRaw = Math.round(historyWindowMs / HISTORY_RESAMPLE_TARGET_POINTS);
|
|
||||||
const stepMs = Math.max(60 * 1000, stepMsRaw);
|
|
||||||
const maxInterpolationGapMs = Math.max(
|
|
||||||
HISTORY_INTERPOLATION_MIN_GAP_MS,
|
|
||||||
Math.min(HISTORY_INTERPOLATION_MAX_GAP_MS, stepMs * HISTORY_INTERPOLATION_GAP_FACTOR)
|
|
||||||
);
|
|
||||||
|
|
||||||
const latestSourceMs = normalized[normalized.length - 1].timestampMs;
|
|
||||||
const windowEndMs = Math.max(Date.now(), latestSourceMs);
|
|
||||||
const windowStartMs = windowEndMs - historyWindowMs;
|
|
||||||
const gridStartMs = Math.floor(windowStartMs / stepMs) * stepMs;
|
|
||||||
const gridEndMs = Math.ceil(windowEndMs / stepMs) * stepMs;
|
|
||||||
const source = normalized.filter((point) => point.timestampMs >= (gridStartMs - maxInterpolationGapMs));
|
|
||||||
|
|
||||||
const keys = [
|
|
||||||
'cpuUsagePercent',
|
|
||||||
'ramUsagePercent',
|
|
||||||
'gpuUsagePercent',
|
|
||||||
'cpuTemperatureC',
|
|
||||||
'gpuTemperatureC'
|
|
||||||
];
|
|
||||||
|
|
||||||
let sourceIndex = 0;
|
|
||||||
const output = [];
|
|
||||||
for (let ts = gridStartMs; ts <= gridEndMs; ts += stepMs) {
|
|
||||||
while (sourceIndex < source.length && source[sourceIndex].timestampMs < ts) {
|
|
||||||
sourceIndex += 1;
|
|
||||||
}
|
|
||||||
const nextPoint = sourceIndex < source.length ? source[sourceIndex] : null;
|
|
||||||
const prevPoint = sourceIndex > 0 ? source[sourceIndex - 1] : null;
|
|
||||||
|
|
||||||
const row = {
|
|
||||||
capturedAt: new Date(ts).toISOString(),
|
|
||||||
timestampMs: ts
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const key of keys) {
|
|
||||||
const nextValue = nextPoint && nextPoint.timestampMs === ts
|
|
||||||
? toNumberOrNull(nextPoint[key])
|
|
||||||
: null;
|
|
||||||
const prevValue = prevPoint && prevPoint.timestampMs === ts
|
|
||||||
? toNumberOrNull(prevPoint[key])
|
|
||||||
: null;
|
|
||||||
row[key] = Number.isFinite(nextValue)
|
|
||||||
? nextValue
|
|
||||||
: (Number.isFinite(prevValue)
|
|
||||||
? prevValue
|
|
||||||
: interpolateMetric(prevPoint, nextPoint, key, ts, maxInterpolationGapMs));
|
|
||||||
}
|
|
||||||
output.push(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
const historyDayBoundaryPlugin = {
|
|
||||||
id: 'historyDayBoundary',
|
|
||||||
afterDatasetsDraw(chart, _args, options) {
|
|
||||||
if (options === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const xScale = chart?.scales?.x;
|
|
||||||
const area = chart?.chartArea;
|
|
||||||
const labels = Array.isArray(chart?.data?.labels) ? chart.data.labels : [];
|
|
||||||
if (!xScale || !area || labels.length < 2) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ctx = chart.ctx;
|
|
||||||
ctx.save();
|
|
||||||
ctx.strokeStyle = 'rgba(111,57,34,0.30)';
|
|
||||||
ctx.fillStyle = 'rgba(111,57,34,0.75)';
|
|
||||||
ctx.setLineDash([4, 4]);
|
|
||||||
ctx.lineWidth = 1;
|
|
||||||
ctx.font = '11px sans-serif';
|
|
||||||
ctx.textAlign = 'left';
|
|
||||||
ctx.textBaseline = 'top';
|
|
||||||
|
|
||||||
for (let index = 1; index < labels.length; index += 1) {
|
|
||||||
const prevDayKey = toDayKeyFromTimestamp(labels[index - 1]);
|
|
||||||
const nextDayKey = toDayKeyFromTimestamp(labels[index]);
|
|
||||||
if (!prevDayKey || !nextDayKey || prevDayKey === nextDayKey) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const xPrev = xScale.getPixelForValue(index - 1);
|
|
||||||
const xNext = xScale.getPixelForValue(index);
|
|
||||||
const x = (xPrev + xNext) / 2;
|
|
||||||
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(x, area.top);
|
|
||||||
ctx.lineTo(x, area.bottom);
|
|
||||||
ctx.stroke();
|
|
||||||
|
|
||||||
const markerLabel = formatDayMarkerLabel(labels[index]);
|
|
||||||
if (markerLabel) {
|
|
||||||
ctx.fillText(markerLabel, x + 4, area.top + 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function buildSeriesToggleButtonStyle(color, active) {
|
|
||||||
if (active) {
|
|
||||||
return {
|
|
||||||
background: color,
|
|
||||||
borderColor: color,
|
|
||||||
color: '#fffaf1'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
background: 'transparent',
|
|
||||||
borderColor: color,
|
|
||||||
color
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHistoryViewportBucket() {
|
|
||||||
if (typeof window === 'undefined') {
|
|
||||||
return 'wide';
|
|
||||||
}
|
|
||||||
return window.innerWidth < HISTORY_STACK_BREAKPOINT ? 'narrow' : 'wide';
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChartLegendRow({ items = [] }) {
|
|
||||||
return (
|
|
||||||
<div className="hardware-history-legend-row" aria-hidden="true">
|
|
||||||
{items.map((item) => (
|
|
||||||
<span key={item.label} className="hardware-history-legend-item">
|
|
||||||
<span className="hardware-history-legend-dot" style={{ background: item.color }} />
|
|
||||||
<span>{item.label}</span>
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GaugeBlock({ title, subtitle, icon, valuePercent, gaugeColor, bars = [], footer = null }) {
|
|
||||||
return (
|
|
||||||
<Card className="hardware-detail-card hardware-detail-card-top">
|
|
||||||
<div className="hardware-detail-card-head">
|
|
||||||
<div className="hardware-detail-card-icon"><i className={`pi ${icon}`} /></div>
|
|
||||||
<div>
|
|
||||||
<h3>{title}</h3>
|
|
||||||
{subtitle ? <small>{subtitle}</small> : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="hardware-detail-gauge-layout">
|
|
||||||
<div className="hardware-detail-gauge-wrap">
|
|
||||||
<Chart type="doughnut" data={buildGaugeDataset(valuePercent, gaugeColor)} options={gaugeOptions} className="hardware-detail-gauge-chart" />
|
|
||||||
<div className="hardware-detail-gauge-center">{formatPercent(valuePercent)}</div>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-detail-bar-list">
|
|
||||||
{bars.map((bar) => (
|
|
||||||
<div key={bar.label} className="hardware-detail-bar-item">
|
|
||||||
<div className="hardware-detail-bar-head">
|
|
||||||
<span>{bar.label}</span>
|
|
||||||
<span>{bar.valueLabel}</span>
|
|
||||||
</div>
|
|
||||||
<ProgressBar value={clampPercent(bar.valuePercent)} showValue={false} />
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{footer}
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function HardwarePage({ hardwareMonitoring }) {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const [historyHours, setHistoryHours] = useState(24);
|
|
||||||
const [historyViewportBucket, setHistoryViewportBucket] = useState(() => getHistoryViewportBucket());
|
|
||||||
const [usageSeriesVisible, setUsageSeriesVisible] = useState({
|
|
||||||
cpu: true,
|
|
||||||
ram: true,
|
|
||||||
gpu: true
|
|
||||||
});
|
|
||||||
const [tempSeriesVisible, setTempSeriesVisible] = useState({
|
|
||||||
cpu: true,
|
|
||||||
gpu: true
|
|
||||||
});
|
|
||||||
const [historyState, setHistoryState] = useState({
|
|
||||||
loading: false,
|
|
||||||
points: [],
|
|
||||||
totalPoints: 0,
|
|
||||||
error: null
|
|
||||||
});
|
|
||||||
const monitoringState = useMemo(
|
|
||||||
() => normalizeHardwareMonitoringPayload(hardwareMonitoring),
|
|
||||||
[hardwareMonitoring]
|
|
||||||
);
|
|
||||||
|
|
||||||
const sample = monitoringState.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 cpuPerCore = Array.isArray(cpu?.perCore) ? cpu.perCore : [];
|
|
||||||
const gpuDevices = Array.isArray(gpu?.devices) ? gpu.devices : [];
|
|
||||||
const primaryGpu = gpuDevices[0] || null;
|
|
||||||
|
|
||||||
const cpuTitle = String(cpu?.name || cpu?.model || cpu?.modelName || cpu?.brand || '').trim() || 'CPU';
|
|
||||||
const ramTitle = String(memory?.name || memory?.vendor || memory?.model || '').trim() || 'Arbeitsspeicher';
|
|
||||||
const gpuTitle = String(primaryGpu?.name || gpu?.name || gpu?.vendor || '').trim() || 'GPU';
|
|
||||||
const historyPoints = Array.isArray(historyState.points) ? historyState.points : [];
|
|
||||||
const resampledHistoryPoints = useMemo(
|
|
||||||
() => buildResampledHistoryPoints(historyPoints, historyHours),
|
|
||||||
[historyPoints, historyHours]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!monitoringState.enabled) {
|
|
||||||
setHistoryState({
|
|
||||||
loading: false,
|
|
||||||
points: [],
|
|
||||||
totalPoints: 0,
|
|
||||||
error: null
|
|
||||||
});
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cancelled = false;
|
|
||||||
const loadHistory = async (forceRefresh = false) => {
|
|
||||||
setHistoryState((prev) => ({
|
|
||||||
...prev,
|
|
||||||
loading: prev.points.length === 0
|
|
||||||
}));
|
|
||||||
try {
|
|
||||||
const response = await api.getHardwareHistory({
|
|
||||||
hours: historyHours,
|
|
||||||
maxPoints: 900,
|
|
||||||
forceRefresh
|
|
||||||
});
|
|
||||||
if (cancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const payload = response?.history && typeof response.history === 'object' ? response.history : {};
|
|
||||||
setHistoryState({
|
|
||||||
loading: false,
|
|
||||||
points: Array.isArray(payload.points) ? payload.points : [],
|
|
||||||
totalPoints: Number(payload.totalPoints || 0),
|
|
||||||
error: null
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
if (cancelled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setHistoryState((prev) => ({
|
|
||||||
...prev,
|
|
||||||
loading: false,
|
|
||||||
error: error?.message || 'Historische Hardware-Daten konnten nicht geladen werden.'
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
loadHistory(true);
|
|
||||||
const refreshMs = Math.max(5000, Number(monitoringState.intervalMs || 5000) * 2);
|
|
||||||
const timer = setInterval(() => {
|
|
||||||
loadHistory(true);
|
|
||||||
}, refreshMs);
|
|
||||||
return () => {
|
|
||||||
cancelled = true;
|
|
||||||
clearInterval(timer);
|
|
||||||
};
|
|
||||||
}, [historyHours, monitoringState.enabled, monitoringState.intervalMs]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let frame = null;
|
|
||||||
const handleResize = () => {
|
|
||||||
if (frame) {
|
|
||||||
cancelAnimationFrame(frame);
|
|
||||||
}
|
|
||||||
frame = requestAnimationFrame(() => {
|
|
||||||
frame = null;
|
|
||||||
setHistoryViewportBucket((prev) => {
|
|
||||||
const next = getHistoryViewportBucket();
|
|
||||||
return prev === next ? prev : next;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
window.addEventListener('resize', handleResize);
|
|
||||||
return () => {
|
|
||||||
if (frame) {
|
|
||||||
cancelAnimationFrame(frame);
|
|
||||||
}
|
|
||||||
window.removeEventListener('resize', handleResize);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const historyUsageChartData = useMemo(() => ({
|
|
||||||
labels: resampledHistoryPoints.map((point) => String(point?.capturedAt || '').trim()),
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: 'CPU',
|
|
||||||
data: resampledHistoryPoints.map((point) => toNumberOrNull(point?.cpuUsagePercent)),
|
|
||||||
borderColor: CPU_SERIES_COLOR,
|
|
||||||
backgroundColor: CPU_SERIES_COLOR,
|
|
||||||
borderWidth: 2,
|
|
||||||
hidden: !usageSeriesVisible.cpu,
|
|
||||||
pointRadius: 0,
|
|
||||||
tension: 0.22
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'RAM',
|
|
||||||
data: resampledHistoryPoints.map((point) => toNumberOrNull(point?.ramUsagePercent)),
|
|
||||||
borderColor: RAM_SERIES_COLOR,
|
|
||||||
backgroundColor: RAM_SERIES_COLOR,
|
|
||||||
borderWidth: 2,
|
|
||||||
hidden: !usageSeriesVisible.ram,
|
|
||||||
pointRadius: 0,
|
|
||||||
tension: 0.22
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'GPU',
|
|
||||||
data: resampledHistoryPoints.map((point) => toNumberOrNull(point?.gpuUsagePercent)),
|
|
||||||
borderColor: GPU_SERIES_COLOR,
|
|
||||||
backgroundColor: GPU_SERIES_COLOR,
|
|
||||||
borderWidth: 2,
|
|
||||||
hidden: !usageSeriesVisible.gpu,
|
|
||||||
pointRadius: 0,
|
|
||||||
tension: 0.22
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}), [resampledHistoryPoints, usageSeriesVisible]);
|
|
||||||
|
|
||||||
const historyTempChartData = useMemo(() => ({
|
|
||||||
labels: resampledHistoryPoints.map((point) => String(point?.capturedAt || '').trim()),
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: 'CPU',
|
|
||||||
data: resampledHistoryPoints.map((point) => toNumberOrNull(point?.cpuTemperatureC)),
|
|
||||||
borderColor: CPU_SERIES_COLOR,
|
|
||||||
backgroundColor: CPU_SERIES_COLOR,
|
|
||||||
borderWidth: 2,
|
|
||||||
hidden: !tempSeriesVisible.cpu,
|
|
||||||
pointRadius: 0,
|
|
||||||
tension: 0.22
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'GPU',
|
|
||||||
data: resampledHistoryPoints.map((point) => toNumberOrNull(point?.gpuTemperatureC)),
|
|
||||||
borderColor: GPU_SERIES_COLOR,
|
|
||||||
backgroundColor: GPU_SERIES_COLOR,
|
|
||||||
borderWidth: 2,
|
|
||||||
hidden: !tempSeriesVisible.gpu,
|
|
||||||
pointRadius: 0,
|
|
||||||
tension: 0.22
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}), [resampledHistoryPoints, tempSeriesVisible]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="hardware-detail-page">
|
|
||||||
<Card className="hardware-detail-hero">
|
|
||||||
<div className="hardware-detail-hero-head">
|
|
||||||
<div>
|
|
||||||
<h2>Hardware Monitoring</h2>
|
|
||||||
<small>Ausführliche Live-Ansicht für CPU, RAM und GPU</small>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-detail-hero-tags">
|
|
||||||
<Tag value={monitoringState.enabled ? 'Aktiv' : 'Inaktiv'} severity={monitoringState.enabled ? 'success' : 'warning'} />
|
|
||||||
<Tag value={`Intervall: ${monitoringState.intervalMs > 0 ? `${monitoringState.intervalMs} ms` : '-'}`} severity="secondary" />
|
|
||||||
<Tag value={`Letztes Update: ${formatUpdatedAt(monitoringState.updatedAt)}`} severity="info" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
{!monitoringState.enabled ? (
|
|
||||||
<Card className="hardware-detail-empty">
|
|
||||||
<h3>Monitoring ist deaktiviert</h3>
|
|
||||||
<p>
|
|
||||||
Aktiviere <code>hardware_monitoring_enabled</code> in den Einstellungen,
|
|
||||||
um die Live-Ansicht auf dieser Seite zu nutzen.
|
|
||||||
</p>
|
|
||||||
<Button
|
|
||||||
label="Zu den Einstellungen"
|
|
||||||
icon="pi pi-cog"
|
|
||||||
onClick={() => navigate('/settings')}
|
|
||||||
/>
|
|
||||||
</Card>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{monitoringState.enabled && !sample ? (
|
|
||||||
<Card className="hardware-detail-empty">
|
|
||||||
<h3>Warte auf erste Messung ...</h3>
|
|
||||||
<p>Die Hardware-Metriken werden gerade aufgebaut.</p>
|
|
||||||
</Card>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{monitoringState.enabled ? (
|
|
||||||
<Card className="hardware-detail-card hardware-history-card">
|
|
||||||
<div className="hardware-detail-card-head hardware-history-card-head">
|
|
||||||
<div>
|
|
||||||
<h3>Historie</h3>
|
|
||||||
<small>
|
|
||||||
Verlauf aus Backend-Log ({historyState.totalPoints} Messpunkte, Ansicht: letzte {historyHours}h)
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-history-window-buttons">
|
|
||||||
{HISTORY_WINDOWS.map((window) => (
|
|
||||||
<Button
|
|
||||||
key={`history-window-${window.hours}`}
|
|
||||||
label={window.label}
|
|
||||||
size="small"
|
|
||||||
severity={historyHours === window.hours ? 'primary' : 'secondary'}
|
|
||||||
outlined={historyHours !== window.hours}
|
|
||||||
onClick={() => setHistoryHours(window.hours)}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{historyState.error ? <small className="error-text">{historyState.error}</small> : null}
|
|
||||||
{historyState.loading && historyPoints.length === 0 ? (
|
|
||||||
<p>Lade Verlauf ...</p>
|
|
||||||
) : resampledHistoryPoints.length === 0 ? (
|
|
||||||
<p>Noch keine Verlaufsdaten vorhanden.</p>
|
|
||||||
) : (
|
|
||||||
<div className="hardware-history-grid">
|
|
||||||
<div className="hardware-history-chart-wrap">
|
|
||||||
<h4>Auslastung (%)</h4>
|
|
||||||
<div className="hardware-history-series-toggles">
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
label="CPU"
|
|
||||||
className="hardware-series-toggle-btn"
|
|
||||||
style={buildSeriesToggleButtonStyle(CPU_SERIES_COLOR, usageSeriesVisible.cpu)}
|
|
||||||
onClick={() => setUsageSeriesVisible((prev) => ({ ...prev, cpu: !prev.cpu }))}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
label="RAM"
|
|
||||||
className="hardware-series-toggle-btn"
|
|
||||||
style={buildSeriesToggleButtonStyle(RAM_SERIES_COLOR, usageSeriesVisible.ram)}
|
|
||||||
onClick={() => setUsageSeriesVisible((prev) => ({ ...prev, ram: !prev.ram }))}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
label="GPU"
|
|
||||||
className="hardware-series-toggle-btn"
|
|
||||||
style={buildSeriesToggleButtonStyle(GPU_SERIES_COLOR, usageSeriesVisible.gpu)}
|
|
||||||
onClick={() => setUsageSeriesVisible((prev) => ({ ...prev, gpu: !prev.gpu }))}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-history-chart">
|
|
||||||
<Chart
|
|
||||||
key={`usage-${historyViewportBucket}`}
|
|
||||||
className="hardware-history-chart-canvas"
|
|
||||||
type="line"
|
|
||||||
data={historyUsageChartData}
|
|
||||||
options={historyChartOptions}
|
|
||||||
plugins={[historyDayBoundaryPlugin]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<ChartLegendRow
|
|
||||||
items={[
|
|
||||||
{ label: 'CPU', color: CPU_SERIES_COLOR },
|
|
||||||
{ label: 'RAM', color: RAM_SERIES_COLOR },
|
|
||||||
{ label: 'GPU', color: GPU_SERIES_COLOR }
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-history-chart-wrap">
|
|
||||||
<h4>Temperatur (°C)</h4>
|
|
||||||
<div className="hardware-history-series-toggles">
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
label="CPU °C"
|
|
||||||
className="hardware-series-toggle-btn"
|
|
||||||
style={buildSeriesToggleButtonStyle(CPU_SERIES_COLOR, tempSeriesVisible.cpu)}
|
|
||||||
onClick={() => setTempSeriesVisible((prev) => ({ ...prev, cpu: !prev.cpu }))}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
size="small"
|
|
||||||
label="GPU °C"
|
|
||||||
className="hardware-series-toggle-btn"
|
|
||||||
style={buildSeriesToggleButtonStyle(GPU_SERIES_COLOR, tempSeriesVisible.gpu)}
|
|
||||||
onClick={() => setTempSeriesVisible((prev) => ({ ...prev, gpu: !prev.gpu }))}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="hardware-history-chart">
|
|
||||||
<Chart
|
|
||||||
key={`temp-${historyViewportBucket}`}
|
|
||||||
className="hardware-history-chart-canvas"
|
|
||||||
type="line"
|
|
||||||
data={historyTempChartData}
|
|
||||||
options={historyChartOptions}
|
|
||||||
plugins={[historyDayBoundaryPlugin]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<ChartLegendRow
|
|
||||||
items={[
|
|
||||||
{ label: 'CPU', color: CPU_SERIES_COLOR },
|
|
||||||
{ label: 'GPU', color: GPU_SERIES_COLOR }
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Card>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{monitoringState.enabled && sample ? (
|
|
||||||
<div className="hardware-detail-grid">
|
|
||||||
<GaugeBlock
|
|
||||||
title="CPU"
|
|
||||||
subtitle={cpuTitle}
|
|
||||||
icon="pi-microchip"
|
|
||||||
valuePercent={cpu?.overallUsagePercent}
|
|
||||||
gaugeColor="#b07a24"
|
|
||||||
bars={[
|
|
||||||
{ label: 'Gesamtauslastung', valuePercent: cpu?.overallUsagePercent, valueLabel: formatPercent(cpu?.overallUsagePercent) },
|
|
||||||
{ label: 'Load Avg 1m', valuePercent: clampPercent(Number(cpu?.loadAverage?.[0]) * 100 / 8), valueLabel: Array.isArray(cpu?.loadAverage) ? String(cpu.loadAverage[0] ?? '-') : '-' }
|
|
||||||
]}
|
|
||||||
footer={(
|
|
||||||
<div className="hardware-detail-core-grid">
|
|
||||||
{cpuPerCore.length === 0 ? <small>Keine Core-Metriken verfügbar.</small> : cpuPerCore.map((core, index) => (
|
|
||||||
<div key={`cpu-core-${core?.index ?? index}`} className="hardware-detail-core-item">
|
|
||||||
<div className="hardware-detail-bar-head">
|
|
||||||
<span>Core {core?.index ?? index}</span>
|
|
||||||
<span>{formatPercent(core?.usagePercent)}</span>
|
|
||||||
</div>
|
|
||||||
<ProgressBar value={clampPercent(core?.usagePercent)} showValue={false} />
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<GaugeBlock
|
|
||||||
title="RAM"
|
|
||||||
subtitle={ramTitle}
|
|
||||||
icon="pi-server"
|
|
||||||
valuePercent={memory?.usagePercent}
|
|
||||||
gaugeColor="#9f6b1d"
|
|
||||||
bars={[
|
|
||||||
{ label: 'Verwendet', valuePercent: memory?.usagePercent, valueLabel: formatPercent(memory?.usagePercent) },
|
|
||||||
{ label: 'Belegt', valuePercent: memory?.usagePercent, valueLabel: formatBytes(memory?.usedBytes) },
|
|
||||||
{ label: 'Frei', valuePercent: Math.max(0, 100 - clampPercent(memory?.usagePercent)), valueLabel: formatBytes(memory?.freeBytes) }
|
|
||||||
]}
|
|
||||||
footer={(
|
|
||||||
<div className="hardware-detail-meter-wrap">
|
|
||||||
<div className="hardware-detail-meter-head">
|
|
||||||
<span>RAM Nutzung</span>
|
|
||||||
<span>{formatBytes(memory?.usedBytes)} / {formatBytes(memory?.totalBytes)}</span>
|
|
||||||
</div>
|
|
||||||
<ProgressBar value={clampPercent(memory?.usagePercent)} showValue={false} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<GaugeBlock
|
|
||||||
title="GPU"
|
|
||||||
subtitle={gpuTitle}
|
|
||||||
icon="pi-desktop"
|
|
||||||
valuePercent={primaryGpu?.utilizationPercent}
|
|
||||||
gaugeColor="#996521"
|
|
||||||
bars={[
|
|
||||||
{ label: '3D / Compute', valuePercent: primaryGpu?.utilizationPercent, valueLabel: formatPercent(primaryGpu?.utilizationPercent) },
|
|
||||||
{ label: 'Speicher', valuePercent: primaryGpu?.memoryUtilizationPercent, valueLabel: formatPercent(primaryGpu?.memoryUtilizationPercent) },
|
|
||||||
{ label: 'VRAM', valuePercent: primaryGpu?.memoryUtilizationPercent, valueLabel: `${formatBytes(primaryGpu?.memoryUsedBytes)} / ${formatBytes(primaryGpu?.memoryTotalBytes)}` }
|
|
||||||
]}
|
|
||||||
footer={(
|
|
||||||
<div className="hardware-detail-meter-wrap">
|
|
||||||
<div className="hardware-detail-meter-head">
|
|
||||||
<span>GPU Nutzung</span>
|
|
||||||
<span>
|
|
||||||
GPU {primaryGpu?.index ?? 0}
|
|
||||||
{primaryGpu?.name ? ` | ${primaryGpu.name}` : ''}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<ProgressBar value={clampPercent(primaryGpu?.utilizationPercent)} showValue={false} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
+190
-236
@@ -9,7 +9,6 @@ import { Tag } from 'primereact/tag';
|
|||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { api } from '../api/client';
|
import { api } from '../api/client';
|
||||||
import { useWebSocket } from '../hooks/useWebSocket';
|
|
||||||
import JobDetailDialog from '../components/JobDetailDialog';
|
import JobDetailDialog from '../components/JobDetailDialog';
|
||||||
import MetadataSelectionDialog from '../components/MetadataSelectionDialog';
|
import MetadataSelectionDialog from '../components/MetadataSelectionDialog';
|
||||||
import CdMetadataDialog from '../components/CdMetadataDialog';
|
import CdMetadataDialog from '../components/CdMetadataDialog';
|
||||||
@@ -59,7 +58,6 @@ const CD_FORMAT_LABELS = {
|
|||||||
|
|
||||||
const MULTIPART_CONTAINER_LIVE_STATUSES = new Set([
|
const MULTIPART_CONTAINER_LIVE_STATUSES = new Set([
|
||||||
'ANALYZING',
|
'ANALYZING',
|
||||||
'METADATA_LOOKUP',
|
|
||||||
'METADATA_SELECTION',
|
'METADATA_SELECTION',
|
||||||
'WAITING_FOR_USER_DECISION',
|
'WAITING_FOR_USER_DECISION',
|
||||||
'READY_TO_START',
|
'READY_TO_START',
|
||||||
@@ -446,7 +444,7 @@ function getQueueActionResult(response) {
|
|||||||
|
|
||||||
function isPipelineMetadataFlowStatus(value) {
|
function isPipelineMetadataFlowStatus(value) {
|
||||||
const normalized = String(value || '').trim().toUpperCase();
|
const normalized = String(value || '').trim().toUpperCase();
|
||||||
return ['METADATA_LOOKUP', 'METADATA_SELECTION', 'READY_TO_START', 'WAITING_FOR_USER_DECISION'].includes(normalized);
|
return ['METADATA_SELECTION', 'READY_TO_START', 'WAITING_FOR_USER_DECISION'].includes(normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeSortText(value) {
|
function normalizeSortText(value) {
|
||||||
@@ -461,63 +459,33 @@ function sanitizeRating(value) {
|
|||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeRatingValue(value) {
|
function findOmdbRatingBySource(omdbInfo, sourceName) {
|
||||||
if (value === null || value === undefined || value === '') {
|
const ratings = Array.isArray(omdbInfo?.Ratings) ? omdbInfo.Ratings : [];
|
||||||
return null;
|
const source = String(sourceName || '').trim().toLowerCase();
|
||||||
}
|
const entry = ratings.find((item) => String(item?.Source || '').trim().toLowerCase() === source);
|
||||||
const numericValue = Number(value);
|
return sanitizeRating(entry?.Value);
|
||||||
if (Number.isFinite(numericValue) && numericValue > 0) {
|
|
||||||
return numericValue.toFixed(1);
|
|
||||||
}
|
|
||||||
return sanitizeRating(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveRatings(row) {
|
function resolveRatings(row) {
|
||||||
const makemkvInfo = row?.makemkvInfo && typeof row.makemkvInfo === 'object' ? row.makemkvInfo : {};
|
const omdbInfo = row?.omdbInfo && typeof row.omdbInfo === 'object' ? row.omdbInfo : null;
|
||||||
const encodePlan = row?.encodePlan && typeof row.encodePlan === 'object' ? row.encodePlan : {};
|
if (!omdbInfo) {
|
||||||
const analyzeContext = makemkvInfo?.analyzeContext && typeof makemkvInfo.analyzeContext === 'object'
|
|
||||||
? makemkvInfo.analyzeContext
|
|
||||||
: {};
|
|
||||||
const selectedMetadata = analyzeContext?.selectedMetadata && typeof analyzeContext.selectedMetadata === 'object'
|
|
||||||
? analyzeContext.selectedMetadata
|
|
||||||
: (makemkvInfo?.selectedMetadata && typeof makemkvInfo.selectedMetadata === 'object'
|
|
||||||
? makemkvInfo.selectedMetadata
|
|
||||||
: {});
|
|
||||||
const planMetadata = encodePlan?.metadata && typeof encodePlan.metadata === 'object'
|
|
||||||
? encodePlan.metadata
|
|
||||||
: {};
|
|
||||||
const selectedTmdbDetails = selectedMetadata?.tmdbDetails && typeof selectedMetadata.tmdbDetails === 'object'
|
|
||||||
? selectedMetadata.tmdbDetails
|
|
||||||
: null;
|
|
||||||
const planTmdbDetails = planMetadata?.tmdbDetails && typeof planMetadata.tmdbDetails === 'object'
|
|
||||||
? planMetadata.tmdbDetails
|
|
||||||
: null;
|
|
||||||
const rowTmdbDetails = row?.tmdbDetails && typeof row.tmdbDetails === 'object'
|
|
||||||
? row.tmdbDetails
|
|
||||||
: null;
|
|
||||||
const tmdbDetails = selectedTmdbDetails || planTmdbDetails || rowTmdbDetails;
|
|
||||||
|
|
||||||
const tmdbRating = normalizeRatingValue(
|
|
||||||
tmdbDetails?.seasonVoteAverage
|
|
||||||
?? tmdbDetails?.voteAverage
|
|
||||||
?? tmdbDetails?.imdbRating
|
|
||||||
?? selectedMetadata?.seasonVoteAverage
|
|
||||||
?? selectedMetadata?.voteAverage
|
|
||||||
?? selectedMetadata?.imdbRating
|
|
||||||
?? planMetadata?.seasonVoteAverage
|
|
||||||
?? planMetadata?.voteAverage
|
|
||||||
?? planMetadata?.imdbRating
|
|
||||||
?? row?.voteAverage
|
|
||||||
?? row?.imdbRating
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!tmdbRating) {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const imdb = sanitizeRating(omdbInfo?.imdbRating)
|
||||||
|
|| findOmdbRatingBySource(omdbInfo, 'Internet Movie Database');
|
||||||
|
const rotten = findOmdbRatingBySource(omdbInfo, 'Rotten Tomatoes');
|
||||||
|
const metascore = sanitizeRating(omdbInfo?.Metascore);
|
||||||
|
|
||||||
const ratings = [];
|
const ratings = [];
|
||||||
if (tmdbRating) {
|
if (imdb) {
|
||||||
ratings.push({ key: 'tmdb', label: 'TMDb', value: tmdbRating });
|
ratings.push({ key: 'imdb', label: 'IMDb', value: imdb });
|
||||||
|
}
|
||||||
|
if (rotten) {
|
||||||
|
ratings.push({ key: 'rt', label: 'RT', value: rotten });
|
||||||
|
}
|
||||||
|
if (metascore) {
|
||||||
|
ratings.push({ key: 'meta', label: 'Meta', value: metascore });
|
||||||
}
|
}
|
||||||
return ratings;
|
return ratings;
|
||||||
}
|
}
|
||||||
@@ -585,7 +553,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
const [downloadFolderBusyPath, setDownloadFolderBusyPath] = useState(null);
|
const [downloadFolderBusyPath, setDownloadFolderBusyPath] = useState(null);
|
||||||
const [metadataDialogVisible, setMetadataDialogVisible] = useState(false);
|
const [metadataDialogVisible, setMetadataDialogVisible] = useState(false);
|
||||||
const [metadataDialogContext, setMetadataDialogContext] = useState(null);
|
const [metadataDialogContext, setMetadataDialogContext] = useState(null);
|
||||||
const [metadataAssignBusy, setMetadataAssignBusy] = useState(false);
|
const [omdbAssignBusy, setOmdbAssignBusy] = useState(false);
|
||||||
const [cdMetadataDialogVisible, setCdMetadataDialogVisible] = useState(false);
|
const [cdMetadataDialogVisible, setCdMetadataDialogVisible] = useState(false);
|
||||||
const [cdMetadataDialogContext, setCdMetadataDialogContext] = useState(null);
|
const [cdMetadataDialogContext, setCdMetadataDialogContext] = useState(null);
|
||||||
const [cdMetadataAssignBusy, setCdMetadataAssignBusy] = useState(false);
|
const [cdMetadataAssignBusy, setCdMetadataAssignBusy] = useState(false);
|
||||||
@@ -600,8 +568,6 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
const [conflictModalMode, setConflictModalMode] = useState('reencode'); // 'reencode' | 'delete'
|
const [conflictModalMode, setConflictModalMode] = useState('reencode'); // 'reencode' | 'delete'
|
||||||
const [conflictModalBusy, setConflictModalBusy] = useState(false);
|
const [conflictModalBusy, setConflictModalBusy] = useState(false);
|
||||||
const toastRef = useRef(null);
|
const toastRef = useRef(null);
|
||||||
const wsReloadTimerRef = useRef(null);
|
|
||||||
const progressStateByJobRef = useRef(new Map());
|
|
||||||
|
|
||||||
const queuedJobIdSet = useMemo(() => {
|
const queuedJobIdSet = useMemo(() => {
|
||||||
const next = new Set();
|
const next = new Set();
|
||||||
@@ -672,16 +638,6 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const scheduleLiveReload = (delayMs = 120) => {
|
|
||||||
if (wsReloadTimerRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wsReloadTimerRef.current = setTimeout(() => {
|
|
||||||
wsReloadTimerRef.current = null;
|
|
||||||
void load();
|
|
||||||
}, delayMs);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api.getPref('history_layout').then((res) => {
|
api.getPref('history_layout').then((res) => {
|
||||||
if (res?.value === 'list' || res?.value === 'grid') {
|
if (res?.value === 'list' || res?.value === 'grid') {
|
||||||
@@ -698,55 +654,6 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [search, status, refreshToken]);
|
}, [search, status, refreshToken]);
|
||||||
|
|
||||||
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 === 'PIPELINE_STATE_CHANGED'
|
|
||||||
|| type === 'PIPELINE_QUEUE_CHANGED'
|
|
||||||
|| type === 'DISC_DETECTED'
|
|
||||||
|| type === 'DISC_REMOVED'
|
|
||||||
) {
|
|
||||||
scheduleLiveReload(80);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type !== 'PIPELINE_PROGRESS') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = message?.payload && typeof message.payload === 'object'
|
|
||||||
? message.payload
|
|
||||||
: {};
|
|
||||||
const normalizedJobId = normalizeJobId(payload?.activeJobId);
|
|
||||||
if (!normalizedJobId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const nextState = String(payload?.state || '').trim().toUpperCase();
|
|
||||||
if (!nextState) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const key = String(normalizedJobId);
|
|
||||||
const prevState = progressStateByJobRef.current.get(key) || '';
|
|
||||||
if (nextState === prevState) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
progressStateByJobRef.current.set(key, nextState);
|
|
||||||
scheduleLiveReload(120);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
const openJobId = Number(params.get('open') || 0);
|
const openJobId = Number(params.get('open') || 0);
|
||||||
@@ -945,10 +852,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
} else if (action === 'restart_encode') {
|
} else if (action === 'restart_encode') {
|
||||||
setActionBusy(true);
|
setActionBusy(true);
|
||||||
try {
|
try {
|
||||||
const response = await api.restartEncodeWithLastSettings(job.id, {
|
const response = await api.restartEncodeWithLastSettings(job.id, options);
|
||||||
...(options || {}),
|
|
||||||
createNewJob: true
|
|
||||||
});
|
|
||||||
const result = getQueueActionResult(response);
|
const result = getQueueActionResult(response);
|
||||||
const replacementJobId = normalizeJobId(result?.jobId);
|
const replacementJobId = normalizeJobId(result?.jobId);
|
||||||
if (result.queued) {
|
if (result.queued) {
|
||||||
@@ -965,14 +869,11 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
} else if (action === 'restart_review') {
|
} else if (action === 'restart_review') {
|
||||||
const title = job?.title || job?.detected_title || `Job #${job?.id}`;
|
const title = job?.title || job?.detected_title || `Job #${job?.id}`;
|
||||||
const isAudiobookJob = resolveMediaType(job) === 'audiobook';
|
|
||||||
if (!skipConfirm) {
|
if (!skipConfirm) {
|
||||||
const confirmed = await confirmModal({
|
const confirmed = await confirmModal({
|
||||||
header: isAudiobookJob ? 'Vorprüfung starten' : 'Review neu starten',
|
header: 'Review neu starten',
|
||||||
message: isAudiobookJob
|
message: `Review für "${title}" neu starten?\nDer Job wird erneut analysiert. Spur- und Skriptauswahl kann danach im Ripper neu getroffen werden.`,
|
||||||
? `Vorprüfung für "${title}" starten?\nDer Job wird neu angelegt und kann danach im Ripper vor dem Encode angepasst werden.`
|
acceptLabel: 'Review starten',
|
||||||
: `Review für "${title}" neu starten?\nDer Job wird erneut analysiert. Spur- und Skriptauswahl kann danach im Ripper neu getroffen werden.`,
|
|
||||||
acceptLabel: isAudiobookJob ? 'Vorprüfung starten' : 'Review starten',
|
|
||||||
rejectLabel: 'Abbrechen'
|
rejectLabel: 'Abbrechen'
|
||||||
});
|
});
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
@@ -981,29 +882,19 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
setActionBusy(true);
|
setActionBusy(true);
|
||||||
try {
|
try {
|
||||||
const response = await api.restartReviewFromRaw(job.id, {
|
const response = await api.restartReviewFromRaw(job.id, options);
|
||||||
...(options || {}),
|
|
||||||
createNewJob: true
|
|
||||||
});
|
|
||||||
const result = getQueueActionResult(response);
|
const result = getQueueActionResult(response);
|
||||||
const replacementJobId = normalizeJobId(result?.jobId);
|
const replacementJobId = normalizeJobId(result?.jobId);
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: isAudiobookJob ? 'Vorprüfung gestartet' : 'Review-Neustart',
|
summary: 'Review-Neustart',
|
||||||
detail: isAudiobookJob
|
detail: 'Analyse gestartet. Job ist jetzt im Ripper verfügbar.',
|
||||||
? 'Job neu angelegt. Im Ripper können die Encode-Einstellungen angepasst werden.'
|
|
||||||
: 'Analyse gestartet. Job ist jetzt im Ripper verfügbar.',
|
|
||||||
life: 3500
|
life: 3500
|
||||||
});
|
});
|
||||||
await load();
|
await load();
|
||||||
await refreshDetailAfterReplacement(job.id, replacementJobId);
|
await refreshDetailAfterReplacement(job.id, replacementJobId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({ severity: 'error', summary: 'Review-Neustart fehlgeschlagen', detail: error.message, life: 4500 });
|
||||||
severity: 'error',
|
|
||||||
summary: isAudiobookJob ? 'Vorprüfung fehlgeschlagen' : 'Review-Neustart fehlgeschlagen',
|
|
||||||
detail: error.message,
|
|
||||||
life: 4500
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
setActionBusy(false);
|
setActionBusy(false);
|
||||||
}
|
}
|
||||||
@@ -1012,7 +903,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
if (!skipConfirm) {
|
if (!skipConfirm) {
|
||||||
const confirmed = await confirmModal({
|
const confirmed = await confirmModal({
|
||||||
header: 'CD-Vorprüfung starten',
|
header: 'CD-Vorprüfung starten',
|
||||||
message: `CD-Vorprüfung für "${title}" starten?\nTrackauswahl und Ausgabeeinstellungen werden im Ripper geöffnet.`,
|
message: `CD-Vorprüfung für "${title}" starten?\nMusicBrainz-Suche, Trackauswahl und Ausgabeeinstellungen werden im Ripper geöffnet.`,
|
||||||
acceptLabel: 'Vorprüfung starten',
|
acceptLabel: 'Vorprüfung starten',
|
||||||
rejectLabel: 'Abbrechen'
|
rejectLabel: 'Abbrechen'
|
||||||
});
|
});
|
||||||
@@ -1026,7 +917,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: 'CD-Vorprüfung gestartet',
|
summary: 'CD-Vorprüfung gestartet',
|
||||||
detail: 'Job ist jetzt im Ripper verfügbar — bitte Tracks und Einstellungen prüfen.',
|
detail: 'Job ist jetzt im Ripper verfügbar — bitte Metadaten und Einstellungen wählen.',
|
||||||
life: 4000
|
life: 4000
|
||||||
});
|
});
|
||||||
await load();
|
await load();
|
||||||
@@ -1238,8 +1129,8 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownloadOutputFolder = async (row, folderPath, ownerJobId = null) => {
|
const handleDownloadOutputFolder = async (row, folderPath) => {
|
||||||
const jobId = Number(ownerJobId || row?.id || selectedJob?.id || 0);
|
const jobId = Number(row?.id || selectedJob?.id || 0);
|
||||||
if (!jobId || !folderPath) return;
|
if (!jobId || !folderPath) return;
|
||||||
setDownloadFolderBusyPath(folderPath);
|
setDownloadFolderBusyPath(folderPath);
|
||||||
try {
|
try {
|
||||||
@@ -1314,7 +1205,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
|
|
||||||
setActionBusy(true);
|
setActionBusy(true);
|
||||||
try {
|
try {
|
||||||
const response = await api.retryJob(row.id, { createNewJob: true });
|
const response = await api.retryJob(row.id);
|
||||||
const result = getQueueActionResult(response);
|
const result = getQueueActionResult(response);
|
||||||
const replacementJobId = normalizeJobId(result?.jobId);
|
const replacementJobId = normalizeJobId(result?.jobId);
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
@@ -1378,7 +1269,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAssignMetadata = (row) => {
|
const handleAssignOmdb = (row) => {
|
||||||
const jobId = Number(row?.id || 0);
|
const jobId = Number(row?.id || 0);
|
||||||
if (!jobId) return;
|
if (!jobId) return;
|
||||||
const makemkvInfo = row?.makemkvInfo && typeof row.makemkvInfo === 'object' ? row.makemkvInfo : {};
|
const makemkvInfo = row?.makemkvInfo && typeof row.makemkvInfo === 'object' ? row.makemkvInfo : {};
|
||||||
@@ -1400,7 +1291,11 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
: (['series', 'tv', 'season', 'episode'].includes(workflowKindRaw) ? 'series' : null);
|
: (['series', 'tv', 'season', 'episode'].includes(workflowKindRaw) ? 'series' : null);
|
||||||
const rowMediaType = resolveMediaType(row);
|
const rowMediaType = resolveMediaType(row);
|
||||||
const isSeriesDvd = (rowMediaType === 'dvd' || rowMediaType === 'bluray') && isSeriesVideoJob(row);
|
const isSeriesDvd = (rowMediaType === 'dvd' || rowMediaType === 'bluray') && isSeriesVideoJob(row);
|
||||||
const metadataProvider = 'tmdb';
|
const metadataProvider = workflowKind === 'series'
|
||||||
|
? 'tmdb'
|
||||||
|
: (workflowKind === 'film'
|
||||||
|
? 'omdb'
|
||||||
|
: (String(selectedMetadata?.metadataProvider || analyzeContext?.metadataProvider || (isSeriesDvd ? 'tmdb' : 'omdb')).trim().toLowerCase() || 'omdb'));
|
||||||
const seasonNumber = selectedMetadata?.seasonNumber ?? analyzeContext?.seriesLookupHint?.seasonNumber ?? null;
|
const seasonNumber = selectedMetadata?.seasonNumber ?? analyzeContext?.seriesLookupHint?.seasonNumber ?? null;
|
||||||
const discNumber = selectedMetadata?.discNumber ?? analyzeContext?.seriesLookupHint?.discNumber ?? null;
|
const discNumber = selectedMetadata?.discNumber ?? analyzeContext?.seriesLookupHint?.discNumber ?? null;
|
||||||
const context = {
|
const context = {
|
||||||
@@ -1431,78 +1326,47 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
...(discNumber ? { discNumber } : {})
|
...(discNumber ? { discNumber } : {})
|
||||||
},
|
},
|
||||||
metadataProvider,
|
metadataProvider,
|
||||||
workflowKind: workflowKind || analyzeContext?.workflowKind || null,
|
|
||||||
metadataCandidates: Array.isArray(analyzeContext?.metadataCandidates) ? analyzeContext.metadataCandidates : [],
|
metadataCandidates: Array.isArray(analyzeContext?.metadataCandidates) ? analyzeContext.metadataCandidates : [],
|
||||||
seriesAnalysis: analyzeContext?.seriesAnalysis || null,
|
seriesAnalysis: analyzeContext?.seriesAnalysis || null,
|
||||||
seriesLookupHint: analyzeContext?.seriesLookupHint || null,
|
seriesLookupHint: analyzeContext?.seriesLookupHint || null,
|
||||||
seriesDecision: analyzeContext?.seriesDecision || null
|
omdbCandidates: []
|
||||||
};
|
};
|
||||||
setMetadataDialogContext(context);
|
setMetadataDialogContext(context);
|
||||||
setMetadataDialogVisible(true);
|
setMetadataDialogVisible(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMetadataSearch = async (query, options = {}) => {
|
const handleOmdbSearch = async (query, options = {}) => {
|
||||||
|
const provider = String(
|
||||||
|
options?.metadataProvider
|
||||||
|
|| metadataDialogContext?.metadataProvider
|
||||||
|
|| 'omdb'
|
||||||
|
).trim().toLowerCase() || 'omdb';
|
||||||
try {
|
try {
|
||||||
const tmdbSeasonHint = metadataDialogContext?.selectedMetadata?.seasonNumber
|
const tmdbSeasonHint = metadataDialogContext?.selectedMetadata?.seasonNumber
|
||||||
?? metadataDialogContext?.seriesLookupHint?.seasonNumber
|
?? metadataDialogContext?.seriesLookupHint?.seasonNumber
|
||||||
?? null;
|
?? null;
|
||||||
const filterRaw = String(options?.resultFilter || '').trim().toLowerCase();
|
const response = provider === 'tmdb'
|
||||||
const includeMovies = filterRaw !== 'series';
|
? await api.searchTmdbSeries(query, tmdbSeasonHint)
|
||||||
const includeSeries = filterRaw !== 'movies' && filterRaw !== 'movie';
|
: await api.searchOmdb(query);
|
||||||
const [movieResponse, seriesResponse] = await Promise.all([
|
return response.results || [];
|
||||||
includeMovies ? api.searchTmdbMovie(query) : Promise.resolve({ results: [] }),
|
|
||||||
includeSeries ? api.searchTmdbSeries(query, tmdbSeasonHint) : 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];
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'TMDb-Suche fehlgeschlagen',
|
summary: provider === 'tmdb' ? 'TMDb-Suche fehlgeschlagen' : 'OMDb-Suche fehlgeschlagen',
|
||||||
detail: error.message
|
detail: error.message
|
||||||
});
|
});
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMetadataSubmit = async (payload) => {
|
const handleOmdbSubmit = async (payload) => {
|
||||||
|
const provider = String(payload?.metadataProvider || metadataDialogContext?.metadataProvider || 'omdb').trim().toLowerCase() || 'omdb';
|
||||||
const submitMode = String(metadataDialogContext?.submitMode || 'assign').trim().toLowerCase() || 'assign';
|
const submitMode = String(metadataDialogContext?.submitMode || 'assign').trim().toLowerCase() || 'assign';
|
||||||
const isPipelineFlow = submitMode === 'pipeline';
|
const isPipelineFlow = submitMode === 'pipeline';
|
||||||
setMetadataAssignBusy(true);
|
setOmdbAssignBusy(true);
|
||||||
try {
|
try {
|
||||||
if (isPipelineFlow) {
|
if (isPipelineFlow) {
|
||||||
const selectResponse = await api.selectMetadata(payload);
|
await api.selectMetadata(payload);
|
||||||
const selectedJobUpdate = selectResponse?.job && typeof selectResponse.job === 'object'
|
|
||||||
? selectResponse.job
|
|
||||||
: null;
|
|
||||||
if (selectedJobUpdate?.id) {
|
|
||||||
const normalizedSelectedId = Number(selectedJobUpdate.id);
|
|
||||||
setJobs((prev) => (
|
|
||||||
Array.isArray(prev)
|
|
||||||
? prev.map((row) => (Number(row?.id || 0) === normalizedSelectedId ? { ...row, ...selectedJobUpdate } : row))
|
|
||||||
: prev
|
|
||||||
));
|
|
||||||
setSelectedJob((prev) => (
|
|
||||||
Number(prev?.id || 0) === normalizedSelectedId
|
|
||||||
? { ...(prev || {}), ...selectedJobUpdate }
|
|
||||||
: prev
|
|
||||||
));
|
|
||||||
}
|
|
||||||
setMetadataDialogVisible(false);
|
setMetadataDialogVisible(false);
|
||||||
setMetadataDialogContext(null);
|
setMetadataDialogContext(null);
|
||||||
|
|
||||||
@@ -1544,27 +1408,11 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const assignResponse = await api.assignJobMetadata(payload.jobId, payload);
|
await api.assignJobOmdb(payload.jobId, payload);
|
||||||
const assignedJobUpdate = assignResponse?.job && typeof assignResponse.job === 'object'
|
|
||||||
? assignResponse.job
|
|
||||||
: null;
|
|
||||||
if (assignedJobUpdate?.id) {
|
|
||||||
const normalizedAssignedId = Number(assignedJobUpdate.id);
|
|
||||||
setJobs((prev) => (
|
|
||||||
Array.isArray(prev)
|
|
||||||
? prev.map((row) => (Number(row?.id || 0) === normalizedAssignedId ? { ...row, ...assignedJobUpdate } : row))
|
|
||||||
: prev
|
|
||||||
));
|
|
||||||
setSelectedJob((prev) => (
|
|
||||||
Number(prev?.id || 0) === normalizedAssignedId
|
|
||||||
? { ...(prev || {}), ...assignedJobUpdate }
|
|
||||||
: prev
|
|
||||||
));
|
|
||||||
}
|
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: 'Metadaten zugewiesen',
|
summary: 'Metadaten zugewiesen',
|
||||||
detail: 'TMDb-Metadaten wurden aktualisiert.',
|
detail: provider === 'tmdb' ? 'TMDb-Metadaten wurden aktualisiert.' : 'OMDb-Metadaten wurden aktualisiert.',
|
||||||
life: 3000
|
life: 3000
|
||||||
});
|
});
|
||||||
setMetadataDialogVisible(false);
|
setMetadataDialogVisible(false);
|
||||||
@@ -1577,11 +1425,11 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
toastRef.current?.show({
|
toastRef.current?.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'TMDb-Zuweisung fehlgeschlagen',
|
summary: provider === 'tmdb' ? 'TMDb-Zuweisung fehlgeschlagen' : 'OMDb-Zuweisung fehlgeschlagen',
|
||||||
detail: error.message
|
detail: error.message
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setMetadataAssignBusy(false);
|
setOmdbAssignBusy(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1603,11 +1451,9 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
setCdMetadataDialogVisible(true);
|
setCdMetadataDialogVisible(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMusicBrainzSearch = async (query, options = {}) => {
|
const handleMusicBrainzSearch = async (query) => {
|
||||||
try {
|
try {
|
||||||
const response = await api.searchMusicBrainz(query, {
|
const response = await api.searchMusicBrainz(query);
|
||||||
trackCount: Number(options?.trackCount || 0) > 0 ? Math.trunc(Number(options.trackCount)) : null
|
|
||||||
});
|
|
||||||
return response.results || [];
|
return response.results || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastRef.current?.show({ severity: 'error', summary: 'MusicBrainz-Suche fehlgeschlagen', detail: error.message });
|
toastRef.current?.show({ severity: 'error', summary: 'MusicBrainz-Suche fehlgeschlagen', detail: error.message });
|
||||||
@@ -1748,6 +1594,71 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const refreshDeleteEntryPreview = async (jobId, selectedJobIds) => {
|
||||||
|
setDeleteEntryPreviewLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await api.getJobDeletePreview(jobId, {
|
||||||
|
includeRelated: deleteEntryIncludeRelated,
|
||||||
|
selectedJobIds
|
||||||
|
});
|
||||||
|
const preview = response?.preview || null;
|
||||||
|
const relatedJobs = Array.isArray(preview?.relatedJobs) ? preview.relatedJobs : [];
|
||||||
|
const nextSelectedJobIds = Array.isArray(preview?.selectedJobIds)
|
||||||
|
? preview.selectedJobIds.map((id) => normalizeJobId(id)).filter(Boolean)
|
||||||
|
: relatedJobs
|
||||||
|
.map((item) => normalizeJobId(item?.id))
|
||||||
|
.filter(Boolean);
|
||||||
|
setDeleteEntryPreview(preview);
|
||||||
|
setDeleteEntrySelectedJobIds(nextSelectedJobIds);
|
||||||
|
const rawCandidates = Array.isArray(preview?.pathCandidates?.raw) ? preview.pathCandidates.raw : [];
|
||||||
|
const defaultSelectedRawPaths = rawCandidates
|
||||||
|
.filter((item) => Boolean(item?.exists))
|
||||||
|
.map((item) => String(item?.path || '').trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
setDeleteEntrySelectedRawPaths(defaultSelectedRawPaths);
|
||||||
|
const movieCandidates = Array.isArray(preview?.pathCandidates?.movie) ? preview.pathCandidates.movie : [];
|
||||||
|
const defaultSelectedMoviePaths = movieCandidates
|
||||||
|
.filter((item) => Boolean(item?.exists))
|
||||||
|
.map((item) => String(item?.path || '').trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
setDeleteEntrySelectedMoviePaths(defaultSelectedMoviePaths);
|
||||||
|
} catch (error) {
|
||||||
|
toastRef.current?.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Löschvorschau fehlgeschlagen',
|
||||||
|
detail: error.message,
|
||||||
|
life: 4500
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setDeleteEntryPreviewLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleDeleteRelatedJobSelection = async (relatedJobId, checked) => {
|
||||||
|
const normalizedRelatedJobId = normalizeJobId(relatedJobId);
|
||||||
|
const dialogJobId = normalizeJobId(deleteEntryDialogRow?.id);
|
||||||
|
if (!normalizedRelatedJobId || !dialogJobId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const relatedJobs = Array.isArray(deleteEntryPreview?.relatedJobs) ? deleteEntryPreview.relatedJobs : [];
|
||||||
|
const knownJobIds = relatedJobs
|
||||||
|
.map((item) => normalizeJobId(item?.id))
|
||||||
|
.filter(Boolean);
|
||||||
|
const currentSelected = new Set(
|
||||||
|
deleteEntrySelectedJobIds
|
||||||
|
.map((item) => normalizeJobId(item))
|
||||||
|
.filter(Boolean)
|
||||||
|
);
|
||||||
|
if (checked) {
|
||||||
|
currentSelected.add(normalizedRelatedJobId);
|
||||||
|
} else {
|
||||||
|
currentSelected.delete(normalizedRelatedJobId);
|
||||||
|
}
|
||||||
|
const orderedSelected = knownJobIds.filter((jobId) => currentSelected.has(jobId));
|
||||||
|
setDeleteEntrySelectedJobIds(orderedSelected);
|
||||||
|
await refreshDeleteEntryPreview(dialogJobId, orderedSelected);
|
||||||
|
};
|
||||||
|
|
||||||
const confirmDeleteEntry = async (target) => {
|
const confirmDeleteEntry = async (target) => {
|
||||||
const normalizedTarget = String(target || '').trim().toLowerCase();
|
const normalizedTarget = String(target || '').trim().toLowerCase();
|
||||||
if (!['raw', 'movie', 'both', 'none'].includes(normalizedTarget)) {
|
if (!['raw', 'movie', 'both', 'none'].includes(normalizedTarget)) {
|
||||||
@@ -1761,6 +1672,16 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
if (!jobId) {
|
if (!jobId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const relatedJobs = Array.isArray(deleteEntryPreview?.relatedJobs) ? deleteEntryPreview.relatedJobs : [];
|
||||||
|
if (deleteEntryIncludeRelated && relatedJobs.length > 0 && deleteEntrySelectedJobIds.length === 0) {
|
||||||
|
toastRef.current?.show({
|
||||||
|
severity: 'warn',
|
||||||
|
summary: 'Historie-Auswahl erforderlich',
|
||||||
|
detail: 'Bitte mindestens einen Rip/Encode-Eintrag auswählen.',
|
||||||
|
life: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
(normalizedTarget === 'raw' || normalizedTarget === 'both')
|
(normalizedTarget === 'raw' || normalizedTarget === 'both')
|
||||||
&& rawDeleteSelectionEnabled
|
&& rawDeleteSelectionEnabled
|
||||||
@@ -1840,6 +1761,16 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
if (!jobId) {
|
if (!jobId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const relatedJobs = Array.isArray(deleteEntryPreview?.relatedJobs) ? deleteEntryPreview.relatedJobs : [];
|
||||||
|
if (deleteEntryIncludeRelated && relatedJobs.length > 0 && deleteEntrySelectedJobIds.length === 0) {
|
||||||
|
toastRef.current?.show({
|
||||||
|
severity: 'warn',
|
||||||
|
summary: 'Historie-Auswahl erforderlich',
|
||||||
|
detail: 'Bitte mindestens einen Rip/Encode-Eintrag auswählen.',
|
||||||
|
life: 3500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
(normalizedTarget === 'raw' || normalizedTarget === 'both')
|
(normalizedTarget === 'raw' || normalizedTarget === 'both')
|
||||||
&& rawDeleteSelectionEnabled
|
&& rawDeleteSelectionEnabled
|
||||||
@@ -2524,6 +2455,12 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const previewRelatedJobs = Array.isArray(deleteEntryPreview?.relatedJobs) ? deleteEntryPreview.relatedJobs : [];
|
const previewRelatedJobs = Array.isArray(deleteEntryPreview?.relatedJobs) ? deleteEntryPreview.relatedJobs : [];
|
||||||
|
const previewSelectedJobIds = Array.isArray(deleteEntryPreview?.selectedJobIds)
|
||||||
|
? deleteEntryPreview.selectedJobIds.map((item) => normalizeJobId(item)).filter(Boolean)
|
||||||
|
: previewRelatedJobs
|
||||||
|
.filter((item) => Boolean(item?.selected))
|
||||||
|
.map((item) => normalizeJobId(item?.id))
|
||||||
|
.filter(Boolean);
|
||||||
const previewRawPaths = Array.isArray(deleteEntryPreview?.pathCandidates?.raw) ? deleteEntryPreview.pathCandidates.raw : [];
|
const previewRawPaths = Array.isArray(deleteEntryPreview?.pathCandidates?.raw) ? deleteEntryPreview.pathCandidates.raw : [];
|
||||||
const previewMoviePaths = Array.isArray(deleteEntryPreview?.pathCandidates?.movie) ? deleteEntryPreview.pathCandidates.movie : [];
|
const previewMoviePaths = Array.isArray(deleteEntryPreview?.pathCandidates?.movie) ? deleteEntryPreview.pathCandidates.movie : [];
|
||||||
const deleteEntryIsMergeJob = isMultipartMergeHistoryRow(deleteEntryDialogRow);
|
const deleteEntryIsMergeJob = isMultipartMergeHistoryRow(deleteEntryDialogRow);
|
||||||
@@ -2537,10 +2474,17 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
() => new Set(deleteEntrySelectedRawPaths.map((item) => String(item || '').trim()).filter(Boolean)),
|
() => new Set(deleteEntrySelectedRawPaths.map((item) => String(item || '').trim()).filter(Boolean)),
|
||||||
[deleteEntrySelectedRawPaths]
|
[deleteEntrySelectedRawPaths]
|
||||||
);
|
);
|
||||||
|
const selectedDeleteRelatedJobSet = useMemo(
|
||||||
|
() => new Set(deleteEntrySelectedJobIds.map((item) => normalizeJobId(item)).filter(Boolean)),
|
||||||
|
[deleteEntrySelectedJobIds]
|
||||||
|
);
|
||||||
const selectedDeleteMoviePathSet = useMemo(
|
const selectedDeleteMoviePathSet = useMemo(
|
||||||
() => new Set(deleteEntrySelectedMoviePaths.map((item) => String(item || '').trim()).filter(Boolean)),
|
() => new Set(deleteEntrySelectedMoviePaths.map((item) => String(item || '').trim()).filter(Boolean)),
|
||||||
[deleteEntrySelectedMoviePaths]
|
[deleteEntrySelectedMoviePaths]
|
||||||
);
|
);
|
||||||
|
const relatedDeleteSelectionRequired = deleteEntryIncludeRelated
|
||||||
|
&& previewRelatedJobs.length > 0
|
||||||
|
&& deleteEntrySelectedJobIds.length === 0;
|
||||||
const rawDeleteSelectionRequired = !deleteEntryIsMergeJob
|
const rawDeleteSelectionRequired = !deleteEntryIsMergeJob
|
||||||
&& rawDeleteSelectionEnabled
|
&& rawDeleteSelectionEnabled
|
||||||
&& deleteEntrySelectedRawPaths.length === 0;
|
&& deleteEntrySelectedRawPaths.length === 0;
|
||||||
@@ -2627,7 +2571,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
onRestartCdReview={resolveMediaType(selectedJob) === 'converter' ? null : handleRestartCdReview}
|
onRestartCdReview={resolveMediaType(selectedJob) === 'converter' ? null : handleRestartCdReview}
|
||||||
onReencode={resolveMediaType(selectedJob) === 'converter' ? null : handleReencode}
|
onReencode={resolveMediaType(selectedJob) === 'converter' ? null : handleReencode}
|
||||||
onRetry={resolveMediaType(selectedJob) === 'converter' ? null : handleRetry}
|
onRetry={resolveMediaType(selectedJob) === 'converter' ? null : handleRetry}
|
||||||
onAssignMetadata={handleAssignMetadata}
|
onAssignOmdb={handleAssignOmdb}
|
||||||
onAssignCdMetadata={handleAssignCdMetadata}
|
onAssignCdMetadata={handleAssignCdMetadata}
|
||||||
onGenerateNfo={handleGenerateNfo}
|
onGenerateNfo={handleGenerateNfo}
|
||||||
onAcknowledgeError={handleAcknowledgeError}
|
onAcknowledgeError={handleAcknowledgeError}
|
||||||
@@ -2642,7 +2586,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
actionBusy={actionBusy}
|
actionBusy={actionBusy}
|
||||||
cancelBusy={actionBusy}
|
cancelBusy={actionBusy}
|
||||||
restoreMergeBusy={actionBusy}
|
restoreMergeBusy={actionBusy}
|
||||||
metadataAssignBusy={metadataAssignBusy}
|
omdbAssignBusy={omdbAssignBusy}
|
||||||
cdMetadataAssignBusy={cdMetadataAssignBusy}
|
cdMetadataAssignBusy={cdMetadataAssignBusy}
|
||||||
generateNfoBusy={generateNfoBusy}
|
generateNfoBusy={generateNfoBusy}
|
||||||
acknowledgeErrorBusy={acknowledgeErrorBusy}
|
acknowledgeErrorBusy={acknowledgeErrorBusy}
|
||||||
@@ -2668,7 +2612,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
modal
|
modal
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
{`Es sind ${previewRelatedJobs.length || 1} Historien-Eintrag/Einträge im Lösch-Scope enthalten.`}
|
{`Es sind ${previewRelatedJobs.length || 1} Historien-Eintrag/Einträge verknüpft. Ausgewählt: ${deleteEntrySelectedJobIds.length || previewSelectedJobIds.length || 0}.`}
|
||||||
</p>
|
</p>
|
||||||
<small className="history-dv-subtle">
|
<small className="history-dv-subtle">
|
||||||
{deleteEntryIsMergeJob
|
{deleteEntryIsMergeJob
|
||||||
@@ -2692,19 +2636,29 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
<ul className="history-delete-preview-list">
|
<ul className="history-delete-preview-list">
|
||||||
{previewRelatedJobs.map((item) => (
|
{previewRelatedJobs.map((item) => (
|
||||||
<li key={`delete-related-${item.id}`}>
|
<li key={`delete-related-${item.id}`}>
|
||||||
<span>
|
<label className="history-delete-preview-checkbox-row">
|
||||||
<strong>#{item.id}</strong>
|
<input
|
||||||
{' '}| {item.title || '-'}
|
type="checkbox"
|
||||||
{' '}| {item.roleLabel || 'Job'}
|
checked={selectedDeleteRelatedJobSet.has(normalizeJobId(item?.id))}
|
||||||
{' '}| {getStatusLabel(item.status)}
|
onChange={(event) => toggleDeleteRelatedJobSelection(item.id, Boolean(event.target.checked))}
|
||||||
{' '}{item.isPrimary ? '(aktuell)' : '(verknüpft)'}
|
/>
|
||||||
</span>
|
<span>
|
||||||
|
<strong>#{item.id}</strong>
|
||||||
|
{' '}| {item.title || '-'}
|
||||||
|
{' '}| {item.roleLabel || 'Job'}
|
||||||
|
{' '}| {getStatusLabel(item.status)}
|
||||||
|
{' '}{item.isPrimary ? '(aktuell)' : '(verknüpft)'}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
<small className="history-dv-subtle">Keine verknüpften Alt-Einträge erkannt.</small>
|
<small className="history-dv-subtle">Keine verknüpften Alt-Einträge erkannt.</small>
|
||||||
)}
|
)}
|
||||||
|
{relatedDeleteSelectionRequired ? (
|
||||||
|
<small className="history-dv-subtle">Bitte mindestens einen Historien-Eintrag auswählen.</small>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!deleteEntryIsMergeJob ? (
|
{!deleteEntryIsMergeJob ? (
|
||||||
@@ -2797,7 +2751,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
outlined
|
outlined
|
||||||
onClick={() => confirmDeleteEntry('movie')}
|
onClick={() => confirmDeleteEntry('movie')}
|
||||||
loading={deleteEntryTargetBusy === 'movie'}
|
loading={deleteEntryTargetBusy === 'movie'}
|
||||||
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired}
|
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@@ -2808,7 +2762,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
outlined
|
outlined
|
||||||
onClick={() => confirmDeleteEntry('raw')}
|
onClick={() => confirmDeleteEntry('raw')}
|
||||||
loading={deleteEntryTargetBusy === 'raw'}
|
loading={deleteEntryTargetBusy === 'raw'}
|
||||||
disabled={deleteTargetActionsDisabled || rawDeleteSelectionRequired}
|
disabled={deleteTargetActionsDisabled || rawDeleteSelectionRequired || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
label={`Eintrag + nur ${deleteEntryOutputShortLabel}`}
|
label={`Eintrag + nur ${deleteEntryOutputShortLabel}`}
|
||||||
@@ -2817,7 +2771,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
outlined
|
outlined
|
||||||
onClick={() => confirmDeleteEntry('movie')}
|
onClick={() => confirmDeleteEntry('movie')}
|
||||||
loading={deleteEntryTargetBusy === 'movie'}
|
loading={deleteEntryTargetBusy === 'movie'}
|
||||||
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired}
|
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
label={`Eintrag + RAW & ${deleteEntryOutputShortLabel}`}
|
label={`Eintrag + RAW & ${deleteEntryOutputShortLabel}`}
|
||||||
@@ -2825,7 +2779,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
severity="danger"
|
severity="danger"
|
||||||
onClick={() => confirmDeleteEntry('both')}
|
onClick={() => confirmDeleteEntry('both')}
|
||||||
loading={deleteEntryTargetBusy === 'both'}
|
loading={deleteEntryTargetBusy === 'both'}
|
||||||
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || rawDeleteSelectionRequired}
|
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || rawDeleteSelectionRequired || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -2837,7 +2791,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
outlined
|
outlined
|
||||||
onClick={() => confirmDeleteFilesOnly('both')}
|
onClick={() => confirmDeleteFilesOnly('both')}
|
||||||
loading={deleteEntryTargetBusy === 'files-both'}
|
loading={deleteEntryTargetBusy === 'files-both'}
|
||||||
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || rawDeleteSelectionRequired}
|
disabled={deleteTargetActionsDisabled || movieDeleteSelectionRequired || rawDeleteSelectionRequired || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<Button
|
<Button
|
||||||
@@ -2847,7 +2801,7 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
outlined
|
outlined
|
||||||
onClick={() => confirmDeleteEntry('none')}
|
onClick={() => confirmDeleteEntry('none')}
|
||||||
loading={deleteEntryTargetBusy === 'none'}
|
loading={deleteEntryTargetBusy === 'none'}
|
||||||
disabled={deleteTargetActionsDisabled}
|
disabled={deleteTargetActionsDisabled || relatedDeleteSelectionRequired}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="Abbrechen"
|
label="Abbrechen"
|
||||||
@@ -2866,9 +2820,9 @@ export default function HistoryPage({ refreshToken = 0 }) {
|
|||||||
setMetadataDialogVisible(false);
|
setMetadataDialogVisible(false);
|
||||||
setMetadataDialogContext(null);
|
setMetadataDialogContext(null);
|
||||||
}}
|
}}
|
||||||
onSubmit={handleMetadataSubmit}
|
onSubmit={handleOmdbSubmit}
|
||||||
onSearch={handleMetadataSearch}
|
onSearch={handleOmdbSearch}
|
||||||
busy={metadataAssignBusy}
|
busy={omdbAssignBusy}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CdMetadataDialog
|
<CdMetadataDialog
|
||||||
|
|||||||
@@ -0,0 +1,357 @@
|
|||||||
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Card } from 'primereact/card';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { InputText } from 'primereact/inputtext';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
import { Paginator } from 'primereact/paginator';
|
||||||
|
import { api } from '../api/client';
|
||||||
|
import { classifyJob } from '../utils/jobTaxonomy';
|
||||||
|
import { getStatusLabel, getStatusSeverity, normalizeStatus } from '../utils/statusPresentation';
|
||||||
|
|
||||||
|
const ACTIVE_STATUSES = [
|
||||||
|
'ANALYZING',
|
||||||
|
'METADATA_SELECTION',
|
||||||
|
'WAITING_FOR_USER_DECISION',
|
||||||
|
'READY_TO_START',
|
||||||
|
'MEDIAINFO_CHECK',
|
||||||
|
'READY_TO_ENCODE',
|
||||||
|
'RIPPING',
|
||||||
|
'ENCODING',
|
||||||
|
'CD_METADATA_SELECTION',
|
||||||
|
'CD_READY_TO_RIP',
|
||||||
|
'CD_ANALYZING',
|
||||||
|
'CD_RIPPING',
|
||||||
|
'CD_ENCODING'
|
||||||
|
];
|
||||||
|
|
||||||
|
const STATUS_FILTERS = [
|
||||||
|
{ key: 'all', label: 'Alle' },
|
||||||
|
{ key: 'active', label: 'Aktiv' },
|
||||||
|
{ key: 'errors', label: 'Fehler/Abbruch' }
|
||||||
|
];
|
||||||
|
|
||||||
|
const VIEW_FILTERS = [
|
||||||
|
{ key: 'all', label: 'Alle Jobs' },
|
||||||
|
{ key: 'ripper', label: 'Ripper-View' },
|
||||||
|
{ key: 'converter', label: 'Converter-View' },
|
||||||
|
{ key: 'audiobook', label: 'Audiobooks' }
|
||||||
|
];
|
||||||
|
|
||||||
|
function normalizeJobId(value) {
|
||||||
|
const parsed = Number(value);
|
||||||
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Math.trunc(parsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatUpdatedAt(value) {
|
||||||
|
if (!value) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
const parsed = new Date(value);
|
||||||
|
if (Number.isNaN(parsed.getTime())) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return parsed.toLocaleString('de-DE');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getKindLabel(meta) {
|
||||||
|
if (meta.family === 'converter') {
|
||||||
|
if (meta.converterMediaType === 'audio') {
|
||||||
|
return 'Converter Audio';
|
||||||
|
}
|
||||||
|
if (meta.converterMediaType === 'iso') {
|
||||||
|
return 'Converter ISO';
|
||||||
|
}
|
||||||
|
return 'Converter Video';
|
||||||
|
}
|
||||||
|
if (meta.family === 'audiobook') {
|
||||||
|
return 'Audiobook';
|
||||||
|
}
|
||||||
|
if (meta.mediaType === 'bluray') {
|
||||||
|
return 'Blu-ray';
|
||||||
|
}
|
||||||
|
if (meta.mediaType === 'dvd') {
|
||||||
|
return 'DVD';
|
||||||
|
}
|
||||||
|
if (meta.mediaType === 'cd') {
|
||||||
|
return 'CD';
|
||||||
|
}
|
||||||
|
return 'Sonstiges';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getKindSeverity(meta) {
|
||||||
|
if (meta.family === 'converter') {
|
||||||
|
return 'info';
|
||||||
|
}
|
||||||
|
if (meta.family === 'audiobook') {
|
||||||
|
return 'warning';
|
||||||
|
}
|
||||||
|
if (meta.mediaType === 'bluray' || meta.mediaType === 'dvd') {
|
||||||
|
return 'success';
|
||||||
|
}
|
||||||
|
return 'secondary';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function JobsInboxPage() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [jobs, setJobs] = useState([]);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [viewFilter, setViewFilter] = useState('all');
|
||||||
|
const [statusFilter, setStatusFilter] = useState('all');
|
||||||
|
const [search, setSearch] = useState('');
|
||||||
|
const [queuedJobIds, setQueuedJobIds] = useState(new Set());
|
||||||
|
const [lastUpdatedAt, setLastUpdatedAt] = useState(null);
|
||||||
|
const [first, setFirst] = useState(0);
|
||||||
|
const [rows, setRows] = useState(25);
|
||||||
|
|
||||||
|
const loadJobs = useCallback(async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const query = { limit: 500, lite: true };
|
||||||
|
if (statusFilter === 'active') {
|
||||||
|
query.statuses = ACTIVE_STATUSES;
|
||||||
|
} else if (statusFilter === 'errors') {
|
||||||
|
query.statuses = ['ERROR', 'CANCELLED'];
|
||||||
|
}
|
||||||
|
|
||||||
|
const [jobsResponse, queueResponse] = await Promise.allSettled([
|
||||||
|
api.getJobs(query),
|
||||||
|
api.getPipelineQueue()
|
||||||
|
]);
|
||||||
|
|
||||||
|
const nextJobs = jobsResponse.status === 'fulfilled' && Array.isArray(jobsResponse.value?.jobs)
|
||||||
|
? jobsResponse.value.jobs
|
||||||
|
: [];
|
||||||
|
setJobs(nextJobs);
|
||||||
|
|
||||||
|
if (queueResponse.status === 'fulfilled') {
|
||||||
|
const rows = Array.isArray(queueResponse.value?.queue?.queuedJobs)
|
||||||
|
? queueResponse.value.queue.queuedJobs
|
||||||
|
: [];
|
||||||
|
setQueuedJobIds(new Set(rows.map((item) => normalizeJobId(item?.jobId)).filter(Boolean)));
|
||||||
|
} else {
|
||||||
|
setQueuedJobIds(new Set());
|
||||||
|
}
|
||||||
|
setLastUpdatedAt(new Date().toISOString());
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}, [statusFilter]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadJobs();
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
loadJobs().catch(() => null);
|
||||||
|
}, 7000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, [loadJobs]);
|
||||||
|
|
||||||
|
const jobsWithMeta = useMemo(() => (
|
||||||
|
jobs.map((job) => ({
|
||||||
|
job,
|
||||||
|
meta: classifyJob(job)
|
||||||
|
}))
|
||||||
|
), [jobs]);
|
||||||
|
|
||||||
|
const viewCounts = useMemo(() => {
|
||||||
|
let all = 0;
|
||||||
|
let ripper = 0;
|
||||||
|
let converter = 0;
|
||||||
|
let audiobook = 0;
|
||||||
|
for (const item of jobsWithMeta) {
|
||||||
|
all += 1;
|
||||||
|
if (item.meta.family === 'converter') {
|
||||||
|
converter += 1;
|
||||||
|
} else {
|
||||||
|
ripper += 1;
|
||||||
|
}
|
||||||
|
if (item.meta.family === 'audiobook') {
|
||||||
|
audiobook += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { all, ripper, converter, audiobook };
|
||||||
|
}, [jobsWithMeta]);
|
||||||
|
|
||||||
|
const filteredRows = useMemo(() => {
|
||||||
|
const normalizedSearch = String(search || '').trim().toLowerCase();
|
||||||
|
return jobsWithMeta.filter(({ job, meta }) => {
|
||||||
|
if (viewFilter === 'ripper' && meta.family === 'converter') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (viewFilter === 'converter' && meta.family !== 'converter') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (viewFilter === 'audiobook' && meta.family !== 'audiobook') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!normalizedSearch) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const haystack = [
|
||||||
|
job?.title,
|
||||||
|
job?.detected_title,
|
||||||
|
job?.imdb_id,
|
||||||
|
job?.status,
|
||||||
|
job?.job_kind,
|
||||||
|
job?.media_type
|
||||||
|
]
|
||||||
|
.map((value) => String(value || '').trim().toLowerCase())
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(' ');
|
||||||
|
return haystack.includes(normalizedSearch);
|
||||||
|
});
|
||||||
|
}, [jobsWithMeta, search, viewFilter]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setFirst(0);
|
||||||
|
}, [viewFilter, statusFilter, search]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (filteredRows.length === 0) {
|
||||||
|
if (first !== 0) {
|
||||||
|
setFirst(0);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (first >= filteredRows.length) {
|
||||||
|
const pageStart = Math.max(0, Math.floor((filteredRows.length - 1) / rows) * rows);
|
||||||
|
setFirst(pageStart);
|
||||||
|
}
|
||||||
|
}, [filteredRows.length, first, rows]);
|
||||||
|
|
||||||
|
const pagedRows = useMemo(
|
||||||
|
() => filteredRows.slice(first, first + rows),
|
||||||
|
[filteredRows, first, rows]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title="Job Inbox"
|
||||||
|
subTitle="Zentrale Jobliste mit denselben Datensätzen für Ripper-, Converter- und Audiobook-Sicht."
|
||||||
|
>
|
||||||
|
<div className="job-inbox-toolbar">
|
||||||
|
<div className="job-inbox-filter-row">
|
||||||
|
{VIEW_FILTERS.map((filter) => {
|
||||||
|
const isActive = filter.key === viewFilter;
|
||||||
|
const count = viewCounts[filter.key] ?? 0;
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={filter.key}
|
||||||
|
label={`${filter.label} (${count})`}
|
||||||
|
className={isActive ? 'job-inbox-filter-active' : 'job-inbox-filter'}
|
||||||
|
outlined={!isActive}
|
||||||
|
onClick={() => setViewFilter(filter.key)}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="job-inbox-filter-row">
|
||||||
|
{STATUS_FILTERS.map((filter) => {
|
||||||
|
const isActive = filter.key === statusFilter;
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={filter.key}
|
||||||
|
label={filter.label}
|
||||||
|
className={isActive ? 'job-inbox-filter-active' : 'job-inbox-filter'}
|
||||||
|
outlined={!isActive}
|
||||||
|
onClick={() => setStatusFilter(filter.key)}
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<Button
|
||||||
|
label="Aktualisieren"
|
||||||
|
icon="pi pi-refresh"
|
||||||
|
outlined
|
||||||
|
size="small"
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => {
|
||||||
|
loadJobs().catch(() => null);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="job-inbox-search-row">
|
||||||
|
<InputText
|
||||||
|
value={search}
|
||||||
|
onChange={(event) => setSearch(event.target.value)}
|
||||||
|
placeholder="Suche nach Titel, Status oder IMDB-ID"
|
||||||
|
className="job-inbox-search-input"
|
||||||
|
/>
|
||||||
|
<small>
|
||||||
|
Letztes Update: {formatUpdatedAt(lastUpdatedAt)} | Treffer: {filteredRows.length}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="job-inbox-list">
|
||||||
|
{loading && filteredRows.length === 0 ? (
|
||||||
|
<p>Inbox wird geladen ...</p>
|
||||||
|
) : filteredRows.length === 0 ? (
|
||||||
|
<p>Keine Jobs für den aktuellen Filter gefunden.</p>
|
||||||
|
) : (
|
||||||
|
pagedRows.map(({ job, meta }) => {
|
||||||
|
const jobId = normalizeJobId(job?.id);
|
||||||
|
if (!jobId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const isQueued = queuedJobIds.has(jobId);
|
||||||
|
const normalizedStatus = normalizeStatus(job?.status);
|
||||||
|
const targetPath = meta.family === 'converter' ? '/converter' : '/ripper';
|
||||||
|
const jobTitle = String(job?.title || job?.detected_title || '').trim() || `Job #${jobId}`;
|
||||||
|
return (
|
||||||
|
<article key={jobId} className="job-inbox-row">
|
||||||
|
<div className="job-inbox-row-main">
|
||||||
|
<strong>#{jobId} | {jobTitle}</strong>
|
||||||
|
<small>
|
||||||
|
Status: {getStatusLabel(normalizedStatus, { queued: isQueued })}
|
||||||
|
{' | '}
|
||||||
|
Aktualisiert: {formatUpdatedAt(job?.updated_at || job?.created_at || null)}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
<div className="job-inbox-row-tags">
|
||||||
|
<Tag value={getKindLabel(meta)} severity={getKindSeverity(meta)} />
|
||||||
|
<Tag
|
||||||
|
value={getStatusLabel(normalizedStatus, { queued: isQueued })}
|
||||||
|
severity={getStatusSeverity(normalizedStatus, { queued: isQueued })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="job-inbox-row-actions">
|
||||||
|
<Button
|
||||||
|
label={meta.family === 'converter' ? 'Im Converter öffnen' : 'Im Ripper öffnen'}
|
||||||
|
icon={meta.family === 'converter' ? 'pi pi-external-link' : 'pi pi-arrow-right'}
|
||||||
|
outlined
|
||||||
|
size="small"
|
||||||
|
onClick={() => navigate(targetPath)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{filteredRows.length > 0 ? (
|
||||||
|
<div className="job-inbox-pagination">
|
||||||
|
<Paginator
|
||||||
|
first={first}
|
||||||
|
rows={rows}
|
||||||
|
totalRecords={filteredRows.length}
|
||||||
|
rowsPerPageOptions={[25, 50, 100]}
|
||||||
|
onPageChange={(event) => {
|
||||||
|
setFirst(event.first);
|
||||||
|
setRows(event.rows);
|
||||||
|
}}
|
||||||
|
template="PrevPageLink PageLinks NextPageLink RowsPerPageDropdown CurrentPageReport"
|
||||||
|
currentPageReportTemplate="{first} - {last} von {totalRecords}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
+399
-1162
File diff suppressed because it is too large.
Load diff
@@ -14,16 +14,6 @@ import CronJobsTab from '../components/CronJobsTab';
|
|||||||
import { confirmModal } from '../utils/confirmModal';
|
import { confirmModal } from '../utils/confirmModal';
|
||||||
|
|
||||||
const EXPERT_MODE_SETTING_KEY = 'ui_expert_mode';
|
const EXPERT_MODE_SETTING_KEY = 'ui_expert_mode';
|
||||||
const USER_PRESET_DEFAULT_SLOTS = Object.freeze([
|
|
||||||
{ key: 'bluray_movie', label: 'Standard-Userpreset für BluRay Film', mediaType: 'bluray' },
|
|
||||||
{ key: 'bluray_series', label: 'Standard-Userpreset für BluRay Serie', mediaType: 'bluray' },
|
|
||||||
{ key: 'dvd_movie', label: 'Standard-Userpreset für DVD Film', mediaType: 'dvd' },
|
|
||||||
{ key: 'dvd_series', label: 'Standard-Userpreset für DVD Serie', mediaType: 'dvd' }
|
|
||||||
]);
|
|
||||||
|
|
||||||
const EMPTY_USER_PRESET_DEFAULTS = Object.freeze(
|
|
||||||
USER_PRESET_DEFAULT_SLOTS.reduce((acc, slot) => ({ ...acc, [slot.key]: null }), {})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Validates template/string fields: only letters, digits, space, _, -, and {placeholders} allowed
|
// Validates template/string fields: only letters, digits, space, _, -, and {placeholders} allowed
|
||||||
function validateSettingValue(key, value) {
|
function validateSettingValue(key, value) {
|
||||||
@@ -55,115 +45,6 @@ function buildValuesMap(categories) {
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePositiveId(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 normalizeUserPresetDefaultsMap(raw = {}) {
|
|
||||||
const source = raw && typeof raw === 'object' ? raw : {};
|
|
||||||
const normalized = { ...EMPTY_USER_PRESET_DEFAULTS };
|
|
||||||
for (const slot of USER_PRESET_DEFAULT_SLOTS) {
|
|
||||||
normalized[slot.key] = normalizePositiveId(source[slot.key]);
|
|
||||||
}
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeRunningChainIds(rawPayload) {
|
|
||||||
const payload = rawPayload && typeof rawPayload === 'object' ? rawPayload : {};
|
|
||||||
const active = Array.isArray(payload.active) ? payload.active : [];
|
|
||||||
const ids = [];
|
|
||||||
const seen = new Set();
|
|
||||||
for (const item of active) {
|
|
||||||
const type = String(item?.type || '').trim().toLowerCase();
|
|
||||||
if (type !== 'chain') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const chainIdRaw = Number(item?.chainId || 0);
|
|
||||||
if (!Number.isFinite(chainIdRaw) || chainIdRaw <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const chainId = Math.trunc(chainIdRaw);
|
|
||||||
if (seen.has(chainId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
seen.add(chainId);
|
|
||||||
ids.push(chainId);
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isLikelyNetworkRequestError(error) {
|
|
||||||
if (!error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const status = Number(error?.status);
|
|
||||||
if (Number.isFinite(status) && status > 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const message = String(error?.message || '').trim().toLowerCase();
|
|
||||||
if (!message) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
message.includes('failed to fetch')
|
|
||||||
|| message.includes('networkerror')
|
|
||||||
|| message.includes('network error')
|
|
||||||
|| message.includes('load failed')
|
|
||||||
|| message.includes('timeout')
|
|
||||||
|| message.includes('aborted')
|
|
||||||
|| message.includes('socket hang up')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isPresetCompatibleWithSlot(preset, slotMediaType) {
|
|
||||||
const mediaType = String(preset?.mediaType || '').trim().toLowerCase();
|
|
||||||
if (mediaType === 'all') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return mediaType === slotMediaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildUserPresetDefaultOptions(userPresets, slotMediaType, selectedPresetId = null) {
|
|
||||||
const presets = Array.isArray(userPresets) ? userPresets : [];
|
|
||||||
const options = [{ label: '(keine Standardzuordnung)', value: null }];
|
|
||||||
const seen = new Set([null]);
|
|
||||||
|
|
||||||
for (const preset of presets) {
|
|
||||||
const presetId = normalizePositiveId(preset?.id);
|
|
||||||
if (!presetId || !isPresetCompatibleWithSlot(preset, slotMediaType)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
seen.add(presetId);
|
|
||||||
options.push({
|
|
||||||
label: `#${presetId} - ${preset?.name || 'Preset'}`,
|
|
||||||
value: presetId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const normalizedSelectedId = normalizePositiveId(selectedPresetId);
|
|
||||||
if (normalizedSelectedId && !seen.has(normalizedSelectedId)) {
|
|
||||||
const existingPreset = presets.find((preset) => normalizePositiveId(preset?.id) === normalizedSelectedId);
|
|
||||||
options.push({
|
|
||||||
label: existingPreset
|
|
||||||
? `#${normalizedSelectedId} - ${existingPreset?.name || 'Preset'} (nicht kompatibel)`
|
|
||||||
: `#${normalizedSelectedId} - (nicht gefunden)`,
|
|
||||||
value: normalizedSelectedId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isSameValue(a, b) {
|
function isSameValue(a, b) {
|
||||||
if (typeof a === 'number' && typeof b === 'number') {
|
if (typeof a === 'number' && typeof b === 'number') {
|
||||||
return Number(a) === Number(b);
|
return Number(a) === Number(b);
|
||||||
@@ -319,10 +200,9 @@ export default function SettingsPage() {
|
|||||||
const [chainSaving, setChainSaving] = useState(false);
|
const [chainSaving, setChainSaving] = useState(false);
|
||||||
const [chainReordering, setChainReordering] = useState(false);
|
const [chainReordering, setChainReordering] = useState(false);
|
||||||
const [chainListDragSourceId, setChainListDragSourceId] = useState(null);
|
const [chainListDragSourceId, setChainListDragSourceId] = useState(null);
|
||||||
const [chainActionBusyIds, setChainActionBusyIds] = useState(() => new Set());
|
const [chainActionBusyId, setChainActionBusyId] = useState(null);
|
||||||
const [runningChainIds, setRunningChainIds] = useState([]);
|
|
||||||
const [lastChainTestResult, setLastChainTestResult] = useState(null);
|
const [lastChainTestResult, setLastChainTestResult] = useState(null);
|
||||||
const [chainEditor, setChainEditor] = useState({ open: false, id: null, name: '', description: '', steps: [] });
|
const [chainEditor, setChainEditor] = useState({ open: false, id: null, name: '', steps: [] });
|
||||||
const [chainEditorErrors, setChainEditorErrors] = useState({});
|
const [chainEditorErrors, setChainEditorErrors] = useState({});
|
||||||
const [chainDragSource, setChainDragSource] = useState(null);
|
const [chainDragSource, setChainDragSource] = useState(null);
|
||||||
|
|
||||||
@@ -333,10 +213,6 @@ export default function SettingsPage() {
|
|||||||
const [userPresets, setUserPresets] = useState([]);
|
const [userPresets, setUserPresets] = useState([]);
|
||||||
const [userPresetsLoading, setUserPresetsLoading] = useState(false);
|
const [userPresetsLoading, setUserPresetsLoading] = useState(false);
|
||||||
const [userPresetSaving, setUserPresetSaving] = useState(false);
|
const [userPresetSaving, setUserPresetSaving] = useState(false);
|
||||||
const [userPresetDefaults, setUserPresetDefaults] = useState(EMPTY_USER_PRESET_DEFAULTS);
|
|
||||||
const [userPresetDefaultsDraft, setUserPresetDefaultsDraft] = useState(EMPTY_USER_PRESET_DEFAULTS);
|
|
||||||
const [userPresetDefaultsLoading, setUserPresetDefaultsLoading] = useState(false);
|
|
||||||
const [userPresetDefaultsSaving, setUserPresetDefaultsSaving] = useState(false);
|
|
||||||
const [userPresetEditor, setUserPresetEditor] = useState({
|
const [userPresetEditor, setUserPresetEditor] = useState({
|
||||||
open: false,
|
open: false,
|
||||||
id: null,
|
id: null,
|
||||||
@@ -359,44 +235,6 @@ export default function SettingsPage() {
|
|||||||
),
|
),
|
||||||
[handBrakePresetSourceOptions, userPresetEditor.handbrakePreset]
|
[handBrakePresetSourceOptions, userPresetEditor.handbrakePreset]
|
||||||
);
|
);
|
||||||
const userPresetDefaultsDirty = useMemo(
|
|
||||||
() => USER_PRESET_DEFAULT_SLOTS.some((slot) => (
|
|
||||||
normalizePositiveId(userPresetDefaultsDraft?.[slot.key]) !== normalizePositiveId(userPresetDefaults?.[slot.key])
|
|
||||||
)),
|
|
||||||
[userPresetDefaultsDraft, userPresetDefaults]
|
|
||||||
);
|
|
||||||
const userPresetDefaultOptionsBySlot = useMemo(() => {
|
|
||||||
const next = {};
|
|
||||||
for (const slot of USER_PRESET_DEFAULT_SLOTS) {
|
|
||||||
next[slot.key] = buildUserPresetDefaultOptions(
|
|
||||||
userPresets,
|
|
||||||
slot.mediaType,
|
|
||||||
userPresetDefaultsDraft?.[slot.key]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return next;
|
|
||||||
}, [userPresets, userPresetDefaultsDraft]);
|
|
||||||
const runningChainIdSet = useMemo(
|
|
||||||
() => new Set(Array.isArray(runningChainIds) ? runningChainIds : []),
|
|
||||||
[runningChainIds]
|
|
||||||
);
|
|
||||||
|
|
||||||
const setChainActionBusy = (chainId, busyFlag) => {
|
|
||||||
const normalizedId = Number(chainId);
|
|
||||||
if (!Number.isFinite(normalizedId) || normalizedId <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const targetId = Math.trunc(normalizedId);
|
|
||||||
setChainActionBusyIds((prev) => {
|
|
||||||
const next = new Set(prev);
|
|
||||||
if (busyFlag) {
|
|
||||||
next.add(targetId);
|
|
||||||
} else {
|
|
||||||
next.delete(targetId);
|
|
||||||
}
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadScripts = async ({ silent = false } = {}) => {
|
const loadScripts = async ({ silent = false } = {}) => {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
@@ -453,35 +291,6 @@ export default function SettingsPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadUserPresetDefaults = async ({ silent = false } = {}) => {
|
|
||||||
if (!silent) {
|
|
||||||
setUserPresetDefaultsLoading(true);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const response = await api.getUserPresetDefaults();
|
|
||||||
const normalized = normalizeUserPresetDefaultsMap(response?.defaults || {});
|
|
||||||
setUserPresetDefaults(normalized);
|
|
||||||
setUserPresetDefaultsDraft(normalized);
|
|
||||||
} catch (error) {
|
|
||||||
if (!silent) {
|
|
||||||
toastRef.current?.show({ severity: 'error', summary: 'Preset-Standards', detail: error.message });
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (!silent) {
|
|
||||||
setUserPresetDefaultsLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const refreshRunningChains = async () => {
|
|
||||||
try {
|
|
||||||
const response = await api.getRuntimeActivities();
|
|
||||||
setRunningChainIds(normalizeRunningChainIds(response));
|
|
||||||
} catch (_error) {
|
|
||||||
// ignore polling errors
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openNewUserPreset = () => {
|
const openNewUserPreset = () => {
|
||||||
setUserPresetEditor({ open: true, id: null, name: '', mediaType: 'all', handbrakePreset: '', extraArgs: '', description: '' });
|
setUserPresetEditor({ open: true, id: null, name: '', mediaType: 'all', handbrakePreset: '', extraArgs: '', description: '' });
|
||||||
setUserPresetErrors({});
|
setUserPresetErrors({});
|
||||||
@@ -543,59 +352,12 @@ export default function SettingsPage() {
|
|||||||
try {
|
try {
|
||||||
await api.deleteUserPreset(presetId);
|
await api.deleteUserPreset(presetId);
|
||||||
toastRef.current?.show({ severity: 'success', summary: 'Preset', detail: 'Preset gelöscht.' });
|
toastRef.current?.show({ severity: 'success', summary: 'Preset', detail: 'Preset gelöscht.' });
|
||||||
await Promise.all([
|
await loadUserPresets({ silent: true });
|
||||||
loadUserPresets({ silent: true }),
|
|
||||||
loadUserPresetDefaults({ silent: true })
|
|
||||||
]);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastRef.current?.show({ severity: 'error', summary: 'Preset löschen', detail: error.message });
|
toastRef.current?.show({ severity: 'error', summary: 'Preset löschen', detail: error.message });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeUserPresetDefault = (slotKey, rawValue) => {
|
|
||||||
const normalized = normalizePositiveId(rawValue);
|
|
||||||
setUserPresetDefaultsDraft((prev) => ({
|
|
||||||
...prev,
|
|
||||||
[slotKey]: normalized
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleResetUserPresetDefaults = () => {
|
|
||||||
setUserPresetDefaultsDraft({ ...userPresetDefaults });
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSaveUserPresetDefaults = async () => {
|
|
||||||
if (!userPresetDefaultsDirty) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'info',
|
|
||||||
summary: 'Preset-Standards',
|
|
||||||
detail: 'Keine Änderungen zum Speichern.'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setUserPresetDefaultsSaving(true);
|
|
||||||
try {
|
|
||||||
const payload = normalizeUserPresetDefaultsMap(userPresetDefaultsDraft);
|
|
||||||
const response = await api.updateUserPresetDefaults(payload);
|
|
||||||
const normalized = normalizeUserPresetDefaultsMap(response?.defaults || payload);
|
|
||||||
setUserPresetDefaults(normalized);
|
|
||||||
setUserPresetDefaultsDraft(normalized);
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Preset-Standards',
|
|
||||||
detail: 'Standard-Zuordnungen gespeichert.'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Preset-Standards',
|
|
||||||
detail: error.message
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setUserPresetDefaultsSaving(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadEffectivePaths = async ({ silent = false } = {}) => {
|
const loadEffectivePaths = async ({ silent = false } = {}) => {
|
||||||
try {
|
try {
|
||||||
const paths = await api.getEffectivePaths({ forceRefresh: true });
|
const paths = await api.getEffectivePaths({ forceRefresh: true });
|
||||||
@@ -624,8 +386,7 @@ export default function SettingsPage() {
|
|||||||
const presetsPromise = api.getHandBrakePresets();
|
const presetsPromise = api.getHandBrakePresets();
|
||||||
const scriptsPromise = api.getScripts();
|
const scriptsPromise = api.getScripts();
|
||||||
const chainsPromise = api.getScriptChains();
|
const chainsPromise = api.getScriptChains();
|
||||||
const runtimePromise = api.getRuntimeActivities();
|
const [scriptsResponse, chainsResponse] = await Promise.allSettled([scriptsPromise, chainsPromise]);
|
||||||
const [scriptsResponse, chainsResponse, runtimeResponse] = await Promise.allSettled([scriptsPromise, chainsPromise, runtimePromise]);
|
|
||||||
if (scriptsResponse.status === 'fulfilled') {
|
if (scriptsResponse.status === 'fulfilled') {
|
||||||
setScripts(Array.isArray(scriptsResponse.value?.scripts) ? scriptsResponse.value.scripts : []);
|
setScripts(Array.isArray(scriptsResponse.value?.scripts) ? scriptsResponse.value.scripts : []);
|
||||||
} else {
|
} else {
|
||||||
@@ -638,9 +399,6 @@ export default function SettingsPage() {
|
|||||||
if (chainsResponse.status === 'fulfilled') {
|
if (chainsResponse.status === 'fulfilled') {
|
||||||
setChains(Array.isArray(chainsResponse.value?.chains) ? chainsResponse.value.chains : []);
|
setChains(Array.isArray(chainsResponse.value?.chains) ? chainsResponse.value.chains : []);
|
||||||
}
|
}
|
||||||
if (runtimeResponse.status === 'fulfilled') {
|
|
||||||
setRunningChainIds(normalizeRunningChainIds(runtimeResponse.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
presetsPromise
|
presetsPromise
|
||||||
.then((presetPayload) => {
|
.then((presetPayload) => {
|
||||||
@@ -672,26 +430,6 @@ export default function SettingsPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load();
|
load();
|
||||||
loadUserPresets();
|
loadUserPresets();
|
||||||
loadUserPresetDefaults();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let cancelled = false;
|
|
||||||
const pollRuntime = async () => {
|
|
||||||
try {
|
|
||||||
const response = await api.getRuntimeActivities();
|
|
||||||
if (!cancelled) {
|
|
||||||
setRunningChainIds(normalizeRunningChainIds(response));
|
|
||||||
}
|
|
||||||
} catch (_error) {
|
|
||||||
// ignore polling errors
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const timer = setInterval(pollRuntime, 2500);
|
|
||||||
return () => {
|
|
||||||
cancelled = true;
|
|
||||||
clearInterval(timer);
|
|
||||||
};
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const dirtyKeys = useMemo(() => {
|
const dirtyKeys = useMemo(() => {
|
||||||
@@ -1019,32 +757,6 @@ export default function SettingsPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleToggleScriptFavorite = async (script) => {
|
|
||||||
const scriptId = Number(script?.id);
|
|
||||||
if (!Number.isFinite(scriptId) || scriptId <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setScriptActionBusyId(scriptId);
|
|
||||||
try {
|
|
||||||
const nextFavorite = !(script?.isFavorite === true);
|
|
||||||
await api.setScriptFavorite(scriptId, nextFavorite);
|
|
||||||
await loadScripts({ silent: true });
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Scripte',
|
|
||||||
detail: nextFavorite ? 'Favorit aktiviert.' : 'Favorit entfernt.'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Favorit konnte nicht geändert werden',
|
|
||||||
detail: error.message
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setScriptActionBusyId(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleScriptListDragStart = (event, scriptId) => {
|
const handleScriptListDragStart = (event, scriptId) => {
|
||||||
if (scriptSaving || scriptsLoading || scriptReordering || scriptEditor?.mode === 'create' || Boolean(scriptActionBusyId)) {
|
if (scriptSaving || scriptsLoading || scriptReordering || scriptEditor?.mode === 'create' || Boolean(scriptActionBusyId)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -1101,8 +813,7 @@ export default function SettingsPage() {
|
|||||||
if (!Number.isFinite(chainId) || chainId <= 0) {
|
if (!Number.isFinite(chainId) || chainId <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const normalizedChainId = Math.trunc(chainId);
|
setChainActionBusyId(chainId);
|
||||||
setChainActionBusy(normalizedChainId, true);
|
|
||||||
setLastChainTestResult(null);
|
setLastChainTestResult(null);
|
||||||
try {
|
try {
|
||||||
const response = await api.testScriptChain(chainId);
|
const response = await api.testScriptChain(chainId);
|
||||||
@@ -1122,75 +833,24 @@ export default function SettingsPage() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isLikelyNetworkRequestError(error)) {
|
|
||||||
try {
|
|
||||||
const runtimeResponse = await api.getRuntimeActivities();
|
|
||||||
const activeIds = normalizeRunningChainIds(runtimeResponse);
|
|
||||||
setRunningChainIds(activeIds);
|
|
||||||
if (activeIds.includes(normalizedChainId)) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'warn',
|
|
||||||
summary: 'Ketten-Test läuft weiter',
|
|
||||||
detail: `"${chain?.name || chainId}" läuft im Hintergrund weiter. Der Test-Request wurde vorzeitig beendet (z.B. Timeout/Verbindungsabbruch).`
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (_runtimeError) {
|
|
||||||
// ignore follow-up runtime fetch errors and show default error toast below
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toastRef.current?.show({ severity: 'error', summary: 'Ketten-Test fehlgeschlagen', detail: error.message });
|
toastRef.current?.show({ severity: 'error', summary: 'Ketten-Test fehlgeschlagen', detail: error.message });
|
||||||
} finally {
|
} finally {
|
||||||
setChainActionBusy(normalizedChainId, false);
|
setChainActionBusyId(null);
|
||||||
refreshRunningChains();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleToggleChainFavorite = async (chain) => {
|
|
||||||
const chainId = Number(chain?.id);
|
|
||||||
if (!Number.isFinite(chainId) || chainId <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const normalizedChainId = Math.trunc(chainId);
|
|
||||||
setChainActionBusy(normalizedChainId, true);
|
|
||||||
try {
|
|
||||||
const nextFavorite = !(chain?.isFavorite === true);
|
|
||||||
await api.setScriptChainFavorite(normalizedChainId, nextFavorite);
|
|
||||||
await loadChains({ silent: true });
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Skriptketten',
|
|
||||||
detail: nextFavorite ? 'Favorit aktiviert.' : 'Favorit entfernt.'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Favorit konnte nicht geändert werden',
|
|
||||||
detail: error.message
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setChainActionBusy(normalizedChainId, false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Chain editor handlers
|
// Chain editor handlers
|
||||||
const openChainEditor = (chain = null) => {
|
const openChainEditor = (chain = null) => {
|
||||||
if (chain) {
|
if (chain) {
|
||||||
setChainEditor({
|
setChainEditor({ open: true, id: chain.id, name: chain.name, steps: (chain.steps || []).map((s, i) => ({ ...s, _key: `${s.id || i}-${Date.now()}` })) });
|
||||||
open: true,
|
|
||||||
id: chain.id,
|
|
||||||
name: chain.name,
|
|
||||||
description: chain.description || '',
|
|
||||||
steps: (chain.steps || []).map((s, i) => ({ ...s, _key: `${s.id || i}-${Date.now()}` }))
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
setChainEditor({ open: true, id: null, name: '', description: '', steps: [] });
|
setChainEditor({ open: true, id: null, name: '', steps: [] });
|
||||||
}
|
}
|
||||||
setChainEditorErrors({});
|
setChainEditorErrors({});
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeChainEditor = () => {
|
const closeChainEditor = () => {
|
||||||
setChainEditor({ open: false, id: null, name: '', description: '', steps: [] });
|
setChainEditor({ open: false, id: null, name: '', steps: [] });
|
||||||
setChainEditorErrors({});
|
setChainEditorErrors({});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1241,7 +901,6 @@ export default function SettingsPage() {
|
|||||||
}
|
}
|
||||||
const payload = {
|
const payload = {
|
||||||
name,
|
name,
|
||||||
description: String(chainEditor.description || '').trim(),
|
|
||||||
steps: chainEditor.steps.map((s) => ({
|
steps: chainEditor.steps.map((s) => ({
|
||||||
stepType: s.stepType,
|
stepType: s.stepType,
|
||||||
scriptId: s.stepType === 'script' ? s.scriptId : null,
|
scriptId: s.stepType === 'script' ? s.scriptId : null,
|
||||||
@@ -1301,7 +960,7 @@ export default function SettingsPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChainListDragStart = (event, chainId) => {
|
const handleChainListDragStart = (event, chainId) => {
|
||||||
if (chainSaving || chainsLoading || chainReordering) {
|
if (chainSaving || chainsLoading || chainReordering || Boolean(chainActionBusyId)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1401,7 +1060,8 @@ export default function SettingsPage() {
|
|||||||
|| Boolean(scriptActionBusyId);
|
|| Boolean(scriptActionBusyId);
|
||||||
const chainListDnDDisabled = chainSaving
|
const chainListDnDDisabled = chainSaving
|
||||||
|| chainsLoading
|
|| chainsLoading
|
||||||
|| chainReordering;
|
|| chainReordering
|
||||||
|
|| Boolean(chainActionBusyId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page-grid">
|
<div className="page-grid">
|
||||||
@@ -1474,17 +1134,7 @@ export default function SettingsPage() {
|
|||||||
dirtyKeys={dirtyKeys}
|
dirtyKeys={dirtyKeys}
|
||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
effectivePaths={effectivePaths}
|
effectivePaths={effectivePaths}
|
||||||
activationBytes={activationBytes}
|
|
||||||
onNotify={(msg) => toastRef.current?.show(msg)}
|
onNotify={(msg) => toastRef.current?.show(msg)}
|
||||||
onSettingApplied={(setting) => {
|
|
||||||
const key = String(setting?.key || '').trim();
|
|
||||||
if (!key) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setDraftValues((prev) => ({ ...prev, [key]: setting?.value }));
|
|
||||||
setInitialValues((prev) => ({ ...prev, [key]: setting?.value }));
|
|
||||||
setErrors((prev) => ({ ...prev, [key]: null }));
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
@@ -1576,7 +1226,6 @@ export default function SettingsPage() {
|
|||||||
<div className="script-order-list">
|
<div className="script-order-list">
|
||||||
{scripts.map((script, index) => {
|
{scripts.map((script, index) => {
|
||||||
const isDragging = Number(scriptListDragSourceId) === Number(script.id);
|
const isDragging = Number(scriptListDragSourceId) === Number(script.id);
|
||||||
const isFavorite = script?.isFavorite === true;
|
|
||||||
return (
|
return (
|
||||||
<div key={script.id} className="script-order-wrapper">
|
<div key={script.id} className="script-order-wrapper">
|
||||||
<div
|
<div
|
||||||
@@ -1601,15 +1250,6 @@ export default function SettingsPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="script-list-actions">
|
<div className="script-list-actions">
|
||||||
<Button
|
|
||||||
icon={isFavorite ? 'pi pi-star-fill' : 'pi pi-star'}
|
|
||||||
label="Favorit"
|
|
||||||
severity={isFavorite ? 'warning' : 'secondary'}
|
|
||||||
outlined={!isFavorite}
|
|
||||||
onClick={() => handleToggleScriptFavorite(script)}
|
|
||||||
loading={scriptActionBusyId === script.id}
|
|
||||||
disabled={scriptReordering || (Boolean(scriptActionBusyId) && scriptActionBusyId !== script.id)}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
icon="pi pi-pencil"
|
icon="pi pi-pencil"
|
||||||
label="Bearbeiten"
|
label="Bearbeiten"
|
||||||
@@ -1754,11 +1394,6 @@ export default function SettingsPage() {
|
|||||||
<div className="script-order-list">
|
<div className="script-order-list">
|
||||||
{chains.map((chain, index) => {
|
{chains.map((chain, index) => {
|
||||||
const isDragging = Number(chainListDragSourceId) === Number(chain.id);
|
const isDragging = Number(chainListDragSourceId) === Number(chain.id);
|
||||||
const chainId = Number(chain?.id);
|
|
||||||
const normalizedChainId = Number.isFinite(chainId) && chainId > 0 ? Math.trunc(chainId) : null;
|
|
||||||
const isChainRuntimeRunning = normalizedChainId !== null && runningChainIdSet.has(normalizedChainId);
|
|
||||||
const isChainActionBusy = normalizedChainId !== null && chainActionBusyIds.has(normalizedChainId);
|
|
||||||
const isFavorite = chain?.isFavorite === true;
|
|
||||||
return (
|
return (
|
||||||
<div key={chain.id} className="script-order-wrapper">
|
<div key={chain.id} className="script-order-wrapper">
|
||||||
<div
|
<div
|
||||||
@@ -1780,35 +1415,35 @@ export default function SettingsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="script-list-main">
|
<div className="script-list-main">
|
||||||
<strong className="script-id-title">{`ID #${chain.id} - ${chain.name}`}</strong>
|
<strong className="script-id-title">{`ID #${chain.id} - ${chain.name}`}</strong>
|
||||||
<small className="chain-description-line" title={String(chain.description || '').trim()}>
|
<small>
|
||||||
{String(chain.description || '').trim() || '—'}
|
{chain.steps?.length ?? 0} Schritt(e):
|
||||||
|
{' '}
|
||||||
|
{(chain.steps || []).map((s, i) => (
|
||||||
|
<span key={i}>
|
||||||
|
{i > 0 ? ' → ' : ''}
|
||||||
|
{s.stepType === 'wait'
|
||||||
|
? `⏱ ${s.waitSeconds}s`
|
||||||
|
: (s.scriptName || `Script #${s.scriptId}`)}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div className="script-list-actions">
|
<div className="script-list-actions">
|
||||||
<Button
|
|
||||||
icon={isFavorite ? 'pi pi-star-fill' : 'pi pi-star'}
|
|
||||||
label="Favorit"
|
|
||||||
severity={isFavorite ? 'warning' : 'secondary'}
|
|
||||||
outlined={!isFavorite}
|
|
||||||
onClick={() => handleToggleChainFavorite(chain)}
|
|
||||||
loading={isChainActionBusy}
|
|
||||||
disabled={chainReordering || isChainActionBusy || isChainRuntimeRunning}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
icon="pi pi-pencil"
|
icon="pi pi-pencil"
|
||||||
label="Bearbeiten"
|
label="Bearbeiten"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => openChainEditor(chain)}
|
onClick={() => openChainEditor(chain)}
|
||||||
disabled={chainReordering}
|
disabled={chainReordering || Boolean(chainActionBusyId)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
icon="pi pi-play"
|
icon="pi pi-play"
|
||||||
label="Test"
|
label="Test"
|
||||||
severity="info"
|
severity="info"
|
||||||
onClick={() => handleTestChain(chain)}
|
onClick={() => handleTestChain(chain)}
|
||||||
loading={isChainActionBusy}
|
loading={chainActionBusyId === chain.id}
|
||||||
disabled={chainReordering || isChainActionBusy || isChainRuntimeRunning}
|
disabled={chainReordering || (Boolean(chainActionBusyId) && chainActionBusyId !== chain.id)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
icon="pi pi-trash"
|
icon="pi pi-trash"
|
||||||
@@ -1816,7 +1451,7 @@ export default function SettingsPage() {
|
|||||||
severity="danger"
|
severity="danger"
|
||||||
outlined
|
outlined
|
||||||
onClick={() => handleDeleteChain(chain)}
|
onClick={() => handleDeleteChain(chain)}
|
||||||
disabled={chainReordering}
|
disabled={chainReordering || Boolean(chainActionBusyId)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1882,20 +1517,6 @@ export default function SettingsPage() {
|
|||||||
/>
|
/>
|
||||||
{chainEditorErrors.name ? <small className="error-text">{chainEditorErrors.name}</small> : null}
|
{chainEditorErrors.name ? <small className="error-text">{chainEditorErrors.name}</small> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="chain-editor-name-row" style={{ marginTop: '0.7rem' }}>
|
|
||||||
<label htmlFor="chain-description">Kurzbeschreibung (max. 50 Zeichen)</label>
|
|
||||||
<InputText
|
|
||||||
id="chain-description"
|
|
||||||
value={chainEditor.description}
|
|
||||||
maxLength={50}
|
|
||||||
onChange={(e) => {
|
|
||||||
setChainEditor((prev) => ({ ...prev, description: e.target.value }));
|
|
||||||
setChainEditorErrors((prev) => ({ ...prev, description: null }));
|
|
||||||
}}
|
|
||||||
placeholder="Kurzer Hinweis zur Kette"
|
|
||||||
/>
|
|
||||||
{chainEditorErrors.description ? <small className="error-text">{chainEditorErrors.description}</small> : null}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="chain-editor-body">
|
<div className="chain-editor-body">
|
||||||
{/* Palette */}
|
{/* Palette */}
|
||||||
@@ -2049,57 +1670,12 @@ export default function SettingsPage() {
|
|||||||
label="Presets neu laden"
|
label="Presets neu laden"
|
||||||
icon="pi pi-refresh"
|
icon="pi pi-refresh"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
onClick={() => Promise.all([loadUserPresets(), loadUserPresetDefaults()])}
|
onClick={() => loadUserPresets()}
|
||||||
loading={userPresetsLoading || userPresetDefaultsLoading}
|
loading={userPresetsLoading}
|
||||||
disabled={userPresetSaving || userPresetDefaultsSaving}
|
disabled={userPresetSaving}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="script-list-box" style={{ marginTop: '1rem' }}>
|
|
||||||
<h4>Standard-Zuordnungen</h4>
|
|
||||||
<small>
|
|
||||||
Weise für jeden Medientyp/Fall ein Standard-Userpreset zu. Diese Zuordnungen werden persistent gespeichert.
|
|
||||||
</small>
|
|
||||||
<div className="user-preset-default-grid" style={{ marginTop: '0.8rem' }}>
|
|
||||||
{USER_PRESET_DEFAULT_SLOTS.map((slot) => (
|
|
||||||
<div key={slot.key} className="user-preset-default-grid-item">
|
|
||||||
<label htmlFor={`user-preset-default-${slot.key}`} style={{ display: 'block', marginBottom: '0.3rem' }}>
|
|
||||||
{slot.label}
|
|
||||||
</label>
|
|
||||||
<Dropdown
|
|
||||||
id={`user-preset-default-${slot.key}`}
|
|
||||||
value={normalizePositiveId(userPresetDefaultsDraft?.[slot.key])}
|
|
||||||
options={userPresetDefaultOptionsBySlot?.[slot.key] || []}
|
|
||||||
optionLabel="label"
|
|
||||||
optionValue="value"
|
|
||||||
onChange={(event) => handleChangeUserPresetDefault(slot.key, event.value)}
|
|
||||||
placeholder="Preset auswählen"
|
|
||||||
showClear
|
|
||||||
disabled={userPresetDefaultsLoading || userPresetDefaultsSaving}
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<div className="actions-row" style={{ marginTop: '0.8rem' }}>
|
|
||||||
<Button
|
|
||||||
label="Zuordnungen speichern"
|
|
||||||
icon="pi pi-save"
|
|
||||||
onClick={handleSaveUserPresetDefaults}
|
|
||||||
loading={userPresetDefaultsSaving}
|
|
||||||
disabled={userPresetDefaultsLoading || !userPresetDefaultsDirty}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
label="Änderungen verwerfen"
|
|
||||||
icon="pi pi-undo"
|
|
||||||
severity="secondary"
|
|
||||||
outlined
|
|
||||||
onClick={handleResetUserPresetDefaults}
|
|
||||||
disabled={userPresetDefaultsLoading || userPresetDefaultsSaving || !userPresetDefaultsDirty}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<small>
|
<small>
|
||||||
Encode-Presets fassen ein HandBrake-Preset und zusätzliche CLI-Argumente zusammen.
|
Encode-Presets fassen ein HandBrake-Preset und zusätzliche CLI-Argumente zusammen.
|
||||||
Sie sind medienbezogen (Blu-ray, DVD oder Universell) und können vor dem Encode
|
Sie sind medienbezogen (Blu-ray, DVD oder Universell) und können vor dem Encode
|
||||||
@@ -2111,9 +1687,9 @@ export default function SettingsPage() {
|
|||||||
) : userPresets.length === 0 ? (
|
) : userPresets.length === 0 ? (
|
||||||
<p style={{ marginTop: '1rem' }}>Keine Presets vorhanden. Lege ein neues Preset an.</p>
|
<p style={{ marginTop: '1rem' }}>Keine Presets vorhanden. Lege ein neues Preset an.</p>
|
||||||
) : (
|
) : (
|
||||||
<div className="preset-list" style={{ marginTop: '1rem' }}>
|
<div className="script-list script-list--reorderable" style={{ marginTop: '1rem' }}>
|
||||||
{userPresets.map((preset) => (
|
{userPresets.map((preset) => (
|
||||||
<div key={preset.id} className="script-list-item preset-list-item">
|
<div key={preset.id} className="script-list-item">
|
||||||
<div className="script-list-main">
|
<div className="script-list-main">
|
||||||
<div className="script-title-line">
|
<div className="script-title-line">
|
||||||
<strong className="script-id-title">#{preset.id} - {preset.name}</strong>
|
<strong className="script-id-title">#{preset.id} - {preset.name}</strong>
|
||||||
@@ -2127,7 +1703,7 @@ export default function SettingsPage() {
|
|||||||
{preset.description || '-'}
|
{preset.description || '-'}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div className="script-list-actions script-list-actions--two preset-list-actions">
|
<div className="script-list-actions script-list-actions--two">
|
||||||
<Button
|
<Button
|
||||||
icon="pi pi-pencil"
|
icon="pi pi-pencil"
|
||||||
label="Bearbeiten"
|
label="Bearbeiten"
|
||||||
@@ -2248,6 +1824,33 @@ export default function SettingsPage() {
|
|||||||
</TabView>
|
</TabView>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
{expertModeEnabled && activationBytes.length > 0 && (
|
||||||
|
<Card
|
||||||
|
title="Activation Bytes Cache"
|
||||||
|
subTitle="Lokal gespeicherte AAX-Activation Bytes. Werden beim ersten Upload automatisch über die Audible-Tools API ermittelt."
|
||||||
|
style={{ marginTop: '1.5rem' }}
|
||||||
|
>
|
||||||
|
<table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'monospace', fontSize: '0.875rem' }}>
|
||||||
|
<thead>
|
||||||
|
<tr style={{ borderBottom: '1px solid var(--surface-border)' }}>
|
||||||
|
<th style={{ textAlign: 'left', padding: '0.5rem 0.75rem' }}>Checksum</th>
|
||||||
|
<th style={{ textAlign: 'left', padding: '0.5rem 0.75rem' }}>Activation Bytes</th>
|
||||||
|
<th style={{ textAlign: 'left', padding: '0.5rem 0.75rem' }}>Gespeichert am</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{activationBytes.map((entry) => (
|
||||||
|
<tr key={entry.checksum} style={{ borderBottom: '1px solid var(--surface-border)' }}>
|
||||||
|
<td style={{ padding: '0.5rem 0.75rem', color: 'var(--text-color-secondary)' }}>{entry.checksum}</td>
|
||||||
|
<td style={{ padding: '0.5rem 0.75rem', fontWeight: 'bold' }}>{entry.activation_bytes}</td>
|
||||||
|
<td style={{ padding: '0.5rem 0.75rem', color: 'var(--text-color-secondary)' }}>{new Date(entry.created_at).toLocaleString('de-DE')}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,410 +0,0 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
||||||
import { Card } from 'primereact/card';
|
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { Tag } from 'primereact/tag';
|
|
||||||
import { Toast } from 'primereact/toast';
|
|
||||||
import { DataTable } from 'primereact/datatable';
|
|
||||||
import { Column } from 'primereact/column';
|
|
||||||
import { ProgressSpinner } from 'primereact/progressspinner';
|
|
||||||
import { api } from '../api/client';
|
|
||||||
import MetadataSelectionDialog from '../components/MetadataSelectionDialog';
|
|
||||||
import { isSeriesVideoJob } from '../utils/jobTaxonomy';
|
|
||||||
|
|
||||||
function normalizeJobId(value) {
|
|
||||||
const parsed = Number(value);
|
|
||||||
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Math.trunc(parsed);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveMediaType(row) {
|
|
||||||
const encodePlan = row?.encodePlan && typeof row.encodePlan === 'object' ? row.encodePlan : null;
|
|
||||||
const candidates = [
|
|
||||||
row?.mediaType,
|
|
||||||
row?.media_type,
|
|
||||||
row?.mediaProfile,
|
|
||||||
row?.media_profile,
|
|
||||||
encodePlan?.mediaProfile,
|
|
||||||
row?.makemkvInfo?.analyzeContext?.mediaProfile,
|
|
||||||
row?.makemkvInfo?.mediaProfile,
|
|
||||||
row?.mediainfoInfo?.mediaProfile
|
|
||||||
];
|
|
||||||
for (const candidate of candidates) {
|
|
||||||
const raw = String(candidate || '').trim().toLowerCase();
|
|
||||||
if (!raw) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (['bluray', 'blu-ray', 'blu_ray', 'bd', 'bdmv', 'bdrom', 'bd-rom', 'bd-r', 'bd-re'].includes(raw)) {
|
|
||||||
return 'bluray';
|
|
||||||
}
|
|
||||||
if (['dvd', 'disc', 'dvdvideo', 'dvd-video', 'dvdrom', 'dvd-rom', 'video_ts', 'iso9660'].includes(raw)) {
|
|
||||||
return 'dvd';
|
|
||||||
}
|
|
||||||
if (raw === 'converter') {
|
|
||||||
return 'converter';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 'other';
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildMetadataContextFromJob(row) {
|
|
||||||
const jobId = normalizeJobId(row?.id);
|
|
||||||
const makemkvInfo = row?.makemkvInfo && typeof row.makemkvInfo === 'object' ? row.makemkvInfo : {};
|
|
||||||
const analyzeContext = makemkvInfo?.analyzeContext && typeof makemkvInfo.analyzeContext === 'object'
|
|
||||||
? makemkvInfo.analyzeContext
|
|
||||||
: {};
|
|
||||||
const selectedMetadata = analyzeContext?.selectedMetadata && typeof analyzeContext.selectedMetadata === 'object'
|
|
||||||
? analyzeContext.selectedMetadata
|
|
||||||
: (makemkvInfo?.selectedMetadata && typeof makemkvInfo.selectedMetadata === 'object'
|
|
||||||
? makemkvInfo.selectedMetadata
|
|
||||||
: {});
|
|
||||||
const workflowKindRaw = String(
|
|
||||||
selectedMetadata?.workflowKind
|
|
||||||
|| analyzeContext?.workflowKind
|
|
||||||
|| ''
|
|
||||||
).trim().toLowerCase();
|
|
||||||
const workflowKind = ['film', 'movie', 'feature'].includes(workflowKindRaw)
|
|
||||||
? 'film'
|
|
||||||
: (['series', 'tv', 'season', 'episode'].includes(workflowKindRaw) ? 'series' : null);
|
|
||||||
const rowMediaType = resolveMediaType(row);
|
|
||||||
const isSeriesDvd = (rowMediaType === 'dvd' || rowMediaType === 'bluray') && isSeriesVideoJob(row);
|
|
||||||
const metadataProvider = 'tmdb';
|
|
||||||
const seasonNumber = selectedMetadata?.seasonNumber ?? analyzeContext?.seriesLookupHint?.seasonNumber ?? null;
|
|
||||||
const discNumber = selectedMetadata?.discNumber ?? analyzeContext?.seriesLookupHint?.discNumber ?? null;
|
|
||||||
|
|
||||||
return {
|
|
||||||
jobId,
|
|
||||||
status: row?.status || null,
|
|
||||||
lastState: row?.last_state || null,
|
|
||||||
submitMode: 'assign',
|
|
||||||
mediaProfile: rowMediaType,
|
|
||||||
detectedTitle: row?.detected_title || row?.title || '',
|
|
||||||
selectedMetadata: {
|
|
||||||
...(selectedMetadata && typeof selectedMetadata === 'object' ? selectedMetadata : {}),
|
|
||||||
title: row?.title || selectedMetadata?.title || row?.detected_title || '',
|
|
||||||
year: row?.year || selectedMetadata?.year || null,
|
|
||||||
imdbId: row?.imdb_id || selectedMetadata?.imdbId || null,
|
|
||||||
poster: row?.poster_url || selectedMetadata?.poster || null,
|
|
||||||
metadataProvider,
|
|
||||||
workflowKind,
|
|
||||||
tmdbId: selectedMetadata?.tmdbId || null,
|
|
||||||
providerId: selectedMetadata?.providerId || null,
|
|
||||||
metadataKind: selectedMetadata?.metadataKind || (isSeriesDvd ? 'season' : null),
|
|
||||||
seasonNumber,
|
|
||||||
seasonName: selectedMetadata?.seasonName || null,
|
|
||||||
episodeCount: selectedMetadata?.episodeCount || 0,
|
|
||||||
episodes: Array.isArray(selectedMetadata?.episodes) ? selectedMetadata.episodes : [],
|
|
||||||
...(discNumber ? { discNumber } : {})
|
|
||||||
},
|
|
||||||
metadataProvider,
|
|
||||||
workflowKind: workflowKind || analyzeContext?.workflowKind || null,
|
|
||||||
metadataCandidates: Array.isArray(analyzeContext?.metadataCandidates) ? analyzeContext.metadataCandidates : [],
|
|
||||||
seriesAnalysis: analyzeContext?.seriesAnalysis || null,
|
|
||||||
seriesLookupHint: analyzeContext?.seriesLookupHint || null,
|
|
||||||
seriesDecision: analyzeContext?.seriesDecision || null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function TmdbMigrationPage() {
|
|
||||||
const toastRef = useRef(null);
|
|
||||||
const countdownIntervalRef = useRef(null);
|
|
||||||
const nextJobTimeoutRef = useRef(null);
|
|
||||||
const jobsRef = useRef([]);
|
|
||||||
const runningRef = useRef(false);
|
|
||||||
|
|
||||||
const [jobs, setJobs] = useState([]);
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
const [running, setRunning] = useState(false);
|
|
||||||
const [metadataDialogVisible, setMetadataDialogVisible] = useState(false);
|
|
||||||
const [metadataDialogContext, setMetadataDialogContext] = useState(null);
|
|
||||||
const [metadataAssignBusy, setMetadataAssignBusy] = useState(false);
|
|
||||||
const [cooldownRemaining, setCooldownRemaining] = useState(0);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
jobsRef.current = Array.isArray(jobs) ? jobs : [];
|
|
||||||
}, [jobs]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
runningRef.current = running;
|
|
||||||
}, [running]);
|
|
||||||
|
|
||||||
const clearTimers = useCallback(() => {
|
|
||||||
if (countdownIntervalRef.current) {
|
|
||||||
clearInterval(countdownIntervalRef.current);
|
|
||||||
countdownIntervalRef.current = null;
|
|
||||||
}
|
|
||||||
if (nextJobTimeoutRef.current) {
|
|
||||||
clearTimeout(nextJobTimeoutRef.current);
|
|
||||||
nextJobTimeoutRef.current = null;
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => () => {
|
|
||||||
clearTimers();
|
|
||||||
}, [clearTimers]);
|
|
||||||
|
|
||||||
const loadPendingJobs = useCallback(async () => {
|
|
||||||
setLoading(true);
|
|
||||||
try {
|
|
||||||
const response = await api.getTmdbMigrationPendingJobs({ limit: 1000 });
|
|
||||||
const rows = Array.isArray(response?.jobs) ? response.jobs : [];
|
|
||||||
setJobs(rows);
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Laden fehlgeschlagen',
|
|
||||||
detail: error?.message || 'TMDb-Migrationsliste konnte nicht geladen werden.'
|
|
||||||
});
|
|
||||||
setJobs([]);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
void loadPendingJobs();
|
|
||||||
}, [loadPendingJobs]);
|
|
||||||
|
|
||||||
const openJobInDialog = useCallback((job) => {
|
|
||||||
if (!job) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const context = buildMetadataContextFromJob(job);
|
|
||||||
if (!context?.jobId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setMetadataDialogContext(context);
|
|
||||||
setMetadataDialogVisible(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const scheduleNextJob = useCallback((nextJob, seconds = 10) => {
|
|
||||||
clearTimers();
|
|
||||||
const normalizedSeconds = Math.max(0, Math.trunc(Number(seconds || 0)));
|
|
||||||
if (!nextJob) {
|
|
||||||
setRunning(false);
|
|
||||||
setCooldownRemaining(0);
|
|
||||||
setMetadataDialogVisible(false);
|
|
||||||
setMetadataDialogContext(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setCooldownRemaining(normalizedSeconds);
|
|
||||||
if (normalizedSeconds > 0) {
|
|
||||||
countdownIntervalRef.current = setInterval(() => {
|
|
||||||
setCooldownRemaining((prev) => {
|
|
||||||
const next = Number(prev || 0) - 1;
|
|
||||||
return next > 0 ? next : 0;
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
nextJobTimeoutRef.current = setTimeout(() => {
|
|
||||||
clearTimers();
|
|
||||||
setCooldownRemaining(0);
|
|
||||||
if (!runningRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
openJobInDialog(nextJob);
|
|
||||||
}, normalizedSeconds * 1000);
|
|
||||||
}, [clearTimers, openJobInDialog]);
|
|
||||||
|
|
||||||
const startSequence = () => {
|
|
||||||
const pending = jobsRef.current;
|
|
||||||
if (!Array.isArray(pending) || pending.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clearTimers();
|
|
||||||
setRunning(true);
|
|
||||||
setMetadataDialogVisible(true);
|
|
||||||
setCooldownRemaining(0);
|
|
||||||
openJobInDialog(pending[0]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const stopSequence = useCallback(() => {
|
|
||||||
clearTimers();
|
|
||||||
setRunning(false);
|
|
||||||
setCooldownRemaining(0);
|
|
||||||
setMetadataDialogVisible(false);
|
|
||||||
setMetadataDialogContext(null);
|
|
||||||
}, [clearTimers]);
|
|
||||||
|
|
||||||
const handleMetadataSearch = async (query, options = {}) => {
|
|
||||||
const workflow = String(
|
|
||||||
options?.workflowKind
|
|
||||||
|| metadataDialogContext?.selectedMetadata?.workflowKind
|
|
||||||
|| ''
|
|
||||||
).trim().toLowerCase();
|
|
||||||
try {
|
|
||||||
const tmdbSeasonHint = metadataDialogContext?.selectedMetadata?.seasonNumber
|
|
||||||
?? metadataDialogContext?.seriesLookupHint?.seasonNumber
|
|
||||||
?? null;
|
|
||||||
const response = workflow === 'series'
|
|
||||||
? await api.searchTmdbSeries(query, tmdbSeasonHint)
|
|
||||||
: await api.searchTmdbMovie(query);
|
|
||||||
return response?.results || [];
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'TMDb-Suche fehlgeschlagen',
|
|
||||||
detail: error?.message || 'Suche fehlgeschlagen.'
|
|
||||||
});
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMetadataSubmit = async (payload) => {
|
|
||||||
const normalizedJobId = normalizeJobId(payload?.jobId);
|
|
||||||
if (!normalizedJobId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setMetadataAssignBusy(true);
|
|
||||||
clearTimers();
|
|
||||||
setCooldownRemaining(0);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await api.assignJobMetadata(normalizedJobId, payload || {});
|
|
||||||
|
|
||||||
const remaining = jobsRef.current.filter((row) => normalizeJobId(row?.id) !== normalizedJobId);
|
|
||||||
jobsRef.current = remaining;
|
|
||||||
setJobs(remaining);
|
|
||||||
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Job migriert',
|
|
||||||
detail: `Job #${normalizedJobId} wurde auf TMDb aktualisiert.`,
|
|
||||||
life: 2600
|
|
||||||
});
|
|
||||||
|
|
||||||
if (remaining.length === 0) {
|
|
||||||
setRunning(false);
|
|
||||||
setMetadataDialogVisible(false);
|
|
||||||
setMetadataDialogContext(null);
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Migration abgeschlossen',
|
|
||||||
detail: 'Alle ausstehenden Jobs wurden abgearbeitet.',
|
|
||||||
life: 3200
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!runningRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
scheduleNextJob(remaining[0], 10);
|
|
||||||
} catch (error) {
|
|
||||||
toastRef.current?.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Migration fehlgeschlagen',
|
|
||||||
detail: error?.message || 'Metadaten konnten nicht übernommen werden.'
|
|
||||||
});
|
|
||||||
throw error;
|
|
||||||
} finally {
|
|
||||||
setMetadataAssignBusy(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const mediumTagBody = (row) => {
|
|
||||||
const mediaType = resolveMediaType(row);
|
|
||||||
const label = mediaType === 'bluray' ? 'Blu-ray' : mediaType === 'dvd' ? 'DVD' : mediaType === 'converter' ? 'Converter' : 'Other';
|
|
||||||
return <Tag value={label} severity={mediaType === 'converter' ? 'info' : 'warning'} />;
|
|
||||||
};
|
|
||||||
|
|
||||||
const titleBody = (row) => String(row?.title || row?.detected_title || `Job #${row?.id || '-'}`).trim() || '-';
|
|
||||||
|
|
||||||
const countdownProgressValue = useMemo(() => {
|
|
||||||
if (cooldownRemaining <= 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const elapsed = 10 - Math.min(10, cooldownRemaining);
|
|
||||||
return Math.max(0, Math.min(100, Math.round((elapsed / 10) * 100)));
|
|
||||||
}, [cooldownRemaining]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="page-grid tmdb-migration-page">
|
|
||||||
<Toast ref={toastRef} position="top-right" />
|
|
||||||
|
|
||||||
<Card title="TMDb Migration (Direktlink)" subTitle="Diese Seite ist nicht in der Navigation verlinkt.">
|
|
||||||
<div className="tmdb-migration-toolbar">
|
|
||||||
<div className="tmdb-migration-toolbar-left">
|
|
||||||
<Tag value={`${jobs.length} offen`} severity={jobs.length > 0 ? 'warning' : 'success'} />
|
|
||||||
{running ? <Tag value="Sequenz aktiv" severity="info" /> : null}
|
|
||||||
</div>
|
|
||||||
<div className="tmdb-migration-toolbar-actions">
|
|
||||||
<Button
|
|
||||||
label="Liste neu laden"
|
|
||||||
icon={loading ? 'pi pi-spin pi-spinner' : 'pi pi-refresh'}
|
|
||||||
outlined
|
|
||||||
onClick={() => {
|
|
||||||
if (!metadataAssignBusy) {
|
|
||||||
void loadPendingJobs();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
disabled={metadataAssignBusy}
|
|
||||||
/>
|
|
||||||
{!running ? (
|
|
||||||
<Button
|
|
||||||
label="Start"
|
|
||||||
icon="pi pi-play"
|
|
||||||
onClick={startSequence}
|
|
||||||
disabled={jobs.length === 0 || loading || metadataAssignBusy}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Button
|
|
||||||
label="Stop"
|
|
||||||
icon="pi pi-stop"
|
|
||||||
severity="secondary"
|
|
||||||
onClick={stopSequence}
|
|
||||||
disabled={metadataAssignBusy}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{running && cooldownRemaining > 0 ? (
|
|
||||||
<div className="tmdb-migration-countdown">
|
|
||||||
<ProgressSpinner style={{ width: '2rem', height: '2rem' }} strokeWidth="5" />
|
|
||||||
<div className="tmdb-migration-countdown-copy">
|
|
||||||
<strong>Nächste Suche startet in {cooldownRemaining}s</strong>
|
|
||||||
<small>API-Wartezeit aktiv (mind. 10 Sekunden zwischen Jobs).</small>
|
|
||||||
</div>
|
|
||||||
<div className="tmdb-migration-countdown-progress" aria-label="Cooldown Fortschritt">
|
|
||||||
<div className="tmdb-migration-countdown-bar" style={{ width: `${countdownProgressValue}%` }} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
<DataTable
|
|
||||||
value={jobs}
|
|
||||||
loading={loading}
|
|
||||||
dataKey="id"
|
|
||||||
emptyMessage="Keine offenen Jobs für TMDb-Migration."
|
|
||||||
className="tmdb-migration-table"
|
|
||||||
rows={50}
|
|
||||||
paginator={jobs.length > 50}
|
|
||||||
>
|
|
||||||
<Column field="id" header="ID" style={{ width: '6rem' }} body={(row) => `#${row?.id || '-'}`} />
|
|
||||||
<Column header="Titel" body={titleBody} />
|
|
||||||
<Column field="year" header="Jahr" style={{ width: '8rem' }} body={(row) => row?.year || '-'} />
|
|
||||||
<Column header="Medium" body={mediumTagBody} style={{ width: '10rem' }} />
|
|
||||||
<Column
|
|
||||||
header="Status"
|
|
||||||
style={{ width: '14rem' }}
|
|
||||||
body={(row) => String(row?.status || row?.last_state || '-').trim() || '-'}
|
|
||||||
/>
|
|
||||||
</DataTable>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<MetadataSelectionDialog
|
|
||||||
visible={metadataDialogVisible}
|
|
||||||
context={metadataDialogContext}
|
|
||||||
onHide={stopSequence}
|
|
||||||
onSubmit={handleMetadataSubmit}
|
|
||||||
onSearch={handleMetadataSearch}
|
|
||||||
busy={metadataAssignBusy || (running && cooldownRemaining > 0)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
+172
-881
File diff suppressed because it is too large.
Load diff
@@ -254,14 +254,16 @@ export function isSeriesVideoJob(job) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const metadataProvider = String(
|
||||||
|
analyzeContext?.metadataProvider
|
||||||
|
|| selectedMetadata?.metadataProvider
|
||||||
|
|| ''
|
||||||
|
).trim().toLowerCase();
|
||||||
const metadataKind = String(
|
const metadataKind = String(
|
||||||
selectedMetadata?.metadataKind
|
selectedMetadata?.metadataKind
|
||||||
|| analyzeContext?.metadataKind
|
|| analyzeContext?.metadataKind
|
||||||
|| ''
|
|| ''
|
||||||
).trim().toLowerCase();
|
).trim().toLowerCase();
|
||||||
if (['film', 'movie', 'feature'].includes(metadataKind)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const seasonNumberRaw = selectedMetadata?.seasonNumber ?? analyzeContext?.seriesLookupHint?.seasonNumber ?? null;
|
const seasonNumberRaw = selectedMetadata?.seasonNumber ?? analyzeContext?.seriesLookupHint?.seasonNumber ?? null;
|
||||||
const seasonNumberText = String(seasonNumberRaw ?? '').trim();
|
const seasonNumberText = String(seasonNumberRaw ?? '').trim();
|
||||||
const parsedSeasonNumber = Number(seasonNumberText.replace(',', '.'));
|
const parsedSeasonNumber = Number(seasonNumberText.replace(',', '.'));
|
||||||
@@ -277,7 +279,15 @@ export function isSeriesVideoJob(job) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
const tmdbIdRaw = selectedMetadata?.tmdbId
|
||||||
|
?? analyzeContext?.tmdbId
|
||||||
|
?? selectedMetadata?.providerId
|
||||||
|
?? analyzeContext?.providerId
|
||||||
|
?? null;
|
||||||
|
const tmdbIdText = String(tmdbIdRaw ?? '').trim();
|
||||||
|
const hasTmdbId = Boolean(tmdbIdText) && tmdbIdText !== '0';
|
||||||
|
|
||||||
|
return (metadataProvider === 'tmdb' || metadataProvider === 'themoviedb') && hasTmdbId;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSeriesDvdJob(job) {
|
export function isSeriesDvdJob(job) {
|
||||||
@@ -287,3 +297,29 @@ export function isSeriesDvdJob(job) {
|
|||||||
export function isConverterJob(job) {
|
export function isConverterJob(job) {
|
||||||
return resolveMediaType(job) === 'converter';
|
return resolveMediaType(job) === 'converter';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function classifyJob(job) {
|
||||||
|
const jobKind = resolveJobKind(job);
|
||||||
|
const mediaType = resolveMediaType(job);
|
||||||
|
const converterMediaType = normalizeConverterMediaType(
|
||||||
|
(jobKind && jobKind.startsWith('converter_'))
|
||||||
|
? jobKind.replace('converter_', '')
|
||||||
|
: (getEncodePlan(job)?.converterMediaType || job?.converterMediaType)
|
||||||
|
);
|
||||||
|
|
||||||
|
let family = 'other';
|
||||||
|
if (mediaType === 'converter') {
|
||||||
|
family = 'converter';
|
||||||
|
} else if (mediaType === 'audiobook') {
|
||||||
|
family = 'audiobook';
|
||||||
|
} else if (mediaType === 'cd' || mediaType === 'dvd' || mediaType === 'bluray') {
|
||||||
|
family = 'rip';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
jobKind,
|
||||||
|
mediaType,
|
||||||
|
converterMediaType,
|
||||||
|
family
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ const STATUS_LABELS = {
|
|||||||
IDLE: 'Bereit',
|
IDLE: 'Bereit',
|
||||||
DISC_DETECTED: 'Medium erkannt',
|
DISC_DETECTED: 'Medium erkannt',
|
||||||
ANALYZING: 'Analyse',
|
ANALYZING: 'Analyse',
|
||||||
METADATA_LOOKUP: 'TMDb-Suche',
|
|
||||||
METADATA_SELECTION: 'Metadatenauswahl',
|
METADATA_SELECTION: 'Metadatenauswahl',
|
||||||
WAITING_FOR_USER_DECISION: 'Warte auf Auswahl',
|
WAITING_FOR_USER_DECISION: 'Warte auf Auswahl',
|
||||||
READY_TO_START: 'Startbereit',
|
READY_TO_START: 'Startbereit',
|
||||||
@@ -14,11 +13,11 @@ const STATUS_LABELS = {
|
|||||||
FINISHED: 'Fertig',
|
FINISHED: 'Fertig',
|
||||||
CANCELLED: 'Abgebrochen',
|
CANCELLED: 'Abgebrochen',
|
||||||
ERROR: 'Fehler',
|
ERROR: 'Fehler',
|
||||||
CD_ANALYZING: 'Analyse',
|
CD_ANALYZING: 'CD-Analyse',
|
||||||
CD_METADATA_SELECTION: 'Metadatenauswahl',
|
CD_METADATA_SELECTION: 'CD-Metadatenauswahl',
|
||||||
CD_READY_TO_RIP: 'Bereit zum Encodieren',
|
CD_READY_TO_RIP: 'CD bereit (Rip/Encode)',
|
||||||
CD_RIPPING: 'Rippen',
|
CD_RIPPING: 'CD-Rippen',
|
||||||
CD_ENCODING: 'Encodieren'
|
CD_ENCODING: 'CD-Encodieren'
|
||||||
};
|
};
|
||||||
|
|
||||||
const PROCESS_STATUS_LABELS = {
|
const PROCESS_STATUS_LABELS = {
|
||||||
@@ -47,7 +46,6 @@ const FALLBACK_TOKEN_LABELS = {
|
|||||||
ENCODE: 'encodieren',
|
ENCODE: 'encodieren',
|
||||||
ENCODING: 'encodieren',
|
ENCODING: 'encodieren',
|
||||||
ANALYZING: 'analyse',
|
ANALYZING: 'analyse',
|
||||||
LOOKUP: 'suche',
|
|
||||||
METADATA: 'metadaten',
|
METADATA: 'metadaten',
|
||||||
SELECTION: 'auswahl',
|
SELECTION: 'auswahl',
|
||||||
WAITING: 'warte',
|
WAITING: 'warte',
|
||||||
@@ -122,7 +120,6 @@ export function getStatusSeverity(status, options = {}) {
|
|||||||
normalized === 'RIPPING'
|
normalized === 'RIPPING'
|
||||||
|| normalized === 'ENCODING'
|
|| normalized === 'ENCODING'
|
||||||
|| normalized === 'ANALYZING'
|
|| normalized === 'ANALYZING'
|
||||||
|| normalized === 'METADATA_LOOKUP'
|
|
||||||
|| normalized === 'MEDIAINFO_CHECK'
|
|| normalized === 'MEDIAINFO_CHECK'
|
||||||
|| normalized === 'METADATA_SELECTION'
|
|| normalized === 'METADATA_SELECTION'
|
||||||
|| normalized === 'POST_ENCODE_SCRIPTS'
|
|| normalized === 'POST_ENCODE_SCRIPTS'
|
||||||
@@ -157,6 +154,5 @@ export const STATUS_FILTER_OPTIONS = [
|
|||||||
{ label: getStatusLabel('RIPPING'), value: 'RIPPING' },
|
{ label: getStatusLabel('RIPPING'), value: 'RIPPING' },
|
||||||
{ label: getStatusLabel('ENCODING'), value: 'ENCODING' },
|
{ label: getStatusLabel('ENCODING'), value: 'ENCODING' },
|
||||||
{ label: getStatusLabel('ANALYZING'), value: 'ANALYZING' },
|
{ label: getStatusLabel('ANALYZING'), value: 'ANALYZING' },
|
||||||
{ label: getStatusLabel('METADATA_LOOKUP'), value: 'METADATA_LOOKUP' },
|
|
||||||
{ label: getStatusLabel('METADATA_SELECTION'), value: 'METADATA_SELECTION' }
|
{ label: getStatusLabel('METADATA_SELECTION'), value: 'METADATA_SELECTION' }
|
||||||
];
|
];
|
||||||
Executable → Regular
+62
-314
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Ripster – Installationsskript (Git)
|
# Ripster – Installationsskript (Git)
|
||||||
# Unterstützt: Debian 11/12, Ubuntu 22.04/24.04
|
# Unterstützt: Debian 11/12, Ubuntu 22.04/24.04
|
||||||
@@ -22,10 +21,6 @@
|
|||||||
# --no-makemkv MakeMKV-Installation überspringen
|
# --no-makemkv MakeMKV-Installation überspringen
|
||||||
# --no-handbrake HandBrake-Installation überspringen
|
# --no-handbrake HandBrake-Installation überspringen
|
||||||
# --no-nginx Nginx-Einrichtung überspringen
|
# --no-nginx Nginx-Einrichtung überspringen
|
||||||
# --no-system-deps Abschnitt "Systemabhängigkeiten installieren" überspringen
|
|
||||||
# --accept-makemkv-eula MakeMKV-Lizenz/EULA bewusst akzeptieren
|
|
||||||
# --force-license-prompts
|
|
||||||
# Lizenzabfragen auch bei vorhandenen Tools erneut anzeigen
|
|
||||||
# --reinstall Vorhandene Installation aktualisieren (Daten bleiben erhalten)
|
# --reinstall Vorhandene Installation aktualisieren (Daten bleiben erhalten)
|
||||||
# -h, --help Diese Hilfe anzeigen
|
# -h, --help Diese Hilfe anzeigen
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -59,17 +54,7 @@ SKIP_MAKEMKV=false
|
|||||||
SKIP_HANDBRAKE=false
|
SKIP_HANDBRAKE=false
|
||||||
HANDBRAKE_INSTALL_MODE=""
|
HANDBRAKE_INSTALL_MODE=""
|
||||||
SKIP_NGINX=false
|
SKIP_NGINX=false
|
||||||
SKIP_SYSTEM_DEPS=false
|
|
||||||
ACCEPT_MAKEMKV_EULA=false
|
|
||||||
FORCE_LICENSE_PROMPTS=false
|
|
||||||
MAKEMKV_EULA_REVIEWED=false
|
|
||||||
HANDBRAKE_NOTICE_SHOWN=false
|
|
||||||
REINSTALL=false
|
REINSTALL=false
|
||||||
GIT_COMMAND_TIMEOUT_SEC=180
|
|
||||||
|
|
||||||
# Keine interaktiven Git-Prompts im Installer (z.B. Credentials) - stattdessen
|
|
||||||
# sauber mit Fehler abbrechen.
|
|
||||||
export GIT_TERMINAL_PROMPT=0
|
|
||||||
|
|
||||||
# --- Container-Optionen -------------------------------------------------------
|
# --- Container-Optionen -------------------------------------------------------
|
||||||
CONTAINER_TYPE="none"
|
CONTAINER_TYPE="none"
|
||||||
@@ -87,9 +72,6 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--no-makemkv) SKIP_MAKEMKV=true; shift ;;
|
--no-makemkv) SKIP_MAKEMKV=true; shift ;;
|
||||||
--no-handbrake) SKIP_HANDBRAKE=true; shift ;;
|
--no-handbrake) SKIP_HANDBRAKE=true; shift ;;
|
||||||
--no-nginx) SKIP_NGINX=true; shift ;;
|
--no-nginx) SKIP_NGINX=true; shift ;;
|
||||||
--no-system-deps) SKIP_SYSTEM_DEPS=true; shift ;;
|
|
||||||
--accept-makemkv-eula) ACCEPT_MAKEMKV_EULA=true; shift ;;
|
|
||||||
--force-license-prompts) FORCE_LICENSE_PROMPTS=true; shift ;;
|
|
||||||
--reinstall) REINSTALL=true; shift ;;
|
--reinstall) REINSTALL=true; shift ;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
sed -n '/^# Verwendung/,/^# ====/p' "$0" | head -n -1 | sed 's/^# \?//'
|
sed -n '/^# Verwendung/,/^# ====/p' "$0" | head -n -1 | sed 's/^# \?//'
|
||||||
@@ -153,30 +135,6 @@ detect_container_env() {
|
|||||||
|
|
||||||
command_exists() { command -v "$1" &>/dev/null; }
|
command_exists() { command -v "$1" &>/dev/null; }
|
||||||
|
|
||||||
run_git_command() {
|
|
||||||
local description="$1"
|
|
||||||
shift
|
|
||||||
local status=0
|
|
||||||
|
|
||||||
info "$description..."
|
|
||||||
if command_exists timeout; then
|
|
||||||
timeout --foreground "${GIT_COMMAND_TIMEOUT_SEC}" "$@"
|
|
||||||
status=$?
|
|
||||||
if [[ "$status" -ne 0 ]]; then
|
|
||||||
if [[ "$status" -eq 124 ]]; then
|
|
||||||
fatal "Git-Kommando lief in Timeout (${GIT_COMMAND_TIMEOUT_SEC}s): $*"
|
|
||||||
fi
|
|
||||||
fatal "Git-Kommando fehlgeschlagen (Exit $status): $*"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
"$@"
|
|
||||||
status=$?
|
|
||||||
if [[ "$status" -ne 0 ]]; then
|
|
||||||
fatal "Git-Kommando fehlgeschlagen (Exit $status): $*"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
service_unit_exists() {
|
service_unit_exists() {
|
||||||
local unit="$1"
|
local unit="$1"
|
||||||
systemctl list-unit-files --type=service --all --no-legend 2>/dev/null \
|
systemctl list-unit-files --type=service --all --no-legend 2>/dev/null \
|
||||||
@@ -230,36 +188,6 @@ backup_and_remove_backend_src() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_persistent_backend_data() {
|
|
||||||
local src_dir="$INSTALL_DIR/backend/data"
|
|
||||||
local backup_root="$INSTALL_DIR/backend/data/temp/ripster-data-backup"
|
|
||||||
local backup_dir="${backup_root}/data_bak_$(date +%Y%m%d%H%M%S)"
|
|
||||||
local copied_any=false
|
|
||||||
local candidate
|
|
||||||
|
|
||||||
if [[ ! -d "$src_dir" ]]; then
|
|
||||||
warn "Kein Backend-Datenverzeichnis gefunden: $src_dir"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Nur kleine, kritische Metadaten sichern. Medienordner bleiben im
|
|
||||||
# Installationspfad bestehen und werden hier bewusst nicht kopiert.
|
|
||||||
mkdir -p "$backup_dir"
|
|
||||||
for candidate in "ripster.db" "ripster.db-shm" "ripster.db-wal" "thumbnails"; do
|
|
||||||
if [[ -e "${src_dir}/${candidate}" ]]; then
|
|
||||||
cp -a "${src_dir}/${candidate}" "$backup_dir/"
|
|
||||||
copied_any=true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ "$copied_any" == true ]]; then
|
|
||||||
DATA_BACKUP="$backup_dir"
|
|
||||||
ok "Persistente Backend-Daten gesichert nach: $DATA_BACKUP"
|
|
||||||
else
|
|
||||||
warn "Keine zu sichernden Kern-Daten in $src_dir gefunden (ripster.db/thumbnails)."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
enforce_default_output_dirs_permissions() {
|
enforce_default_output_dirs_permissions() {
|
||||||
local default_dirs=(
|
local default_dirs=(
|
||||||
"$INSTALL_DIR/backend/data/output/raw"
|
"$INSTALL_DIR/backend/data/output/raw"
|
||||||
@@ -401,7 +329,7 @@ SupplementaryGroups=video render cdrom disk
|
|||||||
# darf no_new_privileges nicht aktiv sein.
|
# darf no_new_privileges nicht aktiv sein.
|
||||||
NoNewPrivileges=false
|
NoNewPrivileges=false
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ReadWritePaths=${INSTALL_DIR}/backend/data ${INSTALL_DIR}/backend/logs ${SERVICE_HOME} ${MAKEMKV_SERVICE_DIR}
|
ReadWritePaths=${INSTALL_DIR}/backend/data ${INSTALL_DIR}/backend/logs /tmp ${SERVICE_HOME} ${MAKEMKV_SERVICE_DIR}
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
@@ -457,58 +385,6 @@ install_node() {
|
|||||||
ok "Node.js $(node --version) installiert"
|
ok "Node.js $(node --version) installiert"
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_makemkv_eula() {
|
|
||||||
if [[ "$MAKEMKV_EULA_REVIEWED" == true ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$ACCEPT_MAKEMKV_EULA" == true ]]; then
|
|
||||||
warn "MakeMKV-EULA wurde per --accept-makemkv-eula ausdrücklich akzeptiert."
|
|
||||||
MAKEMKV_EULA_REVIEWED=true
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
warn "MakeMKV unterliegt eigenen Lizenz- und Registrierungsbedingungen."
|
|
||||||
warn "Ripster kann diese Bedingungen nicht automatisch fuer dich akzeptieren."
|
|
||||||
echo "Bitte pruefe die MakeMKV-Lizenzbedingungen, bevor MakeMKV gebaut und installiert wird."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
local answer=""
|
|
||||||
if [[ -t 0 ]]; then
|
|
||||||
read -r -p "MakeMKV-EULA bewusst akzeptieren und MakeMKV installieren? Tippe 'yes': " answer
|
|
||||||
elif [[ -r /dev/tty ]]; then
|
|
||||||
read -r -p "MakeMKV-EULA bewusst akzeptieren und MakeMKV installieren? Tippe 'yes': " answer </dev/tty
|
|
||||||
else
|
|
||||||
fatal "MakeMKV-Installation benoetigt ausdrueckliche Zustimmung. Nutze --accept-makemkv-eula oder --no-makemkv."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$answer" != "yes" ]]; then
|
|
||||||
fatal "MakeMKV-Installation abgebrochen. Nutze --no-makemkv zum Ueberspringen."
|
|
||||||
fi
|
|
||||||
|
|
||||||
ACCEPT_MAKEMKV_EULA=true
|
|
||||||
MAKEMKV_EULA_REVIEWED=true
|
|
||||||
}
|
|
||||||
|
|
||||||
show_handbrake_license_notice() {
|
|
||||||
if [[ "$HANDBRAKE_NOTICE_SHOWN" == true ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
warn "HandBrakeCLI ist ein eigenständiges Drittanbieterprogramm unter GPL-2.0-only."
|
|
||||||
warn "Die Ripster-Lizenz ersetzt oder verändert die HandBrake-Lizenz nicht."
|
|
||||||
if [[ "$HANDBRAKE_INSTALL_MODE" == "gpu" ]]; then
|
|
||||||
warn "Die gebündelte HandBrakeCLI enthält FDK-AAC-Hinweise."
|
|
||||||
warn "Ihre Weiterverteilung ist bis zur Klärung oder einem Neuaufbau ohne FDK-AAC ungeklärt."
|
|
||||||
else
|
|
||||||
info "Bei der Standardversion gelten die Lizenzhinweise des Distributionspakets."
|
|
||||||
fi
|
|
||||||
info "Weitere Details: THIRD_PARTY_NOTICES.md und third_party/handbrake/BUILDINFO.md"
|
|
||||||
HANDBRAKE_NOTICE_SHOWN=true
|
|
||||||
}
|
|
||||||
|
|
||||||
install_makemkv() {
|
install_makemkv() {
|
||||||
header "MakeMKV installieren"
|
header "MakeMKV installieren"
|
||||||
|
|
||||||
@@ -517,8 +393,6 @@ install_makemkv() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confirm_makemkv_eula
|
|
||||||
|
|
||||||
info "Installiere Build-Abhängigkeiten für MakeMKV..."
|
info "Installiere Build-Abhängigkeiten für MakeMKV..."
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
build-essential pkg-config libc6-dev libssl-dev \
|
build-essential pkg-config libc6-dev libssl-dev \
|
||||||
@@ -559,7 +433,6 @@ install_makemkv() {
|
|||||||
cd "$tmp_dir"
|
cd "$tmp_dir"
|
||||||
tar xf "makemkv-bin-${makemkv_version}.tar.gz"
|
tar xf "makemkv-bin-${makemkv_version}.tar.gz"
|
||||||
cd "makemkv-bin-${makemkv_version}"
|
cd "makemkv-bin-${makemkv_version}"
|
||||||
# MakeMKV expects this marker during its own build after explicit user consent.
|
|
||||||
mkdir -p tmp && echo "accepted" > tmp/eula_accepted
|
mkdir -p tmp && echo "accepted" > tmp/eula_accepted
|
||||||
make -j"$(nproc)"
|
make -j"$(nproc)"
|
||||||
make install
|
make install
|
||||||
@@ -573,9 +446,7 @@ install_makemkv() {
|
|||||||
sync_makemkv_beta_key() {
|
sync_makemkv_beta_key() {
|
||||||
header "MakeMKV Betakey synchronisieren"
|
header "MakeMKV Betakey synchronisieren"
|
||||||
|
|
||||||
local backend_base_url="http://127.0.0.1:${BACKEND_PORT}/api"
|
local backend_settings_url="http://127.0.0.1:${BACKEND_PORT}/settings"
|
||||||
local backend_health_url="${backend_base_url}/health"
|
|
||||||
local backend_settings_url="${backend_base_url}/settings"
|
|
||||||
local beta_api_url="https://cable.ayra.ch/makemkv/api.php?json"
|
local beta_api_url="https://cable.ayra.ch/makemkv/api.php?json"
|
||||||
local settings_response=""
|
local settings_response=""
|
||||||
local current_key=""
|
local current_key=""
|
||||||
@@ -583,7 +454,6 @@ sync_makemkv_beta_key() {
|
|||||||
local beta_key=""
|
local beta_key=""
|
||||||
local save_response=""
|
local save_response=""
|
||||||
local makemkv_settings_file="${SERVICE_HOME}/.MakeMKV/settings.conf"
|
local makemkv_settings_file="${SERVICE_HOME}/.MakeMKV/settings.conf"
|
||||||
local wait_attempt=0
|
|
||||||
|
|
||||||
update_makemkv_settings_file_key() {
|
update_makemkv_settings_file_key() {
|
||||||
local settings_file="$1"
|
local settings_file="$1"
|
||||||
@@ -603,14 +473,6 @@ sync_makemkv_beta_key() {
|
|||||||
chmod 600 "$settings_file" 2>/dev/null || true
|
chmod 600 "$settings_file" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
while (( wait_attempt < 10 )); do
|
|
||||||
if curl -fsS "$backend_health_url" >/dev/null 2>&1; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
wait_attempt=$((wait_attempt + 1))
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! settings_response=$(curl -fsS "$backend_settings_url" 2>/dev/null); then
|
if ! settings_response=$(curl -fsS "$backend_settings_url" 2>/dev/null); then
|
||||||
warn "Backend-Settings konnten nicht geladen werden."
|
warn "Backend-Settings konnten nicht geladen werden."
|
||||||
warn "Betakey-Synchronisierung übersprungen: $backend_settings_url"
|
warn "Betakey-Synchronisierung übersprungen: $backend_settings_url"
|
||||||
@@ -716,59 +578,8 @@ install_handbrake_standard() {
|
|||||||
fatal "HandBrake wurde installiert, aber kein CLI-Befehl wurde gefunden."
|
fatal "HandBrake wurde installiert, aber kein CLI-Befehl wurde gefunden."
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_bundled_handbrake_binary() {
|
|
||||||
local candidate="$1"
|
|
||||||
local checksum_file="${SCRIPT_DIR}/third_party/handbrake/SHA256SUMS"
|
|
||||||
local host_arch
|
|
||||||
local binary_desc=""
|
|
||||||
|
|
||||||
if [[ ! -f "$candidate" ]]; then
|
|
||||||
fatal "Gebündelte HandBrakeCLI fehlt: $candidate"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -x "$candidate" ]]; then
|
|
||||||
fatal "Gebündelte HandBrakeCLI ist nicht ausführbar: $candidate"
|
|
||||||
fi
|
|
||||||
|
|
||||||
host_arch="$(uname -m 2>/dev/null || echo unknown)"
|
|
||||||
if command_exists file; then
|
|
||||||
binary_desc="$(file -b "$candidate" 2>/dev/null || true)"
|
|
||||||
info "Gebündelte HandBrakeCLI: ${binary_desc:-Architektur nicht ermittelbar}"
|
|
||||||
case "$binary_desc" in
|
|
||||||
*"x86-64"*)
|
|
||||||
case "$host_arch" in
|
|
||||||
x86_64|amd64) ;;
|
|
||||||
*) fatal "Gebündelte HandBrakeCLI ist x86-64, Host-Architektur ist '$host_arch'." ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
warn "Architektur der gebündelten HandBrakeCLI konnte nicht eindeutig geprüft werden."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
warn "Befehl 'file' nicht gefunden - Architekturprüfung für HandBrakeCLI übersprungen."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "$checksum_file" ]] && command_exists sha256sum; then
|
|
||||||
local expected
|
|
||||||
local actual
|
|
||||||
expected=$(awk '$2 == "bin/HandBrakeCLI" || $2 == "./bin/HandBrakeCLI" { print $1; exit }' "$checksum_file")
|
|
||||||
if [[ -n "$expected" ]]; then
|
|
||||||
actual=$(sha256sum "$candidate" | awk '{ print $1 }')
|
|
||||||
if [[ "$actual" != "$expected" ]]; then
|
|
||||||
fatal "Prüfsumme der gebündelten HandBrakeCLI stimmt nicht. Erwartet $expected, erhalten $actual."
|
|
||||||
fi
|
|
||||||
ok "Prüfsumme der gebündelten HandBrakeCLI verifiziert"
|
|
||||||
else
|
|
||||||
warn "Keine passende HandBrakeCLI-Prüfsumme in $checksum_file gefunden."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "HandBrakeCLI-Prüfsumme konnte nicht geprüft werden (SHA256SUMS oder sha256sum fehlt)."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_handbrake_gpu_bundled() {
|
install_handbrake_gpu_bundled() {
|
||||||
info "Installiere gebündelte GPU-fähige HandBrakeCLI..."
|
info "Installiere gebündeltes HandBrakeCLI mit NVDEC..."
|
||||||
local bundled_source="$BUNDLED_HANDBRAKE_CLI"
|
local bundled_source="$BUNDLED_HANDBRAKE_CLI"
|
||||||
local downloaded_tmp=""
|
local downloaded_tmp=""
|
||||||
|
|
||||||
@@ -786,8 +597,6 @@ install_handbrake_gpu_bundled() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
verify_bundled_handbrake_binary "$bundled_source"
|
|
||||||
|
|
||||||
install -m 0755 "$bundled_source" /usr/local/bin/HandBrakeCLI
|
install -m 0755 "$bundled_source" /usr/local/bin/HandBrakeCLI
|
||||||
hash -r 2>/dev/null || true
|
hash -r 2>/dev/null || true
|
||||||
if [[ -n "$downloaded_tmp" ]]; then
|
if [[ -n "$downloaded_tmp" ]]; then
|
||||||
@@ -807,8 +616,6 @@ install_handbrake() {
|
|||||||
HANDBRAKE_INSTALL_MODE="standard"
|
HANDBRAKE_INSTALL_MODE="standard"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
show_handbrake_license_notice
|
|
||||||
|
|
||||||
case "$HANDBRAKE_INSTALL_MODE" in
|
case "$HANDBRAKE_INSTALL_MODE" in
|
||||||
standard) install_handbrake_standard ;;
|
standard) install_handbrake_standard ;;
|
||||||
gpu) install_handbrake_gpu_bundled ;;
|
gpu) install_handbrake_gpu_bundled ;;
|
||||||
@@ -907,99 +714,59 @@ info "Installationsverzeichnis: $INSTALL_DIR"
|
|||||||
info "Systembenutzer: $SERVICE_USER"
|
info "Systembenutzer: $SERVICE_USER"
|
||||||
info "Backend-Port: $BACKEND_PORT"
|
info "Backend-Port: $BACKEND_PORT"
|
||||||
info "Frontend-Host: $FRONTEND_HOST"
|
info "Frontend-Host: $FRONTEND_HOST"
|
||||||
info "System-Dependencies: $([[ "$SKIP_SYSTEM_DEPS" == true ]] && echo "überspringen" || echo "installieren")"
|
|
||||||
|
|
||||||
# --- HandBrake-Installmodus auswählen ----------------------------------------
|
# --- HandBrake-Installmodus auswählen ----------------------------------------
|
||||||
if [[ "$SKIP_SYSTEM_DEPS" == false || "$FORCE_LICENSE_PROMPTS" == true ]]; then
|
select_handbrake_mode
|
||||||
select_handbrake_mode
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Lizenzhinweise auf Wunsch unabhängig vom Installationsstatus zeigen -----
|
|
||||||
if [[ "$FORCE_LICENSE_PROMPTS" == true ]]; then
|
|
||||||
header "Lizenzabfragen erneut anzeigen"
|
|
||||||
|
|
||||||
if [[ "$SKIP_MAKEMKV" == false ]]; then
|
|
||||||
confirm_makemkv_eula
|
|
||||||
else
|
|
||||||
warn "MakeMKV-Lizenzabfrage übersprungen (--no-makemkv)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$SKIP_HANDBRAKE" == false ]]; then
|
|
||||||
show_handbrake_license_notice
|
|
||||||
else
|
|
||||||
warn "HandBrake-Lizenzhinweis übersprungen (--no-handbrake)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Systemabhängigkeiten -----------------------------------------------------
|
# --- Systemabhängigkeiten -----------------------------------------------------
|
||||||
if [[ "$SKIP_SYSTEM_DEPS" == true ]]; then
|
header "Systemabhängigkeiten installieren"
|
||||||
header "Systemabhängigkeiten installieren"
|
|
||||||
warn "Übersprungen (--no-system-deps)"
|
info "Paketlisten aktualisieren..."
|
||||||
|
apt_update
|
||||||
|
|
||||||
|
info "Installiere Basispakete..."
|
||||||
|
apt-get install -y \
|
||||||
|
curl wget git jq \
|
||||||
|
ffmpeg \
|
||||||
|
mediainfo \
|
||||||
|
util-linux udev \
|
||||||
|
ca-certificates gnupg \
|
||||||
|
lsb-release \
|
||||||
|
mkvtoolnix \
|
||||||
|
coreutils
|
||||||
|
|
||||||
|
ok "Basispakete installiert"
|
||||||
|
|
||||||
|
info "Installiere CD-Ripping-Tools..."
|
||||||
|
apt-get install -y \
|
||||||
|
cdparanoia \
|
||||||
|
flac \
|
||||||
|
lame \
|
||||||
|
opus-tools \
|
||||||
|
vorbis-tools
|
||||||
|
|
||||||
|
ok "CD-Ripping-Tools installiert (cdparanoia, flac, lame, opus-tools, vorbis-tools)"
|
||||||
|
|
||||||
|
install_node
|
||||||
|
|
||||||
|
if [[ "$SKIP_MAKEMKV" == false ]]; then
|
||||||
|
install_makemkv
|
||||||
else
|
else
|
||||||
header "Systemabhängigkeiten installieren"
|
warn "MakeMKV-Installation übersprungen (--no-makemkv)"
|
||||||
|
|
||||||
info "Paketlisten aktualisieren..."
|
|
||||||
apt_update
|
|
||||||
|
|
||||||
info "Installiere Basispakete..."
|
|
||||||
apt-get install -y \
|
|
||||||
curl wget git jq \
|
|
||||||
ffmpeg \
|
|
||||||
mediainfo \
|
|
||||||
util-linux udev \
|
|
||||||
ca-certificates gnupg \
|
|
||||||
lsb-release \
|
|
||||||
mkvtoolnix \
|
|
||||||
coreutils
|
|
||||||
|
|
||||||
ok "Basispakete installiert"
|
|
||||||
|
|
||||||
info "Installiere CD-Ripping-Tools..."
|
|
||||||
apt-get install -y \
|
|
||||||
cdparanoia \
|
|
||||||
flac \
|
|
||||||
lame \
|
|
||||||
opus-tools \
|
|
||||||
vorbis-tools
|
|
||||||
|
|
||||||
ok "CD-Ripping-Tools installiert (cdparanoia, flac, lame, opus-tools, vorbis-tools)"
|
|
||||||
|
|
||||||
install_node
|
|
||||||
|
|
||||||
if [[ "$SKIP_MAKEMKV" == false ]]; then
|
|
||||||
install_makemkv
|
|
||||||
else
|
|
||||||
warn "MakeMKV-Installation übersprungen (--no-makemkv)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$SKIP_HANDBRAKE" == false ]]; then
|
|
||||||
install_handbrake
|
|
||||||
else
|
|
||||||
warn "HandBrake-Installation übersprungen (--no-handbrake)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$SKIP_NGINX" == false ]]; then
|
|
||||||
if ! command_exists nginx; then
|
|
||||||
info "Installiere nginx..."
|
|
||||||
apt-get install -y nginx
|
|
||||||
fi
|
|
||||||
ok "nginx installiert"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SKIP_SYSTEM_DEPS" == true ]]; then
|
if [[ "$SKIP_HANDBRAKE" == false ]]; then
|
||||||
missing_required=()
|
install_handbrake
|
||||||
command_exists git || missing_required+=("git")
|
else
|
||||||
command_exists jq || missing_required+=("jq")
|
warn "HandBrake-Installation übersprungen (--no-handbrake)"
|
||||||
command_exists node || missing_required+=("node")
|
fi
|
||||||
command_exists npm || missing_required+=("npm")
|
|
||||||
if [[ "$SKIP_NGINX" == false ]]; then
|
|
||||||
command_exists nginx || missing_required+=("nginx")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${#missing_required[@]} -gt 0 ]]; then
|
if [[ "$SKIP_NGINX" == false ]]; then
|
||||||
fatal "--no-system-deps gesetzt, aber folgende Pflicht-Tools fehlen: ${missing_required[*]}. Bitte vorab installieren oder ohne --no-system-deps ausführen."
|
if ! command_exists nginx; then
|
||||||
|
info "Installiere nginx..."
|
||||||
|
apt-get install -y nginx
|
||||||
fi
|
fi
|
||||||
|
ok "nginx installiert"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Systembenutzer anlegen ---------------------------------------------------
|
# --- Systembenutzer anlegen ---------------------------------------------------
|
||||||
@@ -1045,24 +812,10 @@ header "Repository holen (Git)"
|
|||||||
info "Prüfe Branch '$GIT_BRANCH' auf Remote..."
|
info "Prüfe Branch '$GIT_BRANCH' auf Remote..."
|
||||||
branch_check_output=""
|
branch_check_output=""
|
||||||
branch_check_status=0
|
branch_check_status=0
|
||||||
if command_exists timeout; then
|
if ! branch_check_output=$(git ls-remote --exit-code --heads "$REPO_URL" "$GIT_BRANCH" 2>&1); then
|
||||||
branch_check_output=$(timeout --foreground "${GIT_COMMAND_TIMEOUT_SEC}" \
|
branch_check_status=$?
|
||||||
git ls-remote --exit-code --heads "$REPO_URL" "$GIT_BRANCH" 2>&1) || branch_check_status=$?
|
|
||||||
else
|
|
||||||
branch_check_output=$(git ls-remote --exit-code --heads "$REPO_URL" "$GIT_BRANCH" 2>&1) || branch_check_status=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$branch_check_status" -ne 0 ]]; then
|
|
||||||
if [[ "$branch_check_status" -eq 124 ]]; then
|
|
||||||
fatal "Timeout beim Prüfen des Branches '${GIT_BRANCH}' (${GIT_COMMAND_TIMEOUT_SEC}s)."
|
|
||||||
fi
|
|
||||||
if [[ "$branch_check_status" -eq 2 ]]; then
|
if [[ "$branch_check_status" -eq 2 ]]; then
|
||||||
if command_exists timeout; then
|
available_branches=$(git ls-remote --heads "$REPO_URL" 2>/dev/null | awk '{print $2}' | sed 's|refs/heads/||' | tr '\n' ' ')
|
||||||
available_branches=$(timeout --foreground "${GIT_COMMAND_TIMEOUT_SEC}" \
|
|
||||||
git ls-remote --heads "$REPO_URL" 2>/dev/null | awk '{print $2}' | sed 's|refs/heads/||' | tr '\n' ' ')
|
|
||||||
else
|
|
||||||
available_branches=$(git ls-remote --heads "$REPO_URL" 2>/dev/null | awk '{print $2}' | sed 's|refs/heads/||' | tr '\n' ' ')
|
|
||||||
fi
|
|
||||||
fatal "Branch '$GIT_BRANCH' existiert nicht im Repository $REPO_URL.\nVerfügbare Branches: ${available_branches:-keine oder Remote nicht erreichbar}"
|
fatal "Branch '$GIT_BRANCH' existiert nicht im Repository $REPO_URL.\nVerfügbare Branches: ${available_branches:-keine oder Remote nicht erreichbar}"
|
||||||
fi
|
fi
|
||||||
fatal "Remote $REPO_URL ist nicht erreichbar.\nGit-Fehler: ${branch_check_output:-unbekannt}"
|
fatal "Remote $REPO_URL ist nicht erreichbar.\nGit-Fehler: ${branch_check_output:-unbekannt}"
|
||||||
@@ -1072,24 +825,22 @@ ok "Branch '$GIT_BRANCH' gefunden"
|
|||||||
if [[ -d "$INSTALL_DIR/.git" ]]; then
|
if [[ -d "$INSTALL_DIR/.git" ]]; then
|
||||||
if [[ "$REINSTALL" == true ]]; then
|
if [[ "$REINSTALL" == true ]]; then
|
||||||
info "Aktualisiere bestehendes Repository..."
|
info "Aktualisiere bestehendes Repository..."
|
||||||
info "Sichere persistente Backend-Daten (ohne große Medienordner)..."
|
# Daten sichern
|
||||||
backup_persistent_backend_data
|
if [[ -d "$INSTALL_DIR/backend/data" ]]; then
|
||||||
|
DATA_BACKUP="/tmp/ripster-data-backup-$(date +%Y%m%d%H%M%S)"
|
||||||
|
cp -a "$INSTALL_DIR/backend/data" "$DATA_BACKUP"
|
||||||
|
info "Datenbank gesichert nach: $DATA_BACKUP"
|
||||||
|
fi
|
||||||
backup_and_remove_backend_src
|
backup_and_remove_backend_src
|
||||||
# safe.directory nötig wenn das Verzeichnis einem anderen User gehört
|
# safe.directory nötig wenn das Verzeichnis einem anderen User gehört
|
||||||
# (z.B. ripster-Serviceuser nach erstem Install)
|
# (z.B. ripster-Serviceuser nach erstem Install)
|
||||||
git config --global --add safe.directory "$INSTALL_DIR" 2>/dev/null || true
|
git config --global --add safe.directory "$INSTALL_DIR" 2>/dev/null || true
|
||||||
run_git_command "Setze Git-Remote-URL" \
|
git -C "$INSTALL_DIR" remote set-url origin "$REPO_URL"
|
||||||
git -C "$INSTALL_DIR" remote set-url origin "$REPO_URL"
|
git -C "$INSTALL_DIR" remote set-branches origin '*'
|
||||||
run_git_command "Aktualisiere Remote-Branch-Mapping" \
|
git -C "$INSTALL_DIR" fetch --quiet origin
|
||||||
git -C "$INSTALL_DIR" remote set-branches origin '*'
|
git -C "$INSTALL_DIR" reset --hard HEAD
|
||||||
run_git_command "Hole Änderungen vom Remote" \
|
git -C "$INSTALL_DIR" checkout --quiet -B "$GIT_BRANCH" "origin/$GIT_BRANCH"
|
||||||
git -C "$INSTALL_DIR" fetch --quiet origin
|
git -C "$INSTALL_DIR" reset --hard "origin/$GIT_BRANCH"
|
||||||
run_git_command "Setze Arbeitsverzeichnis auf aktuellen Stand (HEAD)" \
|
|
||||||
git -C "$INSTALL_DIR" reset --hard HEAD
|
|
||||||
run_git_command "Checkout Branch '$GIT_BRANCH'" \
|
|
||||||
git -C "$INSTALL_DIR" checkout --quiet -B "$GIT_BRANCH" "origin/$GIT_BRANCH"
|
|
||||||
run_git_command "Setze Branch auf origin/$GIT_BRANCH" \
|
|
||||||
git -C "$INSTALL_DIR" reset --hard "origin/$GIT_BRANCH"
|
|
||||||
ok "Repository aktualisiert auf Branch '$GIT_BRANCH'"
|
ok "Repository aktualisiert auf Branch '$GIT_BRANCH'"
|
||||||
else
|
else
|
||||||
fatal "$INSTALL_DIR enthält bereits ein Git-Repository.\nVerwende --reinstall um zu aktualisieren."
|
fatal "$INSTALL_DIR enthält bereits ein Git-Repository.\nVerwende --reinstall um zu aktualisieren."
|
||||||
@@ -1111,7 +862,6 @@ mkdir -p "$INSTALL_DIR/backend/data/output/series"
|
|||||||
mkdir -p "$INSTALL_DIR/backend/data/output/cd"
|
mkdir -p "$INSTALL_DIR/backend/data/output/cd"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/downloads"
|
mkdir -p "$INSTALL_DIR/backend/data/downloads"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/logs"
|
mkdir -p "$INSTALL_DIR/backend/data/logs"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/temp"
|
|
||||||
|
|
||||||
# Gesicherte Daten zurückspielen
|
# Gesicherte Daten zurückspielen
|
||||||
if [[ -n "${DATA_BACKUP:-}" && -d "$DATA_BACKUP" ]]; then
|
if [[ -n "${DATA_BACKUP:-}" && -d "$DATA_BACKUP" ]]; then
|
||||||
@@ -1125,7 +875,6 @@ mkdir -p "$INSTALL_DIR/backend/data/output/raw"
|
|||||||
mkdir -p "$INSTALL_DIR/backend/data/output/movies"
|
mkdir -p "$INSTALL_DIR/backend/data/output/movies"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/output/series"
|
mkdir -p "$INSTALL_DIR/backend/data/output/series"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/output/cd"
|
mkdir -p "$INSTALL_DIR/backend/data/output/cd"
|
||||||
mkdir -p "$INSTALL_DIR/backend/data/temp"
|
|
||||||
|
|
||||||
# --- npm-Abhängigkeiten installieren -----------------------------------------
|
# --- npm-Abhängigkeiten installieren -----------------------------------------
|
||||||
header "npm-Abhängigkeiten installieren"
|
header "npm-Abhängigkeiten installieren"
|
||||||
@@ -1182,7 +931,6 @@ DEFAULT_MOVIE_DIR=${INSTALL_DIR}/backend/data/output/movies
|
|||||||
DEFAULT_SERIES_DIR=${INSTALL_DIR}/backend/data/output/series
|
DEFAULT_SERIES_DIR=${INSTALL_DIR}/backend/data/output/series
|
||||||
DEFAULT_CD_DIR=${INSTALL_DIR}/backend/data/output/cd
|
DEFAULT_CD_DIR=${INSTALL_DIR}/backend/data/output/cd
|
||||||
DEFAULT_DOWNLOAD_DIR=${INSTALL_DIR}/backend/data/downloads
|
DEFAULT_DOWNLOAD_DIR=${INSTALL_DIR}/backend/data/downloads
|
||||||
DEFAULT_TEMP_DIR=${INSTALL_DIR}/backend/data/temp
|
|
||||||
EOF
|
EOF
|
||||||
ok "Backend .env erstellt"
|
ok "Backend .env erstellt"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loaded 100 of 209 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user