Upload files to 'anime_scripts'
This commit is contained in:
parent
f2c7d70878
commit
b652d20591
@ -75,8 +75,6 @@ def get_show(id):
|
|||||||
return response.json()
|
return response.json()
|
||||||
raise ValueError("Bad show")
|
raise ValueError("Bad show")
|
||||||
|
|
||||||
items = []
|
|
||||||
|
|
||||||
def get_base_show(res):
|
def get_base_show(res):
|
||||||
base = res["data"]["Media"]
|
base = res["data"]["Media"]
|
||||||
return SortableAnime(base["id"], base["startDate"]["year"], "BASE", base["title"], base["format"])
|
return SortableAnime(base["id"], base["startDate"]["year"], "BASE", base["title"], base["format"])
|
||||||
@ -89,27 +87,31 @@ def process_shows(res):
|
|||||||
pass
|
pass
|
||||||
return ls
|
return ls
|
||||||
|
|
||||||
show_id = search(argv[1])
|
def main(query):
|
||||||
res = get_show(show_id)
|
items = []
|
||||||
items.extend(process_shows(res))
|
show_id = search(query)
|
||||||
base_show = get_base_show(res)
|
res = get_show(show_id)
|
||||||
|
items.extend(process_shows(res))
|
||||||
|
base_show = get_base_show(res)
|
||||||
|
|
||||||
if "PREQUEL" not in [i.type for i in items]:
|
if "PREQUEL" not in [i.type for i in items]:
|
||||||
season = 1
|
season = 1
|
||||||
else:
|
else:
|
||||||
ignore = []
|
ignore = []
|
||||||
while True:
|
while True:
|
||||||
f = False
|
f = False
|
||||||
for i in items:
|
for i in items:
|
||||||
if i.type == "PREQUEL" and i not in ignore:
|
if i.type == "PREQUEL" and i not in ignore:
|
||||||
fi = [i for i in process_shows(get_show(i.id)) if i not in items]
|
fi = [i for i in process_shows(get_show(i.id)) if i not in items]
|
||||||
items.extend(fi)
|
items.extend(fi)
|
||||||
ignore.append(i)
|
ignore.append(i)
|
||||||
f = True
|
f = True
|
||||||
if not f:
|
if not f:
|
||||||
break
|
break
|
||||||
items = [i for i in items if i.frmt == "TV"]
|
items = [i for i in items if i.frmt == "TV"]
|
||||||
items.sort(key=lambda i: i.year)
|
items.sort(key=lambda i: i.year)
|
||||||
season = items.index(base_show)+1
|
season = items.index(base_show)+1
|
||||||
|
return season
|
||||||
|
|
||||||
print("Season {}".format(season))
|
if __name__ == "__main__":
|
||||||
|
print("Season {}".format(main(argv[1])))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user