Skip to content

Commit

Permalink
removed unneeded retries
Browse files Browse the repository at this point in the history
  • Loading branch information
morsela committed May 24, 2016
1 parent d2df255 commit f6453b7
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions resources/lib/TorecSubtitlesDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ def search_by_movie_name(self, movie_name):
subtitle_data = subtitle_data.read()
return SubtitlePage(id_, movie_name, sub_url, subtitle_data)

def get_download_link(self, sub_id, option_id, persist=True):
response = None
data = None

def get_download_link(self, sub_id, option_id):
params = {
"sub_id": sub_id,
"code": option_id,
Expand All @@ -190,17 +187,8 @@ def get_download_link(self, sub_id, option_id, persist=True):
"userAuth": self._get_user_auth()
}

for i in xrange(16):
response = self.opener.open(
"%s/ajax/sub/downloadun.asp" % self.BASE_URL, urllib.urlencode(params),
)
data = response.read()
if len(data) != 0 or not persist:
break
time.sleep(1)
if data:
return data
return response
response = self.opener.open("%s/ajax/sub/downloadun.asp" % self.BASE_URL, urllib.urlencode(params))
return response.read()

def download(self, download_link):
response = self.opener.open(
Expand Down

0 comments on commit f6453b7

Please sign in to comment.