Rclone with Gdrive on LibreElec | PlexGuide.com

Rclone with Gdrive on LibreElec

  • Stop using Chrome! Download the Brave Browser via >>> [Brave.com]
    It's a forked version of Chrome with native ad-blockers and Google's spyware stripped out! Download for Mac, Windows, Android, and Linux!
Welcome to the PlexGuide.com
Serving the Community since 2016!
Register Now

tonycfromit

Experienced
Staff
Mar 16, 2018
85
40
Great work, fellas! I cannot wait until you guys get this one sorted!

Currently I am running a PGBlitz setup on my HDPC since this was the only way I could get T drive to work since the PGDrives RO option was taken out, and I do see the pause you guys are mentioning. The HTPC is running a regular Ubuntu 18x build instead of server so for me the answer is to open Unionfs and then pop open a few folders and ls -la before starting Kodi.

Hopefully what you are doing will resolve the situation and we will be one step closer to making the perfect PGClient box!

I am still hoping to figure out how to do something similar with my QNAP or a replacement server (I am looking for something good and cheap and as fast as my QNAP now or will build one) so I could have a PG Home Gateway that is always connected via VPN to a server so that the rest of my network just pulls the data from there, but I am not sure this will be something that will ever happen.
 
  • Like
Reactions: 1 user

tonycfromit

Experienced
Staff
Mar 16, 2018
85
40
Last week, someone asked if this was possible. After looking into a couple of things besides LibreElec (xbian), I did manage to get rclone running on LibreElec. Why would one want to do that? Well, in LibreElec (KODI) you can use a plugin called PlexKodiConnect. What it does is let Kodi connect to your plex server and sync your library directily into Kodi instead of having to install the plex for kodi plugin or having to run a version of plex media player on your system. If you have a kodi based live TV system or want to use an IP TV service, that is actually a great asset. Now why the RClone mount? Simple. PlexKodiConnect has the ability to use the plex database but, stream your files from your local folders, as long as they are the same as the ones used in Plex. OK, but using LIbreElec, those paths can not be the same. Well no but there's a way around that. PlexKodiConnect (PKC) can substitute paths. Why would you benefit? Well I read about a lot of people having issues with buffering and speed. Since you'd be streaming from a local mounted gdrive, you'd bypass peering issues caused by your server location. Accessing and buffering of files would go a lot faster. The downside to this is, that you can not use things like transcoding anymore. That being sayd, it takes a huge part off the load off your pelx server. Now, as this little guide is for LibreElec systems, this does work for Kodi on iwndows, Mac or LInux aswell. I am not going to cover how you need to set up PKC. I'll do a different tutorial on that. This is simply for mouning rclone.

Now, LibreElect (LE), isn't a standard distro so you can not install packages to it directly and most of the filesystem is read-only. Lucky RClone doesn't need any dependencies and you can run it straight away. What you do need to consider is that some things are going to be in different paths. Like the path to your rclone mount wouldn't be /mnt/gdrive since there's no /mount available but /var/media. Now ok, that doesn't correspond with the paths I got on the server. Wll no worries. PKC can solve that with substituting your paths, as I mentioned before.

Fiçrst thing you need to do, is make sure the SSH service is enabled in LibreElec. That allows you to login to your system remotely with an SSH client like Putty if you'd be using windows.

1. Login to your LibreElec device. You can find the IP-address to connect to in your KODI under system information. Username and password are standard:

Onece you logged in, you can change that password to your liking by typing


2. switch your directory just to be sure. You don't want to end up in a read-only filesystem


3. download the latest build of rclone. Make sure you have the right version for your device architecture. Mine is a Raspberry PI 3b 32 bit. So in my case it's


4. Unzip this file

You should end up with the following directory

Remember this path or note it down

5. Run rclone config to configure your mount.

make sure you name your remote gdrive like you used to do in the plexguide config. The reason for that is that for the service to mount your drive automatically, I used the plexguide one with some little changes.

6. now if you were to test if everything works, just issue the following command.

Open a second SSH clinet, log in and browse to the /var/media folder to see if it's populated with your gdrive contents.

7. Now lets create the service shall we? run the following command

Paste in the following code
Code:
#!/bin/bash
#
# GitHub:
https://github.com/Admin9705/PlexGuide.com-The-Awesome-Plex-Server
# Author:   FlickerRate
# URL:      https://plexguide.com
#
# PlexGuide Copyright (C) 2018 PlexGuide.com
# Licensed under GNU General Public License v3.0 GPL-3 (in short)
#
#   You may copy, distribute and modify the software as long as you
track
#   changes/dates in source files. Any modifications to our software
#   including (via compiler) GPL-licensed code must also be made
available
#   under the GPL along with build & install instructions.
#
#################################################################################
[Unit]
Description=GDrive Daemon
After=multi-user.target

[Service]
Type=simple
User=0
Group=0
ExecStart=/storage/rclone-v1.45-linux-arm/rclone --allow-non-empty --allow-other mount gdrive: /var/media \
                      --uid=1000 --gid=1000 \
                      --size-only --dir-cache-time=2m \
                      --vfs-read-chunk-size=96M --vfs-cache-max-age 675h \
                      --vfs-read-chunk-size-limit=1G \
                      --buffer-size=48M --syslog --umask 002 --log-level INFO \
                      --config /storage/.config/rclone/rclone.conf
ExecStop=/bin/fusermount -uz /var/media
TimeoutStopSec=20
KillMode=process
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
press CTRL+o and press ENTER to save the file. Press CTRL+X to quite nano.

8. Now only thing left to do is start the service.

If all went well and you browse to your /var/media folder, you should see your gdrive contents.

That's it. You can now populate your library in LE straight from this mount or install PKC and substitue your paths.
Ok, so I am actually trying this on LibreElec - running it on a x86 box FIRST before creating one on a pi.
I have followed your instructions, except I made the folder /var/media/gdrive instead of just dumping it in media. Next I made a second service exactly the same (kind of) for my TDrive. Then I made these services and they work (I can see the files) but then, when I reboot, it all disappears. My services are gone, as in the files are not there, the folders in /var/media for gdrive and tdrive are not there, and the actual files like "gdrive.service" and "tdrive.service" are gone.

I am SURE it is something obvious I am missing, but I can't think of what it is. Am I supposed to do a next step where I do one more thing so that the files don't disappear and the whole thing runs at LE startup?

Thoughts?
 
M

MrDoob

Guest
Create a startup script ..


Or add this in crontab -e

@reboot rclone mount ...... gdrive
@reboot rclone mount... tdrive
 
  • Like
Reactions: 1 user

tonycfromit

Experienced
Staff
Mar 16, 2018
85
40
Create a startup script ..


Or add this in crontab -e

@reboot rclone mount ...... gdrive
@reboot rclone mount... tdrive
Thanks for your response! Although I don't have much experience with scripting (and none with crontab) I am willing to give it a shot. I have been considering learning a tad more about this very area and maybe I can use this as motivation to take it on.

Since I am starting from basic-user level on this specific area, if you have done something similar to the setup I am using or have seen what I am trying to navigate here, where did you start for resources on creating and running scripts that will work in LibreElec. The first thing that comes to mind is that running or installing just about anything in LibreElec that is not a Kodi addon is tougher than it would otherwise be, but with something like a couple of good websites to follow once I figure out exactly what I need these automations to be doing could make this a do-able thing. '

I am taking a "learning new skill" approach, not a "fix this and forget how" scramble that have gotten me this far without knowing how to script, so anything you have, like some good bookmarks or something, would be helpful to get started. I already have some of the more generic stuff that you can find from google, but I haven't really cracked the surface.
 
M

MrDoob

Guest
You have a mount Code for gdrive und tdrive *?*

Bsp.:
sudo rclone mount --balablablablablablabla gdrive:/{Name of folder}

You take this ..

And copy it to

crontab -e

Add this before. @reboot{ 1 EMPTY PART} then your Code.
CRTG +X ( then y )
reboot and try
 
  • Like
Reactions: 1 user

plex4thewin

Noobz
Jul 16, 2020
2
0
You have a mount Code for gdrive und tdrive *?*

Bsp.:
sudo rclone mount --balablablablablablabla gdrive:/{Name of folder}

You take this ..

And copy it to

crontab -e

Add this before. @reboot{ 1 EMPTY PART} then your Code.
CRTG +X ( then y )
reboot and try
hi is there a noob guide to this, i get rclone working on LibreElec but disappears when rebooted. Thx.
Post automatically merged:

Last week, someone asked if this was possible. After looking into a couple of things besides LibreElec (xbian), I did manage to get rclone running on LibreElec. Why would one want to do that? Well, in LibreElec (KODI) you can use a plugin called PlexKodiConnect. What it does is let Kodi connect to your plex server and sync your library directily into Kodi instead of having to install the plex for kodi plugin or having to run a version of plex media player on your system. If you have a kodi based live TV system or want to use an IP TV service, that is actually a great asset. Now why the RClone mount? Simple. PlexKodiConnect has the ability to use the plex database but, stream your files from your local folders, as long as they are the same as the ones used in Plex. OK, but using LIbreElec, those paths can not be the same. Well no but there's a way around that. PlexKodiConnect (PKC) can substitute paths. Why would you benefit? Well I read about a lot of people having issues with buffering and speed. Since you'd be streaming from a local mounted gdrive, you'd bypass peering issues caused by your server location. Accessing and buffering of files would go a lot faster. The downside to this is, that you can not use things like transcoding anymore. That being sayd, it takes a huge part off the load off your pelx server. Now, as this little guide is for LibreElec systems, this does work for Kodi on iwndows, Mac or LInux aswell. I am not going to cover how you need to set up PKC. I'll do a different tutorial on that. This is simply for mouning rclone.

Now, LibreElect (LE), isn't a standard distro so you can not install packages to it directly and most of the filesystem is read-only. Lucky RClone doesn't need any dependencies and you can run it straight away. What you do need to consider is that some things are going to be in different paths. Like the path to your rclone mount wouldn't be /mnt/gdrive since there's no /mount available but /var/media. Now ok, that doesn't correspond with the paths I got on the server. Wll no worries. PKC can solve that with substituting your paths, as I mentioned before.

Fiçrst thing you need to do, is make sure the SSH service is enabled in LibreElec. That allows you to login to your system remotely with an SSH client like Putty if you'd be using windows.

1. Login to your LibreElec device. You can find the IP-address to connect to in your KODI under system information. Username and password are standard:

Onece you logged in, you can change that password to your liking by typing


2. switch your directory just to be sure. You don't want to end up in a read-only filesystem


3. download the latest build of rclone. Make sure you have the right version for your device architecture. Mine is a Raspberry PI 3b 32 bit. So in my case it's


4. Unzip this file

You should end up with the following directory

Remember this path or note it down

5. Run rclone config to configure your mount.

make sure you name your remote gdrive like you used to do in the plexguide config. The reason for that is that for the service to mount your drive automatically, I used the plexguide one with some little changes.

6. now if you were to test if everything works, just issue the following command.

Open a second SSH clinet, log in and browse to the /var/media folder to see if it's populated with your gdrive contents.

7. Now lets create the service shall we? run the following command

