fix merge trackers
This commit is contained in:
parent
5701324e00
commit
e701fa28ba
|
@ -1356,20 +1356,23 @@ trying to add the torrent. It's possible your .torrent file is corrupted."))
|
||||||
if is_duplicate:
|
if is_duplicate:
|
||||||
merge_dialog = dialogs.MergeDlg()
|
merge_dialog = dialogs.MergeDlg()
|
||||||
if merge_dialog.show(self.window) == 1:
|
if merge_dialog.show(self.window) == 1:
|
||||||
new_trackers_as_list = self.manager.dump_trackers(torrent).\
|
new_trackers_as_list = self.manager.dump_trackers(torrent)\
|
||||||
replace(' ','').splitlines(True)
|
.splitlines()
|
||||||
original_trackers_as_list = self.manager.get_trackers(
|
original_trackers_as_list = self.manager.get_trackers(
|
||||||
unique_id).replace(' ','').splitlines(True)
|
unique_id).splitlines()
|
||||||
for index in xrange(len(new_trackers_as_list)):
|
merged_trackers = []
|
||||||
if original_trackers_as_list.count(
|
for s in original_trackers_as_list, new_trackers_as_list:
|
||||||
new_trackers_as_list[index]) == 0:
|
for x in s:
|
||||||
original_trackers_as_list.append(
|
merged_trackers.append(x)
|
||||||
new_trackers_as_list[index])
|
#remove duplicates
|
||||||
merged_trackers_as_string = ''.join([
|
d = {}
|
||||||
original_trackers_as_list[index] for \
|
for k in merged_trackers:
|
||||||
index in xrange(len(original_trackers_as_list))])
|
d[k] = 1
|
||||||
|
merged_trackers_as_string = ''
|
||||||
|
for x in d.keys():
|
||||||
|
merged_trackers_as_string = merged_trackers_as_string + x + '\n'
|
||||||
self.manager.replace_trackers(unique_id,
|
self.manager.replace_trackers(unique_id,
|
||||||
merged_trackers_as_string)
|
merged_trackers_as_string.strip())
|
||||||
else:
|
else:
|
||||||
dialogs.show_popup_warning(self.window, _("Unknown duplicate \
|
dialogs.show_popup_warning(self.window, _("Unknown duplicate \
|
||||||
torrent error."))
|
torrent error."))
|
||||||
|
|
Loading…
Reference in New Issue