Description: make subdownloader work again after API change
 Follow opensubtitles.org download link
 .
 Download links were constructed by subdownloader instead of using the
 download URL from the API.
Author: Christos Trochalakis <yatiohi@ideopolis.gr>
Bug: https://bugs.launchpad.net/subdownloader/+bug/1528605
Bug-Debian: https://bugs.debian.org/810530
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+bug/1528605
Acked-By: Mattia Rizzolo <mattia@debian.org>
Last-Update: 2016-01-13


--- a/gui/main.py
+++ b/gui/main.py
@@ -1140,7 +1140,7 @@
                    if not skip_all:
                         log.debug("Downloading subtitle '%s'" % destinationPath)
 			#print {sub.getIdFileOnline():destinationPath}
-                        osHttpRequests.download('http://www.opensubtitles.org/en/download/file/%s.gz' %sub.getIdFileOnline(), destinationPath)
+                        osHttpRequests.download(sub.getDownloadLink(), destinationPath)
                         #if self.OSDBServer.DownloadSubtitles({sub.getIdFileOnline():destinationPath}):
                             #success_downloaded += 1
                         #else:
--- a/modules/SDService.py
+++ b/modules/SDService.py
@@ -490,6 +490,7 @@
                             #sub.setLanguageName(i["LanguageName"]) 
                             sub.setRating(i["SubRating"])
                             sub.setUploader(i["UserNickName"])
+                            sub.setDownloadLink(i["SubDownloadLink"])
                             sub.setVideo(video)
                             
                             self.log.debug("  [%s] - %s"%  (sub.getLanguage(), sub.getFileName()))
--- a/modules/subtitlefile.py
+++ b/modules/subtitlefile.py
@@ -139,6 +139,12 @@
     def getRating(self):
         return self.rating
 
+    def setDownloadLink(self, link):
+        self.download_link = link
+
+    def getDownloadLink(self):
+        return self.download_link
+
     def setExtraInfo(self, info, data):
         self._extraInfo[info] = data
 
