Updated Video.sh to use videoContainer env

pull/237/head
snorkrat 2 years ago committed by GitHub
parent 7e949de371
commit 0b9bdb69a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,6 +64,9 @@ log "Donate: https://github.com/sponsors/RandomNinjaAtk"
log "Project: https://github.com/RandomNinjaAtk/docker-lidarr-extended" log "Project: https://github.com/RandomNinjaAtk/docker-lidarr-extended"
log "Support: https://github.com/RandomNinjaAtk/docker-lidarr-extended/discussions" log "Support: https://github.com/RandomNinjaAtk/docker-lidarr-extended/discussions"
log "-----------------------------------------------------------------------------" log "-----------------------------------------------------------------------------"
log "Snorkrat Modified for videoContainer option"
log "Video container set to format: $videoContainer"
log "-----------------------------------------------------------------------------"
sleep 5 sleep 5
log "" log ""
log "Lift off in..."; sleep 0.5 log "Lift off in..."; sleep 0.5
@ -87,6 +90,7 @@ Configuration () {
log "CONFIG :: Music Video Location :: $videoPath" log "CONFIG :: Music Video Location :: $videoPath"
log "CONFIG :: Subtitle Language set to: $youtubeSubtitleLanguage" log "CONFIG :: Subtitle Language set to: $youtubeSubtitleLanguage"
log "CONFIG :: yt-dlp format: $videoFormat" log "CONFIG :: yt-dlp format: $videoFormat"
log "CONFIG :: Video container set to format: $videoContainer"
if [ -n "$videoDownloadTag" ]; then if [ -n "$videoDownloadTag" ]; then
log "CONFIG :: Video download tag set to: $videoDownloadTag" log "CONFIG :: Video download tag set to: $videoDownloadTag"
fi fi
@ -341,12 +345,12 @@ DownloadVideo () {
if echo "$1" | grep -i "youtube" | read; then if echo "$1" | grep -i "youtube" | read; then
if [ ! -z "$cookiesFile" ]; then if [ ! -z "$cookiesFile" ]; then
yt-dlp -f "$videoFormat" --no-video-multistreams --cookies "$cookiesFile" -o "$downloadPath/incomplete/${2}${3}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format mkv --remux-video mkv --no-mtime --geo-bypass "$1" yt-dlp -f "$videoFormat" --no-video-multistreams --cookies "$cookiesFile" -o "$downloadPath/incomplete/${2}${3}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format $videoContainer --remux-video $videoContainer --no-mtime --geo-bypass "$1"
else else
yt-dlp -f "$videoFormat" --no-video-multistreams -o "$downloadPath/incomplete/${2}${3}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format mkv --remux-video mkv --no-mtime --geo-bypass "$1" yt-dlp -f "$videoFormat" --no-video-multistreams -o "$downloadPath/incomplete/${2}${3}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format $videoContainer --remux-video $videoContainer --no-mtime --geo-bypass "$1"
fi fi
if [ -f "$downloadPath/incomplete/${2}${3}.mkv" ]; then if [ -f "$downloadPath/incomplete/${2}${3}.$videoContainer" ]; then
chmod 666 "$downloadPath/incomplete/${2}${3}.mkv" chmod 666 "$downloadPath/incomplete/${2}${3}.$videoContainer"
downloadFailed=false downloadFailed=false
else else
downloadFailed=true downloadFailed=true
@ -394,16 +398,31 @@ VideoProcessWithSMA () {
extension="${filename##*.}" extension="${filename##*.}"
filenamenoext="${filename%.*}" filenamenoext="${filename%.*}"
if python3 /usr/local/sma/manual.py --config "/config/extended/scripts/sma.ini" -i "$file" -nt &>/dev/null; then if [[ $filenoext.$videoContainer == *.mkv ]]
sleep 0.01 then
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: Processed with SMA..."
rm /usr/local/sma/config/*log* if python3 /usr/local/sma/manual.py --config "/config/extended/scripts/sma.ini" -i "$file" -nt &>/dev/null; then
sleep 0.01
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: Processed with SMA..."
rm /usr/local/sma/config/*log*
else
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: ERROR: SMA Processing Error"
rm "$video"
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: INFO: deleted: $filename"
fi
else else
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: ERROR: SMA Processing Error" if python3 /usr/local/sma/manual.py --config "/config/extended/scripts/sma-mp4.ini" -i "$file" -nt &>/dev/null; then
rm "$video" sleep 0.01
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: INFO: deleted: $filename" log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: Processed with SMA..."
rm /usr/local/sma/config/*log*
else
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: ERROR: SMA Processing Error"
rm "$video"
log "$processCount of $lidarrArtistIdsCount :: $1 :: $lidarrArtistName :: $2 :: INFO: deleted: $filename"
fi
fi fi
done done
} }
VideoTagProcess () { VideoTagProcess () {
@ -430,10 +449,13 @@ VideoTagProcess () {
genre="" genre=""
fi fi
mv "$filenoext.mkv" "$filenoext-temp.mkv" if [[ $filenoext.$videoContainer == *.mkv ]]
then
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "$processCount of $lidarrArtistIdsCount :: $4 :: $lidarrArtistName :: ${1}${2} $3 :: Tagging file" log "$processCount of $lidarrArtistIdsCount :: $4 :: $lidarrArtistName :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \ ffmpeg -y \
-i "$filenoext-temp.mkv" \ -i "$filenoext-temp.$videoContainer" \
-c copy \ -c copy \
-metadata TITLE="${1}" \ -metadata TITLE="${1}" \
-metadata DATE_RELEASE="$3" \ -metadata DATE_RELEASE="$3" \
@ -444,9 +466,32 @@ VideoTagProcess () {
-metadata ALBUMARTIST="$lidarrArtistName" \ -metadata ALBUMARTIST="$lidarrArtistName" \
-metadata ENCODED_BY="lidarr-extended" \ -metadata ENCODED_BY="lidarr-extended" \
-attach "$downloadPath/incomplete/${1}${2}.jpg" -metadata:s:t mimetype=image/jpeg \ -attach "$downloadPath/incomplete/${1}${2}.jpg" -metadata:s:t mimetype=image/jpeg \
"$filenoext.mkv" &>/dev/null "$filenoext.$videoContainer" &>/dev/null
rm "$filenoext-temp.mkv" rm "$filenoext-temp.$videoContainer"
chmod 666 "$filenoext.mkv" chmod 666 "$filenoext.$videoContainer"
else
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "$processCount of $lidarrArtistIdsCount :: $4 :: $lidarrArtistName :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \
-i "$filenoext-temp.$videoContainer" \
-i "$downloadPath/incomplete/${1}${2}.jpg" \
-map 1 \
-map 0 \
-c copy \
-disposition:0 attached_pic \
-movflags faststart \
-metadata title="${1}" \
-metadata date="$3" \
-metadata artist="$lidarrArtistName" \
-metadata genre="$genre" \
"$filenoext.$videoContainer" &>/dev/null
rm "$filenoext-temp.$videoContainer"
chmod 666 "$filenoext.$videoContainer"
fi
done done
} }
@ -748,7 +793,7 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
fi fi
fi fi
fi fi
if [[ -n $(find "$videoPath/$lidarrArtistFolderNoDisambig" -maxdepth 1 -iname "${musicbrainzVideoTitleClean}${plexVideoType}.mkv") ]]; then if [[ -n $(find "$videoPath/$lidarrArtistFolderNoDisambig" -maxdepth 1 -iname "${musicbrainzVideoTitleClean}${plexVideoType}.$videoContainer") ]]; then
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: ${musicbrainzVideoTitle}${musicbrainzVideoDisambiguation} :: Previously Downloaded, skipping..." log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: ${musicbrainzVideoTitle}${musicbrainzVideoDisambiguation} :: Previously Downloaded, skipping..."
continue continue
fi fi
@ -837,7 +882,7 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
tidy -w 2000 -i -m -xml "$videoPath/$lidarrArtistFolderNoDisambig/${videoTitleClean}${plexVideoType}.nfo" &>/dev/null tidy -w 2000 -i -m -xml "$videoPath/$lidarrArtistFolderNoDisambig/${videoTitleClean}${plexVideoType}.nfo" &>/dev/null
fi fi
fi fi
if [[ -n $(find "$videoPath/$lidarrArtistFolderNoDisambig" -maxdepth 1 -iname "${videoTitleClean}${plexVideoType}.mkv") ]]; then if [[ -n $(find "$videoPath/$lidarrArtistFolderNoDisambig" -maxdepth 1 -iname "${videoTitleClean}${plexVideoType}.$videoContainer") ]]; then
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: ${imvdbVideoTitle} :: Previously Downloaded, skipping..." log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: ${imvdbVideoTitle} :: Previously Downloaded, skipping..."
continue continue
fi fi

Loading…
Cancel
Save