Giter Site home page Giter Site logo

mpris-ctl's People

Contributors

mariusor avatar nedludd avatar vaygr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mpris-ctl's Issues

Segfault with multiple MPRIS enabled players

$ mpris-ctl info
process 29475: arguments to dbus_message_new_method_call() were incorrect, assertion "destination == NULL || _dbus_check_is_valid_bus_name (destination)" failed in file dbus-message.c line 1370.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)
Process 29475 (mpris-ctl) of user 1000 dumped core.
                                             
           Stack trace of thread 29475:
           #0  0x00007fb40621fa10 raise (libc.so.6)
           #1  0x00007fb40622113a abort (libc.so.6)
           #2  0x00007fb4065c8984 n/a (libdbus-1.so.3)
           #3  0x00007fb4065bf72c _dbus_warn_check_failed (libdbus-1.so.3)
           #4  0x00007fb4065aff82 dbus_message_new_method_call (libdbus-1.so.3)
           #5  0x0000000000401ece n/a (mpris-ctl)
           #6  0x00000000004021b8 n/a (mpris-ctl)
           #7  0x0000000000401118 n/a (mpris-ctl)
           #8  0x00007fb40620c511 __libc_start_main (libc.so.6)
           #9  0x00000000004011aa n/a (mpris-ctl)

Segfault while selecting a player

Trying 0.8.5 here.

Even a simple mpris-ctl --player a leads to a segfault, hence none of the commands work on inactive players, if you want to specify, e.g. mpris-ctl --player ncspot pp.

mpris-ctl --player active ... / mpris-ctl --player inactive ... work though.

List command support

Thanks for this useful program. Apparently playerctl is becoming overloaded..

But! Listing existing players functionality could be borrowed and be useful here. There's a flag to specify the player, but there's no way to get the name you'd want to control with mpris-ctl.

Something as simple as --list flag would be great.

Address boundary error

when trying to execute a command from i3 with a specific player name, such as Multimediální přehrávač VLC I receive

fish: Job 1, 'bash -c "mpris-ctl --player 'Mu…' terminated by signal SIGSEGV (Address boundary error)

if I execute it in an interactive bash shell on its own, it works, but in fish and in noninteractive bash, it doesn't
it is fixed by using bash -ic but I wonder why.

Add a currenty playing info command

Add a command (with tokenized string support) which would print the current playing song information.

$ mpris-ctl info "%track_name"
Song 42
$ mpris-ctl info
Song 42 - Bloor - The Best of Bloor

Tokens:

  • %track_name
  • %artist_name
  • %album_name

In the second example we're using the default value for the info tokenized string %track_name - %artist_name - %album_name

Add play status option to the application

Add a command to show the play status of the player:

$ mpris-ctl play
$ mpris-ctl status
playing
$ mpris-ctl pp
$ mpris-ctl status
paused
$ mpris-ctl stop
$ mpris-ctl status
stopped

Valid statuses:

  • playing
  • paused
  • stopped
  • unavailable (?) - when there's no active MPRIS player - probably will return an error exit code

Collaboration proposal

First of all, thanks for such a piece of software!

I was using it in the last few months when I was on Arch Linux, and it was all I was searching for; I had tried playerctl, but it does too much for my taste.

Now that I changed to Void Linux with musl libc and kind of lost access to Spotify — it doesn't work with musl, neither does Google Winedive, as they're linked against glibc —, I was searching for other (lightweight) media players and, between one player and another, I started to read your code and read the MPRIS spec and such.

During this, I wrote playpause; it is more minimalistic than yours, because I rarely want to see some metadata. As I wrote in README, "it just plays and pauses your media player".

Anyway, I saw your code and, despite how useful is mpris-ctl, I think the code base can be futher enhanced. With this, I refer to things like code duplication and some potential spaghetti code (it isn't about goto — I use it myself).

I think I can help you with that; I'm writing this issue because, but in addition I think the mpris-ctl "architecture" — if I can call it that way — must be modified/enhanced. You can see my code if you're interested.

What you think about it? :)

pp option is now unusable

Just a small suggestion. I use your program every day for media playback, but since the update of inactive player interaction, the pp command, which I use the most, loses its purpose as it can only stop everything, or play everything due to the explicit selection of type of players affected. This feature is not much of a feature in my eyes, because this behaviour was already available with stop and play commands.
Do you think you could something about it?

Negative seeking arguments don't parse

