Skip to content

Commit

Permalink
remove spotify recommendations feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiko2k committed Dec 18, 2024
1 parent 6c16ef7 commit d3529a6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 41 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ Changelog
- **Fixed** loading configuration with negative integers, this fixes setting a negative baseline offset
- **Fixed** playlist being able to skip to next song even when current song was looped due to a race condition
- **Fixed** leaking file handlers when handling themes and databases, this may fix potential memory leaks
- ***Removed*** guitar chords feature - api.guitarchords.com it partially relied on is dead, replaced by newer API that would need implementing, and the chords feature was unmaintained
- **Improved** Various changes to build system, Migrated to pyproject.toml
- ***Removed*** guitar chords feature - api.guitarchords.com it partially relied on is dead, replaced by newer API that would need implementing, and the chords feature was unmaintained
- ***Removed*** Spotify recommendations feature (API deprecated by Spotify)

- Many other bug fixes and code refactors [Special thanks to @C0rn3j for a lot of these]

### v7.8.3
Expand Down
36 changes: 18 additions & 18 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22019,24 +22019,24 @@ def get_spot_album_track(index: int):
track_menu.add_to_sub(1, MenuItem(_("Copy Track URL"), get_track_spot_url, get_track_spot_url_deco, pass_ref=True,
icon=spot_icon))

def get_spot_recs(tr: TrackClass | None = None) -> None:
if not tr:
tr = pctl.playing_object()
if not tr:
return
url = spot_ctl.get_artist_url_from_local(tr)
if not url:
show_message(_("No results found"))
return
track_url = tr.misc.get("spotify-track-url")

show_message(_("Fetching..."))
shooter(spot_ctl.rec_playlist, (url, track_url))

def get_spot_recs_track(index: int):
get_spot_recs(pctl.get_track(index))

track_menu.add_to_sub(1, MenuItem(_("Get Recommended"), get_spot_recs_track, pass_ref=True, icon=spot_icon))
# def get_spot_recs(tr: TrackClass | None = None) -> None:
# if not tr:
# tr = pctl.playing_object()
# if not tr:
# return
# url = spot_ctl.get_artist_url_from_local(tr)
# if not url:
# show_message(_("No results found"))
# return
# track_url = tr.misc.get("spotify-track-url")
#
# show_message(_("Fetching..."))
# shooter(spot_ctl.rec_playlist, (url, track_url))
#
# def get_spot_recs_track(index: int):
# get_spot_recs(pctl.get_track(index))
#
# track_menu.add_to_sub(1, MenuItem(_("Get Recommended"), get_spot_recs_track, pass_ref=True, icon=spot_icon))


def drop_tracks_to_new_playlist(track_list: list[int], hidden: bool = False) -> None:
Expand Down
44 changes: 22 additions & 22 deletions src/tauon/t_modules/t_spot.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,28 +821,28 @@ def playlist(self, url: str, return_list: bool = False, silent: bool = False) ->
if not silent:
self.tauon.switch_playlist(len(self.tauon.pctl.multi_playlist) - 1)

def rec_playlist(self, artist_url: str, track_url: str) -> None:

self.connect()
if not self.spotify:
return

id = artist_url.strip("/").split("/")[-1]
track_ids = None
if track_url:
track_ids = [track_url.strip("/").split("/")[-1]]
artist = self.spotify.artist(id)
recs = self.spotify.recommendations(artist_ids=[id], track_ids=track_ids, limit=25, market=self.country)
playlist = []
self.update_existing_import_list()
for t in recs.tracks:
nt = self.load_track(t, update_master_count=True, include_album_url=True)
self.tauon.pctl.master_library[nt.index] = nt
playlist.append(nt.index)

self.tauon.pctl.multi_playlist.append(self.tauon.pl_gen(title=artist.name + " Recs", playlist_ids=playlist))
self.tauon.switch_playlist(len(self.tauon.pctl.multi_playlist) - 1)
self.tauon.gui.message_box = False
# def rec_playlist(self, artist_url: str, track_url: str) -> None:
#
# self.connect()
# if not self.spotify:
# return
#
# id = artist_url.strip("/").split("/")[-1]
# track_ids = None
# if track_url:
# track_ids = [track_url.strip("/").split("/")[-1]]
# artist = self.spotify.artist(id)
# recs = self.spotify.recommendations(artist_ids=[id], track_ids=track_ids, limit=25, market=self.country)
# playlist = []
# self.update_existing_import_list()
# for t in recs.tracks:
# nt = self.load_track(t, update_master_count=True, include_album_url=True)
# self.tauon.pctl.master_library[nt.index] = nt
# playlist.append(nt.index)
#
# self.tauon.pctl.multi_playlist.append(self.tauon.pl_gen(title=artist.name + " Recs", playlist_ids=playlist))
# self.tauon.switch_playlist(len(self.tauon.pctl.multi_playlist) - 1)
# self.tauon.gui.message_box = False

def artist_playlist(self, url: str) -> None:
self.connect()
Expand Down

0 comments on commit d3529a6

Please sign in to comment.