mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Remove: local library only item from playback and syncing media
This commit is contained in:
parent
1e0f1f329f
commit
7c6e098014
4 changed files with 6 additions and 21 deletions
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue