Debugging the TEN service

This commit is contained in:
2026-05-15 00:00:57 +09:30
parent 887841b901
commit 1cbd080821
4 changed files with 40 additions and 19 deletions
+17 -1
View File
@@ -3,7 +3,22 @@ from pathlib import Path
from abc import ABC, abstractmethod
class BaseService(ABC):
# ... your existing abstract methods ...
@abstractmethod
def name(self):
pass
@abstractmethod
def slugify(self, text):
pass
@abstractmethod
def discover_seasons(self, show_title, source_season=None, source_url=None):
pass
@abstractmethod
def normalize_episode(self, source_title, output_title, entry):
pass
def download_episode(self, episode, entry, download_dir):
"""
@@ -32,3 +47,4 @@ class BaseService(ABC):
result = subprocess.run(cmd)
return result.returncode == 0
+2 -2
View File
@@ -125,7 +125,7 @@ class iViewService(BaseService):
# -------------------------
# Season discovery
# -------------------------
def discover_seasons(self, show_title):
def discover_seasons(self, show_title, source_season=None, source_url=None):
slug = self.slugify(show_title)
@@ -161,7 +161,7 @@ class iViewService(BaseService):
# -------------------------
# Episode normalization
# -------------------------
def normalize_episode(self, show_title, entry):
def normalize_episode(self, show_title, entry, season_num):
season = entry.get("season_number") or 1
episode = entry.get("episode_number") or 1
+15 -12
View File
@@ -34,12 +34,19 @@ class TenService(BaseService):
print(f"❌ Error: Ten requires 'source_season' in series.json for '{show_title}'")
return None
if config.get("source_url"):
url = config["source_url"]
else:
slug = self.slugify(show_title)
# Ten URL structure: /v/show-name/season-YYYY or /v/show-name/season-X
url = f"https://10play.com.au/{slug}/episodes/season-{source_season}"
if source_url:
url = source_url
else:
slug = self.slugify(show_title)
# Ten URL structure: /v/show-name/episodes/YYYY or /v/show-name/episodes/season-X
s_str = str(source_season)
if len(s_str) == 4:
season_path = s_str
else:
season_path = f"season-{s_str}"
url = f"https://10play.com.au/{slug}/episodes/{season_path}"
print(f"🔎 Querying Ten: {url}")
data = self.run_ytdlp_json(url)
@@ -72,15 +79,11 @@ class TenService(BaseService):
show_clean = output_title.replace(" ", ".")
title_clean = clean_title.replace(" ", ".")
filename = f"{show_clean}.S{s_val:02d}E{episode_idx:02d}.{title_clean}".strip(".")
# filename = f"{show_clean}.S{s_val:02d}E{episode_idx:02d}.{title_clean}".strip(".") # With episode title
filename = f"{show_clean}.S{s_val:02d}E{episode_idx:02d}".strip(".") # Without episode title
return {
"show": show_clean,
"episode_id": episode_id,
"filename": filename
}
def download_episode(self, episode, entry, download_dir):
# You can reuse the logic from your iViewService here
# Just ensure --netrc is included in the final subprocess call
pass