kawaiiDango / pano-scrobbler

Scrobbles to last.fm, ListenBrainz, libre.fm, GNU FM, Maloja, Pleroma or to a file, on Android
https://kawaiidango.github.io/pano-scrobbler/
GNU General Public License v3.0
1.14k stars 31 forks source link

Play button #484

Open ThreeDeeJay opened 3 months ago

ThreeDeeJay commented 3 months ago

Is your feature request related to a problem, or particular use cases? Please describe. The current Search button is great to find a track on different apps, but I only want to use a single music player while still having the option to search the track on other apps.

Describe the solution you'd like It would be great to have a Play button, dedicated for playing the track in Spotify/Musicolet/etc, and make the search just show different apps that support searching via text, like YouTube for music videos.

Additional info If the Last.fm API provides Youtube/Spotify/etc links like the ones found in the track page, it would be nice to have them as individual buttons like Redomi or even provide it the link in case song.link has more services than last.fm. 👀👌 image

kawaiiDango commented 3 months ago

The Last.fm API does not provide such links. The play button just launches the play from search intent. https://developer.android.com/reference/android/provider/MediaStore#INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH

ThreeDeeJay commented 3 months ago

Oh dang, you're right. It only provides the MusicBrainz ID. I've found a couple alternatives, though each has pros and cons.

For streaming services:

For a local file button:

So ideally, it would just show the button for tracks found in a source (streaming or local).

catuhana commented 1 month ago

Last.fm's track.getInfo returns a MusicBrainz mbid for recordings. And relations added to that recording can be fetched from https://musicbrainz.org/ws/2/recording/{mbid}?fmt=json&inc=url-rels. The only issue is Last.fm doesn't always return the recording mbid value, and not all recordings on MusicBrainz has relations added.

ThreeDeeJay commented 1 month ago

@catuhana Then assuming Pano Scrobbler can get the work ID from the scrobbled track, it could instead lookup all of its recordings. Sadly it's limited to 100, but we can make multiple calls with +100 offsets because in this case, the jackpot was in result # 170/422:

Though I'm still trying to figure out how to filter out cover artists because in the first call there's a Youtube link to a Cello cover. And maybe even just make it return only recordings with URL resources to reduce bandwidth/calls.

By the way, last.fm MBIDs aren't reliable: if you track.getInfo on that song, the artist's MBID is 420ca290-76c5-41af-999e-564d7c71f1a7 (character voiced by Itano Tomomi) instead of 0383dadf-2a4e-4d10-a46a-e9e041da8eb3 (UK rock group). Not to mention, last.fm's track.getInfo recording MBID ecfa6746-7bc4-4088-ace6-d209477bd63f doesn't have an associated URL either.

catuhana commented 1 month ago

By the way, last.fm MBIDs aren't reliable: if you track.getInfo on that song, the artist's MBID is 420ca290-76c5-41af-999e-564d7c71f1a7 (character voiced by Itano Tomomi) instead of 0383dadf-2a4e-4d10-a46a-e9e041da8eb3 (UK rock group).

I have noticed that. I think this can be checked with the local artist name to see if it's the expected artist/track or not.

For the last point, I have already said that not all songs on MusicBrainz have relations added. There's nothing we can do about that, other than adding relations ourselves, which is the purpose of MusicBrainz.

ThreeDeeJay commented 1 month ago

@catuhana Since excluding recordings without URLs apparently isn't possible using the API, I guess the best alternative we have is just making multiple offset calls (if even needed, though most songs don't).

On the bright side, I found a way to include the performing artist, so PS could also exclude the ones that don't match the scrobbled track's artist so we don't get those pesky covers https://musicbrainz.org/ws/2/recording?work=41c94a08-a551-3c86-bb17-d9a52e3a618b&fmt=json&inc=artist-credits+url-rels&limit=100&offset=0 image

https://musicbrainz.org/ws/2/recording?work=41c94a08-a551-3c86-bb17-d9a52e3a618b&fmt=json&inc=artist-credits+url-rels&limit=100&offset=100 image

@kawaiiDango Any thoughts? 👀

ThreeDeeJay commented 1 month ago

PS: Once it gets a URL like https://open.spotify.com/track/2OBofMJx94NryV2SK8p8Zf, it could use it to fetch streaming links from other services, like this: https://api.song.link/v1-alpha.1/links?url=spotify:track:2OBofMJx94NryV2SK8p8Zf


"linksByPlatform": {
  "amazonMusic": {
    "country": "US",
    "url": "https://music.amazon.com/albums/B0157E3W76?trackAsin=B0157E47K2",
    "entityUniqueId": "AMAZON_SONG::B0157E47K2"
  },
  "amazonStore": {
    "country": "US",
    "url": "https://amazon.com/dp/B0157E47K2",
    "entityUniqueId": "AMAZON_SONG::B0157E47K2"
  },
  "audiomack": {
    "country": "US",
    "url": "https://audiomack.com/song/bianca-martins-3/bohemian-rhapsody",
    "entityUniqueId": "AUDIOMACK_SONG::12851704"
  },
  "audius": {
    "country": "US",
    "url": "https://audius.co/tracks/2AWP1",
    "entityUniqueId": "AUDIUS_SONG::2AWP1"
  },
  "anghami": {
    "country": "US",
    "url": "https://play.anghami.com/song/42332997?refer=linktree",
    "entityUniqueId": "ANGHAMI_SONG::42332997"
  },
  "boomplay": {
    "country": "US",
    "url": "https://www.boomplay.com/songs/2850851",
    "entityUniqueId": "BOOMPLAY_SONG::2850851"
  },
  "deezer": {
    "country": "US",
    "url": "https://www.deezer.com/track/568115892",
    "entityUniqueId": "DEEZER_SONG::568115892"
  },
  "napster": {
    "country": "US",
    "url": "https://play.napster.com/track/tra.593001532",
    "entityUniqueId": "NAPSTER_SONG::tra.593001532"
  },
  "pandora": {
    "country": "US",
    "url": "https://www.pandora.com/TR:6933254",
    "entityUniqueId": "PANDORA_SONG::TR:6933254"
  },
  "soundcloud": {
    "country": "US",
    "url": "https://soundcloud.com/queen-69312/bohemian-rhapsody-remastered-1",
    "entityUniqueId": "SOUNDCLOUD_SONG::253166273"
  },
  "tidal": {
    "country": "US",
    "url": "https://listen.tidal.com/track/36737274",
    "entityUniqueId": "TIDAL_SONG::36737274"
  },
  "yandex": {
    "country": "RU",
    "url": "https://music.yandex.ru/track/1710808",
    "entityUniqueId": "YANDEX_SONG::1710808"
  },
  "youtube": {
    "country": "US",
    "url": "https://www.youtube.com/watch?v=fJ9rUzIMcZQ",
    "entityUniqueId": "YOUTUBE_VIDEO::fJ9rUzIMcZQ"
  },
  "youtubeMusic": {
    "country": "US",
    "url": "https://music.youtube.com/watch?v=fJ9rUzIMcZQ",
    "entityUniqueId": "YOUTUBE_VIDEO::fJ9rUzIMcZQ"
  },
  "spotify": {
    "country": "US",
    "url": "https://open.spotify.com/track/2OBofMJx94NryV2SK8p8Zf",
    "nativeAppUriDesktop": "spotify:track:2OBofMJx94NryV2SK8p8Zf",
    "entityUniqueId": "SPOTIFY_SONG::2OBofMJx94NryV2SK8p8Zf"
  }
}