fix: avoid duplicate beat metadata fetching from api
This commit is contained in:
2
BUGS.md
2
BUGS.md
@@ -23,6 +23,8 @@
|
||||
|
||||
## Nice-to
|
||||
|
||||
- beat metadata is handled by the app, currently. The handling should move into "jukebox".
|
||||
|
||||
- add a test for /playlists/<playlist_id> but obfuscate the IDs and user id
|
||||
|
||||
- TrackFileMatching, scoreAgainstLocalHints
|
||||
|
||||
@@ -91,17 +91,21 @@ fun AnnotationRoute(
|
||||
var playlistDisplayName by remember { mutableStateOf("playlist") }
|
||||
|
||||
LaunchedEffect(playlistId) {
|
||||
playlistDisplayName = viewModel.getPlaylistDisplayName(playlistId)
|
||||
val name = viewModel.getPlaylistDisplayName(playlistId)
|
||||
playlistDisplayName = name
|
||||
viewModel.fetchBeatsMetadataForPlaylist(playlistId, name)
|
||||
}
|
||||
|
||||
LaunchedEffect(playback, playlistId, playlistDisplayName, annotationSessionFolder) {
|
||||
LaunchedEffect(playback, playlistId, annotationSessionFolder) {
|
||||
val service = playback ?: return@LaunchedEffect
|
||||
val name = viewModel.getPlaylistDisplayName(playlistId)
|
||||
playlistDisplayName = name
|
||||
service.trackBoundaryEvents.collect { event ->
|
||||
val snapshot = beatTimesMs.toList()
|
||||
beatTimesMs.clear()
|
||||
viewModel.persistBeatAnnotation(
|
||||
playlistId,
|
||||
playlistDisplayName,
|
||||
name,
|
||||
annotationSessionFolder,
|
||||
event,
|
||||
snapshot,
|
||||
|
||||
@@ -212,11 +212,9 @@ fun NowPlayingRoute(
|
||||
}
|
||||
|
||||
LaunchedEffect(playlistId) {
|
||||
playlistDisplayName = viewModel.getPlaylistDisplayName(playlistId)
|
||||
}
|
||||
|
||||
LaunchedEffect(playlistId, playlistDisplayName) {
|
||||
viewModel.fetchBeatsMetadataForPlaylist(playlistId, playlistDisplayName)
|
||||
val name = viewModel.getPlaylistDisplayName(playlistId)
|
||||
playlistDisplayName = name
|
||||
viewModel.fetchBeatsMetadataForPlaylist(playlistId, name)
|
||||
}
|
||||
|
||||
LaunchedEffect(playback) {
|
||||
@@ -257,12 +255,14 @@ fun NowPlayingRoute(
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(collectRunData, playback, playlistId, playlistDisplayName) {
|
||||
LaunchedEffect(collectRunData, playback, playlistId) {
|
||||
if (!collectRunData) return@LaunchedEffect
|
||||
val service = playback ?: return@LaunchedEffect
|
||||
val name = viewModel.getPlaylistDisplayName(playlistId)
|
||||
playlistDisplayName = name
|
||||
service.trackBoundaryEvents.collect { event ->
|
||||
val snapshot = collector.snapshotAndClear()
|
||||
viewModel.persistRunData(playlistId, playlistDisplayName, runSessionFolder, event, snapshot)
|
||||
viewModel.persistRunData(playlistId, name, runSessionFolder, event, snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user