[gnome-music] scrobbler: Update to use CoreSong properties
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] scrobbler: Update to use CoreSong properties
- Date: Mon, 17 Aug 2020 14:14:13 +0000 (UTC)
commit 27b87647744c07ed709602f11535e0813e50b884
Author: Adam Blanchet <adamblanchet free fr>
Date: Tue Aug 11 15:40:29 2020 +0200
scrobbler: Update to use CoreSong properties
Currently, LastFMScrobbler uses utils.py to get the media information to
send to _lastfm_api_call.
Changed _lastfm_api_call to use CoreSong properties instead of utils.py
calls. Removed now unused import of utils.py.
Closes: #402
gnomemusic/scrobbler.py | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/scrobbler.py b/gnomemusic/scrobbler.py
index 98bf0ba1..04888594 100644
--- a/gnomemusic/scrobbler.py
+++ b/gnomemusic/scrobbler.py
@@ -31,7 +31,6 @@ gi.require_version('Soup', '2.4')
from gi.repository import Gio, GLib, Goa, GObject, Soup
from gnomemusic.musiclogger import MusicLogger
-import gnomemusic.utils as utils
class GoaLastFM(GObject.GObject):
@@ -324,7 +323,7 @@ class LastFmScrobbler(GObject.GObject):
def scrobbled(self, scrobbled):
self._scrobbled = scrobbled
- def _lastfm_api_call(self, media, time_stamp, request_type_key):
+ def _lastfm_api_call(self, coresong, time_stamp, request_type_key):
"""Internal method called by self.scrobble"""
api_key = self._goa_lastfm.client_id
sk = self._goa_lastfm.session_key
@@ -335,8 +334,8 @@ class LastFmScrobbler(GObject.GObject):
return
secret = self._goa_lastfm.secret
- artist = utils.get_artist_name(media)
- title = utils.get_media_title(media)
+ artist = coresong.props.artist
+ title = coresong.props.title
request_type = {
"update now playing": "track.updateNowPlaying",
@@ -345,7 +344,7 @@ class LastFmScrobbler(GObject.GObject):
# The album is optional. So only provide it when it is
# available.
- album = media.get_album()
+ album = coresong.props.album
request_dict = {}
if (request_type_key == "scrobble"
@@ -429,8 +428,7 @@ class LastFmScrobbler(GObject.GObject):
if not self.props.can_scrobble:
return
- media = coresong.props.media
- self._lastfm_api_call(media, time_stamp, "scrobble")
+ self._lastfm_api_call(coresong, time_stamp, "scrobble")
def now_playing(self, coresong):
"""Set now playing song to Last.fm
@@ -444,5 +442,4 @@ class LastFmScrobbler(GObject.GObject):
if not self.props.can_scrobble:
return
- media = coresong.props.media
- self._lastfm_api_call(media, None, "update now playing")
+ self._lastfm_api_call(coresong, None, "update now playing")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]