mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Update Podcast Episode add libraryItemId, expanded returns audioTrack object
This commit is contained in:
		
							parent
							
								
									6e5e638076
								
							
						
					
					
						commit
						ac3fa31d1e
					
				| @ -40,6 +40,7 @@ class PodcastManager { | |||||||
|     episodesToDownload.forEach((ep) => { |     episodesToDownload.forEach((ep) => { | ||||||
|       var newPe = new PodcastEpisode() |       var newPe = new PodcastEpisode() | ||||||
|       newPe.setData(ep, index++) |       newPe.setData(ep, index++) | ||||||
|  |       newPe.libraryItemId = libraryItem.id | ||||||
|       var newPeDl = new PodcastEpisodeDownload() |       var newPeDl = new PodcastEpisodeDownload() | ||||||
|       newPeDl.setData(newPe, libraryItem) |       newPeDl.setData(newPe, libraryItem) | ||||||
|       this.startPodcastEpisodeDownload(newPeDl) |       this.startPodcastEpisodeDownload(newPeDl) | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ const AudioTrack = require('../files/AudioTrack') | |||||||
| 
 | 
 | ||||||
| class PodcastEpisode { | class PodcastEpisode { | ||||||
|   constructor(episode) { |   constructor(episode) { | ||||||
|  |     this.libraryItemId = null | ||||||
|     this.id = null |     this.id = null | ||||||
|     this.index = null |     this.index = null | ||||||
| 
 | 
 | ||||||
| @ -26,6 +27,7 @@ class PodcastEpisode { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   construct(episode) { |   construct(episode) { | ||||||
|  |     this.libraryItemId = episode.libraryItemId | ||||||
|     this.id = episode.id |     this.id = episode.id | ||||||
|     this.index = episode.index |     this.index = episode.index | ||||||
|     this.episode = episode.episode |     this.episode = episode.episode | ||||||
| @ -43,6 +45,7 @@ class PodcastEpisode { | |||||||
| 
 | 
 | ||||||
|   toJSON() { |   toJSON() { | ||||||
|     return { |     return { | ||||||
|  |       libraryItemId: this.libraryItemId, | ||||||
|       id: this.id, |       id: this.id, | ||||||
|       index: this.index, |       index: this.index, | ||||||
|       episode: this.episode, |       episode: this.episode, | ||||||
| @ -61,6 +64,7 @@ class PodcastEpisode { | |||||||
| 
 | 
 | ||||||
|   toJSONExpanded() { |   toJSONExpanded() { | ||||||
|     return { |     return { | ||||||
|  |       libraryItemId: this.libraryItemId, | ||||||
|       id: this.id, |       id: this.id, | ||||||
|       index: this.index, |       index: this.index, | ||||||
|       episode: this.episode, |       episode: this.episode, | ||||||
| @ -71,6 +75,7 @@ class PodcastEpisode { | |||||||
|       enclosure: this.enclosure ? { ...this.enclosure } : null, |       enclosure: this.enclosure ? { ...this.enclosure } : null, | ||||||
|       pubDate: this.pubDate, |       pubDate: this.pubDate, | ||||||
|       audioFile: this.audioFile.toJSON(), |       audioFile: this.audioFile.toJSON(), | ||||||
|  |       audioTrack: this.audioTrack.toJSON(), | ||||||
|       publishedAt: this.publishedAt, |       publishedAt: this.publishedAt, | ||||||
|       addedAt: this.addedAt, |       addedAt: this.addedAt, | ||||||
|       updatedAt: this.updatedAt, |       updatedAt: this.updatedAt, | ||||||
| @ -79,8 +84,13 @@ class PodcastEpisode { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   get audioTrack() { | ||||||
|  |     var audioTrack = new AudioTrack() | ||||||
|  |     audioTrack.setData(this.libraryItemId, this.audioFile, 0) | ||||||
|  |     return audioTrack | ||||||
|  |   } | ||||||
|   get tracks() { |   get tracks() { | ||||||
|     return [this.audioFile] |     return [this.audioTrack] | ||||||
|   } |   } | ||||||
|   get duration() { |   get duration() { | ||||||
|     return this.audioFile.duration |     return this.audioFile.duration | ||||||
| @ -135,10 +145,8 @@ class PodcastEpisode { | |||||||
|     return supportedMimeTypes.includes(this.audioFile.mimeType) |     return supportedMimeTypes.includes(this.audioFile.mimeType) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getDirectPlayTracklist(libraryItemId) { |   getDirectPlayTracklist() { | ||||||
|     var audioTrack = new AudioTrack() |     return this.tracks | ||||||
|     audioTrack.setData(libraryItemId, this.audioFile, 0) |  | ||||||
|     return [audioTrack] |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   checkEqualsEnclosureUrl(url) { |   checkEqualsEnclosureUrl(url) { | ||||||
|  | |||||||
| @ -31,7 +31,11 @@ class Podcast { | |||||||
|     this.metadata = new PodcastMetadata(podcast.metadata) |     this.metadata = new PodcastMetadata(podcast.metadata) | ||||||
|     this.coverPath = podcast.coverPath |     this.coverPath = podcast.coverPath | ||||||
|     this.tags = [...podcast.tags] |     this.tags = [...podcast.tags] | ||||||
|     this.episodes = podcast.episodes.map((e) => new PodcastEpisode(e)) |     this.episodes = podcast.episodes.map((e) => { | ||||||
|  |       var podcastEpisode = new PodcastEpisode(e) | ||||||
|  |       podcastEpisode.libraryItemId = this.libraryItemId | ||||||
|  |       return podcastEpisode | ||||||
|  |     }) | ||||||
|     this.autoDownloadEpisodes = !!podcast.autoDownloadEpisodes |     this.autoDownloadEpisodes = !!podcast.autoDownloadEpisodes | ||||||
|     this.lastEpisodeCheck = podcast.lastEpisodeCheck || 0 |     this.lastEpisodeCheck = podcast.lastEpisodeCheck || 0 | ||||||
|   } |   } | ||||||
| @ -179,7 +183,7 @@ class Podcast { | |||||||
|   getDirectPlayTracklist(episodeId) { |   getDirectPlayTracklist(episodeId) { | ||||||
|     var episode = this.episodes.find(ep => ep.id === episodeId) |     var episode = this.episodes.find(ep => ep.id === episodeId) | ||||||
|     if (!episode) return false |     if (!episode) return false | ||||||
|     return episode.getDirectPlayTracklist(this.libraryItemId) |     return episode.getDirectPlayTracklist() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   addPodcastEpisode(podcastEpisode) { |   addPodcastEpisode(podcastEpisode) { | ||||||
| @ -188,6 +192,7 @@ class Podcast { | |||||||
| 
 | 
 | ||||||
|   addNewEpisodeFromAudioFile(audioFile, index) { |   addNewEpisodeFromAudioFile(audioFile, index) { | ||||||
|     var pe = new PodcastEpisode() |     var pe = new PodcastEpisode() | ||||||
|  |     pe.libraryItemId = this.libraryItemId | ||||||
|     pe.setDataFromAudioFile(audioFile, index) |     pe.setDataFromAudioFile(audioFile, index) | ||||||
|     this.episodes.push(pe) |     this.episodes.push(pe) | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user