diff --git a/load_playlist.py b/load_playlist.py index 1d17b35..31c479e 100644 --- a/load_playlist.py +++ b/load_playlist.py @@ -31,7 +31,8 @@ async def load_playlist(path): data = [(pid, line) for line in data] stmt = await conn.prepare( - "INSERT INTO playlist_track (playlist_id, filepath) VALUES ($1, $2)") + "INSERT INTO playlist_track (playlist_id, filepath) VALUES ($1, $2) " + "ON CONFLICT(playlist_id, filepath) DO NOTHING") await stmt.executemany(data) print("Done. Loaded", len(data), "tracks")