Plexdrive


Recommended Posts

On 5/27/2017 at 9:22 AM, starbix said:

Hey I wrote a plexdrive plugin. Here it is: https://raw.githubusercontent.com/Starbix/unRAID-plugins/master/plugins/plexdrive.plg

 

I'm totally new to plugin writing, but I also have a unionfs plugin if anyone else is interested.

 

Hopefully it works for you guys

 

Hey Starbix.

 

I would love your unionfs plugin as well.

 

Figuring it out is another thing but I would appreciate it for sure.


And thanks for your first plugin!

Link to comment
6 minutes ago, airbillion said:

Can anyon give a tutorial on how the plexdrive pluin works?

 

I installed it, but cannot et it to run.

 

Thanks!

The plugin places the file "plexdrive" in the /usr/sbin/ folder, so you would just run your command pointing at that.

 

I just spent like a week hitting my head against a wall so let me know if you want more details on how I got plexdrive working A-Z

Link to comment
25 minutes ago, airbillion said:

OK...I found it and got it to run...thanks...

 

Any additional help on how you have it set up would be great!

Alright now please take everything I have as a guideline cause I may have set it up all wrong or not in an "optimized way" but hey, it works!

 

Alright I also did stuff over a period so prob some stuff in stupid ways, I'm also going to assume you have your drives mounted with rclone, additionally I did not encrypt, its esentially the same just point to your encrypted folders.

 

create a google API key? or whatever its called, google that.

 

-Created a folder in appdata called "plexdrive"

-created a folder in there called "tmp"

-I copied plexdrive from starbix's plugin into the plexdrive folder, and called it "plexdrive" (additionally could just install it from plexdrive github, this was one of those things that when I started I didnt know)

-chmod -755 /mnt/user/appdata/plexdrive/plexdrive

-create a file in your plexdrive folder called "config.json" and in it put your client ID and secret from google API

 

{
"clientId": "ID goes here",
"clientSecret": "Client Secret goes here"
}

 

 

So you should now have a folder /mnt/user/appdata/plexdrive and inside it should be the file plexdrive and config.json and the folder tmp

 

then here are my mounting scripts

 

/mnt/user/appdata/plexdrive/plexdrive -o allow_other -c /mnt/user/appdata/plexdrive -t

 

and

 

/mnt/user/appdata/plexdrive/tmp /mnt/disks/plxdrive/ &

 

That should get you a working plexdrive, mine mounts to /mnt/disks/plxdrive

 

And here is my rclone mount for my google drive so I can access it outside of plexdrive's read only.

 

rclone mount --allow-other --allow-non-empty plexdrive:/ /mnt/disks/plexdrive/ &

 

So at this point you should have a fully working plexdrive (read only) and a read/write google drive


Add these to your SMB

 

[plexdrive]
path = /mnt/disks/plxdrive
comment =
browseable = yes
# Public
public = yes
writeable = yes
vfs objects =

 

[plexdriveRW]
path = /mnt/disks/plexdrive
comment =
browseable = yes
# Public
public = yes
writeable = yes
vfs objects =

 

To easily wrose your folders.

 

And then (if you wish) your gonna want to make a union mount so that plex will see local and cloud data as the same.

 

So for me I make a folder:

 

/mnt/user/Media/Plex/TV (this folder was empty when I started)

 

I created a new folder in disks

 

/mnt/disks/plexdriveunion/

 

And then I merged those 2 and my plxdrive all together

 

I installed starbix's union plugin but I also went to the nerdpack plugin and installed fuse that way.

 

unionfs -o cow,allow_other /mnt/user/Media/Plex/=RW:/mnt/disks/plxdrive/Media/Plex/=RO /mnt/disks/plexdriveunion/ &

 

So now your /mnt/disks/plexdriveunion folder will have some data in it.

 

Add SMB

 

[plexdriveunion]
path = /mnt/disks/plexdriveunion
comment =
browseable = yes
# Public
public = yes
writeable = yes
vfs objects =

 

Your /mnt/user/media/Plex/TV folder will now have a hiiden folder in it.

 

Point everything, plex, sonarr, etc to /mnt/disks/plexdriveunion and off you go, they will try to write to your local copy and then you simply rclone to the cloud.

 

I'm personally using

 

rclone move --transfers 10 --exclude .unionfs/** --min-age 30d /mnt/user/Media/Plex/TV/Adult plexdrive:/Media/Plex/TV/Adult

 

 

Sorry this jumps all over the place but hopefully it poitns you in the right direction, feel free to ask follow up questions.

 

 

 

 

 

 

Edited by Sparkum
  • Upvote 2
Link to comment
  • 2 weeks later...

Well, I started playing around and it looks like mongodb is installed but needs a command like

mongod --dbpath /mnt/user/appdata/plexdrive/

 to start mongodb.  I don't know if this would best be done in the mount script or user script scheduled at array startup, etc.

Link to comment

I just run this script all 5 mins together with the plexdrive stuff (which checks if it's still mounted)

 

if [[ -s "/mnt/user/appdata/plexdrive/mongodb/mongod.lock" ]]; then
echo "mongodb already started"
else
mongod --dbpath /mnt/user/appdata/plexdrive/mongodb &
fi

 

Oh and the plexdrive4 plugin should work, if not please create an issue on github.

Edited by starbix
Link to comment

I'm having an issue with the plugin, where when I reboot my server, the mongod.lock file is left in place, with the wrong process number. Thus, when system starts again, it things mongodb is already running (via script above from starbix), but it can't actually find the process/connect to it. Maybe we can incorporate some sort of cleaning into the plugin, upon system shutdown?

Link to comment

I did mine a little different, I have:

nohup /usr/bin/mongod --dbpath /mnt/user/appdata/plexdrive/mongodb/ &

in the beginning of my rclone mount script (which I run at array start), and

/usr/bin/mongod --dbpath /mnt/user/appdata/plexdrive/mongodb/ --shutdown

in my rclone unmount script (which I run at array stop).  This line shuts down mongodb cleanly

  • Upvote 1
Link to comment
4 hours ago, jjdunkel said:

I did mine a little different, I have:


nohup /usr/bin/mongod --dbpath /mnt/user/appdata/plexdrive/mongodb/ &

in the beginning of my rclone mount script (which I run at array start), and


/usr/bin/mongod --dbpath /mnt/user/appdata/plexdrive/mongodb/ --shutdown

in my rclone unmount script (which I run at array stop).  This line shuts down mongodb cleanly

Perfect! I'll incorporate the shutdown of array script then, thanks for providing it!

On 6/29/2017 at 2:36 PM, starbix said:

I just run this script all 5 mins together with the plexdrive stuff (which checks if it's still mounted)

 


if [[ -s "/mnt/user/appdata/plexdrive/mongodb/mongod.lock" ]]; then
echo "mongodb already started"
else
mongod --dbpath /mnt/user/appdata/plexdrive/mongodb &
fi

 

Oh and the plexdrive4 plugin should work, if not please create an issue on github.

Mind sharing your script that runs every 5 minutes to check on mounts? Thanks for the plugin too!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.