mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-20 09:40:17 +02:00
Fix local episode play-item event, set PodcastEpisode size and AudioTrack FileMetadata for downloads
This commit is contained in:
parent
1cdcd7327f
commit
6380d7cc02
3 changed files with 8 additions and 9 deletions
|
@ -96,7 +96,7 @@ class Podcast(
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
fun addEpisode(audioTrack:AudioTrack, episode:PodcastEpisode):PodcastEpisode {
|
fun addEpisode(audioTrack:AudioTrack, episode:PodcastEpisode):PodcastEpisode {
|
||||||
val localEpisodeId = "local_ep_" + episode.id
|
val localEpisodeId = "local_ep_" + episode.id
|
||||||
val newEpisode = PodcastEpisode(localEpisodeId,(episodes?.size ?: 0) + 1,episode.episode,episode.episodeType,episode.title,episode.subtitle,episode.description,null,null,null,audioTrack,episode.chapters,audioTrack.duration,0, episode.id, localEpisodeId)
|
val newEpisode = PodcastEpisode(localEpisodeId,(episodes?.size ?: 0) + 1,episode.episode,episode.episodeType,episode.title,episode.subtitle,episode.description,null,null,null,audioTrack,episode.chapters,audioTrack.duration,episode.size, episode.id, localEpisodeId)
|
||||||
episodes?.add(newEpisode)
|
episodes?.add(newEpisode)
|
||||||
|
|
||||||
var index = 1
|
var index = 1
|
||||||
|
|
|
@ -70,6 +70,7 @@ class FolderScanner(var ctx: Context) {
|
||||||
)
|
)
|
||||||
localLibraryItem.localFiles.add(localFile)
|
localLibraryItem.localFiles.add(localFile)
|
||||||
|
|
||||||
|
val trackFileMetadata = FileMetadata(file.name, file.extension, file.absolutePath, file.getBasePath(ctx), file.length())
|
||||||
// Create new audio track
|
// Create new audio track
|
||||||
val track = AudioTrack(
|
val track = AudioTrack(
|
||||||
audioTrackFromServer.index,
|
audioTrackFromServer.index,
|
||||||
|
@ -78,7 +79,7 @@ class FolderScanner(var ctx: Context) {
|
||||||
localFile.filename ?: "",
|
localFile.filename ?: "",
|
||||||
localFile.contentUrl,
|
localFile.contentUrl,
|
||||||
localFile.mimeType ?: "",
|
localFile.mimeType ?: "",
|
||||||
null,
|
trackFileMetadata,
|
||||||
true,
|
true,
|
||||||
localFileId,
|
localFileId,
|
||||||
null,
|
null,
|
||||||
|
@ -274,7 +275,8 @@ class FolderScanner(var ctx: Context) {
|
||||||
localLibraryItem.localFiles.add(localFile)
|
localLibraryItem.localFiles.add(localFile)
|
||||||
|
|
||||||
// Create new audio track
|
// Create new audio track
|
||||||
val track = AudioTrack(audioTrackFromServer.index, audioTrackFromServer.startOffset, audioTrackFromServer.duration, localFile.filename ?: "", localFile.contentUrl, localFile.mimeType ?: "", null, true, localFileId, null, audioTrackFromServer.index)
|
val trackFileMetadata = FileMetadata(docFile.name ?: "", docFile.extension ?: "", docFile.getAbsolutePath(ctx), docFile.getBasePath(ctx), docFile.length())
|
||||||
|
val track = AudioTrack(audioTrackFromServer.index, audioTrackFromServer.startOffset, audioTrackFromServer.duration, localFile.filename ?: "", localFile.contentUrl, localFile.mimeType ?: "", trackFileMetadata, true, localFileId, null, audioTrackFromServer.index)
|
||||||
audioTracks.add(track)
|
audioTracks.add(track)
|
||||||
|
|
||||||
Log.d(tag, "scanDownloadItem: Created Audio Track with index ${track.index} from local file ${localFile.absolutePath}")
|
Log.d(tag, "scanDownloadItem: Created Audio Track with index ${track.index} from local file ${localFile.absolutePath}")
|
||||||
|
|
|
@ -332,16 +332,13 @@ export default {
|
||||||
if (!this.selectedEpisode) return
|
if (!this.selectedEpisode) return
|
||||||
if (this.playerIsStartingPlayback) return
|
if (this.playerIsStartingPlayback) return
|
||||||
await this.$hapticsImpact()
|
await this.$hapticsImpact()
|
||||||
this.$store.commit('setPlayerIsStartingPlayback', this.selectedEpisode.id)
|
this.$store.commit('setPlayerIsStartingPlayback', this.selectedEpisode.serverEpisodeId)
|
||||||
this.$eventBus.$emit('play-item', {
|
|
||||||
libraryItemId: this.localLibraryItemId,
|
|
||||||
episodeId: this.selectedEpisode.id
|
|
||||||
})
|
|
||||||
this.$eventBus.$emit('play-item', {
|
this.$eventBus.$emit('play-item', {
|
||||||
libraryItemId: this.localLibraryItemId,
|
libraryItemId: this.localLibraryItemId,
|
||||||
episodeId: this.selectedEpisode.id,
|
episodeId: this.selectedEpisode.id,
|
||||||
serverLibraryItemId: this.libraryItemId,
|
serverLibraryItemId: this.libraryItemId,
|
||||||
serverEpisodeId: this.selectedEpisode.id
|
serverEpisodeId: this.selectedEpisode.serverEpisodeId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async dialogAction(action) {
|
async dialogAction(action) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue