feat: add historical backfill with --init CLI and episode numbering
Adds a --init mode that seeds the database with past shows from a given anchor episode/date forward, batch-fetching likes from SoundCloud and partitioning them into weekly buckets. Episode numbers are tracked in the shows table and auto-incremented by the poller for new shows. Includes full API documentation (docs/api.md) and updated README. Made-with: Cursor
This commit is contained in:
@@ -40,6 +40,13 @@ class Poller:
|
||||
week_start, week_end = get_show_week(now, self._show_day, self._show_hour)
|
||||
show = self._db.get_or_create_show(week_start, week_end)
|
||||
|
||||
if show.episode_number is None:
|
||||
latest = self._db.get_latest_episode_number()
|
||||
if latest is not None:
|
||||
new_ep = latest + 1
|
||||
self._db.update_show_episode_number(show.id, new_ep)
|
||||
logger.info("Auto-assigned episode #%d to show %d", new_ep, show.id)
|
||||
|
||||
tracks = await self._sc.fetch_likes(
|
||||
user_id=user_id,
|
||||
since=week_start,
|
||||
|
||||
Reference in New Issue
Block a user