Skip to content

Commit

Permalink
feat: Added additional content directory service methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalopitz committed Jul 17, 2020
1 parent 7a1ff6f commit a297d27
Showing 1 changed file with 99 additions and 4 deletions.
103 changes: 99 additions & 4 deletions lib/services/ContentDirectory.js
Expand Up @@ -25,10 +25,6 @@ class ContentDirectory extends Service {
this.SCPDURL = '/xml/ContentDirectory1.xml'
}

async Browse (options) { return this._request('Browse', options) }

async DestroyObject (options) { return this._request('DestroyObject', options) }

async _parseResult (input) {
input.Result = await Helpers.ParseXml(input.Result)
return input
Expand Down Expand Up @@ -66,6 +62,105 @@ class ContentDirectory extends Service {
}
})
}

async Browse (options) {
return this._request('Browse', options)
}

async DestroyObject (options) {
return this._request('DestroyObject', options)
}

/**
* See: http://docs.python-soco.com/en/latest/api/soco.music_library.html#soco.music_library.MusicLibrary.album_artist_display_option
*
* Possible values are:
* 'WMP' - use Album Artists
* 'ITUNES' - use iTunes® Compilations
* 'NONE' - do not group compilations
*/
async GetSearchCapabilities () {
return this._request('GetSearchCapabilities', {}).then(
(r) => r.SearchCaps
)
}

async GetSortCapabilities () {
return this._request('GetSortCapabilities', {}).then((r) => r.SortCaps)
}

async GetSystemUpdateID () {
return this._request('GetSystemUpdateID', {}).then((r) => r.Id)
}

async GetAlbumArtistDisplayOption () {
return this._request('GetAlbumArtistDisplayOption', {}).then(
(r) => r.AlbumArtistDisplayOption
)
}

async GetLastIndexChange () {
return this._request('GetLastIndexChange', {}).then(
(r) => r.LastIndexChange
)
}

async FindPrefix (ObjectID, Prefix) {
return this._request('FindPrefix', {
ObjectID,
Prefix
})
}

async GetAllPrefixLocations (ObjectID) {
return this._request('GetAllPrefixLocations', {
ObjectID
})
}

async CreateObject (ContainerID, Elements) {
return this._request('CreateObject', {
ContainerID,
Elements
})
}

async UpdateObject (ObjectID, CurrentTagValue) {
return this._request('UpdateObject', {
ObjectID,
CurrentTagValue
})
}

async RefreshShareIndex (AlbumArtistDisplayOption = '') {
return this._request('RefreshShareIndex', {
AlbumArtistDisplayOption
})
}

async RequestResort (SortOrder) {
return this._request('RequestResort', {
SortOrder
})
}

async GetShareIndexInProgress () {
return this._request('GetShareIndexInProgress', {}).then(
(r) => r.IsIndexing !== '0'
)
}

async GetBrowseable () {
return this._request('GetBrowseable', {}).then(
(r) => r.IsBrowseable !== '0'
)
}

async SetBrowseable (Browseable) {
return this._request('SetBrowseable', {
Browseable
})
}
}

module.exports = ContentDirectory

0 comments on commit a297d27

Please sign in to comment.