1.0.018 - For Kodi Compatibility Use "filename-trailer"

#41 #39 

Untested, should work.... 

This will remove exiting movie-trailer.mkv and replace it with the same file but has a matching file name. If you rename your files frequently, you'll most likely end up with dupes....
pull/49/head
RandomNinjaAtk 1 year ago committed by GitHub
parent f7b98bd585
commit 3901da2a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.0.017"
scriptVersion="1.0.018"
arrEventType="$radarr_eventtype"
arrItemId=$radarr_movie_id
tmdbApiKey="3b7751e3179f796565d88fdb2fcdf426"
@ -78,12 +78,15 @@ arrItemData=$(curl -s "$arrUrl/api/v3/movie/$arrItemId?apikey=$arrApiKey")
itemTitle=$(echo "$arrItemData" | jq -r .title)
itemHasFile=$(echo "$arrItemData" | jq -r .hasFile)
itemPath="$(echo "$arrItemData" | jq -r ".path")"
itemFileName=$(curl -s "$arrUrl/api/v3/moviefile?movieId=$arrItemId&apikey=$arrApiKey" | jq -r .[].relativePath)
itemFileNameNoExt="${itemFileName%.*}"
itemFolder="$(basename "$itemPath")"
itemRelativePath="$(echo "$arrItemData" | jq -r ".movieFile.relativePath")"
itemTrailerId="$(echo "$arrItemData" | jq -r ".youTubeTrailerId")"
tmdbId="$(echo "$arrItemData" | jq -r ".tmdbId")"
if [ ! -d "$itemPath" ]; then
log "$itemTitle :: ERROR: Item Path does not exist ($itemPath), Skipping..."
exit
@ -157,10 +160,10 @@ do
log "$itemTitle :: $i of $tmdbVideosListDataIdsCount :: $tmdbExtraType :: Single Trailer Enabled..."
if [ "$extrasKodiCompatibility" == "true" ] ; then
finalPath="$itemPath"
finalFileName="movie-trailer"
finalFileName="$itemFileNameNoExt-trailer"
else
finalPath="$itemPath/$extraFolderName"
finalFileName="$itemFolder"
finalFileName="$tmdbExtraTitleClean"
fi
else
finalPath="$itemPath/$extraFolderName"
@ -180,6 +183,11 @@ do
break
fi
continue
elif [ -f "$finalPath/movie-trailer.mkv" ]; then
if [ "$extrasKodiCompatibility" == "true" ] ; then
log "$itemTitle :: $i of $tmdbVideosListDataIdsCount :: $tmdbExtraType :: Removing old \"movie-trailer.mkv\" to replace with Kodi naming..."
rm "$finalPath/movie-trailer.mkv"
fi
fi
videoLanguages="$(echo "$extrasLanguages" | sed "s/-[[:alpha:]][[:alpha:]]//g")"

Loading…
Cancel
Save