Download Station Command Line Interface

Questions regarding modifying the torrent engine or download station may go here.
Forum rules
Please note the disclaimer before modifying your Synology Product.

Re: Download Station Command Line Interface

Postby joechong » Mon Aug 10, 2009 8:58 am

I think I found the issue. Its at my end, the script file when I moved from Windows to Synology has the Ctrl-M characters. Removed it, and I manage to execute the v1.0 script, and went into interactive mode. This is what I see:

Note:For simplicity sake, as I'm still running multiple versions, I've renamed it to "downloadstation.v10.sh" :)

Code: Select all
JoeNAS01> downloadstation.v10.sh

********************************
Downloadstation Interactive Mode
********************************

type 'exit' or EOF (CTRL-D) to quit
type 'set <var> <value>' to set an option
type 'reconnect' to create a new connection after changing the connection related options

>>> list
task_id  filename                                  status
207      true.blood.0208.hdtv.xvid-notv.part1.rar  -
208      true.blood.0208.hdtv.xvid-notv.part2.rar  -
209      true.blood.0208.hdtv.xvid-notv.part3.rar  WAITING
210      true.blood.0208.hdtv.xvid-notv.part4.rar  WAITING
211      true.blood.0208.hdtv.xvid-notv.part5.rar  WAITING
212      true.blood.0208.hdtv.xvid-notv.part6.rar  WAITING
213      true.blood.0208.hdtv.xvid-notv.part7.rar  WAITING
214      E313.part1.rar                            WAITING
215      E313.part2.rar                            WAITING
216      E313.part3.rar                            WAITING
217      E313.part4.rar                            WAITING
218      M801.part1.rar                            WAITING
219      M801.part2.rar                            WAITING
220      M801.part3.rar                            WAITING
221      M801.part4.rar                            WAITING
>>>
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby joechong » Mon Aug 10, 2009 8:59 am

I think I found the issue. Its at my end, the script file when I moved from Windows to Synology has the Ctrl-M characters. Removed it, and I manage to execute the v1.0 script, and went into interactive mode.

However, I don't see the new columns that are added in the new script. But, the removal of duplicates worked fine.

Note:For simplicity sake, as I'm still running multiple versions, I've renamed it to "downloadstation.v10.sh" :)

Code: Select all
JoeNAS01> downloadstation.v10.sh

********************************
Downloadstation Interactive Mode
********************************

type 'exit' or EOF (CTRL-D) to quit
type 'set <var> <value>' to set an option
type 'reconnect' to create a new connection after changing the connection related options

>>> list
task_id  filename                                  status
207      true.blood.0208.hdtv.xvid-notv.part1.rar  -
208      true.blood.0208.hdtv.xvid-notv.part2.rar  -
209      true.blood.0208.hdtv.xvid-notv.part3.rar  WAITING
210      true.blood.0208.hdtv.xvid-notv.part4.rar  WAITING
211      true.blood.0208.hdtv.xvid-notv.part5.rar  WAITING
212      true.blood.0208.hdtv.xvid-notv.part6.rar  WAITING
213      true.blood.0208.hdtv.xvid-notv.part7.rar  WAITING
214      E313.part1.rar                            WAITING
215      E313.part2.rar                            WAITING
216      E313.part3.rar                            WAITING
217      E313.part4.rar                            WAITING
218      M801.part1.rar                            WAITING
219      M801.part2.rar                            WAITING
220      M801.part3.rar                            WAITING
221      M801.part4.rar                            WAITING
>>>
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby joechong » Mon Aug 10, 2009 9:27 am

Hi Wawe,

Ignore my previous posting. I think the new version you've released is so very cool! Its working in all aspects. I realized that I just have to add in another new field 'rate' into the default_columns, and I'll get what I required under the "list" command. This is what's showing now under the list command.
Code: Select all
JoeNAS01> downloadstation.v10.sh list
task_id  filename                                  status    rate
207      true.blood.0208.hdtv.xvid-notv.part1.rar  COMPLETE  -
208      true.blood.0208.hdtv.xvid-notv.part2.rar  COMPLETE  -
209      true.blood.0208.hdtv.xvid-notv.part3.rar  COMPLETE  -
210      true.blood.0208.hdtv.xvid-notv.part4.rar  PAUSED    28 KB/s
211      true.blood.0208.hdtv.xvid-notv.part5.rar  PAUSED    26 KB/s
212      true.blood.0208.hdtv.xvid-notv.part6.rar  8.60 %    50 KB/s
213      true.blood.0208.hdtv.xvid-notv.part7.rar  11.67 %   15 KB/s
214      E313.part1.rar                            WAITING   -
215      E313.part2.rar                            WAITING   -
216      E313.part3.rar                            WAITING   -
217      E313.part4.rar                            WAITING   -
218      M801.part1.rar                            WAITING   -
219      M801.part2.rar                            WAITING   -
220      M801.part3.rar                            WAITING   -
221      M801.part4.rar                            WAITING   -


