mirror of
https://github.com/lifegpc/pythonscript.git
synced 2026-06-06 11:28:58 +08:00
Update link_to_jellyfin_music.py
This commit is contained in:
@@ -102,6 +102,8 @@ p.add_argument("-r", "--recursive", help="Recursive search",
|
|||||||
p.add_argument("-c", "--cover", help="Cover file name", default="cover.jpg")
|
p.add_argument("-c", "--cover", help="Cover file name", default="cover.jpg")
|
||||||
p.add_argument("-H", "--hardlink", help="Use hard link instead of copy",
|
p.add_argument("-H", "--hardlink", help="Use hard link instead of copy",
|
||||||
action="store_true", default=False)
|
action="store_true", default=False)
|
||||||
|
p.add_argument("-d", "--delete", help="Delete output", action="store_true",
|
||||||
|
default=False)
|
||||||
arg = p.parse_intermixed_args()
|
arg = p.parse_intermixed_args()
|
||||||
print(arg)
|
print(arg)
|
||||||
for f in get_m4a_files(arg.INPUT, arg.recursive):
|
for f in get_m4a_files(arg.INPUT, arg.recursive):
|
||||||
@@ -114,10 +116,18 @@ for f in get_m4a_files(arg.INPUT, arg.recursive):
|
|||||||
thumb = r[1]
|
thumb = r[1]
|
||||||
if arg.verbose:
|
if arg.verbose:
|
||||||
print(f"Target thumb: {thumb}")
|
print(f"Target thumb: {thumb}")
|
||||||
if not exists(thumb):
|
if arg.delete and exists(thumb):
|
||||||
|
remove(thumb)
|
||||||
|
elif not exists(thumb):
|
||||||
makedirs(split(thumb)[0], exist_ok=True)
|
makedirs(split(thumb)[0], exist_ok=True)
|
||||||
generate_thumb(f, thumb)
|
generate_thumb(f, thumb)
|
||||||
if not arg.force and exists(r[0]):
|
if exists(r[0]):
|
||||||
|
if arg.delete:
|
||||||
|
remove(r[0])
|
||||||
|
if arg.verbose:
|
||||||
|
print(f"File {r[0]} deleted.")
|
||||||
|
continue
|
||||||
|
if not arg.force:
|
||||||
print(f"File {r[0]} exists, skipped")
|
print(f"File {r[0]} exists, skipped")
|
||||||
continue
|
continue
|
||||||
if exists(r[0]):
|
if exists(r[0]):
|
||||||
|
|||||||
Reference in New Issue
Block a user