last.fm is a music-oriented social media platform that allows users to track their music listening habits. The basic unit of data collected by last.fm is deemed the "scrobble," which represents a single instance of a playcount of a single track. last.fm records the artist, album, and track title, and the timestamp for the play instance. last.fm integrates with many popular music streaming apps such as Spotify and Tidal to allow users of these applications to track their listening habits.
Plex Media Server allows users to remotely stream their personal media collections, including music collections. Plex Media Server provides a number of tools for users to engage with their listening history, for example, to listen to their most frequently played tracks in a given year. Plex Media Server uses a local database to record these data.
The purpose of this project is to synchronize last.fm "scrobbles" with the recorded playcounts in the Plex Media Server database. In this way, users of Plex Media Server can have their listening habits across streaming services reflected in the playlists generated by the media server.
- Maintain a local database of previous matches so any new data can be automatically processed without manual input from the user.
- Provide fuzzy string match suggestions to minimize manual searching in cases where no perfect match is automatically detected.
- Build a dashboard to provide basic filtering operations and user manipulation of the match table (e.g., deleting a match, matching a previously unmatched track, managing newly added tracks to the media server library).
Using the public API, last.fm scrobble information for a given user is downloaded to a local SQLite database. A matching track is searched for within the user's Plex Media Server library. If an exact match is found, the ID of the last.fm track and the media server track are related in the database. If no match is found, the user is given the option to manually match the track or indicate that there is no matching track (e.g., in the case where a user listened to a song on a streaming service that was not present in their local media library).
After a chunk of tracks are matched, updated playcount data is pushed to the Plex Media Server SQLite database. Finally, a web interface provides the user with options to remove matches, match newly added tracks, or download the latest batch of "scrobbles" from last.fm.
- Efficient -> able to handle 100k+ data operations in seconds
- Maintainable -> separation of frontend and backend logic allows for incremental enhancements
- User friendly -> web interface provides intuitive tools for data manipulation, including tables with various filter capabilities, a dashboard with quick stats, and a matching interface that offers suggestions based on fuzzy string matching
Web interface dashboard |
Web track matching interface with fuzzy search suggestions |