-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhandle_duplicates.py
More file actions
32 lines (23 loc) · 914 Bytes
/
handle_duplicates.py
File metadata and controls
32 lines (23 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python3
# Takes duplicates CSV file,
# plus original playlist m3u8 file,
# then:
# sorts CSV file by similarity (field 0)
# make a holding directory for audio
# open a new m3u8 file for possible duplicates
# for each line:
# move file in field 1 to holding directory
# move file in field 2 to holding directory
import csv
import argparse
parser = argparse.ArgumentParser(description='Separate out possible duplicates for manual checking.')
parser.add_argument('-d', '--duplicates', required=True, type=str, help='Filename of CSV with possible duplicates')
args = parser.parse_args()
duplicates = args.duplicates
# listofDupes will contain the duplicates, sorted with the best matches at the top
with open(duplicates, 'r') as csvfile:
reader = csv.reader(csvfile)
listofDupes = list(reader)
listofDupes.sort(key=lambda value: int(value[0]), reverse=True)
# print(listofDupes)
# We'd