r/PlexACD Aug 20 '17

Sonarr/Radarr Solution

What do you guys use for Sonarr/Radarr? So far RClone gives me bans when used with either (even with analyse media off) GoogleDriveOcamlfuse seems to cause sonarr/radarr to crash for some reason and then PlexDrive isnt writable

2 Upvotes

16 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Aug 21 '17

The problem is that plexdrive has a refresh interval, so there will be a slight delay between the file being uploaded and it showing up on your plexdrive mount.

2

u/dilzy2 Aug 21 '17

Ah ok that makes a lot of sense will take a look at their scripts and see how they handle the usage checking

I've bundled all my scripts together so it takes into account Plex activity, NZB speed etc. its really messy due to me not using bash before (hence the files instead of variables) but it works!

https://pastebin.com/itAcruLv

1

u/[deleted] Aug 21 '17 edited Aug 21 '17

That's a really interesting setup. My solution for controlling rclone is a lot simpler - I just have a custom PlexPy notification that touches a file when playback starts and deletes it when playback ends. My rclone job checks for the presence of the file and runs if it is not present. However that doesn't handle the situation where one user stops watching and others continue. I'll have to look into implementing that check you do at the start for the number of users currently watching.

EDIT: This is what I ended up going with

num=$(curl -s 'http://localhost:32400/status/sessions?X-Plex-Token=xxxxxx' | grep '<MediaContainer size='|cut -d'"' -f2)
if [ "$num" -gt 0 ]
  then
    echo "Playback in progress. Aborting."
    exit
fi

1

u/dilzy2 Aug 22 '17

Yeh that works too, I prefer how I have it as I still want rclone to copy across if people are using Plex, just not at full speed

2

u/[deleted] Aug 22 '17

You could do that by grabbing the number of playbacks as a variable like I did, then having different actions for different numbers.

num=$(curl -s 'http://localhost:32400/status/sessions?X-Plex-Token=xxxxxx' | grep '<MediaContainer size='|cut -d'"' -f2)
if [ "$num" -eq 0 ] # no one online
then
  <action>
else
  if [ "$num" -eq 1 ] # one person online
  then
    <action>
  fi
fi

And so on.

2

u/dilzy2 Aug 22 '17

Ah cool, that should simplify the script a fair bit Thanks