mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-07-17 01:12:27 +00:00
Remove: local only items from frontend
This commit is contained in:
parent
e194df455b
commit
9492975a74
4 changed files with 16 additions and 39 deletions
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
<!-- Downloaded icon -->
|
||||
<div v-if="showHasLocalDownload" class="absolute right-0 top-0 z-20" :style="{ top: (isPodcast || (seriesSequence && showSequence) ? 1.75 : 0.375) * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
||||
<span class="material-icons text-2xl text-success">{{ isLocalOnly ? 'task' : 'download_done' }}</span>
|
||||
<span class="material-icons text-2xl text-success">{{ 'download_done' }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Error widget -->
|
||||
|
|
@ -153,10 +153,6 @@ export default {
|
|||
isLocal() {
|
||||
return !!this._libraryItem.isLocal
|
||||
},
|
||||
isLocalOnly() {
|
||||
// Local item with no server match
|
||||
return this.isLocal && !this._libraryItem.libraryItemId
|
||||
},
|
||||
media() {
|
||||
return this._libraryItem.media || {}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="localLibraryItem || isLocal" class="absolute top-0 right-0 z-20" :style="{ top: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
||||
<span class="material-icons text-2xl text-success">{{ isLocalOnly ? 'task' : 'download_done' }}</span>
|
||||
<span class="material-icons text-2xl text-success">{{ 'download_done' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -93,10 +93,6 @@ export default {
|
|||
isLocal() {
|
||||
return !!this._libraryItem.isLocal
|
||||
},
|
||||
isLocalOnly() {
|
||||
// Local item with no server match
|
||||
return this.isLocal && !this._libraryItem.libraryItemId
|
||||
},
|
||||
media() {
|
||||
return this._libraryItem.media || {}
|
||||
},
|
||||
|
|
@ -363,4 +359,4 @@ export default {
|
|||
min-width: var(--list-card-cover-width);
|
||||
max-width: var(--list-card-cover-width);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -36,10 +36,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="hasLocal" class="mx-1">
|
||||
<div v-if="isLocalOnly" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||
<p class="text-sm">{{ $strings.MessageMediaNotLinkedToServer }}</p>
|
||||
</div>
|
||||
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingServerAddress" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||
<div v-if="currentServerConnectionConfigId && !isLocalMatchingServerAddress" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||
<p class="text-sm">{{ $getString('MessageMediaLinkedToADifferentServer', [localLibraryItem.serverAddress]) }}</p>
|
||||
</div>
|
||||
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingUser" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||
|
|
@ -240,10 +237,6 @@ export default {
|
|||
isLocal() {
|
||||
return this.libraryItem.isLocal
|
||||
},
|
||||
isLocalOnly() {
|
||||
// TODO: Remove the possibility to have local only on android
|
||||
return this.isLocal && !this.libraryItem.libraryItemId
|
||||
},
|
||||
hasLocal() {
|
||||
// Server library item has matching local library item
|
||||
return this.isLocal || this.libraryItem.localLibraryItem
|
||||
|
|
@ -282,21 +275,21 @@ export default {
|
|||
* User is currently connected to a server and this local library item has the same server address
|
||||
*/
|
||||
isLocalMatchingServerAddress() {
|
||||
if (this.isLocalOnly || !this.localLibraryItem || !this.currentServerAddress) return false
|
||||
if (!this.localLibraryItem || !this.currentServerAddress) return false
|
||||
return this.localLibraryItem.serverAddress === this.currentServerAddress
|
||||
},
|
||||
/**
|
||||
* User is currently connected to a server and this local library item has the same user id
|
||||
*/
|
||||
isLocalMatchingUser() {
|
||||
if (this.isLocalOnly || !this.localLibraryItem || !this.user) return false
|
||||
if (!this.localLibraryItem || !this.user) return false
|
||||
return this.localLibraryItem.serverUserId === this.user.id || this.localLibraryItem.serverUserId === this.user.oldUserId
|
||||
},
|
||||
/**
|
||||
* User is currently connected to a server and this local library item has the same connection config id
|
||||
*/
|
||||
isLocalMatchingConnectionConfig() {
|
||||
if (this.isLocalOnly || !this.localLibraryItemServerConnectionConfigId || !this.currentServerConnectionConfigId) return false
|
||||
if (!this.localLibraryItemServerConnectionConfigId || !this.currentServerConnectionConfigId) return false
|
||||
return this.localLibraryItemServerConnectionConfigId === this.currentServerConnectionConfigId
|
||||
},
|
||||
bookCoverAspectRatio() {
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@ export default {
|
|||
if (!this.mediaItemHistory) return []
|
||||
return (this.mediaItemHistory.events || []).sort((a, b) => b.timestamp - a.timestamp)
|
||||
},
|
||||
mediaItemIsLocal() {
|
||||
return this.mediaItemHistory && this.mediaItemHistory.isLocal
|
||||
},
|
||||
mediaItemLibraryItemId() {
|
||||
if (!this.mediaItemHistory) return null
|
||||
return this.mediaItemHistory.libraryItemId
|
||||
|
|
@ -91,7 +88,7 @@ export default {
|
|||
|
||||
// Collapse saves
|
||||
if (evt.name === 'Save') {
|
||||
let saveName = evt.name + "-" + evt.serverSyncAttempted + "-" + evt.serverSyncSuccess
|
||||
let saveName = evt.name + '-' + evt.serverSyncAttempted + '-' + evt.serverSyncSuccess
|
||||
if (lastSaveName === saveName && numSaves > 0 && !keyUpdated) {
|
||||
include = false
|
||||
const totalInGroup = groups[key].length
|
||||
|
|
@ -140,19 +137,14 @@ export default {
|
|||
},
|
||||
playAtTime(startTime) {
|
||||
this.$store.commit('setPlayerIsStartingPlayback', this.mediaItemEpisodeId || this.mediaItemLibraryItemId)
|
||||
if (this.mediaItemIsLocal) {
|
||||
// Local only
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
||||
// Server may have local
|
||||
const localProg = this.$store.getters['globals/getLocalMediaProgressByServerItemId'](this.mediaItemLibraryItemId, this.mediaItemEpisodeId)
|
||||
if (localProg) {
|
||||
// Has local copy so prefer
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: localProg.localLibraryItemId, episodeId: localProg.localEpisodeId, serverLibraryItemId: this.mediaItemLibraryItemId, serverEpisodeId: this.mediaItemEpisodeId, startTime })
|
||||
} else {
|
||||
// Server may have local
|
||||
const localProg = this.$store.getters['globals/getLocalMediaProgressByServerItemId'](this.mediaItemLibraryItemId, this.mediaItemEpisodeId)
|
||||
if (localProg) {
|
||||
// Has local copy so prefer
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: localProg.localLibraryItemId, episodeId: localProg.localEpisodeId, serverLibraryItemId: this.mediaItemLibraryItemId, serverEpisodeId: this.mediaItemEpisodeId, startTime })
|
||||
} else {
|
||||
// Only on server
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
||||
}
|
||||
// Only on server
|
||||
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
||||
}
|
||||
},
|
||||
getEventIcon(name) {
|
||||
|
|
@ -211,4 +203,4 @@ export default {
|
|||
if (this.onMediaItemHistoryUpdatedListener) this.onMediaItemHistoryUpdatedListener.remove()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue