Skip to content

Commit

Permalink
Remove the torrent grouping based on names
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Apr 18, 2024
1 parent f88d449 commit 6da7f5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
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 6da7f5c

Please sign in to comment.