772d1f359b
* refactor: rename ArtistRadio to SimilarSongs for clarity and consistency Signed-off-by: Deluan <deluan@navidrome.org> * feat: implement GetSimilarSongsByTrack and related functionality for song similarity retrieval Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance GetSimilarSongsByTrack to include artist and album details and update tests Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance song matching by implementing title and artist filtering in loadTracksByTitleAndArtist Signed-off-by: Deluan <deluan@navidrome.org> * test: add unit tests for song matching functionality in provider Signed-off-by: Deluan <deluan@navidrome.org> * refactor: extract song matching functionality into its own file Signed-off-by: Deluan <deluan@navidrome.org> * docs: clarify similarSongsFallback function description in provider.go Signed-off-by: Deluan <deluan@navidrome.org> * refactor: initialize result slice for songs with capacity based on response length Signed-off-by: Deluan <deluan@navidrome.org> * refactor: simplify agent method calls for retrieving images and similar songs Signed-off-by: Deluan <deluan@navidrome.org> * refactor: simplify agent method calls for retrieving images and similar songs Signed-off-by: Deluan <deluan@navidrome.org> * refactor: remove outdated comments in GetSimilarSongs methods Signed-off-by: Deluan <deluan@navidrome.org> * fix: use composite key for song matches to handle duplicates by title and artist Signed-off-by: Deluan <deluan@navidrome.org> * refactor: consolidate expectations setup for similar songs tests Signed-off-by: Deluan <deluan@navidrome.org> * feat: add instant mix action to song context menu and update translations Signed-off-by: Deluan <deluan@navidrome.org> * fix(provider): handle unknown entity types in GetSimilarSongs Signed-off-by: Deluan <deluan@navidrome.org> * refactor: move playSimilar action to playbackActions and streamline song processing Signed-off-by: Deluan <deluan@navidrome.org> * format Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance instant mix functionality with loading notification and shuffle option Signed-off-by: Deluan <deluan@navidrome.org> * feat: implement fuzzy matching for similar songs based on configurable threshold Signed-off-by: Deluan <deluan@navidrome.org> * refactor: implement track matching with multiple specificity levels Signed-off-by: Deluan <deluan@navidrome.org> * refactor: enhance track matching by implementing unified scoring with specificity levels Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance deezer top tracks result with album Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance track matching with fuzzy album similarity for improved scoring Signed-off-by: Deluan <deluan@navidrome.org> * docs: document multi-phase song matching algorithm with detailed scoring and prioritization Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import subsonic from '../subsonic/index.js'
|
|
import { playTracks } from '../actions/index.js'
|
|
import { processSongsForPlayback } from '../common/playbackActions.js'
|
|
|
|
export const playTopSongs = async (dispatch, notify, artistName) => {
|
|
const res = await subsonic.getTopSongs(artistName, 100)
|
|
const data = res.json['subsonic-response']
|
|
|
|
if (data.status !== 'ok') {
|
|
throw new Error(
|
|
`Error fetching top songs: ${data.error?.message || 'Unknown error'} (Code: ${data.error?.code || 'unknown'})`,
|
|
)
|
|
}
|
|
|
|
const songs = data.topSongs?.song || []
|
|
if (!songs.length) {
|
|
notify('message.noTopSongsFound', 'warning')
|
|
return
|
|
}
|
|
|
|
const { songData, ids } = processSongsForPlayback(songs)
|
|
dispatch(playTracks(songData, ids))
|
|
}
|
|
|
|
export const playShuffle = async (dataProvider, dispatch, id) => {
|
|
const res = await dataProvider.getList('song', {
|
|
pagination: { page: 1, perPage: 500 },
|
|
sort: { field: 'random', order: 'ASC' },
|
|
filter: { album_artist_id: id, missing: false },
|
|
})
|
|
|
|
const data = {}
|
|
const ids = []
|
|
res.data.forEach((s) => {
|
|
data[s.id] = s
|
|
ids.push(s.id)
|
|
})
|
|
dispatch(playTracks(data, ids))
|
|
}
|