Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media browsing #7

Open
matiasgarciaisaia opened this issue Feb 24, 2014 · 7 comments
Open

Media browsing #7

matiasgarciaisaia opened this issue Feb 24, 2014 · 7 comments

Comments

@matiasgarciaisaia
Copy link

Preface

One of the things that mosts annoys me from Sonos is that it's search engine offers me inaccessible songs when people leaves my office. I think it's pretty straightforward to filter out music from inaccessible network libraries.

Issue

Implement media browsing in sonos-discovery.
It not just is really useful as-is, but also it enables us to implement some heartbeat ping system to add this capability, and provide a better Sonos experience from http-api or web-controller.

I've already started playing a bit with this, but I've no experience with UPnP at all.

This issue may be a bit of a self-reminder - but I'll be glad to know you're in, too :)

@jishi
Copy link
Owner

jishi commented Feb 24, 2014

Hi, I'm not really sure what you are trying to achieve. If you have indexed locations that are located on your co-workers laptops, and they would be unavailable, Sonos wouldn't know this unless it rescans the data. Even if you would have media-browsing in sonos-discovery, you would still receive tracks that are unavailable.

Are you talking about a separate search client (web based perhaps) to search and queue tracks, and filter the result based on the accessibility of the hosting computer (where the tracks reside)?

@matiasgarciaisaia
Copy link
Author

As Sonos doesn't do that, sonos-discovery could regullarly ping those network devices to know if they are accessible or not. And, having media browsing enabled, sonos-discovery could provide that search functionality, even improved.

It most likely will be consumed by the web-controller, to emulate the Sonos search feature, but it will be able to filter the results.

I imagine UPnP provides some search functionality to avoid having to scan the whole library at sonos-discovery level, right?

Anyway, media browsing is required for a full web-controller.

@jishi
Copy link
Owner

jishi commented Feb 24, 2014

Well, the library is in the players so it is searchable the same way as on the controller. The core functionality for this is already in place, because it is the same UPnP action as fetching the queue and the favorites.

One big improvement is that you could probably utilize all players for querying and maybe speed things up (I do that when I fetch album art), as well as doing some sort of "mixed" search (like, search for artist and track title at the same time and display the result).

@matiasgarciaisaia
Copy link
Author

I've tried making a Player.prototype.getAll() function analogous to Player.prototype.getFavourites() (just querying for "S:" instead of "FV:2"), but needed to adapt the parsing of the response, and maybe anything else that I don't remember now.

Do you say there currently is a function to get a player's library? Could you elaborate a bit on this?

Thanks for your time :)

@jishi
Copy link
Owner

jishi commented Feb 24, 2014

Yes, I have a generic browse method which is overloaded by getFavorites and getQueue.

So in your getAll function you could just invoke:

this.browse("S:", null, null, function (success, result) { // ... do some stuff here? });

Where result will have been XML parsed into an array of javascript objects. Remember that the player will only return approx 600 items at max, you need to invoke it multiple times if the result is bigger than that (check result.totalMatches). It doesn't support filtering atm, but that might not be needed (I think that just limits the fields returned in the XML).

Other examples are:
A:ALBUMARTIST:T (search albums starting with T)
A:TRACKS:The (tracks starting with "The")
A:ALBUM:The (albums starting with "The")

I think you get the drift. :)

However, avoid doing to specialized methods. If it is generically helpful, I would consider merging it. The browse method is public so you can invoke it from the outside if you have some special need.

@matiasgarciaisaia
Copy link
Author

You've saved me like hours playing around with Wireshark and the like. I'll see what I can do (and when, he :)).

Having Sonos only at work makes things a little more slow than what I wished.

@jishi
Copy link
Owner

jishi commented Feb 25, 2014

Well, it's never a bad thing to wireshark stuff anyway to get a better understanding of how they interact :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants