Add a shortcut to chosing the version of an item (#1522)
## Description Based on feedback from users, many felt it was difficult to 1) tell if multiple version of an item existed and 2) choose the version they want So this PR adds a new expandable button next to Play/Resume/Restart to choose the version. It is a shortcut to the More->Choose Version dialog, but also serves as a more prominent indicator that there are multiple versions. The button is only shown if there are 2+ versions to choose from. Also adds displaying the bitrate in the choose version dialog just in case there are identically named versions with the same resolution. Dev note: I also added some docs for classes & functions related to choosing a version ### Related issues Related to #652 ### Testing Emulator ## Screenshots <img width="1280" height="720" alt="choose_version_button_unfocused Large" src="https://github.com/user-attachments/assets/4f6051ef-b6ae-4fad-9d54-3840523350ed" /> <img width="1280" height="720" alt="choose_version_button Large" src="https://github.com/user-attachments/assets/0e8412bc-2d18-4c6c-987a-2f067363ad2c" /> ## AI or LLM usage None
This commit is contained in:
parent
99fab9a383
commit
d1b8c09615
10 changed files with 141 additions and 1 deletions
|
|
@ -19,6 +19,9 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
import kotlin.time.Duration
|
||||
|
||||
/**
|
||||
* Wrapper for [ItemPlaybackDao] to save [ItemPlayback] objects and also convert them into [ChosenStreams]
|
||||
*/
|
||||
@Singleton
|
||||
class ItemPlaybackRepository
|
||||
@Inject
|
||||
|
|
@ -28,6 +31,13 @@ class ItemPlaybackRepository
|
|||
private val playbackLanguageChoiceDao: PlaybackLanguageChoiceDao,
|
||||
private val streamChoiceService: StreamChoiceService,
|
||||
) {
|
||||
/**
|
||||
* Get the chosen source & stream for the given item
|
||||
*
|
||||
* This will be either the explicit choice from the user ([ItemPlayback]) or the default choices
|
||||
*
|
||||
* @see getChosenItemFromPlayback
|
||||
*/
|
||||
suspend fun getSelectedTracks(
|
||||
itemId: UUID,
|
||||
item: BaseItem,
|
||||
|
|
@ -40,6 +50,11 @@ class ItemPlaybackRepository
|
|||
return getChosenItemFromPlayback(item, itemPlayback, plc, prefs)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the chosen source & stream for the given item
|
||||
*
|
||||
* This will be either the explicit choice from the provided [ItemPlayback] & [PlaybackLanguageChoice] or the default choices if they are null
|
||||
*/
|
||||
fun getChosenItemFromPlayback(
|
||||
item: BaseItem,
|
||||
itemPlayback: ItemPlayback?,
|
||||
|
|
@ -86,6 +101,9 @@ class ItemPlaybackRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the choice for a specific media source for an item
|
||||
*/
|
||||
suspend fun savePlayVersion(
|
||||
itemId: UUID,
|
||||
sourceId: UUID,
|
||||
|
|
@ -103,6 +121,11 @@ class ItemPlaybackRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the chosen track (index & type) for an item
|
||||
*
|
||||
* Additionally, if the item is part of a TV Series, store the language as the preferred one for this series
|
||||
*/
|
||||
suspend fun saveTrackSelection(
|
||||
item: BaseItem,
|
||||
itemPlayback: ItemPlayback?,
|
||||
|
|
@ -180,6 +203,9 @@ class ItemPlaybackRepository
|
|||
return toSave.copy(rowId = id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for [ItemPlaybackDao.getTrackModifications] to get the [ItemTrackModification] for an item, if any
|
||||
*/
|
||||
suspend fun getTrackModifications(
|
||||
itemId: UUID,
|
||||
trackIndex: Int,
|
||||
|
|
@ -188,6 +214,9 @@ class ItemPlaybackRepository
|
|||
itemPlaybackDao.getTrackModifications(userId, itemId, trackIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and save a [ItemTrackModification] via [ItemPlaybackDao.saveItem]
|
||||
*/
|
||||
suspend fun saveTrackModifications(
|
||||
itemId: UUID,
|
||||
trackIndex: Int,
|
||||
|
|
@ -206,6 +235,9 @@ class ItemPlaybackRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the user's source/stream choices for an item
|
||||
*/
|
||||
suspend fun deleteChosenStreams(chosenStreams: ChosenStreams?) {
|
||||
Timber.d("deleteChosenStreams: %s", chosenStreams)
|
||||
chosenStreams?.plc?.let {
|
||||
|
|
@ -219,6 +251,9 @@ class ItemPlaybackRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Info about which media source and streams the user/app has chosen for playback
|
||||
*/
|
||||
data class ChosenStreams(
|
||||
val itemPlayback: ItemPlayback?,
|
||||
val plc: PlaybackLanguageChoice?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue