pymedusa / Medusa

Automatic Video Library Manager for TV Shows. It watches for new episodes of your favorite shows, and when they are posted it does its magic.
https://pymedusa.com
GNU General Public License v3.0
1.77k stars 275 forks source link

Most recent release broke Synology Downloadstation integration #9460

Open Tailslide opened 3 years ago

Tailslide commented 3 years ago

Describe the bug Since applying the latest release, downloads are stuck on snatched and look like this in DownloadStation.

To Reproduce Steps to reproduce the behavior:

  1. Initiate a download either through daily search or manual search
  2. Check downloadstation

Expected behavior Download works

Screenshots image

Medusa (please complete the following information):

Debug logs (at least 50 lines): 2021-04-20 14:18:18 INFO SNATCHQUEUE-SNATCH-328634 :: [0286e89] Downloading [filename] with 191 seeders and 7 leechers and size 2.12 GB from [search provider], through a SearchType.MANUAL_SEARCH search 2021-04-20 14:18:18 INFO SNATCHQUEUE-SNATCH-328634 :: [0286e89] Beginning to snatch release: [filename]

Additional context I'm wondering if this fix here doesn't work with sites that require a login. https://github.com/pymedusa/Medusa/issues/9366

p0psicles commented 3 years ago

Pls use the issue template.

Tailslide commented 3 years ago

I can confirm that commenting out the two line change from #9366 makes this stop for me. (However the previous issue of the latest download station not working is still there then)

Tailslide commented 3 years ago

Not sure why this got closed but I fixed the issue by updating downloadstation.py to use the new Version 2 of the DownloadStation API.

I can do a PR for it if you want.

p0psicles commented 3 years ago

If you could do a PR, that would be much appreciated. But maybe a good idea to consult with @benjv

BenjV commented 3 years ago

The two lines form #9366 will use the url (if available) to the torrent instead of the torrent file because the latest version of downloadstation broke the old API for downloading via torrent files. Are you using a private torrent provider who needs a username/password? Then downloadstation would not be able to to access that provider, because it does not have the possibility to login there.

I am working on a overhaul of the downloadstation client of medusa, that will use the "SYNO.DownloadStation2.Task" and that will fix the problem with downloading via the torrent file, but I will see if I can fix just this problem earlier.

Tailslide commented 3 years ago

@BenjV I have a working version of downloadstation.py using "SYNO.DownloadStation2.Task". I can submit this change if you want and you can review it or you can do you own if you want.

BenjV commented 3 years ago

I have already a working version which uses the "SYNO.DownloadStation2.Task", I am making some more changes, like checking the download location to be a correct and available share and only logging in again when the cookie is expired and not on every action. I will do some testing and then submit the PR, probably tomorrow.

Tailslide commented 3 years ago

@BenjV Sounds good thank you! The previous release of medusa had a workaround where I could still get up and running by installing the old downloadstation. I'm not sure there is a workaround for this release.

BenjV commented 3 years ago

@Tailslide You did not answer my question whether you are using a private torrent provider which needs login. If so and your "login.php" error stems from that, then this error would also occur when a private torrent provider would use magnet link instead of torrents. So my question is did the problem occurred when using a private torrent provider and so does that provider use magnet links or only torrent files?

Tailslide commented 3 years ago

@BenjV The issue I saw was with a private tracker and a torrent file. As you said, sending the torrent url to the download station doesn't work since it can't authenticate. I just took the original code and converted it to the V2 api and seems to be running with no issues. Looks like no one else is complaining so far and my problem has a temporary fix so maybe you don't need to rush any changes out.

BenjV commented 3 years ago

I'll take my time, but I was already busy to cleanup and upgrade the downloadstation client of Medusa.

andersjohansson3 commented 3 years ago

I'm now experiencing this issue as well w private trackers. Is there a workaround or do I need to wait for a fix to be applied? I'm running Medusa in a docker container so I guess that limits workaround possibilites some...

Tailslide commented 3 years ago

@andersjohansson3 You can revert back to the previous version of Medusa https://github.com/pymedusa/Medusa/releases/tag/v0.5.10

And the older version of downloadstation https://archive.synology.com/download/Package/DownloadStation/3.8.15-3563

BenjV commented 3 years ago

There is no workaround.

There is a new api available for DownloadStation, but Synology has not yet released documentation for it. So I am busy with trial and error methode to find how how it can be used. So either revert back to the old version of Download Station or be patient.

BenjV commented 3 years ago

@p0psicles It took some time because l had no time to spend on this, but now I have created a pull request to support the new Download Station API. I had to rewrite downloadstation.py and change generic.py I also did some clean-up and removed some unnecessary code for things like exception handling that already was done elsewhere.

p0psicles commented 3 years ago

The changes have been merged develop. @Tailslide could you also verify this is fixed now?

Tailslide commented 3 years ago

@p0psicles Sorry I can't. I switched to a new NAS and set it up with docker containers, not using download station anymore.

podzit commented 3 years ago

With the last release of Medusa on Synology, Torrents are sent to Download Station that's OK but they have status "Waiting" and don't start :( If I add manually the same torrent In DS, the download start immediately...

There's no info about that in Medusa log: 2021-07-07 18:51:52 INFO SNATCHQUEUE-SNATCH-321239 :: [db102f3] Torrent added as task ['dbid_1904'] to DownloadStation 2021-07-07 18:51:49 INFO SNATCHQUEUE-SNATCH-321239 :: [db102f3] Adding "The.Handmaids.Tale.S04E01.FRENCH.WEBRip.x264-FRATERNiTY" torrent to DownloadStation 2021-07-07 18:51:45 INFO SNATCHQUEUE-SNATCH-321239 :: [db102f3] Downloading The.Handmaids.Tale.S04E01.FRENCH.WEBRip.x264-FRATERNiTY with 29 seeders and 1 leechers and size 247.19 MB from Xthor, through a SearchType.MANUAL_SEARCH search 2021-07-07 18:51:45 INFO SNATCHQUEUE-SNATCH-321239 :: [db102f3] Beginning to snatch release: The.Handmaids.Tale.S04E01.FRENCH.WEBRip.x264-FRATERNiTY

podzit commented 3 years ago

I have discover in setup/ torrent search an error when I try to test connection with DownloadStation: 2021-07-07 19:23:18 WARNING Thread-1 :: [db102f3] Could not get the list of shares from DownloadStation: The logged in session does not have permission 2021-07-07 19:23:18 INFO Thread-1 :: [db102f3] DownloadStation checking if "DL" is a valid share

But the user in the setup is the administrator of the NAS... Is there an issue with API authentication ?

BenjV commented 3 years ago

The Synology webapi to current versions of Download Station only function if you set admin as the user. Any other user result in this problem.

Also other usernames who have admin privs don't function. This is a pure Synology problem and cannot be fixed in medusa

MatthK commented 1 year ago

https://github.com/seansfkelley/nas-download-manager/issues/177#issuecomment-822699863

I know it's an old thread, but I still have this problem. And it seems there is now at least some documentation from Synology. Is there a way to get this updated?

BenjV commented 1 year ago

As I wrote on that post:

You can use any account as long as it has application privileges to DownLoadStation and you have configured the download location in DownloadStation for that user. If you fail to do that the download will be added but never starts.

So you have to create a user in your Nas and give that user permission to use DownloadStation (control panel, application privileges, select downloadsStation and Edit). That user/password should be configured within medusa on the Torrents Search tab for DownloaddStation.

And the "system Internal User" sc-medusa must have read/write privs on the share where DownloadStation puts the downloaded video's