[ PlexDrive ] [ 5.2.1 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

This is the best place for community developers to publish their genius work. Your Apps enrich the QNAP Turbo NAS.
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

[ PlexDrive ] [ 5.2.1 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by QNAP_Stephane »

Image

Source : https://github.com/dweidenfeld/plexdrive

Download : x86 / arm64 / x31 /x41 /x19 /x64

https://www.myqnap.org/product/plexdrive

About :

Plexdrive allows you to mount your Google Drive account as read-only fuse filesystem, with direct delete option on the filesystem.

The project is comparable to projects like rclone, google-drive-ocamlfuse or node-gdrive-fuse, but optimized for media streaming e.g. with plex ;)

Please note that plexdrive doesn't currently support writes (adding new files or modifications), it only supports reading existing files and deletion.

Code: Select all

[~] # plexdrive --help
Usage of plexdrive:
  --cache-file string
        Path the the cache file (default "/share/homes/admin/.plexdrive/cache.bolt")
  --chunk-check-threads int
        The number of threads to use for checking chunk existence (default 2)
  --chunk-load-ahead int
        The number of chunks that should be read ahead (default 3)
  --chunk-load-threads int
        The number of threads to use for downloading chunks (default 2)
  --chunk-size string
        The size of each chunk that is downloaded (units: B, K, M, G) (default "10M")
  -c, --config string
        The path to the configuration directory (default "/share/homes/admin/.plexdrive")
  -o, --fuse-options string
        Fuse mount options (e.g. -fuse-options allow_other,...)
  --gid int
        Set the mounts GID (-1 = default permissions) (default -1)
  --max-chunks int
        The maximum number of chunks to be stored on disk (default 8)
  --refresh-interval duration
        The time to wait till checking for changes (default 1m0s)
  --root-node-id string
        The ID of the root node to mount (use this for only mount a sub directory) (default "root")
  --uid int
        Set the mounts UID (-1 = default permissions) (default -1)
  --umask value
        Override the default file permissions
  -v, --verbosity int
        Set the log level (0 = error, 1 = warn, 2 = info, 3 = debug, 4 = trace)
  --version
        Displays program's version information
Last edited by QNAP_Stephane on Sun Jan 22, 2023 6:59 pm, edited 2 times in total.
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
User avatar
mydjtl
Getting the hang of things
Posts: 95
Joined: Wed Jan 11, 2017 7:52 am

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by mydjtl »

How do you install fuse on QNAP?


https://github.com/dweidenfeld/plexdrive

Installation
First you need to install fuse on your system
Then you should download the newest release from the GitHub release page.
Create your own client id and client secret (see https://rclone.org/drive/#making-your-own-client-id).
Sample command line for plexdrive
./plexdrive mount -c /root/.plexdrive -o allow_other /mnt/plexdrive
TS-251+
(2) Seagate IronWolf 12TB 7200 RPM 256MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drives
8gb RAM in one slot. 4.3.3
Firmware as of 3/8/2020: 4.4.1.1216 (2/14/2020)
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by QNAP_Stephane »

it is installed by default on your NAS
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
bluebonnet
New here
Posts: 5
Joined: Fri May 29, 2015 11:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by bluebonnet »

Can I get more step-by-step instructions of what to do after the install? I installed the qpkg, but not sure what to do next. I do have a gdrive API key, but don't know where to put it in.
bluebonnet
New here
Posts: 5
Joined: Fri May 29, 2015 11:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by bluebonnet »

This was a real trial and error process for me to figure out how to set this up. Thought I'd document the exact steps that work on a QNAP so others could set this up too. It is fantastic if you want to use the Plex Media Server to load media files from your Google Drive.

Prep
1) Install the PlexDrive app from https://qnapclub.eu/en/qpkg/505. This app does nothing in the regular QNAP gui interface, you have to access it via Terminal. Note, we already have Fuse on QNAP, so nothing is needed to get that installed/working.
2) Get Google API credentials (recommended) or create your own. Follow the instructions here: https://rclone.org/drive/#making-your-own-client-id. Paste these into a text file so they are ready to go when you get to step 5.

Mount Your PlexDrive
3) Use any SSH terminal to connect to your server, such as BitVise, Putty, etc. Log in to your Qnap's IP address as the admin.
4) Change to the PlexDrive app directory:

Code: Select all

 cd /share/CACHEDEV1_DATA/.qpkg/PlexDrive 
5) Enter the command to mount your PlexDrive:

Code: Select all

 ./plexdrive mount -c /root/.plexdrive -o allow_other /mnt/HDA_ROOT/plexdrive 
You will know it is working if you get the following instructions:

Code: Select all

	1. Please go to https://console.developers.google.com/
	2. Create a new project
	3. Go to library and activate the Google Drive API
	4. Go to credentials and create an OAuth client ID
	5. Set the application type to 'other'
	6. Specify some name and click create
	7. Enter your generated client ID: xxxxxxx  [i]<enter your own client id here and press enter[/i]
	8. Enter your generated client secret: xxxxxx  [i]<enter your own client secret here and press enter[/i]
	Go to the following link in your browser https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=xxxxx=state-token
	Paste the authorization code: xxxxxx
Once you have entered the required info, it will take a few mins to build the cache, but it is now set and ready.

