mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Fix playlist play/shuffle buttons not working
This commit is contained in:
parent
8aa64c6fef
commit
9c53abf152
2 changed files with 34 additions and 2 deletions
|
|
@ -53,7 +53,14 @@ abstract class MusicViewModel(
|
||||||
musicService.setQueue(pager, startIndex, shuffled)
|
musicService.setQueue(pager, startIndex, shuffled)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
BaseItemKind.PLAYLIST -> {
|
||||||
|
val pager = getPagerForPlaylist(api, item.id)
|
||||||
|
musicService.setQueue(pager, startIndex, shuffled)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
Timber.w("Unknown item type to play for music: %s", item.type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +92,14 @@ abstract class MusicViewModel(
|
||||||
musicService.addAllToQueue(pager, 0)
|
musicService.addAllToQueue(pager, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
BaseItemKind.PLAYLIST -> {
|
||||||
|
val pager = getPagerForPlaylist(api, item.id)
|
||||||
|
musicService.addAllToQueue(pager, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
Timber.w("Unknown item type to queue for music: %s", item.type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,3 +236,21 @@ suspend fun ViewModel.getPagerForArtist(
|
||||||
)
|
)
|
||||||
return ApiRequestPager(api, request, GetItemsRequestHandler, viewModelScope).init()
|
return ApiRequestPager(api, request, GetItemsRequestHandler, viewModelScope).init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun ViewModel.getPagerForPlaylist(
|
||||||
|
api: ApiClient,
|
||||||
|
playlistId: UUID,
|
||||||
|
): ApiRequestPager<GetItemsRequest> {
|
||||||
|
val request =
|
||||||
|
GetItemsRequest(
|
||||||
|
parentId = playlistId,
|
||||||
|
recursive = true,
|
||||||
|
includeItemTypes = listOf(BaseItemKind.AUDIO),
|
||||||
|
fields = DefaultItemFields,
|
||||||
|
sortBy =
|
||||||
|
listOf(
|
||||||
|
ItemSortBy.DEFAULT,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return ApiRequestPager(api, request, GetItemsRequestHandler, viewModelScope).init()
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue