Python completion script: GDrive Uploader + Archive Extraction + Sorting ( still in progress!)

Discussion of Transmission that doesn't fit in the other categories
Post Reply
Posts: 2
Joined: Mon May 16, 2016 7:39 pm

Python completion script: GDrive Uploader + Archive Extraction + Sorting ( still in progress!)

Post by siorai » Tue Jan 10, 2017 6:53 pm

Sometime ago I decided that I wanted the ability to upload things to google drive when a torrent completed, it's turned into a fairly indepth project for me over the last couple of months and I thought maybe some of the folks here might find some use for it.

I know there are other alternatives and that I still have a ways to go before I'd consider this really complete, but I thought I'd share anyway.

It's still changing fairly rapidly, and this is the first thing I've actually really coded, ( taught myself with this very project ) so any feedback would be greatly appreciated.

Everything should be fairly well documented.

Clone, sudo (elevation needed to add syslink to AutoUploaderGoogleDrive to bin) then crack open the and change parameters according to the comments listed there.

I've confirmed it running on Centos 7, and Ubuntu, running from the Transmission-Daemon.

Feature Details:

Uploads torrents to google drive using the Google Drive Python API for interaction.
Supports local file structure replication on remote Google Drive by recreating folders contained in the torrent on the GDrive.
Script creates a table based on email parameters specified in settings file.
Option to change default uploading permissions for uploaded files.
Remote sorting based on
Google API authentication handled in script with
Authentication supports either Service Account or (which requires your own GSuite) Oauth2 JSON credentials.
Automatically searches for rar archives, extracts them, uploads them, and then deletes the extracted contents in order to save on disk space while keeping the archives intact to continue seeding.
In depth logging of nearly everything that's going on so the user can see exactly what's going on and when.
URLShortener has been implemented in the default table by use of the Google API's URL Shortener service.
Email to be sent upon torrent completion is sent via the Gmail portion of the Google API with composition, encoding, and sending all done in script.
Command line usage for uploads that can be utilized by other programs or straight from the command line.
Option for pastebin like usage for uploading of single files by specifying a specific folder for when the script is called on a single file instead of a folder. Acts like other command-line based pastebin like utilities without any sort of file restrictions.

Right now I'd say that script probably requires some good knowledge of bash and knowing a bit of python probably wouldn't hurt, I'm in the process of simplifying the setup process (in regards to the by moving everything over to settings.json to include validating of said json in order to catch errors that'll prevent the script from running properly.

I should note that without a GSuite (ie paying for Google Apps for business) the practicality of this script will probably be somewhat limited for most since the current cap of standard Google Accounts is 15 gigabytes shared across everything.

If anyone feels like giving it a go, feel free, but it's still very much a work in progress. So please keep that in mind.

Currently I'm in the process of breaking down the __init__ in the main class of the module to better show what's actually going on. As I move stuff out of there I'll be documenting each as I go along. If you have any questions, please feel free to ask.

tl;dr -

I made a script that uploads completed torrents to google drive, it automatically extracts archives, and sends you an email when it's all done with links to each thing it uploaded. Does other cool stuff.

Post Reply