From ccfe41e74e0e376360d4f21f27dda6afa4ea1c05 Mon Sep 17 00:00:00 2001 From: KeksNino <87879013+KeksNino@users.noreply.github.com> Date: Fri, 19 Sep 2025 23:48:10 +0200 Subject: [PATCH] Initial code commit --- csv_file_sync.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 csv_file_sync.py diff --git a/csv_file_sync.py b/csv_file_sync.py new file mode 100644 index 0000000..8aeed5b --- /dev/null +++ b/csv_file_sync.py @@ -0,0 +1,20 @@ +import os +import csv + +download_folder = "/home/user/Music/test/" + +csv_file = "syntax-error.csv" + +playlist_tracks = set() +with open(download_folder + csv_file, newline='', encoding='utf-8') as f: + reader = csv.reader(f) + for row in reader: + row = row[:-1] + print(f"{row[1]} - {row[0]}.mp3") + +# Scan download folder +for file in os.listdir(download_folder): + if file not in playlist_tracks: + file_path = os.path.join(download_folder, file) + os.remove(file_path) + print(f"Deleted: {file}")