Just a small bug, for those that are in PAUSED status, the rate's still shown as above 0. Other than that, it works very well. Thanks for the enhancements, and looking forward to the Torrent feature.
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby Wawe » Mon Aug 10, 2009 6:59 pm

Glad you like it.
You can also select columns you want to view by supplying them as arguments to the list command. No need to change the script every time you want a different set of columns. :-)
If you want to have a quick way to access a non-default combination of columns I'd recommend aliases, e.g.
Code: Select all
alias dlist='downloadstation list task_id  filename status rate'

You can put those in /etc/profile to have them permanently. This way, you won't have to change every new version of the script you download.

The rate is just read from the database and formatted, so it's actually an inconsistency in Download Station. However, I'll make the script always show zero if a job is paused. Thanks for reporting this.

I managed to implement a function to add BitTorrent download jobs. I'll release the update in a few days when I find time to polish the functionality and write the documentation for it.
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: Download Station Command Line Interface

Postby joechong » Tue Aug 11, 2009 2:22 am

Quick question on accessing the database. What tools do you use within the shell do perform a query on the postgresql database? Is there some clients that needs to be installed before using it? I was trying to view what happens to the database when an emule link is added, but couldn't find anything yet to enable me to view the Synology download database.
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby Wawe » Tue Aug 11, 2009 7:35 am

I don't use a shell client. I enabled access from the local network for the PostGreSQL database on the Disk Station and use SQuirreLSQL to view it from another computer.

In /usr/syno/pgsql/bin on the Disk Station is the command line client for PostGreSQL, called psql, which is what you are looking for. :-)
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: Download Station Command Line Interface

Postby joechong » Tue Aug 11, 2009 8:57 am

Can you give a few quick steps on how to achieve the method you're using with Squirrel? Am interested to see how the database looked like. Tried the shell method, but not sure what database, userid/password to be used.

Code: Select all
JoeNAS01> psql
psql: FATAL:  database "root" does not exist
JoeNAS01> psql download
psql: FATAL:  role "root" does not exist
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby Wawe » Tue Aug 11, 2009 10:37 am

Here's how my /usr/syno/pgsql/etc/pg_hba.conf looks like:
Code: Select all
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    download    admin       192.168.0.1/24        md5
# IPv6 local connections:
##host    all         all         ::1/128               md5

Note that this is a security risk if you have untrusted hosts on your local network.

The username for the Download Station DB is "admin", password "dd@awylds", the database is "download".
I don't think the eMule client uses this database, though.
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

BitTorrent support added

Postby Wawe » Fri Sep 04, 2009 9:07 am

I finally found the time to complete BitTorrent support and update the documentation accordingly.
There are three new commands, "torrent", "tlist" and "tmonitor" to add, list and monitor torrents.
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: BitTorrent support added

Postby joechong » Sat Oct 03, 2009 3:14 pm

Coolness! Let me try out and provide you feedback.
joechong
Novice
Novice
 
Posts: 47
Joined: Sun Jul 19, 2009 9:36 am

Re: Download Station Command Line Interface

Postby espresso » Tue Oct 06, 2009 9:11 am

Hey Synologers,

I know Download station uses rtorrent in the background.
Has anyone figured out, how to access the .rtorrent.rc for it
I'm particularity interested in turning on the RC4 encryption

I have stopped the download station and installed rtorrent to be able to manipulate the encryption settings.

Thanks,
E
NAS: DS412+, DSM 4.2-3203, 4x2TB WD20EADS, RAID 5
Router: SiteCom 300N XR
Display: Samsung UE46B8000
NMT: PopcornHour C-200, 2.5" 320GB WD3200BEKT
AVR: Harman/Kardon AVR 355
Game Console: XBOX 360
User avatar
espresso
Novice
Novice
 
