Last active
May 15, 2021 12:44
-
-
Save agneevX/47e9cb4927da5b58aa8d8966069f1026 to your computer and use it in GitHub Desktop.
A dirty bash script to install the Plex Trakt scrobbler
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
#!/bin/bash | |
set -e | |
PLEX_LOCATION="/var/lib/plexmediaserver" | |
TRAKT_DL_LOCATION="https://github.com/trakt/Plex-Trakt-Scrobbler/archive/master.zip" | |
if ! command -v unzip &> /dev/null; then | |
printf "unzip could not be found.. installing unzip \n\n" | |
sudo apt -y install unzip | |
fi | |
cd /tmp | |
printf "Downloading Plex-trakt-scrobbler\n\n"; cd /tmp | |
if ! command -v aria2c &> /dev/null; then | |
printf "Using wget...\n\n" | |
wget -q $TRAKT_DL_LOCATION -O Plex-Trakt-Scrobbler.zip --show-progress --progress=bar:force:noscroll | |
else | |
printf "using aria2...\n\n" | |
aria2c -j 8 -x 16 $TRAKT_DL_LOCATION | |
fi | |
unzip -q -o ./Plex-Trakt-*.zip | |
sudo systemctl stop plexmediaserver; clear | |
printf "Copying to Plex folder\n\n" | |
sudo cp -r /tmp/Plex-Trakt-Scrobbler-*/Trakttv.bundle "$PLEX_LOCATION/Library/Application Support/Plex Media Server/Plug-ins/" | |
# Downloading apsw.so and trakt databases | |
printf "Downloading and unzipping trakt.zip from Dropbox\n\n" | |
wget "https://www.dropbox.com/s/8139onakej9xfyj/trakt.zip?dl=1" -O trakt.zip | |
unzip -q ./trakt.zip | |
# Copying databases and changing ownership | |
sudo cp ./trakt/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload | |
cd "$PLEX_LOCATION/Library/Application Support/Plex Media Server/Plug-in Support/Databases" | |
sudo cp /tmp/trakt/*.trakttv.db* ./ | |
sudo chown plex:plex ./*.trakttv.db* && sudo chmod 644 ./*.trakttv.db* | |
rm -r /tmp/Plex-Trakt* /tmp/trakt* | |
cd ~/; sudo systemctl start plexmediaserver | |
printf "Plex-Trakt-Scrobbler is now installed.\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment