mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
barnkanalen: fix sorting on -A
This commit is contained in:
parent
503bb540f5
commit
564de61fed
@ -84,36 +84,26 @@ class Barnkanalen(Svtplay):
|
|||||||
yield i
|
yield i
|
||||||
|
|
||||||
def find_all_episodes(self, options):
|
def find_all_episodes(self, options):
|
||||||
parse = urlparse(self._url)
|
|
||||||
|
|
||||||
videos = []
|
videos = []
|
||||||
tab = None
|
|
||||||
match = re.search("__barnplay'] = ({.*});", self.get_urldata())
|
match = re.search("__barnplay'] = ({.*});", self.get_urldata())
|
||||||
if not match:
|
if not match:
|
||||||
log.error("Couldn't retrieve episode list.")
|
log.error("Couldn't retrieve episode list.")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
dataj = json.loads(match.group(1))
|
dataj = json.loads(match.group(1))
|
||||||
if re.search("/genre", parse.path):
|
dataj = dataj["context"]["dispatcher"]["stores"]["EpisodesStore"]
|
||||||
videos = self._genre(dataj)
|
showId = list(dataj["data"].keys())[0]
|
||||||
else:
|
items = dataj["data"][showId]["episodes"]
|
||||||
if parse.query:
|
for i in items:
|
||||||
match = re.search("tab=(.+)", parse.query)
|
program = i
|
||||||
if match:
|
videos = self.videos_to_list(program, videos)
|
||||||
tab = match.group(1)
|
videos.reverse()
|
||||||
|
|
||||||
dataj = dataj["context"]["dispatcher"]["stores"]["EpisodesStore"]
|
|
||||||
showId = dataj["data"].keys()[0]
|
|
||||||
items = dataj["data"][showId]["episodes"]
|
|
||||||
for i in items:
|
|
||||||
program = i
|
|
||||||
videos = self.videos_to_list(program, videos)
|
|
||||||
|
|
||||||
episodes = [urljoin("http://www.svt.se", x) for x in videos]
|
episodes = [urljoin("http://www.svt.se", x) for x in videos]
|
||||||
|
|
||||||
if options.all_last > 0:
|
if options.all_last > 0:
|
||||||
return sorted(episodes)[-options.all_last:]
|
return episodes[-options.all_last:]
|
||||||
return sorted(episodes)
|
return episodes
|
||||||
|
|
||||||
def videos_to_list(self, lvideos, videos):
|
def videos_to_list(self, lvideos, videos):
|
||||||
url = self.url + "/" + str(lvideos["id"])
|
url = self.url + "/" + str(lvideos["id"])
|
||||||
|
Loading…
Reference in New Issue
Block a user