raffaem / waybar-mediaplayer

A mediaplayer for waybar with progress bar, tooltip, album art and synced lyrics
MIT License
31 stars 5 forks source link

Does not working with other music players (`amberol`, `kew`), combined together because recieved the same error message #3

Closed jernejmarcic closed 9 months ago

jernejmarcic commented 9 months ago

I apologize if this report is of poor quaoity I am still very new to this.

Same as before, I am using Endevour OS, running Hyprland. I am running the script as instructed in the README, I changed nothing and to my knowledge followed the instructions precisely.

I have downloaded music saved in the .flac format. I know that it has all the necessary metadata (such as cover art). However the script does function properly.

I have decided to test several different music players, and since they all produced the same error I have decided to group them together. So far I have tested amberol, kew.

There is only minor variation, kew did not get the second error received in amberol

Testing using amberol

Firstly I used the playerctl --list-all to get the amberol player_name and set it then I re-ran waybar. Upon launching it mediaplayer looked as such: 20240125_22h32m01s_grim (reusing the same image since it looks the same)

After waybar was up and running I launched amberol immediately after I got the following error:

Traceback (most recent call last):
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 46, in on_player_appeared
    init_player(manager, player)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 344, in init_player
    update_metadata(player, player.props.metadata, manager)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 219, in update_metadata
    updated = update_progressbar(manager, player)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 281, in update_progressbar
    length = pmetadata["mpris:length"]
             ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gi/overrides/GLib.py", line 345, in __getitem__
    raise KeyError(key)
KeyError: 'mpris:length'

While playing song I receive this error every second or so at regular intervals:

File "/usr/lib/python3.11/site-packages/gi/overrides/GLib.py", line 345, in __getitem__
    raise KeyError(key)
KeyError: 'mpris:length'
Traceback (most recent call last):
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 77, in on_metadata
    update_metadata(player, metadata, manager)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 219, in update_metadata
    updated = update_progressbar(manager, player)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 288, in update_progressbar
    perc = (pos / (length / config["length_factor"])) * 100
                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for /: 'str' and 'int'

Setting a different player_name and then playing music with amberol does not fix the issue unlike with vlc.

Testing using kew

I follow the same procedure with kew, copy and pasting the output of playerctl --list-all to player_name and restarting waybar.

I get the following error, the same as the error running amberol:

Traceback (most recent call last):
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 455, in <module>
    main()
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 431, in main
    init_player(manager, player)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 344, in init_player
    update_metadata(player, player.props.metadata, manager)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 219, in update_metadata
    updated = update_progressbar(manager, player)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 281, in update_progressbar
    length = pmetadata["mpris:length"]
             ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gi/overrides/GLib.py", line 345, in __getitem__
    raise KeyError(key)
KeyError: 'mpris:length'

However the mediaplayers appearance is different appearing as such: 20240125_22h26m18s_grim (reusing the same image since it looks the same)

raffaem commented 9 months ago

vlc and amberol should be fixed now.

Can you update following the update instructions in the README and try again?

kew is broken by itself, as it doesn't report track length.

Look at:

❯ playerctl --player kew542518 metadata
kew542518 xesam:title               Symphony No. 5: I. Allegro con brio
kew542518 xesam:artist              Ludwig van Beethoven
kew542518 xesam:album               Beethoven, L. van: Symphonies Nos. 5 and 6, "Pastoral"
kew542518 xesam:contentCreated      
kew542518 mpris:artUrl              /tmp/kew/raffaele/coverokrsgf.jpg
kew542518 mpris:trackid             '/org/kew/tracklist/track1'

And compare it with vlc:

➜ playerctl --player vlc metadata
vlc   mpris:trackid             '/org/videolan/vlc/playlist/3'
vlc   xesam:url                 file:///home/USERNAME/Music/MUSICFILE.mp3
vlc   xesam:title               Symphony No. 5: I. Allegro con brio
vlc   xesam:artist              Ludwig van Beethoven
vlc   xesam:album               Beethoven, L. van: Symphonies Nos. 5 and 6, "Pastoral"
vlc   vlc:time                  419
vlc   mpris:length              419474306
vlc   xesam:genre               Classical
vlc   mpris:artUrl              file:///home/USERNAME/.cache/vlc/art/artistalbum/FILE.jpg
vlc   vlc:length                419474
vlc   vlc:publisher             3

If we don't have track length we can't calculate the progress for the progress bar.

You should report a bug to kew linking this issue.

raffaem commented 9 months ago

waybar-mediaplayer should no longer crash in case the downstream player doesn't report song's length back to us.

However the progress bar won't work (see note in README).

firefox is fixed too.

jernejmarcic commented 9 months ago

I apologize for including programs that wouldn't work in the first place, I will check the metadata from now on.

Amberol still does not work

I set the player_name to io.bassi.Amberol, however I still get the same error as before (the scond one I included)

Traceback (most recent call last):
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 489, in <module>
    main()
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 462, in main
    init_player(manager, player)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 373, in init_player
    update_metadata(player, player.props.metadata, manager)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 236, in update_metadata
    updated = update_progressbar(manager, player)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 318, in update_progressbar
    perc = (pos / (length / config["length_factor"])) * 100
                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for /: 'str' and 'int'
raffaem commented 9 months ago

Fixed again (it got fixed a first time, but than that fix got lost when we fixed for kew not reporting length).

Now Amberol should work. Try to update.

jernejmarcic commented 9 months ago

Amberol work, save for cover image as expected. I still get an error message however the track lenght and title work flawlessly.

Traceback (most recent call last):
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 44, in on_player_appeared
    init_player(manager, player)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 375, in init_player
    update_metadata(player, player.props.metadata, manager)
  File "/home/jernej/.config/waybar/waybar-mediaplayer/src/mediaplayer", line 254, in update_metadata
    len(player.get_title()) + len(icons["stop"]) > config["widget_length"]
    ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
raffaem commented 9 months ago

Update again. (I don't understand how your song doesn't have a title BTW :))

jernejmarcic commented 9 months ago

Other than the cover art support and the porblem with kew, everything works. Testing with Firefox (with plasma-browser-integration installed and set as player_title) shows the title and progress bar. Testing with Amberol, displays the title and progress bar without trouble.

I appose for the confusion, the screenshot I provided was how it appeared at the time. From further testing I concluded the mediaplayer looks like this: 20240125_22h32m01s_grim When there are no players found, which leads me to believe I did something wrong at the time.

raffaem commented 9 months ago

I did report the bug to kew: https://github.com/ravachol/kew/issues/112

We have to wait they fix it on their side. They are not reporting the song's length back to us, so we cannot compute the progress to display on the progress bar.

For the cover art, let's continue in the other thread!