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://goo.gl/XJ03Gl

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

  • Hippo

    Hi,
    This works well ruTorrent?

  • Run script and post output

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

    • Hippo

      What command to start ? " dropbox_uploader " ?

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

      • Hippo

        Zozz4ever@RT-N18U:/tmp/home/root# sh /opt/etc/cron.5mins/torrent-watch.sh

        Zozz4ever@RT-N18U:/tmp/home/root#

        I waiting 5 min, but not happaned..

        Transmission is filled with a .torrent file and waited while downloading. Then I checked the Dropbox Apps / folder -... Transmission and saw that placed a txt file. I downloaded transmission wrote that it completed downloads.

        But I spent a .torrent file to the folder that does not begin downloading the Transmission.

        Sorry, little speak english.

  • Hippo

    Hi,

    I using latest HGG firmware with Asus RT N18U.
    I installed entware, transmission and setup dropbox uploder successful.

    I put .torrent files to Dropbox App/Transmission folder.. But not download my usb hdd...

    Please help.

  • Gary

    Is that any different in debian Transmission? i follow the steps until finish the step after that i reboot the router and put the torrent in to dropbox and wait 5 mins, but it didn't dl the torrent to the tranmission. thx a lot

  • kolodziej

    Hi,
    My torrent-watch.sh script seems to work, but transmission isn't adding files to queue. I have checked the log and it gives me something like:

    [18:10:09.445] Found new .torrent file "fileName.torrent" in watchdir "/mnt/transmission/watch" (watch.c:142)
    [18:10:09.445] Couldn't read "/mnt/transmission/watch/fileName.torrent": Permission denied (utils.c:218)

    I tried adding the files to folder manually and it's working, so it seems tha dropbox_uploader is downloading files with wrong permissions.
    Any suggestion to selve the problem?
    Thanks in advance.

  • Sephiroth

    TeHashX...

    Cron is not working for me.
    I can see cron service running using top with pid 530. But if I check the service by the instruction "cron status" the system response is... "cron: can't lock /opt/var/run/cron.pid, otherpid may be 530: Resource temporarily unavailable"

    If I execute /opt/etc/cron.5mins/torrent-watch.sh works flawless but not automatically under cron.

    • Try to install from scratch, probably missed some step

      • Sephiroth

        Finally i did it using cru.

        echo "cru a Drop2Trans "*/1 * * * * /jffs/torrent-watch.sh"" >> /jffs/scripts/services-start

        Crontab still not working but doesn't matter.

        Thanks again!

      • Did you changed router username from admin?

      • Sephiroth

        Yes. I tried to change the user in crontab for root/admin/sephiroth(my username) but nothing result. Even without name...

  • Sephiroth

    I've followed all steps but I Don't know why doesn't work.

    dropbox_uploader is installed in opt/bin

    torrent-watch.sh in entwareetccron.5mins

    I put the .torrents inside the application folder but happens nothing.

    Any suggestion?

    • Sephiroth

      in addition... when i execute "dropbox_uploader info" my account is well recognized

      • Probably something is changed, let me have a look

      • Ok, I found it, entware dropbox_uploader script has a line witch will break functionality.
        We have to remove line 957 in /opt/bin/dropbox_uploader witch contain: local SIZE=$(echo "$line" | sed -n 's/.*"bytes": *([0-9]*).*/1/p')
        1. Open with notepad++ and edit
        2. In terminal with this command
        sed -i '957d' /opt/bin/dropbox_uploader
        Do it only once because will delete another line on consecutive retries.
        Then run /opt/etc/cron.5mins/torrent-watch.sh or reboot router

      • Sephiroth

        Thank you for the reply TeHashX. I will try it when I get home. :)

      • Sephiroth

        sephiroth@WD:/tmp/home/root# /opt/etc/cron.5mins/torrent-watch.sh
        > Downloading "/Test.torrent" to "/opt/etc/transmission/watchdir/Test.torrent"... DONE
        > Deleting "/Test.torrent"... DONE
        sephiroth@WD:/tmp/home/root#

        ...

        Donwload job done at Fri Jan 16 19:35:10 GMT 2015

        Eureka! It works!
        T h a n k y o u !!!

        PD: I found an insignificant grammatical error in the final message. DoWNload job.

SoftEther VPN Running on AsusWRT Routers
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Nginx Web Server with PHP Support through Optware-NG
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Spreed WebRTC server and web client
Asterisk VoIP Server running on AsusWRT Routers
SoftEther VPN Running on AsusWRT Routers
NZBGet through Entware
Minidlna UPnP Media Server through Debian Jessie Arm
NetData System Monitor Entware

SUBSCRIBE

To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...