add open on last.fm button
This commit is contained in:
parent
bcc708ded9
commit
4b92e46b57
@ -73,6 +73,7 @@
|
||||
<li><a class="ctx-item" data-action="queue">Queue Track</a></li>
|
||||
<li><a class="ctx-item" data-action="edit">Edit Metadata</a></li>
|
||||
<li><a class="ctx-item" data-action="download">Download</a></li>
|
||||
<li><a class="ctx-item" data-action="lastfm">View on Last.fm</a></li>
|
||||
<li class="ctx-multi"><a class="ctx-item playlist-add" style="display: none;">Add to Playlist</a>
|
||||
<ul class="ctx-sub-items playlist-list" id="ctx-playlists"></ul>
|
||||
</li>
|
||||
|
@ -294,6 +294,18 @@
|
||||
})
|
||||
}
|
||||
|
||||
function lfmurl (i) {
|
||||
return i.replace(/\s/g, '+')
|
||||
}
|
||||
|
||||
function popLastFMPage (tid) {
|
||||
httpGet('/api/track/' + tid).then(function (metadata) {
|
||||
window.open('https://www.last.fm/music/' + lfmurl(metadata.artist) + '/_/' + lfmurl(metadata.title))
|
||||
}, function (e) {
|
||||
console.log(e)
|
||||
})
|
||||
}
|
||||
|
||||
function ctxHandle (el) {
|
||||
if (ctxState === 0) return
|
||||
let dt = el.getAttribute("data-action")
|
||||
@ -310,6 +322,9 @@
|
||||
case 'download':
|
||||
window.open('/api/serve/by-id/' + ctxState + '?dl=1', '_blank')
|
||||
break
|
||||
case 'lastfm':
|
||||
popLastFMPage(ctxState)
|
||||
break
|
||||
case 'edit':
|
||||
editTrack(ctxState)
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user