chore: polish repo for public release

Add MIT LICENSE, fix README clone URL and add CI/license badges,
flesh out setup.py metadata, add a GitHub Actions test workflow,
and remove dead code left over from earlier iterations.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 03:37:26 +02:00
parent b66b22923d
commit 0ca953cebc
7 changed files with 71 additions and 30 deletions

View File

@@ -116,13 +116,6 @@ def download_space_video(
raise DownloadError(f"Failed to render Space video: {exc}") from exc
def fetch_metadata_or_fallback(space_id: str, cookies_file: Optional[str]) -> SpaceMetadata:
try:
return XApiClient(cookies_file=cookies_file).fetch_space_metadata(space_id)
except XApiError:
return SpaceMetadata(space_id=space_id, title=f"X Space {space_id}", participants=[])
def fetch_required_metadata(space_id: str, cookies_file: Optional[str]) -> SpaceMetadata:
try:
return XApiClient(cookies_file=cookies_file).fetch_space_metadata(space_id)
@@ -144,17 +137,6 @@ def fetch_required_timeline(metadata: SpaceMetadata, cookies_file: Optional[str]
return SpeakerTimeline(intervals, first_seen)
def fetch_timeline_or_none(metadata: SpaceMetadata, cookies_file: str) -> Optional[SpeakerTimeline]:
try:
intervals, first_seen, history_participants = XApiClient(cookies_file=cookies_file).fetch_space_timeline(metadata)
except XApiError:
return None
merge_history_participants(metadata, history_participants)
if not intervals and not first_seen:
return None
return SpeakerTimeline(intervals, first_seen)
def merge_history_participants(metadata: SpaceMetadata, history_participants) -> None:
existing = {participant.username.lower() for participant in metadata.participants}
for participant in history_participants:

View File

@@ -19,5 +19,5 @@ def validate_space_url(url: str) -> Tuple[bool, Optional[str], Optional[str]]:
if not match:
return False, None, "Invalid URL format. Expected: https://x.com/i/spaces/{SPACE_ID}"
space_id = match.group(2) # Changed from group(1) to group(2)
space_id = match.group(2)
return True, space_id, None

View File

@@ -203,8 +203,8 @@ def build_ffmpeg_command(audio_path: str, output_path: str, width: int, height:
"veryfast",
"-pix_fmt",
"yuv420p",
"-c:a",
"copy",
"-c:a",
"copy",
"-shortest",
output_path,
]
@@ -454,11 +454,3 @@ def ellipsize(draw: ImageDraw.ImageDraw, value: str, font, max_width: int) -> st
while trimmed and draw.textlength(trimmed + suffix, font=font) > max_width:
trimmed = trimmed[:-1]
return (trimmed or value[:1]) + suffix
def format_time(seconds: float) -> str:
minutes, secs = divmod(int(seconds), 60)
hours, minutes = divmod(minutes, 60)
if hours:
return f"{hours:d}:{minutes:02d}:{secs:02d}"
return f"{minutes:d}:{secs:02d}"