yt-dlp now output movie format
This commit is contained in:
parent
82b569a133
commit
9a2969939e
1 changed files with 14 additions and 46 deletions
|
|
@ -117,7 +117,7 @@ in
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate Jellyfin-compatible NFO files from yt-dlp metadata
|
# Generate Jellyfin-compatible NFO files from yt-dlp metadata (movie format)
|
||||||
_generate_jellyfin_nfo() {
|
_generate_jellyfin_nfo() {
|
||||||
local filepath="$1"
|
local filepath="$1"
|
||||||
[[ -z "$filepath" ]] && return 1
|
[[ -z "$filepath" ]] && return 1
|
||||||
|
|
@ -125,8 +125,6 @@ in
|
||||||
local dir=$(dirname "$filepath")
|
local dir=$(dirname "$filepath")
|
||||||
local basename=$(basename "$filepath")
|
local basename=$(basename "$filepath")
|
||||||
local name_noext="''${basename%.*}"
|
local name_noext="''${basename%.*}"
|
||||||
local season_dir="$dir"
|
|
||||||
local series_dir=$(dirname "$season_dir")
|
|
||||||
local json_file="$dir/$name_noext.info.json"
|
local json_file="$dir/$name_noext.info.json"
|
||||||
|
|
||||||
[[ ! -f "$json_file" ]] && return 1
|
[[ ! -f "$json_file" ]] && return 1
|
||||||
|
|
@ -136,13 +134,11 @@ in
|
||||||
local upload_date=$(jq -r '.upload_date // ""' "$json_file")
|
local upload_date=$(jq -r '.upload_date // ""' "$json_file")
|
||||||
local uploader=$(jq -r '.uploader // "Unknown"' "$json_file")
|
local uploader=$(jq -r '.uploader // "Unknown"' "$json_file")
|
||||||
|
|
||||||
local season_num=""
|
local year=""
|
||||||
local episode_num=""
|
local premiered=""
|
||||||
local aired_date=""
|
|
||||||
if [[ ''${#upload_date} -eq 8 ]]; then
|
if [[ ''${#upload_date} -eq 8 ]]; then
|
||||||
season_num="''${upload_date:0:4}"
|
year="''${upload_date:0:4}"
|
||||||
episode_num="''${upload_date:4:4}"
|
premiered="''${upload_date:0:4}-''${upload_date:4:2}-''${upload_date:6:2}"
|
||||||
aired_date="''${upload_date:0:4}-''${upload_date:4:2}-''${upload_date:6:2}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
description=$(echo "$description" | sed 's/&/\&/g; s/</\</g; s/>/\>/g')
|
description=$(echo "$description" | sed 's/&/\&/g; s/</\</g; s/>/\>/g')
|
||||||
|
|
@ -150,36 +146,16 @@ in
|
||||||
uploader=$(echo "$uploader" | sed 's/&/\&/g; s/</\</g; s/>/\>/g')
|
uploader=$(echo "$uploader" | sed 's/&/\&/g; s/</\</g; s/>/\>/g')
|
||||||
|
|
||||||
local nfo_file="$dir/$name_noext.nfo"
|
local nfo_file="$dir/$name_noext.nfo"
|
||||||
cat > "$nfo_file" << EPISODENFO
|
cat > "$nfo_file" << MOVIENFO
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<episodedetails>
|
<movie>
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<season>$season_num</season>
|
<year>$year</year>
|
||||||
<episode>$episode_num</episode>
|
<premiered>$premiered</premiered>
|
||||||
<aired>''${aired_date:-}</aired>
|
|
||||||
<plot>$description</plot>
|
<plot>$description</plot>
|
||||||
</episodedetails>
|
<studio>$uploader</studio>
|
||||||
EPISODENFO
|
</movie>
|
||||||
|
MOVIENFO
|
||||||
if [[ ! -f "$series_dir/tvshow.nfo" ]]; then
|
|
||||||
cat > "$series_dir/tvshow.nfo" << TVSHOWNFO
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<tvshow>
|
|
||||||
<title>$uploader</title>
|
|
||||||
<plot>Videos from $uploader</plot>
|
|
||||||
</tvshow>
|
|
||||||
TVSHOWNFO
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$season_dir/season.nfo" ]] && [[ -n "$season_num" ]]; then
|
|
||||||
cat > "$season_dir/season.nfo" << SEASONNFO
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<season>
|
|
||||||
<title>Season $season_num</title>
|
|
||||||
<seasonnumber>$season_num</seasonnumber>
|
|
||||||
</season>
|
|
||||||
SEASONNFO
|
|
||||||
fi
|
|
||||||
|
|
||||||
local thumb_file=""
|
local thumb_file=""
|
||||||
for ext in jpg webp png; do
|
for ext in jpg webp png; do
|
||||||
|
|
@ -192,14 +168,6 @@ SEASONNFO
|
||||||
if [[ -n "$thumb_file" ]]; then
|
if [[ -n "$thumb_file" ]]; then
|
||||||
local thumb_ext="''${thumb_file##*.}"
|
local thumb_ext="''${thumb_file##*.}"
|
||||||
mv "$thumb_file" "$dir/$name_noext-thumb.$thumb_ext" 2>/dev/null
|
mv "$thumb_file" "$dir/$name_noext-thumb.$thumb_ext" 2>/dev/null
|
||||||
|
|
||||||
if [[ ! -f "$series_dir/poster.jpg" ]] && [[ ! -f "$series_dir/poster.webp" ]] && [[ ! -f "$series_dir/poster.png" ]]; then
|
|
||||||
cp "$dir/$name_noext-thumb.$thumb_ext" "$series_dir/poster.$thumb_ext"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$season_dir/poster.jpg" ]] && [[ ! -f "$season_dir/poster.webp" ]] && [[ ! -f "$season_dir/poster.png" ]]; then
|
|
||||||
cp "$dir/$name_noext-thumb.$thumb_ext" "$season_dir/poster.$thumb_ext"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,8 +310,8 @@ SEASONNFO
|
||||||
match_filter="--match-filter \"$combined_filter\""
|
match_filter="--match-filter \"$combined_filter\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build output template (Jellyfin TV show format)
|
# Build output template (Jellyfin movie format)
|
||||||
local output_template="$DOWNLOAD_DIR/$platform_name/%(uploader|Unknown)s/Season %(upload_date>%Y|0000)s/S%(upload_date>%Y|0000)sE%(upload_date>%m%d|0000)s - %(title)s.%(ext)s"
|
local output_template="$DOWNLOAD_DIR/$platform_name/%(title)s (%(upload_date>%Y|0000)s)/%(title)s (%(upload_date>%Y|0000)s).%(ext)s"
|
||||||
|
|
||||||
local archive_file="$DOWNLOAD_DIR/.archive.txt"
|
local archive_file="$DOWNLOAD_DIR/.archive.txt"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue