Skip to content

Commit

Permalink
Fixed the issue where the error window 'songs' pops up after NetEase …
Browse files Browse the repository at this point in the history
…Cloud searches for all results but continues to search.
  • Loading branch information
chenmozhijin committed May 12, 2024
1 parent f9ed3e9 commit 5d52b2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ def ne_search(keyword: str, search_type: SearchType, page: str | int = 1) -> dic
return []
match search_type:
case SearchType.SONG:
if 'songs' not in data['result']:
return []
results = nesonglist2result(data['result']['songs'])
case SearchType.ALBUM:
if 'albums' not in data['result']:
return []
results = []
for album in data['result']['albums']:
results.append({
Expand All @@ -156,6 +160,8 @@ def ne_search(keyword: str, search_type: SearchType, page: str | int = 1) -> dic
'source': Source.NE,
})
case SearchType.SONGLIST:
if 'playlists' not in data['result']:
return []
results = []
for songlist in data['result']['playlists']:
results.append({
Expand Down
6 changes: 3 additions & 3 deletions view/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@ def search_nextpage_error(self, error: str) -> None:
def results_table_scroll_changed(self) -> None:
# 判断是否已经滚动到了底部或消失
results_table_scroll = self.results_tableWidget.verticalScrollBar()

value = results_table_scroll.value()
max_val = results_table_scroll.maximum()
min_val = results_table_scroll.minimum()
if ((max_val - min_val) == 0 and self.results_tableWidget.rowCount() != 0) or value == self.results_tableWidget.verticalScrollBar().maximum():
max_value = results_table_scroll.maximum()
if value == max_value:

# 更新列表(获取下一页)
table = self.results_tableWidget
Expand Down

0 comments on commit 5d52b2f

Please sign in to comment.