19 lines
757 B
Python
19 lines
757 B
Python
from pathlib import Path
|
|
|
|
def get_missing_episodes(path: Path):
|
|
for first_level_path in path.iterdir():
|
|
if first_level_path.is_dir():
|
|
episodes = []
|
|
missing_episodes = []
|
|
for second_level_path in first_level_path.iterdir():
|
|
if second_level_path.is_dir():
|
|
episodes.append(second_level_path.name.split('.')[0])
|
|
sorted_episodes = sorted(episodes, key=int)
|
|
max_index = int(sorted_episodes[-1])
|
|
for i in range(0, max_index):
|
|
if str(i) not in episodes:
|
|
missing_episodes.append(i)
|
|
if len(missing_episodes) > 0:
|
|
print(first_level_path.name)
|
|
print(missing_episodes)
|