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 mgchan » Tue Jan 24, 2012 8:36 am

I'm using the latest version of the CLI to automatically add torrent files from a folder every hour (through 'downloadstation torrent $file').

At one point I had two hard drives crash simultaneously and I had to rebuild my disk groups, etc. I went through a lot of reconfiguring and lost some data, and also upgraded the DSM software (now on 3.2-1955). Now, when I add a torrent file through the CLI, it gets stuck on "Waiting" status and never executes. If I try to edit the torrent in the GUI, it only shows me the option to change the destination folder. I do have a default destination set in the GUI.

If I add files manually through the create function in the GUI the files work appropriately (added to queue or started immediately).

Does this seem like a downloadstation issue or could it be an issue with the CLI?
mgchan
I'm New!
I'm New!
 
Posts: 4
Joined: Fri Oct 07, 2011 9:43 pm

downlodstation cli DS710+ DSM4 - missing status error

Postby Synology Dummy » Tue Apr 10, 2012 1:58 am

UPDATE Hi, thanks for your script :D

  • I could compile downloadstation_shm without any error but I get "Segmentation fault (core dumped)", my DS has an Intel Atom. Nevertheless I realized that downloadstation list gets a fairly exact view on the status, so downloadstation_shm seems not necessary anymore?
  • I tried using downloadstation with an already installed python 2.5 and additionally with ipkg install py25-pgsql py25-mx-base - no errors so far.
  • In your script the status 101:'ERROR' was missing for me and a command to do a restart on this. Also I allowed myself to made the UNKNOWN status to print the id from the db

I allowed myself to add this, below is the diff.

Venia
Code: Select all
--- downloadstation_1.7
+++ downloadstation
@@ -1,7 +1,7 @@
-#!/usr/bin/env python2.4
+#!/usr/bin/env python
 
 """
-Version 1.7
+Version 1.7p
 
 Copyright (C) 2011 Matthias Radig
 
@@ -47,7 +47,7 @@
 
 # formatting results ******************************************************
 
-states = {1:'WAITING', 2:'ACTIVE', 3:'PAUSED', 4:'COMPLETING', 5:'COMPLETE', 6:'CHECKING', 8:'SEEDING', 107:'TIMEOUT'}
+states = {1:'WAITING', 2:'ACTIVE', 3:'PAUSED', 4:'COMPLETING', 5:'COMPLETE', 6:'CHECKING', 8:'SEEDING', 101:'ERROR', 107:'TIMEOUT'}
 
 def noFormat(object):
     return str(object)
@@ -72,7 +72,7 @@
 def formatStatus(status):
     if status in states:
         return states[status]
-    return 'UNKNOWN'
+    return 'UNKNOWN %s' % status
 
 def formatSmartStatus(status, curr, total):
     if status == 2:
@@ -311,6 +311,13 @@
     cursor.close()
     conn.commit()
 
+def restart(conn, options, ids):
+    sql = 'UPDATE download_queue SET status = 1 WHERE (status = 101) '+userClause(options)+" "+idClause(ids)
+    cursor = conn.cursor()
+    cursor.execute(sql)
+    cursor.close()
+    conn.commit()
+
 def remove(conn, options, ids):
     sql = 'DELETE FROM download_queue WHERE 1=1 '+userClause(options)+" "+idClause(ids)
     cursor = conn.cursor()
@@ -720,6 +727,7 @@
     'clean':    clean,
     'pause':    pause,
     'resume':   resume,
+    'restart':  restart,
     'remove':   remove,
     'add':      add,
     'monitor':  monitor,
@@ -749,6 +757,7 @@
             'torrent'+' '*15+'add torrents\n'+
             'remove' +' '*16+'remove specified download jobs\n'+
             'pause' +' '*17+'pause specified download jobs\n'+
+            'restart' +' '*15+'restart specified download jobs\n'+
             'resume' +' '*16+'continue specified download jobs')
 
     for o in option_conf:
Synology Dummy
I'm New!
I'm New!
 
Posts: 5
Joined: Thu Feb 03, 2011 12:43 pm

Re: Download Station Command Line Interface

Postby fallback » Mon Mar 25, 2013 1:40 pm

Hello There,

first i'd like to thank you. This is a really great tool!

The only problem I'm currently facing is the fact, that after adding a job via "downloadstation add xyz" my downloadstaion tries to extract everything. Not only zipped/rared files but also .avi and .mkv files.

This results in the fact, that this download job is marked as failed.

I've added the same dl job manually via WEB-GUI and the download is ok.

Is there any option i'm missing?

thanks!
fallback
I'm New!
I'm New!
 
Posts: 6
Joined: Mon Mar 18, 2013 2:49 pm

Re: Download Station Command Line Interface

Postby Wawe » Wed May 01, 2013 11:50 am

I have released a new version that incorporates the patch by Venia. Thank you very much!
I haven't been following this thread for over a year, better late than never I guess.

Because I still use DiskStation 2.2, I am not much help anymore when it comes to most issues.
Regarding fallback's extraction issue, I am not sure I understand the issue you are having. The expected behavior would be the following:
You run dls pkg process <name>. Files that have the extension zip or rar are extracted into directory <name>. Other files are simply moved into <name>. Is there any error output you get? Can you give me specific instructions to reproduce the issue?
Wawe
Rookie
Rookie
 
Posts: 31
Joined: Wed Dec 31, 2008 9:40 am

Re: Download Station Command Line Interface

Postby cheezburgah » Wed May 29, 2013 4:33 am

Hello,

Ive been using the CLI to pass files via FTP no problem

However when I tried to use FTPS it fails. Any idea how I can fix this?
cheezburgah
I'm New!
I'm New!
 
Posts: 1
Joined: Wed May 29, 2013 4:26 am

Re: Download Station Command Line Interface

Postby fallback » Fri Jun 07, 2013 4:20 pm

Hi There and thanks for your replay.

I'll try to describe my issue a little bit better :)
1. In options (in the Download station gui), automatic extract is not enabled.

2. I use your script with the following command "/opt/bin downloadstation add $URL-to-file"

3. After succesfull download the Download Station tried to extract _every_ download. Not only the ones which are zip or rar.

4. For example if i use "/opt/bin downloadstation add http://google.de/a.avi", the download finishes, but is failed "red" and failed as the download station could not extract the job.
The File it self is stored correctly.

I hope this clarifies this issue. (maybe this even isnt a issue and i just used the tool wrong)
fallback
I'm New!
I'm New!
 
Posts: 6
Joined: Mon Mar 18, 2013 2:49 pm

Previous

Return to Torrent Engines/Download Station Mods

Who is online

Users browsing this forum: No registered users and 4 guests