Create a Plex library from your Google Drive media
6) Restart Plex.
7) Add a new library from location /mnt/HDA_ROOT/plexdrive/
For example, I have a library called "Gdrive Movies" pointing to /mnt/HDA_ROOT/plexdrive/Media/Movies/

Hope this helps someone.
bluebonnet
New here
Posts: 5
Joined: Fri May 29, 2015 11:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by bluebonnet »

Also, if you are getting errors for "Transport Endpoint is not connected," then use this command to unmount:

Code: Select all

fusermount -uz /mnt/HDA_ROOT/plexdrive
You will get a return message that "fusermount: /mnt/HDA_ROOT/plexdrive not mounted"

Them re-run the mount command:

Code: Select all

./plexdrive mount -c /root/.plexdrive -o allow_other /mnt/HDA_ROOT/plexdrive
bluebonnet
New here
Posts: 5
Joined: Fri May 29, 2015 11:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by bluebonnet »

I'm having some problems with my setup and would appreciate any help. All of my directions above work great for getting plexdrive (pd) mounted, well at least temporarily. After I run the mounting steps in terminal, it seems the pd setup never really finishes full setup. I never get any kind of completion notice. But, if I leave the terminal window open, pd stays mounted and I can use it -- can load plex libraries, can watch movies streaming from my gdrive, etc. Works really great. But as soon as I disconnect from terminal (close my ssh session), the plexdrive mount breaks and nothing works.

So, I am at a loss for what could be the issue. Is there something missing in my setup? Is it QNAP just not liking the mount and disconnecting it as soon as I am not connected?

Thoughts?
bluebonnet
New here
Posts: 5
Joined: Fri May 29, 2015 11:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by bluebonnet »

I figured it out. Plexdrive needs to continually run in terminal, and as soon as you close the terminal session it breaks it (per my previous post). The solution is to use Tmux, which allows an ongoing terminal session to run even if you close the window. Apparently this is standard on linux, but qnap doesn't have it by default. Here are the directions I found in another post, and they work for me so far:
1) Manually install Entware: https://qnapclub.eu/en/qpkg/286
2) Manually install tmux: https://qnapclub.eu/en/qpkg/395
3) SSH to QNAP from computer
4) tmux
5) enter the commands to launch plexdrive, outlined above
6) close entire terminal session - command entered keeps running
7) login to QNAP again by SSH
8 ) tmux a (get back to monitoring process you began in tux previously)

Some good tux introductory material here: https://danielmiessler.com/study/tmux/

My next challenge: how to get this to autorun when the server reboots
dulcifium
Been there, done that
Posts: 720
Joined: Fri Oct 23, 2009 6:52 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by dulcifium »

Awesome work!

Is it also possible to run it through Docker?
QNAP TS-639 Pro (3.8.1 Build 20121205) | 6 x 3 TB (Toshiba DT01ACA300 firmware MX6OABB0) | 12 TB RAID-6
Both shared over single port GbE and wifi router to Linux, Android, Windows, macOS and NVIDIA Shield
_Floyd
Starting out
Posts: 13
Joined: Sun Sep 16, 2018 6:35 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by _Floyd »

Does it work with Google teams drive?
tekmonq
New here
Posts: 7
Joined: Sat Jan 28, 2017 6:41 am

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by tekmonq »

Possible to update to latest which includes "team drive" support?

https://github.com/dweidenfeld/plexdrive
States updated 2 months ago.

Thanks
User avatar
QNAP_Stephane
Experience counts
Posts: 4802
Joined: Wed Mar 27, 2013 1:00 am

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by QNAP_Stephane »

tekmonq wrote: Sun Aug 25, 2019 10:34 am Possible to update to latest which includes "team drive" support?
Thanks
any link .. 5.0.0 seems still the latest on GitHub
---------------------------------------------------------------------------------------------------------------------------

Find all QPKG in the MyQnap.org repository https://www.myqnap.org
join our discord server for any inquiry related to qpkg - https://discord.gg/4fPxHSWKQW

----------------------------------------------------------------------------------------------------------------------------
Pawliko
New here
Posts: 9
Joined: Mon Oct 15, 2018 4:44 am

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by Pawliko »

https://github.com/dweidenfeld/plexdrive/issues/333

"There is no released / binary version that has team drive support. You will need to compile this yourself."

I built it on my own, but qnap requierd some libs... and I gave up :P
Sconnery
New here
Posts: 8
Joined: Tue Oct 27, 2015 1:52 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by Sconnery »

anyone managed to get teams drives working on this?
OracleSword
First post
Posts: 1
Joined: Wed Jul 01, 2020 9:14 pm

Re: [ PlexDrive ] [ 5.0.0 ] Plexdrive mounts your Google Drive FUSE filesystem (optimized for media playback)

Post by OracleSword »

This works correctly with Team Drives, but you need to ensure that you use the following included with your mounting script:

" --drive-id=XXXXXXXX"

You can get your drive ID from the web browser, by logging in and clicking on your team drive/share and finding the code from the last part of your browser, i.e. "https://drive.google.com/drive/u/0/folders/XXXXXXXXX"

Does anyone know if Plexdrive actually downloads all of the files from your google drive or only creates like a symbolic link to the files?
Post Reply

Return to “Community Apps”