Paste in the following code
Code:
#!/bin/bash
#
# GitHub:
https://github.com/Admin9705/PlexGuide.com-The-Awesome-Plex-Server
# Author:   FlickerRate
# URL:      https://plexguide.com
#
# PlexGuide Copyright (C) 2018 PlexGuide.com
# Licensed under GNU General Public License v3.0 GPL-3 (in short)
#
#   You may copy, distribute and modify the software as long as you
track
#   changes/dates in source files. Any modifications to our software
#   including (via compiler) GPL-licensed code must also be made
available
#   under the GPL along with build & install instructions.
#
#################################################################################
[Unit]
Description=GDrive Daemon
After=multi-user.target

[Service]
Type=simple
User=0
Group=0
ExecStart=/storage/rclone-v1.45-linux-arm/rclone --allow-non-empty --allow-other mount gdrive: /var/media \
                      --uid=1000 --gid=1000 \
                      --size-only --dir-cache-time=2m \
                      --vfs-read-chunk-size=96M --vfs-cache-max-age 675h \
                      --vfs-read-chunk-size-limit=1G \
                      --buffer-size=48M --syslog --umask 002 --log-level INFO \
                      --config /storage/.config/rclone/rclone.conf
ExecStop=/bin/fusermount -uz /var/media
TimeoutStopSec=20
KillMode=process
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
press CTRL+o and press ENTER to save the file. Press CTRL+X to quite nano.

8. Now only thing left to do is start the service.

If all went well and you browse to your /var/media folder, you should see your gdrive contents.

That's it. You can now populate your library in LE straight from this mount or install PKC and substitue your paths.
hello first of all thank you this works nicely. If its not too much to ask Can you please create a script for us noobies to keep the mount after each rebbot. thanks.
 
Last edited:

Datamonkeh

Data Hoarding Primate
Project Manager
Donor
Donor
Jan 20, 2018
850
388
Before you necro'd a thread that's coming up to a year and a half old, presumably you tried editing your crontab as suggested? What didn't you add and what didn't work?
 

plex4thewin

Noobz
Jul 16, 2020
2
0
Before you necro'd a thread that's coming up to a year and a half old, presumably you tried editing your crontab as suggested? What didn't you add and what didn't work?
Did you read my post ?? I'm a noob just followed the guide on first page to get it working, the post above about creating a scripts and contrab is like another language to me don't how to proceed.
Honestly sometimes you coders treat noobs who is willing to learn like morons!
 
  • Angry
Reactions: 1 user

Datamonkeh

Data Hoarding Primate
Project Manager
Donor
Donor
Jan 20, 2018
850
388
Did you read my post ?? I'm a noob just followed the guide on first page to get it working, the post above about creating a scripts and contrab is like another language to me don't how to proceed.
Honestly sometimes you coders treat noobs who is willing to learn like morons!
So you necro an old thread that has a slightly tenuous link to PG, quote the solution to your problem, ask for a script that will magically do it all for you, get asked what steps you’ve taken to try and resolve it so you can be helped learn and resolve it yourself, get upset because you think I didn’t read your post and claim that you want to learn... by being given a solution that is ‘like another language’ and have a go at ‘coders’ and you’re the one being treated like a moron?

When you are ready to learn, perhaps try this again, but I would suggest adopting a slightly different posting style may help. Alternatively a LE forum will have already documented calling scripts via crontab.
 

philmarlowe

Noobz
Jul 31, 2020
1
1
hi is there a noob guide to this, i get rclone working on LibreElec but disappears when rebooted. Thx.
Post automatically merged:


hello first of all thank you this works nicely. If its not too much to ask Can you please create a script for us noobies to keep the mount after each rebbot. thanks.
So, I'm a newbie as well, but managed to get it working. Instead of making the service in /run/systemd/system, make it in /storage/.config/system.d

Make sure to type systemctl enable if you want it to start automatically after rebooting.

I think it has to do with the fact that it is a read-only file system. I couldn't easily find info online and had to do some digging around the directories, so I thought I'd leave the solution here.
 
  • Like
Reactions: 1 user

Recommend NewsGroups

      Up To a 58% Discount!

Trending