-
{{ numChapters }} Chapter{{ numChapters > 1 ? 's' : '' }}
+
+
{{ description }}
+
+
+ {{ showFullDescription ? 'Read less' : 'Read more' }}
+ {{ showFullDescription ? 'expand_less' : 'expand_more' }}
-
-
+
+
+
+
+
+
@@ -188,7 +190,9 @@ export default {
showFullscreenCover: false,
coverRgb: 'rgb(55, 56, 56)',
coverBgIsLight: false,
- windowWidth: 0
+ windowWidth: 0,
+ descriptionClamped: false,
+ showFullDescription: false
}
},
computed: {
@@ -288,9 +292,6 @@ export default {
duration() {
return this.media.duration
},
- size() {
- return this.media.size
- },
user() {
return this.$store.state.user.user
},
@@ -323,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
@@ -471,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) {
@@ -492,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) {
@@ -505,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()
@@ -560,6 +572,7 @@ export default {
if (libraryItem.id === this.libraryItemId) {
console.log('Item Updated')
this.libraryItem = libraryItem
+ this.checkDescriptionClamped()
}
},
async selectFolder() {
@@ -708,8 +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
+ this.checkDescriptionClamped()
}
},
mounted() {
@@ -718,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)
@@ -737,4 +756,15 @@ export default {
width: 150vw !important;
max-width: 150vw !important;
}
+
+@media only screen and (max-width: 500px) {
+ #metadata {
+ grid-template-columns: auto 1fr;
+ }
+}
+@media only screen and (min-width: 500px) {
+ #metadata {
+ grid-template-columns: auto 1fr auto 1fr;
+ }
+}