Sto tentando di implementare un servizio SMAPI, ma sto riscontrando alcuni problemi.Implementazione dell'API Sonos Music "Errore di ricerca di musica"
Ho costruito un “fake” service che dà risposte hard-coded per questi endpoint:
- getMediaURI
- getLastUpdate
- getMediaMetadata
- getMetaData
- getExtendedMetadata
- getSessionId
Ho seguito le istruzioni per l'aggiunta di un servizio personalizzato, mantenendo tutte le funzionalità deselezionata.
Vedo il mio nuovo servizio di test elencato nella mia app Sonos per iPhone, ma quando lo seleziono, viene visualizzata una schermata che dice "Impossibile sfogliare la musica".
Non sono proprio sicuro di come eseguire il debug di ciò che sta accadendo, quindi sentitevi come se stessi pugnalando al buio. Non voglio fare delle modifiche speculative che potrebbero non avere nulla a che fare con il problema - sembra una ricetta per tonnellate di sforzi inutili.
C'è qualche modo di vedere gli errori che l'app Sonos Controller (client) sta avendo? Ho controllato i registri http://[device ip]:1400/support/aggregate
, ma non vedo alcuna menzione del nome di dominio del mio servizio, né vedo nulla che sembri rilevante.
So che (almeno alcune) richieste stanno raggiungendo il mio servizio, in particolare chiamata a getLastUpdate
e getMetadata
. Ecco l'output dei registri:
2016-02-23T18:55:24.316373+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.316485+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.431603+00:00 app[web.1]: Processing by SoapController#get_last_update as HTML
2016-02-23T18:55:24.431611+00:00 app[web.1]: Processing by SoapController#get_last_update as HTML
2016-02-23T18:55:24.438452+00:00 app[web.1]: params.inspect: {}
2016-02-23T18:55:24.438458+00:00 app[web.1]: params.inspect: {}
2016-02-23T18:55:24.447855+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (7.6ms)
2016-02-23T18:55:24.447907+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (7.6ms)
2016-02-23T18:55:24.448279+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 9.5ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.457801+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.448327+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 9.5ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.464365+00:00 app[web.1]: Processing by SoapController#get_metadata as HTML
2016-02-23T18:55:24.457861+00:00 app[web.1]: Started POST "/soap/action" for 213.86.218.202 at 2016-02-23 18:55:24 +0000
2016-02-23T18:55:24.464428+00:00 app[web.1]: Processing by SoapController#get_metadata as HTML
2016-02-23T18:55:24.465101+00:00 app[web.1]: params.inspect: {"id"=>"root", "index"=>0, "count"=>100}
2016-02-23T18:55:24.465154+00:00 app[web.1]: params.inspect: {"id"=>"root", "index"=>0, "count"=>100}
2016-02-23T18:55:24.472056+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (3.4ms)
2016-02-23T18:55:24.472049+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/wash_out-0.10.0/app/views/wash_out/document/response.builder (3.4ms)
2016-02-23T18:55:24.472248+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 6.9ms | ActiveRecord: 0.0ms)
2016-02-23T18:55:24.472251+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 6.9ms | ActiveRecord: 0.0ms)
Qualsiasi aiuto sarebbe molto apprezzato!
UPDATE Ecco l'uscita dal fare richieste contro il mio servizio falso con SoapUI:
getLastUpdate
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getLastUpdateResponse> <getLastUpdateResult> <catalog>Catalog last updated 2016-02-18 11:52:30</catalog> <favorites>User: Rob last updated favorites 2016-02-18 12:01:00</favorites> <pollInterval>30</pollInterval> </getLastUpdateResult> </tns:getLastUpdateResponse> </soap:Body> </soap:Envelope>
getSessionId
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getSessionIdResponse> <getSessionIdResult>user0001</getSessionIdResult> </tns:getSessionIdResponse> </soap:Body> </soap:Envelope>
getMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getMetadataResponse> <getMetadataResult> <index>0</index> <count>2</count> <total>2</total> <mediaMetadata> <id>some_id_1</id> <title>Title 1</title> <mimeType>audio/mp4</mimeType> <itemType>track</itemType> <displayType>List</displayType> <summary>Summary text 1. Summary text 1. Summary text 1.</summary> <trackMetadata> <artistId/> <artist/> <composerId/> <composer/> <albumId/> <album/> <albumArtURI/> <albumArtistId/> <albumArtist/> <genreId/> <genre/> <duration/> <canPlay/> <canSkip/> <canAddToFavorites/> <rating/> <trackNumber/> </trackMetadata> <streamMetadata></streamMetadata> </mediaMetadata> <mediaMetadata> <id>some_id_2</id> <title>Title 2</title> <mimeType>audio/mp4</mimeType> <itemType>track</itemType> <displayType>List</displayType> <summary>Summary text 2. Summary text 2. Summary text 2.</summary> <trackMetadata> <artistId/> <artist/> <composerId/> <composer/> <albumId/> <album/> <albumArtURI/> <albumArtistId/> <albumArtist/> <genreId/> <genre/> <duration/> <canPlay/> <canSkip/> <canAddToFavorites/> <rating/> <trackNumber/> </trackMetadata> <streamMetadata></streamMetadata> </mediaMetadata> </getMetadataResult> </tns:getMetadataResponse> </soap:Body> </soap:Envelope>
getExtendedMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getExtendedMetadataResponse> <getExtendedMetadataResult> <mediaMetadata> <id>some_id_1</id> <title>Title 1</title> <mimeType>audio/mp4</mimeType> <itemType>track</itemType> <displayType>List</displayType> <summary>Summary text 1. Summary text 1. Summary text 1.</summary> <trackMetadata> <artistId/> <artist/> <composerId/> <composer/> <albumId/> <album/> <albumArtURI/> <albumArtistId/> <albumArtist/> <genreId/> <genre/> <duration/> <canPlay/> <canSkip/> <canAddToFavorites/> <rating/> <trackNumber/> </trackMetadata> <streamMetadata></streamMetadata> </mediaMetadata> </getExtendedMetadataResult> </tns:getExtendedMetadataResponse> </soap:Body> </soap:Envelope>
getMediaMetadata
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getMediaMetadataResponse> <getMediaMetadataResult> <id/> <title>Fake Track Title</title> <mimeType>audio/mp4</mimeType> <itemType>track</itemType> <displayType/> <summary/> <trackMetadata> <artistId>artist:12345</artistId> <artist>Bach</artist> <composerId/> <composer/> <albumId/> <album/> <albumArtURI>https://sonos.therocketfuel.com/images/istockphoto_1945235_satisfaction.jpg</albumArtURI> <albumArtistId/> <albumArtist/> <genreId/> <genre>Classical</genre> <duration>459</duration> <canPlay>true</canPlay> <canSkip>true</canSkip> <canAddToFavorites>false</canAddToFavorites> <rating/> <trackNumber/> </trackMetadata> <streamMetadata></streamMetadata> </getMediaMetadataResult> </tns:getMediaMetadataResponse> </soap:Body> </soap:Envelope>
getMediaURI
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.sonos.com/Services/1.1"> <soap:Body> <tns:getMediaURIResponse> <getMediaURIResult>https://sonos.therocketfuel.com/audio/960bpm.m4a</getMediaURIResult> </tns:getMediaURIResponse> </soap:Body> </soap:Envelope>