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 ") 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()