+
{{ narrators.length === 1 ? 'Narrator' : 'Narrators' }}
+
{{ narrator }},
-
{{ genres.length === 1 ? 'Genre' : 'Genres' }}
-
+
{{ genres.length === 1 ? 'Genre' : 'Genres' }}
+
{{ genre }},
-
Published
-
{{ publishedYear }}
-
-
Size
-
{{ $bytesPretty(size) }}
-
-
Tracks
-
{{ numTracks }} {{ numTracks == 1 ? 'track' : 'tracks' }}
-
-
Chapters
-
{{ numChapters }} {{ numChapters == 1 ? 'chapter' : 'chapters' }}
-
-
- {{ allMetadata ? 'less' : 'more' }}
- {{ allMetadata ? 'expand_less' : 'expand_more' }}
-
+
Published
+
{{ publishedYear }}
-
{{ description }}
+
{{ description }}
+
+
+ {{ showFullDescription ? 'Read less' : 'Read more' }}
+ {{ showFullDescription ? 'expand_less' : 'expand_more' }}
+
+
+
+
+
+
+
@@ -198,13 +191,11 @@ export default {
coverRgb: 'rgb(55, 56, 56)',
coverBgIsLight: false,
windowWidth: 0,
- hideMetadata: true
+ descriptionClamped: false,
+ showFullDescription: false
}
},
computed: {
- allMetadata() {
- return this.isPodcast || this.windowWidth >= 500 || !this.hideMetadata
- },
isIos() {
return this.$platform === 'ios'
},
@@ -301,9 +292,6 @@ export default {
duration() {
return this.media.duration
},
- size() {
- return this.media.size
- },
user() {
return this.$store.state.user.user
},
@@ -336,9 +324,11 @@ export default {
if (this.localLibraryItemId && this.$store.getters['getIsItemStreaming'](this.localLibraryItemId)) return true
return this.$store.getters['getIsItemStreaming'](this.libraryItemId)
},
+ tracks() {
+ return this.media.tracks || []
+ },
numTracks() {
- if (!this.media.tracks) return 0
- return this.media.tracks.length || 0
+ return this.tracks.length || 0
},
numChapters() {
if (!this.media.chapters) return 0
@@ -484,8 +474,10 @@ export default {
readBook() {
this.$store.commit('openReader', this.libraryItem)
},
- async playClick() {
- let episodeId = null
+ playAtTimestamp(seconds) {
+ this.playClick(seconds)
+ },
+ async playClick(startTime = null) {
await this.$hapticsImpact()
if (this.isPodcast) {
@@ -505,7 +497,7 @@ export default {
if (!episode) episode = this.episodes[0]
- episodeId = episode.id
+ const episodeId = episode.id
let localEpisode = null
if (this.hasLocal && !this.isLocal) {
@@ -518,26 +510,33 @@ export default {
if (serverEpisodeId && this.serverLibraryItemId && this.isCasting) {
// If casting and connected to server for local library item then send server library item id
this.$eventBus.$emit('play-item', { libraryItemId: this.serverLibraryItemId, episodeId: serverEpisodeId })
- return
- }
- if (localEpisode) {
+ } else if (localEpisode) {
this.$eventBus.$emit('play-item', { libraryItemId: this.localLibraryItem.id, episodeId: localEpisode.id, serverLibraryItemId: this.serverLibraryItemId, serverEpisodeId })
- return
+ } else {
+ this.$eventBus.$emit('play-item', { libraryItemId: this.libraryItemId, episodeId })
}
} else {
// Audiobook
- if (this.hasLocal && this.serverLibraryItemId && this.isCasting) {
- // If casting and connected to server for local library item then send server library item id
- this.$eventBus.$emit('play-item', { libraryItemId: this.serverLibraryItemId })
- return
- }
- if (this.hasLocal) {
- this.$eventBus.$emit('play-item', { libraryItemId: this.localLibraryItem.id, serverLibraryItemId: this.serverLibraryItemId })
- return
- }
- }
+ let libraryItemId = this.libraryItemId
- this.$eventBus.$emit('play-item', { libraryItemId: this.libraryItemId, episodeId })
+ // When casting use server library item
+ if (this.hasLocal && this.serverLibraryItemId && this.isCasting) {
+ libraryItemId = this.serverLibraryItemId
+ } else if (this.hasLocal) {
+ libraryItemId = this.localLibraryItem.id
+ }
+
+ // If start time and is not already streaming then ask for confirmation
+ if (startTime !== null && startTime !== undefined && !this.$store.getters['getIsMediaStreaming'](libraryItemId, null)) {
+ const { value } = await Dialog.confirm({
+ title: 'Confirm',
+ message: `Start playback for "${this.title}" at ${this.$secondsToTimestamp(startTime)}?`
+ })
+ if (!value) return
+ }
+
+ this.$eventBus.$emit('play-item', { libraryItemId, serverLibraryItemId: this.serverLibraryItemId, startTime })
+ }
},
async clearProgressClick() {
await this.$hapticsImpact()
@@ -573,6 +572,7 @@ export default {
if (libraryItem.id === this.libraryItemId) {
console.log('Item Updated')
this.libraryItem = libraryItem
+ this.checkDescriptionClamped()
}
},
async selectFolder() {
@@ -721,11 +721,13 @@ export default {
this.$router.replace('/bookshelf')
}
},
+ checkDescriptionClamped() {
+ if (!this.$refs.description || this.showFullDescription) return
+ this.descriptionClamped = this.$refs.description.scrollHeight > this.$refs.description.clientHeight
+ },
windowResized() {
this.windowWidth = window.innerWidth
- },
- toggleMetadata() {
- this.hideMetadata = !this.hideMetadata
+ this.checkDescriptionClamped()
}
},
mounted() {
@@ -734,6 +736,7 @@ export default {
this.$eventBus.$on('library-changed', this.libraryChanged)
this.$eventBus.$on('new-local-library-item', this.newLocalLibraryItem)
this.$socket.$on('item_updated', this.itemUpdated)
+ this.checkDescriptionClamped()
},
beforeDestroy() {
window.removeEventListener('resize', this.windowResized)