This commit is contained in:
bparodi@lezzo.org 2024-11-05 15:01:56 +01:00
parent 6547d869c4
commit 7708dafafe

View file

@ -1,4 +1,5 @@
import json, sys, os, glob import json, sys, os, glob
from rapidfuzz import fuzz
from collections import namedtuple from collections import namedtuple
from dateutil import parser from dateutil import parser
@ -121,18 +122,25 @@ for k, v in melevisione.items():
if counter.abs != n and counter.rel != n: if counter.abs != n and counter.rel != n:
assert False, f'{ep}|{counter}|stagione={k}' assert False, f'{ep}|{counter}|stagione={k}'
else: else:
counter = inc(counter) pass
# parsed = Episode(counter.abs, parsed_date, ep.title) # parsed = Episode(counter.abs, parsed_date, ep.title)
ep_ = make(ep.n, ep.date, ep.title, k) ep_ = make(ep.n, ep.date, ep.title, k)
date = parse_date(ep_.date) date = parse_date(ep_.date)
ep_ = WellFormed(counter.abs, date.date(), ep_.title, ep_.season) ep_ = WellFormed(counter.abs, date.date(), ep_.title, ep_.season)
acc.append(ep_) acc.append(ep_)
counter = inc(counter)
counter = reset(counter, k) counter = reset(counter, k)
EPISODI_TOTALI = len(scarti) + sum(expected.values()) EPISODI_TOTALI = len(scarti) + sum(expected.values()) - 1
assert acc[-1].n == EPISODI_TOTALI, f'{acc[-1].n} != {EPISODI_TOTALI}' assert acc[-1].n == EPISODI_TOTALI, f'{acc[-1].n} != {EPISODI_TOTALI}'
print(acc) from copy import copy
all_episodes = copy(acc)
all_titles = [a.title for a in acc]
# from IPython import embed as fuck; fuck()
max(all_episodes, key=lambda x: fuzz.ratio(x.title, "la missione di fata"))