ismailof / mopidy-btsource

Apache License 2.0
2 stars 0 forks source link

Modipy don't see the current song, can't send commands AVRCP #2

Open RemiGdJ opened 7 years ago

RemiGdJ commented 7 years ago

Hi ismailof, I'm trying to play and remote control my phone media via modipy and your module. My phone is connected with my pc, and when i use mopidy --verbose I can see events when I play the next song, or play/pause. When I use a remote to control the media, the commands are sent to mopidy, but as the track isn't played via mopidy (i think), it changes nothing... Do you have any idea to solve this issue ? Thanks !

Rémi

Logs when I start mopidy, play a song, pause, nextsong with my phone (not using remote control): mopidy --verbose INFO 2017-05-12 08:17:09,638 [1915:MainThread] mopidy.__main__ Starting Mopidy 2.1.0 DEBUG 2017-05-12 08:17:09,650 [1915:MainThread] mopidy.ext Loading entry point: IRControl = mopidy_IRControl:Extension DEBUG 2017-05-12 08:17:09,652 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-IRControl 0.1.0 DEBUG 2017-05-12 08:17:09,653 [1915:MainThread] mopidy.ext Loading entry point: btmanager = mopidy_btmanager:Extension DEBUG 2017-05-12 08:17:09,654 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-BTManager 0.1.0 DEBUG 2017-05-12 08:17:09,655 [1915:MainThread] mopidy.ext Loading entry point: btsource = mopidy_btsource:Extension INFO 2017-05-12 08:17:09,678 [1915:MainThread] mopidy_btsource.bt_player Found bluetooth adapter raspberrypi #1 (00:1A:7D:DA:71:0D) DEBUG 2017-05-12 08:17:09,694 [1915:MainThread] mopidy_btsource.bt_player Event Track_Change triggered with no callbacks associated DEBUG 2017-05-12 08:17:09,694 [1915:MainThread] mopidy_btsource.bt_player Event Position_Change triggered with no callbacks associated DEBUG 2017-05-12 08:17:09,694 [1915:MainThread] mopidy_btsource.bt_player Event Status_Change triggered with no callbacks associated INFO 2017-05-12 08:17:09,694 [1915:MainThread] mopidy_btsource.bt_player Connected to bluetooth source HUAWEI P8 lite DEBUG 2017-05-12 08:17:09,696 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-BTSource 0.4.1 DEBUG 2017-05-12 08:17:09,702 [1915:MainThread] mopidy.ext Loading entry point: mpd = mopidy.mpd:Extension DEBUG 2017-05-12 08:17:09,703 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-MPD 2.1.0 DEBUG 2017-05-12 08:17:09,703 [1915:MainThread] mopidy.ext Loading entry point: http = mopidy.http:Extension DEBUG 2017-05-12 08:17:09,704 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-HTTP 2.1.0 DEBUG 2017-05-12 08:17:09,704 [1915:MainThread] mopidy.ext Loading entry point: stream = mopidy.stream:Extension DEBUG 2017-05-12 08:17:09,705 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-Stream 2.1.0 DEBUG 2017-05-12 08:17:09,705 [1915:MainThread] mopidy.ext Loading entry point: m3u = mopidy.m3u:Extension DEBUG 2017-05-12 08:17:09,706 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-M3U 2.1.0 DEBUG 2017-05-12 08:17:09,707 [1915:MainThread] mopidy.ext Loading entry point: softwaremixer = mopidy.softwaremixer:Extension DEBUG 2017-05-12 08:17:09,707 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-SoftwareMixer 2.1.0 DEBUG 2017-05-12 08:17:09,707 [1915:MainThread] mopidy.ext Loading entry point: file = mopidy.file:Extension DEBUG 2017-05-12 08:17:09,708 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-File 2.1.0 DEBUG 2017-05-12 08:17:09,709 [1915:MainThread] mopidy.ext Loading entry point: local = mopidy.local:Extension DEBUG 2017-05-12 08:17:09,716 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-Local 2.1.0 DEBUG 2017-05-12 08:17:09,726 [1915:MainThread] mopidy.ext Loading entry point: musicbox_webclient = mopidy_musicbox_webclient:Extension DEBUG 2017-05-12 08:17:09,728 [1915:MainThread] mopidy.ext Loaded extension: Mopidy-MusicBox-Webclient 2.4.0 DEBUG 2017-05-12 08:17:09,729 [1915:MainThread] mopidy.ext Discovered extensions: IRControl, btmanager, btsource, mpd, http, stream, m3u, softwaremixer, file, local, musicbox_webclient DEBUG 2017-05-12 08:17:09,734 [1915:MainThread] mopidy.config.keyring Fetching passwords from your keyring failed. Any passwords stored in the keyring will not be available. (org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11) INFO 2017-05-12 08:17:09,735 [1915:MainThread] mopidy.config Loading config from builtin defaults DEBUG 2017-05-12 08:17:09,745 [1915:MainThread] mopidy.config Loading config from /etc/xdg/mopidy/mopidy.conf failed; it does not exist INFO 2017-05-12 08:17:09,745 [1915:MainThread] mopidy.config Loading config from /home/pi/.config/mopidy/mopidy.conf INFO 2017-05-12 08:17:09,750 [1915:MainThread] mopidy.config Loading config from command line options DEBUG 2017-05-12 08:17:09,771 [1915:MainThread] mopidy.ext Validating extension: IRControl INFO 2017-05-12 08:17:09,797 [1915:MainThread] mopidy.ext Disabled extension IRControl: Dependency pylirc2>=0.1 not found DEBUG 2017-05-12 08:17:09,798 [1915:MainThread] mopidy.ext Validating extension: btmanager INFO 2017-05-12 08:17:09,824 [1915:MainThread] mopidy.ext Disabled extension btmanager: Dependency BT-Manager>=0.3.0 not found DEBUG 2017-05-12 08:17:09,826 [1915:MainThread] mopidy.ext Validating extension: btsource DEBUG 2017-05-12 08:17:09,829 [1915:MainThread] mopidy.ext Validating extension: mpd DEBUG 2017-05-12 08:17:09,830 [1915:MainThread] mopidy.ext Validating extension: http DEBUG 2017-05-12 08:17:09,887 [1915:MainThread] mopidy.ext Validating extension: stream DEBUG 2017-05-12 08:17:09,888 [1915:MainThread] mopidy.ext Validating extension: m3u DEBUG 2017-05-12 08:17:09,889 [1915:MainThread] mopidy.ext Validating extension: softwaremixer DEBUG 2017-05-12 08:17:09,890 [1915:MainThread] mopidy.ext Validating extension: file DEBUG 2017-05-12 08:17:09,891 [1915:MainThread] mopidy.ext Validating extension: local DEBUG 2017-05-12 08:17:09,893 [1915:MainThread] mopidy.ext Validating extension: musicbox_webclient INFO 2017-05-12 08:17:09,909 [1915:MainThread] mopidy.__main__ Enabled extensions: btsource, mpd, http, stream, m3u, softwaremixer, file, musicbox_webclient, local INFO 2017-05-12 08:17:09,910 [1915:MainThread] mopidy.__main__ Disabled extensions: IRControl, btmanager DEBUG 2017-05-12 08:17:10,116 [1915:MainThread] mopidy.commands Available Mopidy mixers: SoftwareMixer INFO 2017-05-12 08:17:10,117 [1915:MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer DEBUG 2017-05-12 08:17:10,122 [1915:MainThread] mopidy.commands Mixer volume left unchanged INFO 2017-05-12 08:17:10,123 [1915:MainThread] mopidy.commands Starting Mopidy audio INFO 2017-05-12 08:17:10,128 [1915:MainThread] mopidy.commands Starting Mopidy backends: BTSourceBackend, StreamBackend, M3UBackend, FileBackend, LocalBackend INFO 2017-05-12 08:17:10,166 [1915:Audio-2] mopidy.audio.actor Audio output set to "autoaudiosink" DEBUG 2017-05-12 08:17:10,185 [1915:Audio-2] mopidy.audio.gst Changing state to GST_STATE_READY: result=GST_STATE_CHANGE_SUCCESS DEBUG 2017-05-12 08:17:10,197 [1915:MainThread] mopidy.local.actor Using json as the local library DEBUG 2017-05-12 08:17:10,197 [1915:MainThread] mopidy.local.json Loading library: /home/pi/.local/share/mopidy/local/library.json.gz INFO 2017-05-12 08:17:10,198 [1915:MainThread] mopidy.local.json No local library metadata cache found at /home/pi/.local/share/mopidy/local/library.json.gz. Please runmopidy local scanto index your local music library. If you do not have a local music collection, you can disable the local backend to hide this message. INFO 2017-05-12 08:17:10,200 [1915:MainThread] mopidy.local.library Loaded 0 local tracks using json INFO 2017-05-12 08:17:10,210 [1915:MainThread] mopidy.commands Starting Mopidy core INFO 2017-05-12 08:17:10,255 [1915:MainThread] mopidy.commands Starting Mopidy frontends: BTSourceFrontend, MpdFrontend, HttpFrontend INFO 2017-05-12 08:17:10,262 [1915:MainThread] mopidy.mpd.actor MPD server running at [::ffff:127.0.0.1]:6600 DEBUG 2017-05-12 08:17:10,265 [1915:MainThread] mopidy.http.actor Starting HTTP server INFO 2017-05-12 08:17:10,272 [1915:HttpFrontend-12] mopidy.http.actor HTTP server running at [::ffff:127.0.0.1]:6680 INFO 2017-05-12 08:17:10,273 [1915:MainThread] mopidy.commands Starting GLib mainloop DEBUG 2017-05-12 08:17:10,274 [1915:HttpServer] mopidy.http.actor Loaded HTTP extension: mopidy DEBUG 2017-05-12 08:17:10,287 [1915:HttpServer] mopidy.http.actor Loaded HTTP extension: musicbox_webclient DEBUG 2017-05-12 08:17:10,292 [1915:HttpServer] mopidy.http.actor Loaded static HTTP extension: btsource DEBUG 2017-05-12 08:17:10,300 [1915:MainThread] mopidy.audio.gst Got STATE_CHANGED bus message: old=GST_STATE_NULL new=GST_STATE_READY pending=GST_STATE_VOID_PENDING DEBUG 2017-05-12 08:17:10,301 [1915:HttpServer] mopidy.http.actor HTTP routes from extensions: u'/mopidy': <class 'mopidy.http.handlers.AddSlashHandler'> u'/mopidy/ws/?': <class 'mopidy.http.handlers.WebSocketHandler'> u'/mopidy/rpc': <class 'mopidy.http.handlers.JsonRpcHandler'> u'/mopidy/(.+)': <class 'mopidy.http.handlers.StaticFileHandler'> u'/mopidy/': <class 'mopidy.http.handlers.ClientListHandler'> u'/musicbox_webclient': <class 'mopidy.http.handlers.AddSlashHandler'> u'/musicbox_webclient/': <class 'tornado.web.RedirectHandler'> u'/musicbox_webclient/(index.html)': <class 'mopidy_musicbox_webclient.web.IndexHandler'> u'/musicbox_webclient/(.*)': <class 'mopidy_musicbox_webclient.web.StaticHandler'> u'/btsource': <class 'mopidy.http.handlers.AddSlashHandler'> u'/btsource/(.*)': <class 'mopidy.http.handlers.StaticFileHandler'> u'/': <class 'tornado.web.RedirectHandler'> DEBUG 2017-05-12 08:17:10,302 [1915:MpdFrontend-10] mopidy.zeroconf Zeroconf service "Mopidy MPD server on raspberrypi" (_mpd._tcp at []:6600): Published DEBUG 2017-05-12 08:17:10,320 [1915:HttpFrontend-12] mopidy.zeroconf Zeroconf service "Mopidy HTTP server on raspberrypi" (_http._tcp at []:6680): Published DEBUG 2017-05-12 08:17:10,328 [1915:HttpFrontend-12] mopidy.zeroconf Zeroconf service "Mopidy HTTP server on raspberrypi" (_mopidy-http._tcp at []:6680): Published DEBUG 2017-05-12 08:17:14,000 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaTransport1> changed: dbus.Dictionary({dbus.String(u'State'): dbus.String(u'pending', variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:14,003 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaTransport1> changed: dbus.Dictionary({dbus.String(u'State'): dbus.String(u'active', variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:14,610 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Status'): dbus.String(u'playing', variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:14,612 [1915:MainThread] mopidy_btsource.bt_player Event Status_Change triggered callback bt_state_changed DEBUG 2017-05-12 08:17:14,684 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Position'): dbus.UInt32(599L, variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:14,687 [1915:MainThread] mopidy_btsource.bt_player Event Position_Change triggered callback bt_position_changed DEBUG 2017-05-12 08:17:19,322 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaTransport1> changed: dbus.Dictionary({dbus.String(u'State'): dbus.String(u'idle', variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:19,426 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Status'): dbus.String(u'paused', variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:19,428 [1915:MainThread] mopidy_btsource.bt_player Event Status_Change triggered callback bt_state_changed DEBUG 2017-05-12 08:17:19,484 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Position'): dbus.UInt32(0L, variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:19,485 [1915:MainThread] mopidy_btsource.bt_player Event Position_Change triggered callback bt_position_changed DEBUG 2017-05-12 08:17:30,627 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Track'): dbus.Dictionary({dbus.String(u'Album'): dbus.String(u'', variant_level=1), dbus.String(u'NumberOfTracks'): dbus.UInt32(0L, variant_level=1), dbus.String(u'Artist'): dbus.String(u'Taron Egerton', variant_level=1), dbus.String(u'Title'): dbus.String(u"I'm Still Standing", variant_level=1), dbus.String(u'Genre'): dbus.String(u'', variant_level=1), dbus.String(u'Duration'): dbus.UInt32(187902L, variant_level=1), dbus.String(u'TrackNumber'): dbus.UInt32(1L, variant_level=1)}, signature=dbus.Signature('sv'), variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:30,629 [1915:MainThread] mopidy_btsource.bt_player Event Track_Change triggered callback bt_track_changed DEBUG 2017-05-12 08:17:30,630 [1915:MainThread] mopidy_btsource.bt_player Sending Playback command to bluetooth player: STOP DEBUG 2017-05-12 08:17:30,749 [1915:MainThread] mopidy_btsource.bt_player Interface: <org.bluez.MediaPlayer1> changed: dbus.Dictionary({dbus.String(u'Position'): dbus.UInt32(0L, variant_level=1)}, signature=dbus.Signature('sv')) DEBUG 2017-05-12 08:17:30,751 [1915:MainThread] mopidy_btsource.bt_player Event Position_Change triggered callback bt_position_changed

