Last active
May 12, 2020 12:36
-
-
Save hazcod/f5f1d6df32affb3e170bfe917577a774 to your computer and use it in GitHub Desktop.
Sonarr & Plex plex scanner.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
type="$1" | |
PLEXSCAN="/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner" | |
if [ "$type" != "Series" ] && [ "$type" != "Movies" ]; then | |
echo "Unknown type: $type" | |
exit 1 | |
fi | |
section="" | |
if [ "$type" == "Series" ]; then | |
from="${sonarr_episodefile_path}" | |
section="2" | |
fi | |
if [ "$type" == "Movies" ]; then | |
from="${radarr_movie_path}" | |
section="1" | |
fi | |
if [ -z "$from" ]; then | |
echo "Not uploading empty FROM" | |
exit | |
fi | |
scandir="$(dirname "$from")/" | |
echo "Scanning media to Plex: $scandir" | |
"$PLEXSCAN" --verbose --section "$section" --directory "$scandir" --scan --refresh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment