You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1004 B
36 lines
1004 B
import os
|
|
import sys
|
|
|
|
def extract_seasons(file_path):
|
|
seasons = set()
|
|
|
|
with open(file_path, 'r', encoding='utf-8') as file:
|
|
for line in file:
|
|
line = line.strip()
|
|
if not line:
|
|
continue
|
|
parts = line.split(os.sep) # Split by OS-specific path separator
|
|
if len(parts) >= 3: # Expecting at least "./Show/Season XX/Episode.mkv"
|
|
show = parts[1] # Extract show name
|
|
season = parts[2] # Extract season directory
|
|
seasons.add((show, season))
|
|
|
|
# Sort seasons by show and season
|
|
sorted_seasons = sorted(seasons, key=lambda x: (x[0], x[1]))
|
|
|
|
return sorted_seasons
|
|
|
|
def main():
|
|
if len(sys.argv) != 2:
|
|
print("Usage: python script.py <file_path>")
|
|
sys.exit(1)
|
|
|
|
file_path = sys.argv[1]
|
|
seasons = extract_seasons(file_path)
|
|
|
|
for show, season in seasons:
|
|
print(f"{show}: {season}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|