Download Torrents Using Dropbox - Entware

Transmission is a file sharing program.

When you run a torrent, its data will be made available to others by means of upload.

Any content you share is your sole responsibility.

An easy way to put .torrent files in a dropbox folder and will be downloaded automatically by Transmission and create .txt files as confirmation :)

Requirements:

A - A DropBox Account
B - Entware from here
C - Transmission from here

1 - Install Dropbox-Uploader, type in terminal:

opkg install nano cron curl http://bit.ly/2LGZYcO

2 - Fix root account for the cron service

sed -i 's/root/admin/g' /opt/etc/crontab

3 - Create torrent-watch script in /opt/etc/cron.5mins/ folder

nano /opt/etc/cron.5mins/torrent-watch.sh

Paste this lines in terminal

#!/opt/bin/bash

if [ -z "$TR_TORRENT_NAME" ]
then
dropbox_uploader list | grep -iE "^ [F] .+.torrent$" |
sed "s|^ [F] ||g" |
while read item
do
dropbox_uploader download "$item" "/opt/etc/transmission/watchdir/$item"
dropbox_uploader delete "$item"
done
else
echo "Donwload job done at `date`" > "/tmp/$TR_TORRENT_NAME.txt"
dropbox_uploader upload "/tmp/$TR_TORRENT_NAME.txt" "/"
rm -f "/tmp/$TR_TORRENT_NAME.txt"
fi

 

Save with CTRL-O / Enter / and exit with CTRL-X

And make it executable

chmod +x /opt/etc/cron.5mins/torrent-watch.sh

4 - Stop Transmission to edit settings file

/opt/etc/init.d/S88transmission stop
nano /opt/etc/transmission/settings.json

And modify this 2 lines

From:

"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",

To:

"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/opt/etc/cron.5mins/torrent-watch.sh",

Save with CTRL-O / Enter / and exit with CTRL-X

Configure DropBox-Uploader

5 - Go to this page and choose Dropbox API app, Files and datastores, Yes, Provide an app name (choose another name if already taken) and click Create app

dropbox-uploader-app

dropbox-uploader-app2

6 - Now start dropbox-uploader setup in terminal

dropbox_uploader

Copy App key from dropbox web page and paste in terminal when asked

Press ENTER

Copy App secret from dropbox web page and paste in terminal

Press ENTER

Permission type:

a

ENTER

y

ENTER

7 - Open a new tab in browser and paste given address from terminal then press Allow

dropbox-uploader-app3

Press ENTER again in terminal, should get Setup completed!

Output should look like this

admin@RT-AC66U:/tmp/home/root# dropbox_uploader

This is the first time you run this script.

1) Open the following URL in your Browser, and log in using your account: https://www2.dropbox.com/developers/apps
2) Click on "Create App", then select "Dropbox API app"
3) Select "Files and datastores"
4) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder
5) Enter the "App Name" that you prefer (e.g. MyUploader150022791818398)

Now, click on the "Create App" button.

When your new App is successfully created, please type the
App Key, App Secret and the Permission type shown in the confirmation page:

# App key: urp49k427nvw38a ENTER
# App secret: 8cxd5id5ix71dtk ENTER
# Permission type, App folder or Full Dropbox [a/f]: a ENTER

> App key is urp49k427nvw38a, App secret is 8cxd5id5ix71dtk and Access level is App Folder. Looks ok? [y/n]: y ENTER

> Token request... OK

Please open the following URL in your browser, and allow Dropbox Uploader
to access your DropBox folder:

--> https://www2.dropbox.com/1/oauth/authorize?oauth_token=yQyS2ZRRfDq2KtzV

Press enter when done...

https://www2.dropbox.com/1/oauth/authorize?oauth_token=yQyS2ZRRfDq2KtzV
> Access Token request... OK

Setup completed!
admin@RT-AC66U:/tmp/home/root#

8 - Reboot router

reboot

After reboot, place some .torrent files inside newly created folder on dropbox, should be Dropbox/Apps/transmission-test1 (in red color should be your app name)

Now every 5 minutes, dropbox-uploader will look for new torrents files, copy to /opt/etc/transmission/watchdir and Transmission will start download automatically, when finished will create a text file in your dropbox folder with torrent name, inside every file you'll find terminating time.


Source forums.smallnetbuilders.com
Thanks to @ryzhov_al