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="queue">Queue Track</a></li>
|
||||||
<li><a class="ctx-item" data-action="edit">Edit Metadata</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="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>
|
<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>
|
<ul class="ctx-sub-items playlist-list" id="ctx-playlists"></ul>
|
||||||
</li>
|
</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) {
|
function ctxHandle (el) {
|
||||||
if (ctxState === 0) return
|
if (ctxState === 0) return
|
||||||
let dt = el.getAttribute("data-action")
|
let dt = el.getAttribute("data-action")
|
||||||
@ -310,6 +322,9 @@
|
|||||||
case 'download':
|
case 'download':
|
||||||
window.open('/api/serve/by-id/' + ctxState + '?dl=1', '_blank')
|
window.open('/api/serve/by-id/' + ctxState + '?dl=1', '_blank')
|
||||||
break
|
break
|
||||||
|
case 'lastfm':
|
||||||
|
popLastFMPage(ctxState)
|
||||||
|
break
|
||||||
case 'edit':
|
case 'edit':
|
||||||
editTrack(ctxState)
|
editTrack(ctxState)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user