Only open Wikipedia for songs

This commit is contained in:
Keith Edmunds 2021-08-06 13:39:22 +01:00
parent a6a0b905d8
commit 35f2b9629b

View File

@ -501,29 +501,25 @@ class Window(QMainWindow, Ui_MainWindow):
def song_info_search(self):
"""
Open browser tabs for Wikipedia and Songfacts, searching for
Open browser tabs for Wikipedia, searching for
the first that exists of:
- selected track
- current track
- next track
- current track
"""
title = self.visible_playlist_tab().get_selected_title()
if not title:
if self.current_track:
title = self.current_track.title
if not title:
if self.next_track:
title = self.next_track.title
if not title:
if self.current_track:
title = self.current_track.title
if title:
# Wikipedia
str = urllib.parse.quote_plus(title)
url = f"https://www.wikipedia.org/w/index.php?search={str}"
webbrowser.open(url, new=2)
# Songfacts
slug = slugify(title, replacements=([["'", ""]]))
url = f"https://www.songfacts.com/search/songs/{slug}"
webbrowser.open(url, new=2)
def stop(self):
"Stop playing immediately"