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

Add API endpoint to get album from song id #3143

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ Gives you a list of results from searcher.searchforalbum(). Basically runs a nor

### download_specific_release&id=albumid&title=$title&size=$size&url=$url&provider=$provider&kind=$kind
Allows you to manually pass a choose_specific_download release back to searcher.send_to_downloader()

### getAlbumFromSong&recordingId=$recordingId
Search a song by MusicBrainz recordingId and return Album data
13 changes: 12 additions & 1 deletion headphones/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'getVersion', 'checkGithub', 'shutdown', 'restart', 'update', 'getArtistArt',
'getAlbumArt',
'getArtistInfo', 'getAlbumInfo', 'getArtistThumb', 'getAlbumThumb', 'clearLogs',
'choose_specific_download', 'download_specific_release']
'choose_specific_download', 'download_specific_release','getAlbumFromSong']


class Api(object):
Expand Down Expand Up @@ -492,3 +492,14 @@ def _download_specific_release(self, **kwargs):
album = myDB.action(
'SELECT * from albums WHERE AlbumID=?', [id]).fetchone()
searcher.send_to_downloader(data, bestqual, album)

def _getAlbumFromSong(self, **kwargs):
if 'recordingId' not in kwargs:
self.data = 'Missing parameter: recordingId'
return
else:
recordingId = kwargs['recordingId']

tracks = self._dic_from_query(
'SELECT * from tracks WHERE TrackID = "' + recordingId + '"')
self.data = tracks