[gnome-music/wip/jfelder/mpris-cleanup: 38/67] mpris: Rename MediaPlayer2Service class to MPRIS
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 38/67] mpris: Rename MediaPlayer2Service class to MPRIS
- Date: Fri, 5 Apr 2019 20:09:09 +0000 (UTC)
commit 66a4d1c7674c13288434a0d46d612df863c3be55
Author: Jean Felder <jfelder src gnome org>
Date: Tue Oct 23 15:32:33 2018 +0200
mpris: Rename MediaPlayer2Service class to MPRIS
MediaPlayer2Service name is too long and it's not really accurate.
gnomemusic/application.py | 4 ++--
gnomemusic/mpris.py | 46 +++++++++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 9a496093..dda3ebc7 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -36,7 +36,7 @@ import logging
from gi.repository import Gtk, Gio, GLib, Gdk
from gnomemusic import log
-from gnomemusic.mpris import MediaPlayer2Service
+from gnomemusic.mpris import MPRIS
from gnomemusic.widgets.aboutdialog import AboutDialog
from gnomemusic.window import Window
@@ -108,7 +108,7 @@ class Application(Gtk.Application):
self._window.set_default_icon_name(self._application_id)
if self._application_id == 'org.gnome.MusicDevel':
self._window.get_style_context().add_class('devel')
- MediaPlayer2Service(self)
+ MPRIS(self)
# gtk_window_present does not work on Wayland.
# Use gtk_present_with_time as a workaround instead.
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 5623495a..3c607c69 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -94,7 +94,7 @@ class DBusInterface:
invocation.return_value(None)
-class MediaPlayer2Service(DBusInterface):
+class MPRIS(DBusInterface):
'''
<!DOCTYPE node PUBLIC '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
@@ -217,7 +217,7 @@ class MediaPlayer2Service(DBusInterface):
MEDIA_PLAYER2_PLAYLISTS_IFACE = 'org.mpris.MediaPlayer2.Playlists'
def __repr__(self):
- return '<MediaPlayer2Service>'
+ return '<MPRIS>'
def __init__(self, app):
self.con = Gio.bus_get_sync(Gio.BusType.SESSION, None)
@@ -385,7 +385,7 @@ class MediaPlayer2Service(DBusInterface):
self.player.props.current_song)
self.TrackListReplaced(self._path_list, current_song_path)
self.PropertiesChanged(
- MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
+ MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
{'Tracks': GLib.Variant('ao', self._path_list), }, [])
@log
@@ -458,7 +458,7 @@ class MediaPlayer2Service(DBusInterface):
has_next = self.player.props.has_next
has_previous = self.player.props.has_previous
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'Metadata': GLib.Variant('a{sv}', self._get_metadata()),
'CanGoNext': GLib.Variant('b', has_next),
@@ -471,7 +471,7 @@ class MediaPlayer2Service(DBusInterface):
@log
def _on_thumbnail_updated(self, player, data=None):
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'Metadata': GLib.Variant('a{sv}', self._get_metadata()),
},
@@ -479,7 +479,7 @@ class MediaPlayer2Service(DBusInterface):
@log
def _on_player_state_changed(self, klass, args):
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'PlaybackStatus': GLib.Variant('s', self._get_playback_status()),
},
@@ -488,7 +488,7 @@ class MediaPlayer2Service(DBusInterface):
@log
def _on_repeat_mode_changed(self, player, param):
self._update_songs_list()
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'LoopStatus': GLib.Variant('s', self._get_loop_status()),
'Shuffle': GLib.Variant('b', self.player.props.repeat_mode ==
RepeatMode.SHUFFLE),
@@ -497,7 +497,7 @@ class MediaPlayer2Service(DBusInterface):
@log
def _on_volume_changed(self, player, data=None):
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'Volume': GLib.Variant('d', self.player.get_volume()),
},
@@ -505,7 +505,7 @@ class MediaPlayer2Service(DBusInterface):
@log
def _on_prev_next_invalidated(self, player, data=None):
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
{
'CanGoNext': GLib.Variant('b', self.player.props.has_next),
'CanGoPrevious': GLib.Variant('b', self.player.props.has_previous),
@@ -524,7 +524,7 @@ class MediaPlayer2Service(DBusInterface):
or self._player_previous_type == PlayerPlaylist.Type.PLAYLIST):
variant = GLib.Variant('(b(oss))', self._get_active_playlist())
self.PropertiesChanged(
- MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE,
+ MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE,
{'ActivePlaylist': variant, }, [])
self._player_previous_type = klass.get_playlist_type()
@@ -533,7 +533,7 @@ class MediaPlayer2Service(DBusInterface):
def _reload_playlists(self):
def get_playlists_callback(playlists):
self.playlists = playlists
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE,
+ self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE,
{
'PlaylistCount': GLib.Variant('u', len(playlists)),
},
@@ -615,7 +615,7 @@ class MediaPlayer2Service(DBusInterface):
variant = GLib.Variant.new_tuple(GLib.Variant('x', position_msecond))
self.con.emit_signal(
None, '/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE, 'Seeked', variant)
+ MPRIS.MEDIA_PLAYER2_PLAYER_IFACE, 'Seeked', variant)
def GetTracksMetadata(self, track_paths):
metadata = []
@@ -640,7 +640,7 @@ class MediaPlayer2Service(DBusInterface):
def TrackListReplaced(self, tracks, current_song):
self.con.emit_signal(None,
'/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
+ MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
'TrackListReplaced',
GLib.Variant.new_tuple(GLib.Variant('ao', tracks),
GLib.Variant('o', current_song)))
@@ -648,7 +648,7 @@ class MediaPlayer2Service(DBusInterface):
def TrackAdded(self, metadata, after_track):
self.con.emit_signal(None,
'/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
+ MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
'TrackAdded',
GLib.Variant.new_tuple(GLib.Variant('a{sv}', metadata),
GLib.Variant('o', after_track)))
@@ -656,13 +656,13 @@ class MediaPlayer2Service(DBusInterface):
def TrackRemoved(self, path):
self.con.emit_signal(
None, '/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE, 'TrackRemoved',
+ MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE, 'TrackRemoved',
GLib.Variant.new_tuple(GLib.Variant('o', path)))
def TrackMetadataChanged(self, path, metadata):
self.con.emit_signal(
None, '/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
+ MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
'TrackMetadataChanged',
GLib.Variant.new_tuple(
GLib.Variant('o', path), GLib.Variant('a{sv}', metadata)))
@@ -683,7 +683,7 @@ class MediaPlayer2Service(DBusInterface):
def PlaylistChanged(self, playlist):
self.con.emit_signal(None,
'/org/mpris/MediaPlayer2',
- MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE,
+ MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE,
'PlaylistChanged',
GLib.Variant.new_tuple(GLib.Variant('(oss)', playlist)))
@@ -691,7 +691,7 @@ class MediaPlayer2Service(DBusInterface):
return self.GetAll(interface_name)[property_name]
def GetAll(self, interface_name):
- if interface_name == MediaPlayer2Service.MEDIA_PLAYER2_IFACE:
+ if interface_name == MPRIS.MEDIA_PLAYER2_IFACE:
return {
'CanQuit': GLib.Variant('b', True),
'Fullscreen': GLib.Variant('b', False),
@@ -710,7 +710,7 @@ class MediaPlayer2Service(DBusInterface):
'audio/mpeg'
]),
}
- elif interface_name == MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE:
+ elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYER_IFACE:
position_msecond = int(self.player.get_position() * 1e6)
return {
'PlaybackStatus': GLib.Variant('s', self._get_playback_status()),
@@ -729,12 +729,12 @@ class MediaPlayer2Service(DBusInterface):
'CanSeek': GLib.Variant('b', True),
'CanControl': GLib.Variant('b', True),
}
- elif interface_name == MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE:
+ elif interface_name == MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE:
return {
'Tracks': GLib.Variant('ao', self._path_list),
'CanEditTracks': GLib.Variant('b', False)
}
- elif interface_name == MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE:
+ elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE:
return {
'PlaylistCount': GLib.Variant('u', len(self.playlists)),
'Orderings': GLib.Variant('as', ['Alphabetical']),
@@ -751,10 +751,10 @@ class MediaPlayer2Service(DBusInterface):
% interface_name)
def Set(self, interface_name, property_name, new_value):
- if interface_name == MediaPlayer2Service.MEDIA_PLAYER2_IFACE:
+ if interface_name == MPRIS.MEDIA_PLAYER2_IFACE:
if property_name == 'Fullscreen':
pass
- elif interface_name == MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE:
+ elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYER_IFACE:
if property_name == 'Rate':
pass
elif property_name == 'Volume':
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]