Title. Forward seeking works correctly, it parses floats and ms/s/m as expected, but trying to format it as a negative number seek -1 seek -0.5 seek -2s etc all result in it apparently failing to parse and skipping the default interval of 5 seconds ahead instead. I've tried quotes around the number and escaping the -, don't know if there's a trick I'm missing otherwise, but if there is one I'd be interested in hearing it.

0.9.96-1 built from AUR

Ambiguous player names

Not sure if it's by design, but mpris-ctl accepts non-existing player names for --player.

For example, if you list them and add some suffix at the end, that would work, e.g.:

$ mpris-ctl list
Audacious
Chromium
$ mpris-ctl --player Audaciousness play
$

That could lead to unexpected results in some cases.

Add support for multiple players at the same time

Currently if there are multiple MPRIS enabled players, the command is passed just to the last one loaded.

We need to add some logic to trigger commands like play/pause/stop to players that support it (have CanPlay... enabled) also same for using the play status.

Monitoring changes

Thanks for this useful tool!

I've been toying with the idea of adding a monitor option, that works similarly to status but continuously outputs a new line, every time the dbus metadata or play status changes. This is helpful for use with statusbars such as polybar, yabar or i3blocks - it removes the need for polling, and it's more comfortable than relying on sketchy Python scripts. An example call would be mpris-ctl monitor '%play_status %artist_name - %album_name'.

I don't know how much of a hassle it'd be to implement. If you're not up for it, I'm happy to try myself, but it'll be a while, since I haven't written any C before. Either way - would you pull such a change back into your repository? :)

Compile with gcc results in these warnings.

cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -D VERSION_HASH="0.6.0-1" -std=c99 -Wpedantic -Wall -Wextra -D NDEBUG src/main.c -Wl,-O1,--sort-common,--as-needed,-z,relro -ldbus-1 -ompris-ctl

src/main.c: In function ‘print_mpris_info’:
src/main.c:169:38: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size 3 [-Wformat-truncation=]
     snprintf(track_number_label, 3, "%d", props->metadata.track_number);
                                      ^~
src/main.c:169:37: note: directive argument in the range [0, 65535]
     snprintf(track_number_label, 3, "%d", props->metadata.track_number);
                                     ^~~~
In file included from /usr/include/stdio.h:939:0,
                 from src/main.c:5:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 2 and 6 bytes into a destination of size 3
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:172:32: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(bitrate_label, 5, "%d", props->metadata.bitrate);
                                ^~~~
In file included from /usr/include/stdio.h:939:0,
                 from src/main.c:5:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 2 and 6 bytes into a destination of size 5
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘snprintf’,
    inlined from ‘print_mpris_info’ at src/main.c:163:5:
/usr/include/bits/stdio2.h:64:10: warning: ‘__builtin___snprintf_chk’: specified bound 20 exceeds the size 5 of the destination [-Wstringop-overflow=]
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘snprintf’,
    inlined from ‘print_mpris_info’ at src/main.c:166:5:
/usr/include/bits/stdio2.h:64:10: warning: ‘__builtin___snprintf_chk’: specified bound 20 exceeds the size 11 of the destination [-Wstringop-overflow=]
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());

Command doesn't exit when completed

When I map the commands to my media buttons, I can only use the button once, and when it's run in terminal the command doesn't finish till I force close it with ctrl-c.
the output of dbus-send --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames

method return time=1490376872.310747 sender=org.freedesktop.DBus -> destination=:1.166 serial=3 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "org.freedesktop.Notifications"
      string ":1.7"
      string "org.mpris.MediaPlayer2.google-play-music-desktop-player"
      string "org.freedesktop.network-manager-applet"
      string ":1.8"
      string ":1.9"
      string "org.gnome.GConf"
      string "org.freedesktop.systemd1"
      string "org.a11y.Bus"
      string ":1.10"
      string ":1.11"
      string ":1.23"
      string ":1.12"
      string ":1.24"
      string ":1.13"
      string ":1.0"
      string "org.gtk.vfs.Daemon"
      string ":1.166"
      string ":1.36"
      string "org.pulseaudio.Server"
      string "org.PulseAudio1"
      string "org.gtk.vfs.mountpoint_http"
      string ":1.37"
      string ":1.15"
      string ":1.3"
      string ":1.18"
      string ":1.5"
      string ":1.116"
   ]

Output to STDERR

Hi, just wondering why you are sending output to STDERR and not STDOUT?

I was trying to get mpris-ctrl working with a script and it took me forever to figure out why it wasn't working :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.