Menu

#632 Add an option to generate a notification on loading a media file

Next_Release
open
nobody
None
5
2016-04-21
2016-03-04
No

In order to be a complete replacement for certain other Linux GUI media players (eg gnome-player), SMPlayer needs an option to generate a Freedesktop notification when loading a media file.

The show_filename action exists and/but uses the OSD within the player. Perhaps an action notify_filename could be implemented. Or, since the notify-send utility exists (eg in the Debian lib-notify package), some way of running a program with the filename as argument would do.

No doubt this could be generalised to other platforms with equivalent notification functionality, but that's a lower priority from my viewpoint.

If I could browse the source tree at Assembla I might offer a patch, but it says 'too many files to list' at smplayer/src even after enabling JavaScript.

Discussion

  • Ricardo Villalba

    That problem with Assembla, I think that didn't happen before. Anyway you can download the sources, there's a download button on the top left.

     
  • Dirk Fieldhouse

    Dirk Fieldhouse - 2016-04-21

    I was able to download the source zip.

    I had a look at this and observed that SMPlayer implements MPRIS2, which includes DBus events for media status changes. Using this I crafted a shell script (attached) that might be useful for others. I tested it on Lubuntu 14.04 only.

    For a more general (and much more efficient) solution that could be integrated into SMPlayer, you need a cross-platform Qt notification library. Well, here's Snorenotify https://techbase.kde.org/Projects/Snorenotify.

    The same sort of code that generates the MPRIS2 DBus events could be used to drive Snorenotify, ie connecting to the mediaPlaying and stateChanged signals. In my draft code (about 70 lines) there's a SMPlayerNotifier class derived from Snore::Application and QObject that does this; an object of this class could be instantiated as a member of SMPlayer. You would also want to be able to en/disable the notifications (TODO), probably as much work again.

    Now, the key question I suppose: would SMPlayer want to add Snorenotify as a dependency? I wouldn't propose to go further otherwise.

     

Log in to post a comment.