From f55036e12d6432f8a504c8b3d83655333ffd7602 Mon Sep 17 00:00:00 2001 From: Artem Chulkov Date: Mon, 7 Aug 2023 01:21:48 +0500 Subject: [PATCH 1/5] add podcast download and delete episode; show downloading status --- src/library/podcast/PodcastDetails.vue | 26 +++++++++++++++++++++-- src/library/track/CellActions.vue | 6 +++--- src/shared/api.ts | 10 +++++++++ src/shared/components/ContextMenuItem.vue | 3 ++- src/shared/components/Icon.vue | 12 +++++++++-- 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/library/podcast/PodcastDetails.vue b/src/library/podcast/PodcastDetails.vue index 15c2757..4bbd476 100644 --- a/src/library/podcast/PodcastDetails.vue +++ b/src/library/podcast/PodcastDetails.vue @@ -37,13 +37,29 @@ {{ item.title }} - + + + + + diff --git a/src/library/track/CellActions.vue b/src/library/track/CellActions.vue index 35fcc15..6a75868 100644 --- a/src/library/track/CellActions.vue +++ b/src/library/track/CellActions.vue @@ -7,13 +7,13 @@ Add to queue - + Add to playlist - + Favourite - + Download diff --git a/src/shared/api.ts b/src/shared/api.ts index df7597c..3710965 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -25,6 +25,7 @@ export interface Track { isPodcast?: boolean isUnavailable?: boolean playCount? : number + podcastStatus? : string } export interface Album { @@ -363,6 +364,14 @@ export class API { return this.fetch('rest/refreshPodcasts') } + async downloadPodcastEpisode(id: string): Promise { + return this.fetch('rest/downloadPodcastEpisode', { id }) + } + + async deletePodcastEpisode(id: string): Promise { + return this.fetch('rest/deletePodcastEpisode', { id }) + } + async deletePodcast(id: string): Promise { return this.fetch('rest/deletePodcastChannel', { id }) } @@ -479,6 +488,7 @@ export class API { artistId: undefined, image, isPodcast: true, + podcastStatus: item.status, isUnavailable: item.status !== 'completed' || !item.streamId, url: item.status === 'completed' && item.streamId ? this.getStreamUrl(item.streamId) diff --git a/src/shared/components/ContextMenuItem.vue b/src/shared/components/ContextMenuItem.vue index cdd55a1..59704c6 100644 --- a/src/shared/components/ContextMenuItem.vue +++ b/src/shared/components/ContextMenuItem.vue @@ -9,7 +9,7 @@ {{ text }} - + diff --git a/src/shared/components/Icon.vue b/src/shared/components/Icon.vue index e2a1296..4f1ee59 100644 --- a/src/shared/components/Icon.vue +++ b/src/shared/components/Icon.vue @@ -10,7 +10,7 @@ fill="currentColor" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16" - class="bi icon" + :class="{'bi icon': true, 'spin': spin}" v-bind="$attrs" v-html="path" /> @@ -46,6 +46,7 @@ import iconThreeDotsVertical from '@iconify-icons/bi/three-dots-vertical' import iconVolume from '@iconify-icons/bi/volume-up-fill' import iconX from '@iconify-icons/bi/x' + import iconTrash from '@iconify-icons/bi/trash' const icons = { 'arrow-up-down': iconArrowUpDown.body, @@ -77,11 +78,13 @@ 'three-dots-vertical': iconThreeDotsVertical.body, volume: iconVolume.body, x: iconX.body, + trash: iconTrash.body, } as {[key: string]: string} export default defineComponent({ props: { - icon: { type: String, required: true } + icon: { type: String, required: true }, + spin: { type: Boolean, default: false } }, computed: { path(): string { @@ -109,4 +112,9 @@ font-size: 125%; vertical-align: text-bottom; } + + .spin { + transform-origin: center; + animation: b-icon-animation-spin 2s linear infinite normal; + } From fb8fbeb7d86276242d01d8e04f88d5d6339edefe Mon Sep 17 00:00:00 2001 From: Artem Chulkov Date: Mon, 7 Aug 2023 03:24:38 +0500 Subject: [PATCH 2/5] add description cleaner, fix width of track number column --- package.json | 2 + src/library/podcast/PodcastDetails.vue | 2 +- src/library/track/CellActions.vue | 32 ++++++----- src/shared/api.ts | 5 +- src/style/table.scss | 2 +- yarn.lock | 80 +++++++++++++++++++++++++- 6 files changed, 103 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 69384d7..6c0fb7f 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@iconify-icons/bi": "^1.2.2", + "@types/sanitize-html": "^2.9.0", "@vueuse/core": "^10.2.1", "bootstrap": "^4.6.0", "bootstrap-vue": "^2.23.1", @@ -16,6 +17,7 @@ "lodash-es": "^4.17.21", "md5-es": "^1.8.2", "pinia": "^2.0.28", + "sanitize-html": "^2.11.0", "vue": "^2.7.0", "vue-infinite-loading": "^2.4.5", "vue-router": "^3.5.2", diff --git a/src/library/podcast/PodcastDetails.vue b/src/library/podcast/PodcastDetails.vue index 4bbd476..a268c28 100644 --- a/src/library/podcast/PodcastDetails.vue +++ b/src/library/podcast/PodcastDetails.vue @@ -39,7 +39,7 @@