diff --git a/public/index.html b/public/index.html
index f8573de..768e989 100644
--- a/public/index.html
+++ b/public/index.html
@@ -73,6 +73,7 @@
Queue Track
Edit Metadata
Download
+ View on Last.fm
Add to Playlist
diff --git a/public/index.js b/public/index.js
index fbaebbb..65e348d 100644
--- a/public/index.js
+++ b/public/index.js
@@ -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