Skip to content

Commit

Permalink
Merge pull request #7986 from drew2a/fix/remove_similar_groups
Browse files Browse the repository at this point in the history
Remove the torrent grouping feature based on names
  • Loading branch information
drew2a authored Apr 19, 2024
2 parents f88d449 + 3ef004c commit f33d198
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/tribler/gui/widgets/search_results_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __init__(self, original_query, **kwargs):
self.remote_results_received = False
self.postponed_remote_results = []
self.highlight_remote_results = True
self.group_by_name = True
self.sort_by_rank = True
self.original_search_results = []

Expand Down
5 changes: 0 additions & 5 deletions src/tribler/gui/widgets/tablecontentdelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,6 @@ def draw_title_and_tags(self, painter: QPainter, option: QStyleOptionViewItem, i
debug = False # change to True to see the search rank of items and to highlight remote items
item_name = data_item["name"]

group = data_item.get("group")
if group:
has_remote_items = any(group_item.get('remote') for group_item in group.values())
item_name += f" (+ {len(group)} similar{' *' if debug and has_remote_items else ''})"

if debug:
rank = data_item.get("rank")
if rank is not None:
Expand Down
21 changes: 5 additions & 16 deletions src/tribler/gui/widgets/tablecontentmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def __init__(self, parent=None):
self.saved_scroll_state = None
self.qt_object_destroyed = False

self.group_by_name = False
self.sort_by_rank = False
self.text_filter = ''

Expand Down Expand Up @@ -204,7 +203,6 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T
# Only add unique items to the table model and reverse mapping from unique ids to rows is built.
insert_index = 0 if on_top else len(self.data_items)
unique_new_items = []
name_mapping = {item['name']: item for item in self.data_items} if self.group_by_name else {}
now = time.time()
for item in items:
if remote:
Expand All @@ -218,21 +216,12 @@ def extract_unique_new_items(self, items: List, on_top: bool, remote: bool) -> T
item_uid = get_item_uid(item)
if item_uid not in self.item_uid_map:

prev_item = name_mapping.get(item['name'])
if self.group_by_name and prev_item is not None and not on_top and prev_item['type'] == REGULAR_TORRENT:
group = prev_item.setdefault('group', {})
if item_uid not in group:
group[item_uid] = item
else:
self.item_uid_map[item_uid] = insert_index
if 'infohash' in item:
self.item_uid_map[item['infohash']] = insert_index
unique_new_items.append(item)

if self.group_by_name and item['type'] == REGULAR_TORRENT and prev_item is None:
name_mapping[item['name']] = item
self.item_uid_map[item_uid] = insert_index
if 'infohash' in item:
self.item_uid_map[item['infohash']] = insert_index
unique_new_items.append(item)

insert_index += 1
insert_index += 1
return unique_new_items, insert_index

def add_items(self, new_items, on_top=False, remote=False):
Expand Down

0 comments on commit f33d198

Please sign in to comment.