Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mpDris2 for openSUSE:Factory checked in at 2023-03-08 14:53:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mpDris2 (Old) and /work/SRC/openSUSE:Factory/.mpDris2.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mpDris2" Wed Mar 8 14:53:07 2023 rev:6 rq:1070029 version:0.9.1 Changes: -------- --- /work/SRC/openSUSE:Factory/mpDris2/mpDris2.changes 2019-04-15 11:53:43.338607320 +0200 +++ /work/SRC/openSUSE:Factory/.mpDris2.new.31432/mpDris2.changes 2023-03-08 14:53:11.822880070 +0100 @@ -1,0 +2,10 @@ +Tue Mar 7 20:21:06 UTC 2023 - Dirk Müller <[email protected]> + +- update to 0.9.1: + * Use journald when using systemd service + * Bug fixes + * Drop python2 support + * Support `~` expansion in configuration file + * Added -j option to use systemd journald + +------------------------------------------------------------------- Old: ---- mpDris2-0.8.tar.gz New: ---- mpDris2-0.9.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mpDris2.spec ++++++ --- /var/tmp/diff_new_pack.xPwooB/_old 2023-03-08 14:53:12.426883358 +0100 +++ /var/tmp/diff_new_pack.xPwooB/_new 2023-03-08 14:53:12.430883380 +0100 @@ -1,7 +1,7 @@ # # spec file for package mpDris2 # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,17 +12,17 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: mpDris2 -Version: 0.8 +Version: 0.9.1 Release: 0 Summary: MPRIS V2.1 support for mpd License: GPL-3.0-only Group: Productivity/Multimedia/Sound/Players -Url: https://github.com/eonpatapon/mpDris2 +URL: https://github.com/eonpatapon/mpDris2 Source: https://github.com/eonpatapon/mpDris2/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch: interpreter.patch BuildRequires: autoconf ++++++ mpDris2-0.8.tar.gz -> mpDris2-0.9.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/NEWS new/mpDris2-0.9.1/NEWS --- old/mpDris2-0.8/NEWS 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/NEWS 2021-01-20 09:14:37.000000000 +0100 @@ -1,3 +1,17 @@ +mpDris2 v0.9.1 (January 20, 2021) + + - Use journald when using systemd service + +mpDris2 v0.9 (January 19, 2021) + + - Bug fixes + + - Drop python2 support + + - Support `~` expansion in configuration file + + - Added -j option to use systemd journald + mpDris2 v0.8 (February 22, 2019) - Added cli options for mpd host and port, music dir diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/README.md new/mpDris2-0.9.1/README.md --- old/mpDris2-0.8/README.md 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/README.md 2021-01-20 09:14:37.000000000 +0100 @@ -1,7 +1,5 @@ # mpDris2 -[](https://gitter.im/eonpatapon/mpDris2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - mpDris2 provide MPRIS 2 support to mpd (Music Player Daemon). mpDris2 is run in the user session and monitors a local or distant mpd server. @@ -10,15 +8,13 @@ ## Stable release -Download the latest release at http://mpdris2.patapon.info/latest/ +Download the latest release at https://github.com/eonpatapon/mpDris2/releases tar zvxf mpDris2-X.X.tar.gz cd mpDris2-X.X ./autogen.sh --sysconfdir=/etc make install (as root) -Older releases can be found at http://mpdris2.patapon.info/ - ## From git git clone git://github.com/eonpatapon/mpDris2.git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/configure.ac new/mpDris2-0.9.1/configure.ac --- old/mpDris2-0.8/configure.ac 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/configure.ac 2021-01-20 09:14:37.000000000 +0100 @@ -1,5 +1,5 @@ AC_INIT([mpDris2], - [0.8], + [0.9.1], [https://github.com/eonpatapon/mpDris2/issues], [mpdris2], [https://github.com/eonpatapon/mpDris2]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/src/mpDris2.in.py new/mpDris2-0.9.1/src/mpDris2.in.py --- old/mpDris2-0.8/src/mpDris2.in.py 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/src/mpDris2.in.py 2021-01-20 09:14:37.000000000 +0100 @@ -20,8 +20,7 @@ # Some bits taken from quodlibet mpris plugin by <[email protected]> -from __future__ import print_function - +from configparser import ConfigParser import os import sys import re @@ -47,11 +46,6 @@ mutagen = None try: - import configparser -except ImportError: - import ConfigParser as configparser - -try: import gi gi.require_version('Notify', '0.7') except (ImportError, ValueError): @@ -576,11 +570,7 @@ if not any([song_url.startswith(prefix) for prefix in urlhandlers]): song_url = os.path.join(self._params['music_dir'], song_url) self._metadata['xesam:url'] = song_url - try: - cover = self.find_cover(song_url) - except mutagen.MutagenError as e: - logger.error("Can't extract covers from %r: %r" % (song_url, e)) - cover = None + cover = self.find_cover(song_url) if cover: self._metadata['mpris:artUrl'] = cover @@ -638,8 +628,13 @@ self._temp_cover.close() # Search for embedded cover art + song = None if mutagen and os.path.exists(song_path): - song = mutagen.File(song_path) + try: + song = mutagen.File(song_path) + except mutagen.MutagenError as e: + logger.error("Can't extract covers from %r: %r" % (song_path, e)) + if song is not None: if song.tags: # present but null for some file types for tag in song.tags.keys(): @@ -671,9 +666,8 @@ self._temp_song_url = song_url return self._create_temp_cover(pic) - # Look in song directory for common album cover files - if os.path.exists(song_dir): + if os.path.exists(song_dir) and os.path.isdir(song_dir): for f in os.listdir(song_dir): if self._params['cover_regex'].match(f): return 'file://' + os.path.join(song_dir, f) @@ -712,14 +706,17 @@ old_position = self._position old_time = self._time self._currentsong = self.currentsong() - self._status = new_status = self.status() + new_status = self.status() self._time = new_time = int(time.time()) - logger.debug("_update_properties: current song = %r" % self._currentsong) - logger.debug("_update_properties: current status = %r" % self._status) if not new_status: + logger.debug("_update_properties: failed to get new status") return + self._status = new_status + logger.debug("_update_properties: current song = %r" % self._currentsong) + logger.debug("_update_properties: current status = %r" % self._status) + if 'elapsed' in new_status: new_position = float(new_status['elapsed']) elif 'time' in new_status: @@ -882,9 +879,7 @@ def __getattr__(self, attr): if attr[0] == "_": raise AttributeError(attr) - def fn(*a, **kw): - return self.call(attr, *a, **kw) - return fn + return lambda *a, **kw: self.call(attr, *a, **kw) def call(self, command, *args): fn = getattr(self.client, command) @@ -905,37 +900,57 @@ def __init__(self, params): self._notification = None + self._enabled = True - if not params["notify"]: - return + if params["notify"]: + self._notification = self._bootstrap_notifications() + if not self._notification: + logger.error("No notification service provider could be found; disabling notifications") + else: + self._enabled = False + def _bootstrap_notifications(self): + # Check if someone is providing the notification service bus = dbus.SessionBus() try: bus.get_name_owner("org.freedesktop.Notifications") except dbus.exceptions.DBusException: - logger.error("No service handling org.freedesktop.Notifications; disabling notifications") - return + return None + notif = None + + # Bootstrap whatever notifications system we are using if using_gi_notify: logger.debug("Initializing GObject.Notify") if Notify.init(identity): - self._notification = Notify.Notification() - self._notification.set_hint("desktop-entry", GLib.Variant("s", "mpdris2")) - self._notification.set_hint("transient", GLib.Variant("b", True)) + notif = Notify.Notification() + notif.set_hint("desktop-entry", GLib.Variant("s", "mpdris2")) + notif.set_hint("transient", GLib.Variant("b", True)) else: logger.error("Failed to init libnotify; disabling notifications") - self._notification = None elif using_old_notify: logger.debug("Initializing old pynotify") if pynotify.init(identity): - self._notification = pynotify.Notification("", "", "") - self._notification.set_hint("desktop-entry", "mpdris2") - self._notification.set_hint("transient", True) + notif = pynotify.Notification("", "", "") + notif.set_hint("desktop-entry", "mpdris2") + notif.set_hint("transient", True) else: logger.error("Failed to init libnotify; disabling notifications") - self._notification = None + + return notif def notify(self, title, body, uri=''): + if not self._enabled: + return + + # If we did not yet manage to get a notification service, + # try again + if not self._notification: + logger.info('Retrying to acquire a notification service provider...') + self._notification = self._bootstrap_notifications() + if self._notification: + logger.info('Notification service provider acquired!') + if self._notification: try: self._notification.set_urgency(params['notify_urgency']) @@ -1289,6 +1304,7 @@ --music-dir=PATH Set the music library path -d, --debug Run in debug mode + -j, --use-journal Log to systemd journal instead of stderr -v, --version mpDris2 version Environment variables MPD_HOST and MPD_PORT can be used. @@ -1301,17 +1317,20 @@ gettext.bindtextdomain('mpDris2', '@datadir@/locale') gettext.textdomain('mpDris2') - log_format = '%(asctime)s %(module)s %(levelname)s: %(message)s' + log_format_stderr = '%(asctime)s %(module)s %(levelname)s: %(message)s' + + log_journal = False log_level = logging.INFO config_file = None music_dir = None # Parse command line try: - (opts, args) = getopt.getopt(sys.argv[1:], 'c:dh:p:v', + (opts, args) = getopt.getopt(sys.argv[1:], 'c:dh:jp:v', ['help', 'bus-name=', 'config=', 'debug', 'host=', 'music-dir=', - 'path=', 'port=', 'version']) + 'use-journal', 'path=', 'port=', + 'version']) except getopt.GetoptError as ex: (msg, opt) = ex.args print("%s: %s" % (sys.argv[0], msg), file=sys.stderr) @@ -1331,6 +1350,8 @@ log_level = logging.DEBUG elif opt in ['-h', '--host']: params['host'] = arg + elif opt in ['-j', '--use-journal']: + log_journal = True elif opt in ['-p', '--path', '--music-dir']: music_dir = arg elif opt in ['--port']: @@ -1346,8 +1367,24 @@ usage(params) sys.exit() - logging.basicConfig(format=log_format, level=log_level) logger = logging.getLogger('mpDris2') + logger.propagate = False + logger.setLevel(log_level) + + # Attempt to configure systemd journal logging, if enabled + if log_journal: + try: + from systemd.journal import JournalHandler + log_handler = JournalHandler(SYSLOG_IDENTIFIER='mpDris2') + except ImportError: + log_journal = False + + # Log to stderr if journal logging was not enabled, or if setup failed + if not log_journal: + log_handler = logging.StreamHandler() + log_handler.setFormatter(logging.Formatter(log_format_stderr)) + + logger.addHandler(log_handler) # Pick up the server address (argv -> environment -> config) for arg in args[:2]: @@ -1364,7 +1401,7 @@ params['port'] = os.environ['MPD_PORT'] # Read configuration - config = configparser.SafeConfigParser() + config = ConfigParser() if config_file: with open(config_file) as fh: config.read(config_file) @@ -1383,6 +1420,8 @@ if '@' in params['host']: params['password'], params['host'] = params['host'].rsplit('@', 1) + params['host'] = os.path.expanduser(params['host']) + for p in ['mmkeys', 'notify']: if config.has_option('Bling', p): params[p] = config.getboolean('Bling', p) @@ -1403,6 +1442,7 @@ if not re.match('^[0-9A-Za-z+.-]+://', music_dir): music_dir = 'file://' + music_dir if music_dir.startswith('file://'): + music_dir = music_dir[:7] + os.path.expanduser(music_dir[7:]) if not os.path.exists(music_dir[7:]): logger.error('Music library path %s does not exist!' % music_dir) # Non-local URLs can still be useful to MPRIS clients, so accept them. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/src/mpDris2.service.in new/mpDris2-0.9.1/src/mpDris2.service.in --- old/mpDris2-0.8/src/mpDris2.service.in 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/src/mpDris2.service.in 2021-01-20 09:14:37.000000000 +0100 @@ -3,7 +3,7 @@ [Service] Restart=on-failure -ExecStart=@bindir@/mpDris2 +ExecStart=@bindir@/mpDris2 --use-journal BusName=org.mpris.MediaPlayer2.mpd [Install] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/src/mpdris2.desktop new/mpDris2-0.9.1/src/mpdris2.desktop --- old/mpDris2-0.8/src/mpdris2.desktop 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/src/mpdris2.desktop 2021-01-20 09:14:37.000000000 +0100 @@ -9,3 +9,5 @@ NoDisplay=true X-DBUS-ServiceName=org.mpris.MediaPlayer2.mpd X-GNOME-UsesNotifications=true +X-systemd-skip=true +X-GNOME-HiddenUnderSystemd=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mpDris2-0.8/src/org.mpris.MediaPlayer2.mpd.service.in new/mpDris2-0.9.1/src/org.mpris.MediaPlayer2.mpd.service.in --- old/mpDris2-0.8/src/org.mpris.MediaPlayer2.mpd.service.in 2019-02-22 16:33:53.000000000 +0100 +++ new/mpDris2-0.9.1/src/org.mpris.MediaPlayer2.mpd.service.in 2021-01-20 09:14:37.000000000 +0100 @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.mpris.MediaPlayer2.mpd -Exec=@bindir@/mpDris2 +Exec=@bindir@/mpDris2 --use-journal SystemdService=mpDris2.service
