Remove: local library only item from playback and syncing media

This commit is contained in:
Nicholas Wallace 2025-02-08 11:18:46 -07:00
parent 1e0f1f329f
commit 7c6e098014
4 changed files with 6 additions and 21 deletions

View file

@ -79,13 +79,8 @@ class PlaybackSession(
val progress
get() = currentTime / getTotalDuration()
@get:JsonIgnore
val isLocalLibraryItemOnly
get() = localLibraryItemId != "" && libraryItemId == null
@get:JsonIgnore
val mediaItemId
get() =
if (isLocalLibraryItemOnly) localMediaProgressId
else if (episodeId.isNullOrEmpty()) libraryItemId ?: "" else "$libraryItemId-$episodeId"
get() = if (episodeId.isNullOrEmpty()) libraryItemId ?: "" else "$libraryItemId-$episodeId"
@JsonIgnore
fun getCurrentTrackIndex(): Int {

View file

@ -114,20 +114,14 @@ object MediaEventManager {
private fun createMediaItemHistoryForSession(playbackSession: PlaybackSession): MediaItemHistory {
Log.i(tag, "Creating new media item history for media \"${playbackSession.displayTitle}\"")
val isLocalOnly = playbackSession.isLocalLibraryItemOnly
val libraryItemId =
if (isLocalOnly) playbackSession.localLibraryItemId
else playbackSession.libraryItemId ?: ""
val episodeId: String? =
if (isLocalOnly && playbackSession.localEpisodeId != null)
playbackSession.localEpisodeId
else playbackSession.episodeId
val libraryItemId = playbackSession.libraryItemId ?: ""
val episodeId: String? = playbackSession.episodeId
return MediaItemHistory(
id = playbackSession.mediaItemId,
mediaDisplayTitle = playbackSession.displayTitle ?: "Unset",
libraryItemId,
episodeId,
isLocalOnly,
false, // local-only items are not supported
playbackSession.serverConnectionConfigId,
playbackSession.serverAddress,
playbackSession.userId,

View file

@ -248,11 +248,7 @@ class MediaProgressSyncer(
// Save playback session to db (server linked sessions only)
// Sessions are removed once successfully synced with the server
currentPlaybackSession?.let {
if (!it.isLocalLibraryItemOnly) {
DeviceManager.dbManager.savePlaybackSession(it)
}
}
currentPlaybackSession?.let { DeviceManager.dbManager.savePlaybackSession(it) }
if (currentIsLocal) {
// Save local progress sync

View file

@ -784,7 +784,7 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
if (currentPlaybackSession == null) return true
mediaProgressSyncer.currentPlaybackSession?.let { playbackSession ->
if (!DeviceManager.checkConnectivity(ctx) || playbackSession.isLocalLibraryItemOnly) {
if (!DeviceManager.checkConnectivity(ctx)) {
return true // carry on
}