ismailof commented 7 years ago

Hi @RemiGdJ, there has been a long time since I don't play with this code, and currently I cannot try and reproduce the code, but let's try to look this problem through.

If I understand your problem, there are two issues:

  1. the track name is not being reported
  2. commands are not sent to the BT player

First of all, to enable bluetooth control, mopidy must reproduce the URI bt:stream. It works as a streaming source, meaning that the "Track" name in mopidy will not change when the song changes in the BT player (it should display your device's name). Instead, it will change the stream_title, such as some stream radios show the current playing song. It depends on the client you are using that this stream title is shown.

Checking the log, it seems that the bluetooth connection and events are ok, so the extension is catching what it's going on with your player. Your mopidy should update the player status (playing, stopped, paused), time position and stream_title, but only if mopidy's current uri is bt:stream.

About the commands being sent, unluckily previous/next track won't work, due to how mopidy core works, since those commands will 'jump' to the next track in mopidy tracklist, but are not passed to the extension. However, play, pause and stop commands should work.

Summarizing, ¿could you check the following?:

  1. Select the bluetooth stream corresponding to your device: For example, playing Library->Bluetooth -> 'HUAWEI P8 lite'
    • Mopidy should show as current track something like: 'Title: HUAWEI P8 lite, Artist: Bluetooth Player, Album: HUAWEI P8 lite'
      1. From your bluetooth player play some song
    • Can you see the stream_title with the Song name?
      1. From the bluetooth player change to next song
    • The stream title should change to the new song
      1. From mopidy control command 'pause'
    • The music in the player should pause, and also the state in mopidy
      1. From mopidy control command 'resume'
    • The music in the player should resume, and also the state in mopidy

According to the complete log you've provided everything should be working as described. Looking forward to having your feedback

RemiGdJ commented 7 years ago

Thanks for your answer !

Select the bluetooth stream corresponding to your device: For example, playing Library->Bluetooth -> 'HUAWEI P8 lite'

Mopidy should show as current track something like: 'Title: HUAWEI P8 lite, Artist: Bluetooth Player, Album: HUAWEI P8 lite'

When I select the bluetooth stream, modipy don't change the current track. I've got an "Updating Queue" (from musicbox interface) and that's all : the queue isn't updated, and nothing seems to change

ismailof commented 7 years ago

Could you send a verbose log when that happens?

El sáb., 13 may. 2017 13:07, RemiGdJ notifications@github.com escribió:

Thanks for your answer !

Select the bluetooth stream corresponding to your device: For example, playing Library->Bluetooth -> 'HUAWEI P8 lite'

Mopidy should show as current track something like: 'Title: HUAWEI P8 lite, Artist: Bluetooth Player, Album: HUAWEI P8 lite'

When I select the bluetooth stream, modipy don't change the current track. I've got an "Updating Queue" (from musicbox interface) and that's all : the queue isn't updated, and nothing seems to change

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ismailof/mopidy-btsource/issues/2#issuecomment-301241459, or mute the thread https://github.com/notifications/unsubscribe-auth/APtuMsAXCz1Qe7vYJt8TfN5cjgYGP1K2ks5r5Y8DgaJpZM4NY-n9 .