plex_dupefinder
plex_dupefinder copied to clipboard
Mismatches in plex can get deleted
Wrong matches in plex have the potential to get deleted if running with Auto Delete enabled. This can be avoided by comparing the base path for the files before deleting by adding
m = ""
fail = False
for row in data:
n = row[3][0].split("/")
n = n[0:6]
out = "/".join(n)
if m == "":
m = out
else:
if m != out:
fail = True
break
if fail == True:
print("breaking..")
continue
Between lines 390 and 391, and by adding
partz = {}
media_items = {}
best_item = None
pos = 0
for media_id, part_info in collections.OrderedDict(
sorted(parts.items(), key=lambda x: x[1]['score'], reverse=True)).items():
pos += 1
if pos == 1:
best_item = part_info
media_items[pos] = media_id
partz[media_id] = part_info
headers, data = build_tabulated(partz, media_items)
m = ""
fail = False
for row in data:
n = row[3][0].split("/")
n = n[0:6]
out = "/".join(n)
if m == "":
m = out
else:
if m != out:
fail = True
break
if fail == True:
print("breaking..")
continue
Between lines 417 and 418.
The only downside is that you have to change n = n[0:6]
to match the directory depth to match the user's set up in plex.