SynoGet - add a download via command line

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

Re: SynoGet - add a download via command line

Postby BjoernWeber » Sat May 15, 2010 8:33 pm

Hello!

@Sarav:
Maybe you should ask Synology for that! I figured out how to do this, by sniffing packets transfered from the Synology-Download-Redirector to my diskstation. It would be great, if you could write something similar in perl. I think, it's rather simple. You only have to execute two HTTP-posts. With the first, you log in and get an transaction ticket ('id') back in form of a JSON response, with the second you enqueue the download url with that id.
You can look into my sourcecode to see what's the exact syntax for the HTTP-posts. You can also see the HTTP requests in the german synology forum. Even if you don't speak german you will understand the HTTP requests:

http://www.synology-forum.de/showpost.html?p=20418&postcount=10

The only thing you have to do, is parse the JSON response and urlencode the url to download. Should be easy in perl.

@Jonathan, @doomherald:
I'm sorry that SynoGet doesn't work for you. I thought about a couple of things, that could cause that:

- maybe some global proxy configuration that is interfering with SynoGet, or other system-wide network problems
- somehow broken .Net-Framework (I had a long discussion with a guy in the german synology forum, and we found out, that he had some kind of customized .Net-Framework installed by 'Call of Duty' which caused the problem there)
- somehow not correctly configured SynoGet

I could not reproduce the error you get, with a correct configuration. So I decided to build a new version of SynoGet: v0.2 Woohoo! A second version in two years... ;-)
This new version has an additional commandline switch /debug which writes a SynoGetDebug.txt file containing some useful debug information.
You can find the Links to the new version in my first post here.

Please try SynoGet 0.2 with the /debug switch and let me know the results.

Best regards,
Björn
BjoernWeber
Beginner
Beginner
 
Posts: 20
Joined: Sun Sep 28, 2008 2:49 pm

Re: SynoGet - add a download via command line

Postby BjoernWeber » Sun May 16, 2010 8:32 am

Hello!

I have just uploaded SynoGet 0.3:
Now it has a 'donate' button. If you like SynoGet, please use it (just doubleclick SynoGet.exe without parameters and click 'donate' to donate via PayPal)!

Thank you!

Best regards,
Björn

http://www.bjoernweber.net/SynoGet/SynoGet-0.3.zip
http://www.bjoernweber.net/SynoGet/SynoGet-0.3-src.zip
BjoernWeber
Beginner
Beginner
 
Posts: 20
Joined: Sun Sep 28, 2008 2:49 pm

Re: SynoGet - add a download via command line

Postby jce » Sun May 16, 2010 4:22 pm

Hi Björn,

thanks a lot for your efforts, I really appreciate it.

The implementation of a debug switch was a really good idea, and I think I already found out what is going wrong. However, I have no idea what is causing this, but that's hopfully easy for you to find out.

Here's my config file again:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--<add key="ds_protocol" value="https" />-->
    <!--<add key="ds_ip" value="192.168.2.201" />-->
    <!--<add key="ds_port" value="5001" />-->
    <!--<add key="ds_path" value="download/download_redirector.cgi" />-->
    <!--<add key="ds_username" value="jce" />-->
    <!--<add key="ds_password" value="xxx" />-->
  </appSettings>
</configuration>


And here's what is the result in the debug file:
Code: Select all
2010-05-16 17:06:30
Parameters:
downloadurl          -> http://www.torrent.to/res/php/Downloader.php?ID=594927&Filename=Der+Fantastische+Mr.+Fox
ds_protocol          -> https
ds_ip                ->                                                             <-- shouldn't be something decoded here?
ds_port              -> 5001
ds_path              -> download/download_redirector.cgi
ds_username          ->                                                       <-- shouldn't be something decoded here?
ds_password          ->                                                       <-- shouldn't be something decoded here?
passwordinplaintext  -> False
debug                -> True

Password not in plaintext. Decoding password base64...
Password decoded. Plaintext password:                          <-- shouldn't be something decoded here?

Constructing full URL of diskstation download redirector...
Full URL of download redirector:
https://:5001/download/download_redirector.cgi          <-- IP is missing, so this is causing the error later!


So, what is the problem with the IP in the config file then?

I also tried to give the IP as command line parameter and this seemed to work. However, it could still not add the download.

Here's the debug print out of this call:
Code: Select all
Password not in plaintext. Decoding password base64...
Password decoded. Plaintext password:

Constructing full URL of diskstation download redirector...
Full URL of download redirector:
https://192.168.2.201:5001/download/download_redirector.cgi

Configuring to accept all https certificates...
Now all https certificates will be accepted.

Constructing the HTTP-Post for login...
Instantiating the PostSubmitter object...
PostSubmitter object instantiated.
Setting URL to https://192.168.2.201:5001/download/download_redirector.cgi
Adding post item: action      -> login
Adding post item: username    ->
Adding post item: passwd      ->
Setting PostSubmitter type to POST...
Executing the HTTP-Post...
Successfully executed the HTTP-Post.

Deserializing JSON response object...
Could not find member 'errcode' on object of type 'RuntimeType'


Regarding the .NET framework problems you were mentioning, I have the following versions installed (all original MS):
1.1
2.0 SP2
3.0 SP2
3.5 SP1

Thanks for your help and best regards,
Jonathan
jce
I'm New!
I'm New!
 
Posts: 5
Joined: Thu May 13, 2010 2:02 pm

Re: SynoGet - add a download via command line

Postby BjoernWeber » Sun May 16, 2010 5:25 pm

Hi Jonathan!

Aaahhh, now I see, what's going wrong here: :wink:

Like in HTML, in XML a line beginning with <!-- and ending with --> means it is commented out (= like it is not there).
So your config file

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--<add key="ds_protocol" value="https" />-->
    <!--<add key="ds_ip" value="192.168.2.201" />-->
    <!--<add key="ds_port" value="5001" />-->
    <!--<add key="ds_path" value="download/download_redirector.cgi" />-->
    <!--<add key="ds_username" value="jce" />-->
    <!--<add key="ds_password" value="xxx" />-->
  </appSettings>
</configuration>


actually has no content and should rather look like that

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="ds_protocol" value="https" />
    <add key="ds_ip" value="192.168.2.201" />
    <add key="ds_port" value="5001" />
    <add key="ds_path" value="download/download_redirector.cgi" />
    <add key="ds_username" value="jce" />
    <add key="ds_password" value="xxx" />
  </appSettings>
</configuration>


I'm sorry, I should have documented that better. But I never thought about it.

So, if you uncomment all the lines (remove <!-- at the beginning and --> at the end), everything should work fine.

Best regards,
Björn
BjoernWeber
Beginner
Beginner
 
Posts: 20
Joined: Sun Sep 28, 2008 2:49 pm

Re: SynoGet - add a download via command line

Postby jce » Sun May 16, 2010 5:46 pm

Hi Björn,

man... 8) I never looked for something like this. Of course, I know this too! :idea:

Now everything worked fine at once!!!

Thank you very much for your patience and for your help!

Now, I only need to figure out a way to integrate this with Google Chrome... but that's another story.

Best regards,
Jonathan

P.S. Maybe I should donate something... let me see how useful this proofs to be in daily usage.
jce
I'm New!
I'm New!
 
Posts: 5
Joined: Thu May 13, 2010 2:02 pm

Re: SynoGet - add a download via command line

Postby BjoernWeber » Sun May 16, 2010 6:50 pm

Hi Jonathan!

You're welcome! I'm very pleased, that SynoGet now works for you! :)
I'm using Firefox and FlashGot with SynoGet but with Chrome, maybe this helps (chromeget):

https://chrome.google.com/extensions/detail/mpijomibinnmipdpijgaccmhadeghlin

Best regards,
Björn
BjoernWeber
Beginner
Beginner
 
Posts: 20
Joined: Sun Sep 28, 2008 2:49 pm

Re: SynoGet - add a download via command line

Postby E-wawa.pl » Tue May 18, 2010 7:56 pm

I just wrote a link catcher wich uses Your great app. The purpose of it was to work in system tray and when someone selects and copies links from "rapidshare,megaupload, hotfile links" they simply are grabbed to listbox and then can be submited quickly to downloadstation.

I made it for myself maybe someone will find it usefull.

http://www.webzoom.pl/synocatch/synocatch.zip

Tested under windows 7.

Now hotfile premium works. So Adding links doesn't need each time to type auth credentials.
User avatar
E-wawa.pl
Experienced
Experienced
 
