Skip to content

Instantly share code, notes, and snippets.

@p3lim
p3lim / trakt_to_yamtrack.py
Created August 4, 2026 20:37 — forked from mammuth/trakt_to_yamtrack.py
Convert a manual Trakt export zip into a Yamtrack (v0.25.3) import CSV — full history, rewatches, ratings, watchlist, TMDB metadata prefill
#!/usr/bin/env python3
"""Convert a manual Trakt export (.zip contents) into a Yamtrack import CSV.
Targets Yamtrack v0.25.3's CSV importer (integrations/imports/yamtrack.py).
Key importer facts this script relies on:
- Row order determines bulk-create order: movie, tv, season, episode.
- TV is unique per (user, item); Season per (related_tv, item); Episode and
Movie rows may repeat (that is how rewatches are stored).
- Episodes are linked to seasons via (media_id, season_number) after seasons
are created (update_episode_references), so season rows must precede
@p3lim
p3lim / ask.sh
Created October 20, 2016 19:31
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
local prompt default REPLY
while true; do