Posts: 52
Joined: Mon Feb 09, 2009 12:31 pm

Re: Download Station Command Line Interface

Postby Wawe » Tue Oct 06, 2009 1:28 pm

I think there is a way, although i did not fully test it. (i.e. I used an empty .rtorrent.rc, but I did confirm that rtorrent is invoked the right way to use the config file after applying the hack.)
rtorrent is invoked by DownloadStation with the -n parameter, which suppresses loading of the ~/.rtorrent.rc file.

Solution: Create a shell script in place of rtorrent that filters the -n option.
rtorrent binary is located at /usr/syno/bin/rtorrent.
First, move /usr/syno/bin/rtorrent to /usr/syno/bin/rtorrent_binary.
Then, create a shell script /usr/syno/bin/rtorrent like this:
Code: Select all
#!/bin/sh
(for w in $*; do echo $w; done) | grep -v "^\-n$" | xargs /usr/syno/bin/rtorrent_binary

Make it executable and DownloadStation should now use the file /root/.rtorrent.rc when running rtorrent

Short transcript from my testing session:
Code: Select all
BEFORE CHANGE (note the -n option for rtorrent):
radig@Citadel:/usr/syno/bin> dls torrent /volume1/downloads/*.torrent
Adding Torrent Files:
ubuntu-9.04-desktop-i386.iso.torrent
radig@Citadel:/usr/syno/bin> ps | grep rtorrent
 9491 root       4432 S   rtorrent -t 11869 -u admin -f -m -n
 9498 radig       128 D   grep rtorrent

DO CHANGE:
radig@Citadel:/usr/syno/bin> sudo touch /root/.rtorrent.rc
radig@Citadel:/usr/syno/bin> sudo mv rtorrent rtorrent_binary
radig@Citadel:/usr/syno/bin> sudo vi rtorrent                    #created the script described above
radig@Citadel:/usr/syno/bin> sudo chmod 0755 rtorrent

AFTER CHANGE (no -n option anymore):
radig@Citadel:/usr/syno/bin> dls torrent /volume1/downloads/*.torrent
Adding Torrent Files:
ubuntu-9.04-desktop-i386.iso.torrent
radig@Citadel:/usr/syno/bin> ps | grep rtorrent
 9456 root      41260 S   /usr/syno/bin/rtorrent_binary -t 11868 -u admin -f -m
 9464 radig        96 R   grep rtorrent


If you have further questions, I would prefer to continue the discussion in a dedicated thread, as this doesn't really fit the topic of this one.
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: Download Station Command Line Interface

Postby espresso » Tue Oct 06, 2009 2:22 pm

Hey Wawe,

Thanks for the feedback, i will give it a go.
Do you think that if have torrents downloading on optware rtorrent would they be imported with the workaround that we have in place.
Or better to wait till their finished to be on the safe side?

Thanks,
E
NAS: DS412+, DSM 4.2-3203, 4x2TB WD20EADS, RAID 5
Router: SiteCom 300N XR
Display: Samsung UE46B8000
NMT: PopcornHour C-200, 2.5" 320GB WD3200BEKT
AVR: Harman/Kardon AVR 355
Game Console: XBOX 360
User avatar
espresso
Novice
Novice
 
Posts: 52
Joined: Mon Feb 09, 2009 12:31 pm

Re: Download Station Command Line Interface

Postby Wawe » Tue Oct 06, 2009 2:32 pm

I don't know anything about how rtorrent works, but I think waiting until your started torrents are finished would be the easier way.
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: Download Station Command Line Interface

Postby espresso » Wed Oct 07, 2009 5:49 am

Hey Wawe,

Think will wait a bit before I go ahead with it.
What I really would like to have, is the SynoDownload Manager, with Syno Web Interface, but having control over the .torrent.rc
You think with the workaround that we have, the web interface would still work.

Cheers,
E
NAS: DS412+, DSM 4.2-3203, 4x2TB WD20EADS, RAID 5
Router: SiteCom 300N XR
Display: Samsung UE46B8000
NMT: PopcornHour C-200, 2.5" 320GB WD3200BEKT
AVR: Harman/Kardon AVR 355
Game Console: XBOX 360
User avatar
espresso
Novice
Novice
 
Posts: 52
Joined: Mon Feb 09, 2009 12:31 pm

PreviousNext

Return to Torrent Engines/Download Station Mods

Who is online

Users browsing this forum: No registered users and 2 guests