Posts: 119
Joined: Fri Jan 15, 2010 2:34 pm

Re: SynoGet - add a download via command line

Postby BjoernWeber » Mon May 24, 2010 1:21 pm

Hi E-wawa.pl!

Cool! Good job! :)

Would you mind providing the source code, so that one can see, what it is actually doing? Thank you!

Best regards,
Björn
BjoernWeber
Beginner
Beginner
 
Posts: 20
Joined: Sun Sep 28, 2008 2:49 pm

Re: SynoGet - add a download via command line

Postby shalevy » Wed Jun 02, 2010 5:53 am

Hi,

If I want to add a local file instead of url, what action do I need to use instead of the addurl action?

Thanks.
shalevy
I'm New!
I'm New!
 
Posts: 2
Joined: Fri May 28, 2010 1:20 am

Re: SynoGet - add a download via command line

Postby E-wawa.pl » Sat Jun 12, 2010 1:25 pm

If You'r talking about the 'webzoom' software I can add this function. Otherwise ignore... This post :)
User avatar
E-wawa.pl
Experienced
Experienced
 
Posts: 119
Joined: Fri Jan 15, 2010 2:34 pm

Re: SynoGet - add a download via command line

Postby halx » Sun Jun 27, 2010 3:01 am

Great tool BjoernWeber!
I'm second to the file uploading feature implementation request. Some trackers require user login in order to retrieve the real URL of .torrent file. So that's not working with SynoGet or any of the dedicated FFox addons. The idea is to download the .torrent file first and then start SynoGet with it's local name and location.
User avatar
halx
I'm New!
I'm New!
 
Posts: 5
Joined: Sun Jun 27, 2010 2:54 am

Re: SynoGet - add a download via command line

Postby Mandragor » Wed Jun 30, 2010 8:52 pm

Hi,

many thanks for this tool. But I have a trouble with FlashGot.
I use these parameters :
[URL] /ds_protocol:http /ds_ip:192.168.0.100 /ds_port:5000 /ds_path:download/download_redirector.cgi /ds_username:xxx/ds_password:xxx/passwordinplaintext

URL is a megaupload link : http://www.megaupload.com/?d=YYYYYYY

And when I check on the Download Station, instead of the filename, I got

"mgr_dl.php?d=YYYYYYY &u=B.6DKY..."
I did some test, and I find that :
- using your tool alone works fine (with a batch)
- adding a space to the URL in the batch reproduce the same issue

I use latest official Firefox on Windows vista 64.
Mandragor
I'm New!
I'm New!
 
Posts: 1
Joined: Wed Jun 30, 2010 8:21 pm

Re: SynoGet - add a download via command line

Postby LA_ » Sat Jun 04, 2011 8:55 am

shalevy wrote:If I want to add a local file instead of url, what action do I need to use instead of the addurl action?

I have the same question.
Can somebody please help us with this?
Asus RT-N16 1.9.2.7-rtn-r1375 | Asus O!Play Air 1.09P | Synology DS210j
User avatar
LA_
Student
Student
 
Posts: 62
Joined: Mon Mar 08, 2010 3:23 pm

Re: SynoGet - add a download via command line

Postby LA_ » Sat Jan 07, 2012 10:34 pm

Is it possible to add paused url? What should be the url for this? Or, how to pause just added download?

upd. found the way to pause the task
Last edited by LA_ on Sun Jan 22, 2012 8:59 pm, edited 1 time in total.
Asus RT-N16 1.9.2.7-rtn-r1375 | Asus O!Play Air 1.09P | Synology DS210j
User avatar
LA_
Student
Student
 
Posts: 62
Joined: Mon Mar 08, 2010 3:23 pm

Re: SynoGet - add a download via command line

Postby LA_ » Sun Jan 22, 2012 8:59 pm

Is source code of download_redirector.cgi available? Can it be found there?
Asus RT-N16 1.9.2.7-rtn-r1375 | Asus O!Play Air 1.09P | Synology DS210j
User avatar
LA_
Student
Student
 
Posts: 62
Joined: Mon Mar 08, 2010 3:23 pm

PreviousNext

Return to Torrent Engines/Download Station Mods

Who is online

Users browsing this forum: No registered users and 3 guests