initial podcast support
This commit is contained in:
@@ -318,6 +318,20 @@ export class API {
|
||||
return this.get('rest/deleteInternetRadioStation', { id })
|
||||
}
|
||||
|
||||
async getPodcasts(): Promise<any[]> {
|
||||
const response = await this.get('rest/getPodcasts')
|
||||
return (response?.podcasts?.channel || []).map(this.normalizePodcast, this)
|
||||
}
|
||||
|
||||
async getPodcast(id: string): Promise<any> {
|
||||
const response = await this.get('rest/getPodcasts', { id })
|
||||
return this.normalizePodcast(response?.podcasts?.channel[0])
|
||||
}
|
||||
|
||||
async refreshPodcasts(): Promise<void> {
|
||||
return this.get('rest/refreshPodcasts')
|
||||
}
|
||||
|
||||
async scan(): Promise<void> {
|
||||
return this.get('rest/startScan')
|
||||
}
|
||||
@@ -387,6 +401,33 @@ export class API {
|
||||
}
|
||||
}
|
||||
|
||||
private normalizePodcast(podcast: any): any {
|
||||
const image = podcast.originalImageUrl
|
||||
return {
|
||||
id: podcast.id,
|
||||
name: podcast.title,
|
||||
description: podcast.description,
|
||||
image: image,
|
||||
url: podcast.url,
|
||||
trackCount: podcast.episode.length,
|
||||
tracks: podcast.episode.map((episode: any, index: number) => ({
|
||||
id: episode.id,
|
||||
title: episode.title,
|
||||
duration: episode.duration,
|
||||
starred: false,
|
||||
track: podcast.episode.length - index,
|
||||
album: podcast.title,
|
||||
albumId: null,
|
||||
artist: '',
|
||||
artistId: null,
|
||||
image,
|
||||
url: episode.streamId ? this.getStreamUrl(episode.streamId) : null,
|
||||
description: podcast.description,
|
||||
playable: episode.status === 'completed',
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
private getCoverArtUrl(item: any) {
|
||||
if (!item.coverArt) {
|
||||
return undefined
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
BIconBoxArrowRight,
|
||||
BIconPersonFill,
|
||||
BIconPersonCircle,
|
||||
BIconRss,
|
||||
BIconX,
|
||||
} from 'bootstrap-vue'
|
||||
|
||||
@@ -53,6 +54,7 @@
|
||||
BIconBoxArrowRight,
|
||||
BIconPersonFill,
|
||||
BIconPersonCircle,
|
||||
BIconRss,
|
||||
BIconX,
|
||||
},
|
||||
props: {
|
||||
|
||||
@@ -10,6 +10,8 @@ import GenreDetails from '@/library/genre/GenreDetails.vue'
|
||||
import GenreLibrary from '@/library/genre/GenreLibrary.vue'
|
||||
import Starred from '@/library/starred/Starred.vue'
|
||||
import RadioStations from '@/library/radio/RadioStations.vue'
|
||||
import PodcastDetails from '@/library/podcast/PodcastDetails.vue'
|
||||
import PodcastLibrary from '@/library/podcast/PodcastLibrary.vue'
|
||||
import Playlist from '@/playlist/Playlist.vue'
|
||||
import PlaylistList from '@/playlist/PlaylistList.vue'
|
||||
import SearchResult from '@/search/SearchResult.vue'
|
||||
@@ -86,6 +88,17 @@ export function setupRouter(auth: AuthService) {
|
||||
path: '/radio',
|
||||
component: RadioStations,
|
||||
},
|
||||
{
|
||||
name: 'podcasts',
|
||||
path: '/podcasts',
|
||||
component: PodcastLibrary,
|
||||
},
|
||||
{
|
||||
name: 'podcast',
|
||||
path: '/podcast/:id',
|
||||
component: PodcastDetails,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'playlists',
|
||||
path: '/playlists',
|
||||
|
||||
Reference in New Issue
Block a user