Example #1
0
func (this *Sonos) GetGenreArtists(genre string) ([]model.Object, error) {
	req := &upnp.BrowseRequest{
		ObjectID:      objectIDForGenre(genre),
		BrowseFlag:    upnp.BrowseFlag_BrowseDirectChildren,
		Filter:        upnp.BrowseFilter_All,
		StartingIndex: 0,
		RequestCount:  0,
		SortCriteria:  upnp.BrowseSortCriteria_None,
	}
	if result, err := this.Browse(req); nil != err {
		log.Printf("Could not browse artists for genre `%s': %v", genre, err)
		return nil, err
	} else {
		return model.ObjectStream(result.Doc), nil
	}
}
Example #2
0
func (this *Sonos) ListSavedQueues() (objects []model.Object, err error) {
	var result *upnp.BrowseResult
	req := &upnp.BrowseRequest{
		ObjectID:      ObjectID_SavedQueues,
		BrowseFlag:    upnp.BrowseFlag_BrowseDirectChildren,
		Filter:        upnp.BrowseFilter_All,
		StartingIndex: 0,
		RequestCount:  0,
		SortCriteria:  upnp.BrowseSortCriteria_None,
	}
	if result, err = this.Browse(req); nil != err {
		return
	} else {
		objects = model.ObjectStream(result.Doc)
	}
	return
}
Example #3
0
func (this *Sonos) GetArtistAlbums(artist string) (objects []model.Object, err error) {
	var result *upnp.BrowseResult
	req := &upnp.BrowseRequest{
		ObjectID:      objectIDForArtist(artist),
		BrowseFlag:    upnp.BrowseFlag_BrowseDirectChildren,
		Filter:        upnp.BrowseFilter_All,
		StartingIndex: 0,
		RequestCount:  0,
		SortCriteria:  upnp.BrowseSortCriteria_None,
	}
	if result, err = this.Browse(req); nil != err {
		return
	} else {
		objects = model.ObjectStream(result.Doc)
	}
	return
}
Example #4
0
func (this *Sonos) GetAlbumTracks(album string) ([]model.Object, error) {
	req := &upnp.BrowseRequest{
		ObjectID:      objectIDForAlbum(album),
		BrowseFlag:    upnp.BrowseFlag_BrowseDirectChildren,
		Filter:        upnp.BrowseFilter_All,
		StartingIndex: 0,
		RequestCount:  0,
		SortCriteria:  upnp.BrowseSortCriteria_None,
	}
	log.Printf("Browsing tracks for album `%s'", album)
	if result, err := this.Browse(req); nil != err {
		log.Printf("Could not browse tracks for album `%s': %v", album, err)
		return nil, err
	} else {
		return model.ObjectStream(result.Doc), nil
	}
}
Example #5
0
func (this *Sonos) GetMetadata(objectId string) (objects []model.Object, err error) {
	var result *upnp.BrowseResult
	req := &upnp.BrowseRequest{
		ObjectID:      objectId,
		BrowseFlag:    upnp.BrowseFlag_BrowseMetadata,
		Filter:        upnp.BrowseFilter_All,
		StartingIndex: 0,
		RequestCount:  0,
		SortCriteria:  upnp.BrowseSortCriteria_None,
	}
	if result, err = this.Browse(req); nil != err {
		return
	} else {
		objects = model.ObjectStream(result.Doc)
	}
	return
}
Example #6
0
func (this *Sonos) ListQueues() (objects []model.Object, err error) {
	var result *upnp.BrowseResult
	req := &upnp.BrowseRequest{
		ObjectID_Queues,
		upnp.BrowseFlag_BrowseDirectChildren,
		upnp.BrowseFilter_All,
		0, /*StartingIndex*/
		0, /*RequestCount*/
		upnp.BrowseSortCriteria_None,
	}
	if result, err = this.Browse(req); nil != err {
		return
	} else {
		objects = model.ObjectStream(result.Doc)
	}
	return
}
Example #7
0
func (this *Sonos) GetGenreArtists(genre string) ([]model.Object, error) {
	req := &upnp.BrowseRequest{
		objectIDForGenre(genre),
		upnp.BrowseFlag_BrowseDirectChildren,
		upnp.BrowseFilter_All,
		0, /*StartingIndex*/
		0, /*RequestCount*/
		upnp.BrowseSortCriteria_None,
	}
	if result, err := this.Browse(req); nil != err {
		log.Printf("Could not browse artists for genre `%s': %v", genre, err)
		return nil, err
	} else {
		return model.ObjectStream(result.Doc), nil
	}
	panic("unreachable")
}