mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
Updated api commands and API_REFERENCE to include new getArtistArt, getAlbumArt, getArtistInfo & getAlbumInfo commands
This commit is contained in:
@@ -12,9 +12,9 @@ $commands¶meters[&optionalparameters]:
|
|||||||
|
|
||||||
getIndex (fetch data from index page. Returns: ArtistName, ArtistSortName, ArtistID, Status, DateAdded,
|
getIndex (fetch data from index page. Returns: ArtistName, ArtistSortName, ArtistID, Status, DateAdded,
|
||||||
[LatestAlbum, ReleaseDate, AlbumID], HaveTracks, TotalTracks,
|
[LatestAlbum, ReleaseDate, AlbumID], HaveTracks, TotalTracks,
|
||||||
IncludeExtras)
|
IncludeExtras, LastUpdated, ArtworkURL: a remote url to the artwork. To get the cached image path, see getArtistArt command)
|
||||||
|
|
||||||
getArtist&id=$artistid (fetch artist data. returns the artist object (see above) and album info: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, ReleaseDate, AlbumID, ArtistID, Type)
|
getArtist&id=$artistid (fetch artist data. returns the artist object (see above) and album info: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, ReleaseDate, AlbumID, ArtistID, Type, ArtworkURL: hosted image path. For cached image, see getAlbumArt command)
|
||||||
|
|
||||||
getAlbum&id=$albumid (fetch data from album page. Returns the album object, a description object and a tracks object. Tracks contain: AlbumASIN, AlbumTitle, TrackID, Format, TrackDuration (ms), ArtistName, TrackTitle, AlbumID, ArtistID, Location, TrackNumber, CleanName (stripped of punctuation /styling), BitRate)
|
getAlbum&id=$albumid (fetch data from album page. Returns the album object, a description object and a tracks object. Tracks contain: AlbumASIN, AlbumTitle, TrackID, Format, TrackDuration (ms), ArtistName, TrackTitle, AlbumID, ArtistID, Location, TrackNumber, CleanName (stripped of punctuation /styling), BitRate)
|
||||||
|
|
||||||
@@ -53,3 +53,9 @@ checkGithub (updates the version information above and returns getVersion data)
|
|||||||
shutdown (shut down headphones)
|
shutdown (shut down headphones)
|
||||||
restart (restart headphones)
|
restart (restart headphones)
|
||||||
update (update headphones - you may want to check the install type in get version and not allow this if type==exe)
|
update (update headphones - you may want to check the install type in get version and not allow this if type==exe)
|
||||||
|
|
||||||
|
getArtistArt&id=$artistid (Returns either a relative path to the cached image, or a remote url if the image can't be saved to the cache dir)
|
||||||
|
getAlbumArt&id=$albumid (see above)
|
||||||
|
|
||||||
|
getArtistInfo&id=$artistid (Returns the artist bio preformatted in html)
|
||||||
|
getAlbumInfo&id=$albumid (See above, returns album description in html)
|
||||||
+42
-2
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import headphones
|
import headphones
|
||||||
|
|
||||||
from headphones import db, mb, importer, searcher, postprocessor, versioncheck, logger
|
from headphones import db, mb, importer, searcher, cache, postprocessor, versioncheck, logger
|
||||||
|
|
||||||
import lib.simplejson as simplejson
|
import lib.simplejson as simplejson
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
@@ -24,7 +24,7 @@ import copy
|
|||||||
cmd_list = [ 'getIndex', 'getArtist', 'getAlbum', 'getUpcoming', 'getWanted', 'getSimilar', 'getHistory', 'getLogs',
|
cmd_list = [ 'getIndex', 'getArtist', 'getAlbum', 'getUpcoming', 'getWanted', 'getSimilar', 'getHistory', 'getLogs',
|
||||||
'findArtist', 'findAlbum', 'addArtist', 'delArtist', 'pauseArtist', 'resumeArtist', 'refreshArtist',
|
'findArtist', 'findAlbum', 'addArtist', 'delArtist', 'pauseArtist', 'resumeArtist', 'refreshArtist',
|
||||||
'queueAlbum', 'unqueueAlbum', 'forceSearch', 'forceProcess', 'getVersion', 'checkGithub',
|
'queueAlbum', 'unqueueAlbum', 'forceSearch', 'forceProcess', 'getVersion', 'checkGithub',
|
||||||
'shutdown', 'restart', 'update', ]
|
'shutdown', 'restart', 'update', 'getArtwork', 'getInfo']
|
||||||
|
|
||||||
class Api(object):
|
class Api(object):
|
||||||
|
|
||||||
@@ -314,3 +314,43 @@ class Api(object):
|
|||||||
|
|
||||||
def _update(self, **kwargs):
|
def _update(self, **kwargs):
|
||||||
headphones.SIGNAL = 'update'
|
headphones.SIGNAL = 'update'
|
||||||
|
|
||||||
|
def _getArtistArt(self, **kwargs):
|
||||||
|
|
||||||
|
if 'id' not in kwargs:
|
||||||
|
self.data = 'Missing parameter: id'
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.id = kwargs['id']
|
||||||
|
|
||||||
|
self.data = cache.getArtwork(ArtistID=self.id)
|
||||||
|
|
||||||
|
def _getAlbumArt(self, **kwargs):
|
||||||
|
|
||||||
|
if 'id' not in kwargs:
|
||||||
|
self.data = 'Missing parameter: id'
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.id = kwargs['id']
|
||||||
|
|
||||||
|
self.data = cache.getArtwork(AlbumID=self.id)
|
||||||
|
|
||||||
|
def _getArtistInfo(self, **kwargs):
|
||||||
|
|
||||||
|
if 'id' not in kwargs:
|
||||||
|
self.data = 'Missing parameter: id'
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.id = kwargs['id']
|
||||||
|
|
||||||
|
self.data = cache.getInfo(ArtistID=self.id)
|
||||||
|
|
||||||
|
def _getAlbumInfo(self, **kwargs):
|
||||||
|
|
||||||
|
if 'id' not in kwargs:
|
||||||
|
self.data = 'Missing parameter: id'
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.id = kwargs['id']
|
||||||
|
|
||||||
|
self.data = cache.getInfo(AlbumID=self.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user