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

feat: Add Navidrome source #270

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

feat: Add Navidrome source #270

wants to merge 1 commit into from

Conversation

FoxxMD
Copy link
Owner

@FoxxMD FoxxMD commented Feb 14, 2025

Checklist before requesting a review

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Describe your changes

Add Navidrome as a Source, separate from other Subsonic sources.

Issue number and link, if applicable

#265
#268

@FoxxMD FoxxMD self-assigned this Feb 14, 2025
@FoxxMD
Copy link
Owner Author

FoxxMD commented Feb 14, 2025

Ways to get recently played from Navidrome

Smart Playlist

  • monitoring a smart playlist of last played through the getplaylist subsonic api
    • Can use current subsonic credentials and API to do this but requires user to manually create playlist not in navidrome ui

Navidrome API

  • directly querying navidrome for last played (non-subsonic) like MY_NAVIDROME_URL/api/song?_end=15&_order=DESC&_sort=playDate&_start=0
    • requires separate credentials extracted from browser when navigating in navidrome ui
    • x-nd-authorization
    • x-nd-client-unique-id not required but maybe alters behavior? not sure

Response data sample

[
    {
        "playCount": 2,
        "playDate": "2025-02-14T16:50:20.76Z",
        "rating": 0,
        "starred": false,
        "starredAt": null,
        "bookmarkPosition": 0,
        "id": "e88c35e805e5bdfdd4cdd2a97c98d9f4",
        "libraryId": 1,
        "path": "/music/Gorillaz/Cracker Island/08 - Tormenta.mp3",
        "title": "Tormenta",
        "album": "Cracker Island",
        "artistId": "",
        "artist": "Gorillaz feat. Bad Bunny",
        "albumArtistId": "ae85c391f2ea8f0212ee4b08738f1b00",
        "albumArtist": "Gorillaz",
        "albumId": "0a44c74e9f89ac3a15a6a1e91fcfec82",
        "hasCoverArt": true,
        "trackNumber": 8,
        "discNumber": 1,
        "year": 2023,
        "date": "2023",
        "originalYear": 0,
        "releaseYear": 0,
        "size": 8355699,
        "suffix": "mp3",
        "duration": 193.41,
        "bitRate": 320,
        "sampleRate": 44100,
        "channels": 2,
        "genre": "Synthpop",
        "genres": [
            {
                "id": "2ea2361c-8e31-47ef-b9eb-02ad818fdd02",
                "name": "Synthpop"
            }
        ],
        "sortArtistName": "Gorillaz feat. Bad Bunny",
        "orderTitle": "tormenta",
        "orderAlbumName": "cracker island",
        "orderArtistName": "gorillaz feat. bad bunny",
        "orderAlbumArtistName": "gorillaz",
        "compilation": false,
        "comment": "PMEDIA",
        "lyrics": "[]",
        "mbzRecordingID": "a80fe21b-e871-4224-816f-192473888877",
        "mbzArtistId": "e21857d5-3256-4547-afb3-4b6ded592596",
        "rgAlbumGain": 0,
        "rgAlbumPeak": 1,
        "rgTrackGain": 0,
        "rgTrackPeak": 1,
        "createdAt": "2024-08-26T18:18:24.490439623Z",
        "updatedAt": "2024-08-26T18:08:29.61872256Z"
    },
    {
        "playCount": 1,
        "playDate": "2025-02-14T16:48:22.536Z",
        "rating": 0,
        "starred": false,
        "starredAt": null,
        "bookmarkPosition": 0,
        "id": "e656e0dcdd9808f1f61de4810ac3fa05",
        "libraryId": 1,
        "path": "/music/Faith Hill/Take Me as I Am/02 - Wild One.mp3",
        "title": "Wild One",
        "album": "Take Me as I Am",
        "artistId": "83dec102ed9d1bb347345e27ca194ff5",
        "artist": "Faith Hill",
        "albumArtistId": "83dec102ed9d1bb347345e27ca194ff5",
        "albumArtist": "Faith Hill",
        "albumId": "1c9ab6afba737a9a4fa722890a95af36",
        "hasCoverArt": true,
        "trackNumber": 2,
        "discNumber": 1,
        "year": 1993,
        "date": "1993",
        "originalYear": 0,
        "releaseYear": 0,
        "size": 6652403,
        "suffix": "mp3",
        "duration": 165.17,
        "bitRate": 320,
        "sampleRate": 44100,
        "channels": 2,
        "genre": "Country",
        "genres": [
            {
                "id": "efc3c68e-68b7-4f63-9de3-5ac691594323",
                "name": "Country"
            }
        ],
        "sortArtistName": "Hill, Faith",
        "orderTitle": "wild one",
        "orderAlbumName": "take me as i am",
        "orderArtistName": "faith hill",
        "orderAlbumArtistName": "faith hill",
        "compilation": false,
        "lyrics": "[]",
        "mbzRecordingID": "67717720-4f71-4490-bcda-d6dee274eefb",
        "mbzArtistId": "406552d4-5ba1-4226-b7c0-367bc50fc767",
        "rgAlbumGain": 0,
        "rgAlbumPeak": 1,
        "rgTrackGain": 0,
        "rgTrackPeak": 1,
        "createdAt": "2024-08-26T18:08:23.577382083Z",
        "updatedAt": "2024-08-26T18:08:14.728507247Z"
    }
]

Comparison to Subsonic Implementation

Advantages

  • For live plays...
    • playDate is accurate to when the track started to be played
    • Leverages navidrome's own scrobble implementation so we can sure the song was actually listened to long enough to be scrobbled
  • For offline plays (client) or if MS is offline (or backlogging)...
    • It's actual list of scrobbled tracks!
    • If the 3rd party subsonic client respects scrobbling when back online then this list contains offline scrobbles we an backscrobble
    • Can actually backscrobble from navidrome

Disadvantages

  • Requires additional user setup regardless of approach used. Can't get a free lunch for existing navidrome users
  • Lists only contain unique tracks
    • Works similarly to YT Music so if a track listened to "earlier" (IE is in position 3 behind 2 other songs) is listened to again then it is "bumped" up to the top of the list -- there are NOT two instances of the track in the list
      • For "live" monitoring this is a solved problem (YT Music)
      • For offline scrobbles it means we will miss any scrobbles for tracks that were listened to more than once during the offline period
  • For 3rd party subsonic clients we have to assume they are correctly setting playDate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant