kernelhcy / DeaDBeeF-MPRIS-plugin

The MPRIS plugin for DeaDBeeF music player.
http://kernelhcy.github.com/DeaDBeeF-MPRIS-plugin
GNU General Public License v3.0
25 stars 7 forks source link

Bitrate of previous track is reported instead of the current track #3

Open arclance opened 12 years ago

arclance commented 12 years ago

Since I do not know if anyone saw issue 9 from code.google.com and it has been up for a while I will repost it here. https://code.google.com/p/deadbeef-mpris-plugin/issues/detail?id=9

What steps will reproduce the problem?

  1. start dbus-monitor in terminal
  2. play a track in deadbeef
  3. watch output of dbus-monitor First track reports a bitrate of -1
  4. play another track in deadbeef
  5. watch ouput of dbus-monitor Second track reports bitrate of first track
  6. as more tracks play the bitrate of the previous track is reported for each new track

For the first track. What is the expected output?

method call sender=:1.336182 -> dest=:1.335342 serial=7 path=/Player; interface=org.freedesktop.MediaPlayer; member=GetMetadata method return sender=:1.335342 -> dest=:1.336182 reply_serial=7 array [ dict entry( string "location" variant string "file:///mnt/nfsData_9/Music/Organized/0 Albums - Collections/Leon Russell/Leon Russell- Retrospective/09 - Stranger In A Strange Land_Leon Russell.flac" ) dict entry( string "title" variant string "Stranger In A Strange Land" ) dict entry( string "artist" variant string "Leon Russell" ) dict entry( string "album" variant string "Retrospective" ) dict entry( string "genre" variant string "" ) dict entry( string "mtime" variant int32 243440 ) dict entry( string "time" variant int32 243 ) dict entry( string "audio-bitrate" variant int32 851 ) ]

What do you see instead?

method call sender=:1.336182 -> dest=:1.335342 serial=7 path=/Player; interface=org.freedesktop.MediaPlayer; member=GetMetadata method return sender=:1.335342 -> dest=:1.336182 reply_serial=7 array [ dict entry( string "location" variant string "file:///mnt/nfsData_9/Music/Organized/0 Albums - Collections/Leon Russell/Leon Russell- Retrospective/09 - Stranger In A Strange Land_Leon Russell.flac" ) dict entry( string "title" variant string "Stranger In A Strange Land" ) dict entry( string "artist" variant string "Leon Russell" ) dict entry( string "album" variant string "Retrospective" ) dict entry( string "genre" variant string "" ) dict entry( string "mtime" variant int32 243440 ) dict entry( string "time" variant int32 243 ) dict entry( string "audio-bitrate" variant int32 -1 ) ]

For the second track. What is the expected output?

method call sender=:1.336668 -> dest=:1.335342 serial=7 path=/Player; interface=org.freedesktop.MediaPlayer; member=GetMetadata method return sender=:1.335342 -> dest=:1.336668 reply_serial=7 array [ dict entry( string "location" variant string "file:///mnt/nfsData_9/Music/Organized/0 Albums - Collections/Leon Russell/Leon Russell- Retrospective/01 - A Song For You_Leon Russell.flac" ) dict entry( string "title" variant string "A Song For You" ) dict entry( string "artist" variant string "Leon Russell" ) dict entry( string "album" variant string "Retrospective" ) dict entry( string "genre" variant string "" ) dict entry( string "mtime" variant int32 248626 ) dict entry( string "time" variant int32 248 ) dict entry( string "audio-bitrate" variant int32 673 ) ]

What do you see instead?

method call sender=:1.336668 -> dest=:1.335342 serial=7 path=/Player; interface=org.freedesktop.MediaPlayer; member=GetMetadata method return sender=:1.335342 -> dest=:1.336668 reply_serial=7 array [ dict entry( string "location" variant string "file:///mnt/nfsData_9/Music/Organized/0 Albums - Collections/Leon Russell/Leon Russell- Retrospective/01 - A Song For You_Leon Russell.flac" ) dict entry( string "title" variant string "A Song For You" ) dict entry( string "artist" variant string "Leon Russell" ) dict entry( string "album" variant string "Retrospective" ) dict entry( string "genre" variant string "" ) dict entry( string "mtime" variant int32 248626 ) dict entry( string "time" variant int32 248 ) dict entry( string "audio-bitrate" variant int32 851 ) ]

What version of the product are you using? deadbeef-mpris-plugin-2.1.2.tar.gz

On what operating system? Ubuntu 11.04

kernelhcy commented 12 years ago

I have seen the issue on code.google.com. I reviewed the code and found that I just got the bitrate from the DeaDBeeF's interface streamer_get_apx_bitrate. I have no idea why it return the bitrate of the previous song... Maybe this is a bug of deadbeef or I call the wrong function. I will try to fix this bug. Thanks for your report^v^

arclance commented 12 years ago

I discovered that you can get this data from deadbeef using this command in a terminal

deadbeef --nowplaying %@:Bitrate@

I was reading this page trying to add a bitrate column in deadbeef and found that %@:Bitrate@ was used to get the bitrate for a custom column. I tried it as an argument for "--nowplaying" and it worked! It returns the bitrate from the metadata and not the current decoded bitrate which changes for VBR files but it is better than the bitrate from another file.