[gnome-music/wip/jfelder/lastfm-ui-v1: 25/27] Initialize Last.fm scrobbler in application
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/lastfm-ui-v1: 25/27] Initialize Last.fm scrobbler in application
- Date: Tue, 14 Jan 2020 17:08:57 +0000 (UTC)
commit 920d814fb445988481c014e3dceeabbdfc262d4f
Author: Jean Felder <jfelder src gnome org>
Date: Sat Jan 4 16:43:40 2020 +0100
Initialize Last.fm scrobbler in application
gnomemusic/application.py | 11 +++++++++++
gnomemusic/player.py | 3 +--
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index e49607fe..cec31d2c 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -42,6 +42,7 @@ from gnomemusic.inhibitsuspend import InhibitSuspend
from gnomemusic.mpris import MPRIS
from gnomemusic.pauseonsuspend import PauseOnSuspend
from gnomemusic.player import Player
+from gnomemusic.scrobbler import LastFmScrobbler
from gnomemusic.widgets.aboutdialog import AboutDialog
from gnomemusic.window import Window
@@ -67,6 +68,7 @@ class Application(Gtk.Application):
self._coremodel = CoreModel(self)
self._settings = Gio.Settings.new('org.gnome.Music')
+ self._lastfm_scrobbler = LastFmScrobbler(self)
self._player = Player(self)
InhibitSuspend(self)
@@ -120,6 +122,15 @@ class Application(Gtk.Application):
"""
return self._coreselection
+ @GObject.Property(type=LastFmScrobbler, flags=GObject.ParamFlags.READABLE)
+ def lastfm_scrobbler(self):
+ """Get Last.fm scrobbler.
+
+ :returns: Last.fm scrobbler
+ :rtype: LastFmScrobbler
+ """
+ return self._lastfm_scrobbler
+
@GObject.Property(type=Window, flags=GObject.ParamFlags.READABLE)
def window(self):
"""Get main window.
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 79d0c075..a2af87e9 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -35,7 +35,6 @@ from gi._gi import pygobject_new_full
from gnomemusic import log
from gnomemusic.coresong import CoreSong
from gnomemusic.gstplayer import GstPlayer, Playback
-from gnomemusic.scrobbler import LastFmScrobbler
from gnomemusic.widgets.songwidget import SongWidget
@@ -401,7 +400,7 @@ class Player(GObject.GObject):
self._gst_player.bind_property(
'state', self, 'state', GObject.BindingFlags.SYNC_CREATE)
- self._lastfm = LastFmScrobbler(application)
+ self._lastfm = application.props.lastfm_scrobbler
@GObject.Property(
type=bool, default=False, flags=GObject.ParamFlags.READABLE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]