Skip to content

Commit

Permalink
♻️ fix base enhance_descr function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Jun 11, 2018
1 parent 18bbfa0 commit 8acfa92
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions extractors/base/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def post_data(self, url, params=None, **kwargs):
"""Encapsulation requests's method - POST"""
return requests.post(url=url, params=params, cookies=self.cookies, **kwargs)

def enhance_descr(self, torrent, info_dict):
def enhance_descr(self, torrent, descr_text, clone_id):
video_file = None
for test_file in [v["name"] for k, v in torrent.files().items()]: # To get video file
if (os.path.splitext(test_file)[1]).lower() in Video_Containers:
Expand All @@ -151,10 +151,10 @@ def enhance_descr(self, torrent, info_dict):
shot = descr.build_shot(file=video_file, encode=self.encode) if self._EXTEND_DESCR_THUMBNAILS else ""
mediainfo = descr.build_mediainfo(file=video_file,
encode=self.encode) if self._EXTEND_DESCR_MEDIAINFO else ""
clone_info = descr.build_clone_info(clone_id=info_dict["clone_id"],
clone_info = descr.build_clone_info(clone_id=clone_id,
encode=self.encode) if self._EXTEND_DESCR_CLONEINFO else ""

return before + info_dict["descr"] + shot + mediainfo + clone_info
return before + descr_text + shot + mediainfo + clone_info

# -*- The feeding function -*-
def torrent_feed(self, torrent):
Expand Down
2 changes: 1 addition & 1 deletion extractors/byrbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def torrent_clone(self, tid) -> dict:
return return_dict

def date_raw_update(self, torrent, torrent_name_search, raw_info: dict) -> dict:
raw_info["descr"] = self.enhance_descr(torrent=torrent, info_dict=raw_info)
raw_info["descr"] = self.enhance_descr(torrent, raw_info["descr"], raw_info["clone_id"])
filetype = torrent_name_search.group("filetype")
if raw_info["type"] == 401: # Series
raw_info["tv_ename"] = torrent_name_search.group("full_name")
Expand Down
2 changes: 1 addition & 1 deletion extractors/hudbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def torrent_clone(self, tid) -> dict:
return return_dict

def date_raw_update(self, torrent, torrent_name_search, raw_info: dict) -> dict:
raw_info["descr"] = self.enhance_descr(torrent=torrent, info_dict=raw_info)
raw_info["descr"] = self.enhance_descr(torrent, raw_info["descr"], raw_info["clone_id"])
type_ = int(raw_info["type"])
if type_ == 418: # 欧美剧集
torrent_raw_name = torrent_name_search.group("full_name")
Expand Down
2 changes: 1 addition & 1 deletion extractors/npubits.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def torrent_clone(self, tid) -> dict:
return res_dic

def date_raw_update(self, torrent, torrent_name_search, raw_info: dict) -> dict:
raw_info["descr"] = self.enhance_descr(torrent=torrent, info_dict=raw_info)
raw_info["descr"] = self.enhance_descr(torrent, raw_info["descr"], raw_info["clone_id"])
if int(raw_info["category"]) == 402: # Series
raw_info["name"] = torrent_name_search.group("full_name")
season_episode_info = episode_eng2chs(torrent_name_search.group("episode"))
Expand Down
2 changes: 1 addition & 1 deletion extractors/nwsuaf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def date_raw_update(self, torrent, torrent_name_search, raw_info: dict) -> dict:

# Assign raw info
raw_info["name"] = new_title
raw_info["descr"] = self.enhance_descr(torrent=torrent, info_dict=raw_info)
raw_info["descr"] = self.enhance_descr(torrent, raw_info["descr"], raw_info["clone_id"])

return raw_info

Expand Down
2 changes: 1 addition & 1 deletion extractors/tjupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def torrent_clone(self, tid):
return res_dic

def date_raw_update(self, torrent, torrent_name_search, raw_info: dict) -> dict:
raw_info["descr"] = self.enhance_descr(torrent=torrent, info_dict=raw_info)
raw_info["descr"] = self.enhance_descr(torrent, raw_info["descr"], raw_info["clone_id"])
type_ = int(raw_info["type"])
if type_ == 401: # 电影
pass
Expand Down

0 comments on commit 8acfa92

Please sign in to comment.