@saooti/octopus-sdk 41.0.0 → 41.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/composable/radio/usefetchRadioData.ts +29 -12
- package/src/components/display/live/RadioCurrently.vue +2 -5
- package/src/components/misc/player/elements/PlayerTitle.vue +3 -3
- package/src/components/misc/player/radio/RadioHistory.vue +3 -2
- package/src/locale/de.ts +1 -0
- package/src/locale/en.ts +1 -0
- package/src/locale/es.ts +1 -0
- package/src/locale/fr.ts +1 -0
- package/src/locale/it.ts +1 -0
- package/src/locale/sl.ts +1 -0
- package/src/stores/PlayerStore.ts +1 -1
- package/src/stores/class/general/player.ts +2 -2
- package/src/helper/radio/radioHelper.ts +0 -15
package/package.json
CHANGED
|
@@ -2,17 +2,19 @@ import classicApi from "../../../api/classicApi";
|
|
|
2
2
|
import { MediaRadio, MetadataRadio, NextAdvertising } from '@/stores/class/general/player';
|
|
3
3
|
import { Podcast } from '@/stores/class/general/podcast';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
|
-
import radioHelper from "../../../helper/radio/radioHelper";
|
|
6
5
|
import {onBeforeUnmount, Ref, ref} from 'vue';
|
|
6
|
+
import { useI18n } from "vue-i18n";
|
|
7
7
|
export const useFetchRadio = ()=>{
|
|
8
8
|
|
|
9
9
|
const radioInterval : Ref<ReturnType<typeof setTimeout> | undefined> = ref(undefined);
|
|
10
|
+
|
|
11
|
+
const {t} = useI18n();
|
|
10
12
|
|
|
11
13
|
async function fetchRadioMetadata(
|
|
12
14
|
canalId: number,
|
|
13
15
|
previousTitle: string,
|
|
14
16
|
callbackMetadata: (
|
|
15
|
-
metadata: MediaRadio,
|
|
17
|
+
metadata: MediaRadio|undefined,
|
|
16
18
|
podcast: Podcast | undefined,
|
|
17
19
|
history: Array<MediaRadio>
|
|
18
20
|
) => void,
|
|
@@ -33,15 +35,19 @@ export const useFetchRadio = ()=>{
|
|
|
33
35
|
callbackAdvertising(metadata.nextAdvertising);
|
|
34
36
|
}
|
|
35
37
|
const arrayMetadata = metadata.previously;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
if(null!==metadata.currently){
|
|
39
|
+
arrayMetadata.unshift(metadata.currently);
|
|
40
|
+
for (let index = 0, len = arrayMetadata.length; index < len; index++) {
|
|
41
|
+
if (
|
|
42
|
+
dayjs().valueOf() - 18000 >
|
|
43
|
+
dayjs(arrayMetadata[index].startDate).valueOf()
|
|
44
|
+
) {
|
|
45
|
+
await useCallbackIfNewMetadata(previousTitle, arrayMetadata, index, len,callbackMetadata);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
44
48
|
}
|
|
49
|
+
}else{
|
|
50
|
+
callbackMetadata(undefined, undefined, arrayMetadata);
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
async function useCallbackIfNewMetadata(previousTitle: string, arrayMetadata: Array<MediaRadio>, index:number, len: number, callbackMetadata: (
|
|
@@ -63,11 +69,22 @@ export const useFetchRadio = ()=>{
|
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
|
-
function displayTitle(metadata: MediaRadio): string {
|
|
67
|
-
|
|
72
|
+
function displayTitle(metadata: MediaRadio|undefined): string {
|
|
73
|
+
if(!metadata){
|
|
74
|
+
return t("Silent stream");
|
|
75
|
+
}
|
|
76
|
+
let title = "";
|
|
77
|
+
if (metadata?.title) {
|
|
78
|
+
title += metadata.title;
|
|
79
|
+
}
|
|
80
|
+
if (metadata?.artist) {
|
|
81
|
+
title += " - " + metadata.artist;
|
|
82
|
+
}
|
|
83
|
+
return title;
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
|
|
87
|
+
|
|
71
88
|
onBeforeUnmount(() => {
|
|
72
89
|
clearInterval(radioInterval.value as unknown as number);
|
|
73
90
|
})
|
|
@@ -72,10 +72,7 @@ const currentlyPlayingString = computed(() => {
|
|
|
72
72
|
if (playingRadio.value && playerStore.playerRadio) {
|
|
73
73
|
return displayTitle(playerStore.playerRadio.metadata);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
return displayTitle(currentMetadata.value);
|
|
77
|
-
}
|
|
78
|
-
return "";
|
|
75
|
+
return displayTitle(currentMetadata.value);
|
|
79
76
|
});
|
|
80
77
|
|
|
81
78
|
onMounted(()=>{
|
|
@@ -102,7 +99,7 @@ async function fetchCurrentlyPlaying(): Promise<void> {
|
|
|
102
99
|
updateMetadata,
|
|
103
100
|
);
|
|
104
101
|
}
|
|
105
|
-
function updateMetadata(metadata: MediaRadio, podcast?: Podcast): void {
|
|
102
|
+
function updateMetadata(metadata: MediaRadio|undefined, podcast?: Podcast): void {
|
|
106
103
|
currentMetadata.value = metadata;
|
|
107
104
|
currentPodcast.value = podcast;
|
|
108
105
|
}
|
|
@@ -89,7 +89,7 @@ onUnmounted(()=>{
|
|
|
89
89
|
async function fetchCurrentlyPlaying(): Promise<void> {
|
|
90
90
|
fetchRadioMetadata(
|
|
91
91
|
playerStore.playerRadio?.canalId ?? 0,
|
|
92
|
-
playerStore.playerRadio?.metadata
|
|
92
|
+
playerStore.playerRadio?.metadata?.title ?? "",
|
|
93
93
|
updateMetadata,
|
|
94
94
|
updateAdvertising,
|
|
95
95
|
);
|
|
@@ -98,11 +98,11 @@ function updateAdvertising(nextAdvertising: NextAdvertising): void {
|
|
|
98
98
|
playerStore.playerRadioUpdateNextAdvertising(nextAdvertising);
|
|
99
99
|
}
|
|
100
100
|
function updateMetadata(
|
|
101
|
-
metadata: MediaRadio,
|
|
101
|
+
metadata: MediaRadio|undefined,
|
|
102
102
|
podcast: Podcast | undefined,
|
|
103
103
|
history: Array<MediaRadio>,
|
|
104
104
|
): void {
|
|
105
|
-
playerStore.playerMetadata(metadata, history);
|
|
105
|
+
playerStore.playerMetadata(metadata, history); //TODO
|
|
106
106
|
playerStore.playerRadioPodcast(podcast);
|
|
107
107
|
}
|
|
108
108
|
</script>
|
|
@@ -40,10 +40,10 @@ import ChevronLeftIcon from "vue-material-design-icons/ChevronLeft.vue";
|
|
|
40
40
|
import ChevronRightIcon from "vue-material-design-icons/ChevronRight.vue";
|
|
41
41
|
import { usePlayerStore } from "../../../../stores/PlayerStore";
|
|
42
42
|
import dayjs from "dayjs";
|
|
43
|
-
import radioHelper from "../../../../helper/radio/radioHelper";
|
|
44
43
|
import { computed, nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch } from "vue";
|
|
45
44
|
import { MediaRadio } from "@/stores/class/general/player";
|
|
46
45
|
import { useI18n } from "vue-i18n";
|
|
46
|
+
import { useFetchRadio } from "@/components/composable/radio/usefetchRadioData";
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
//Data
|
|
@@ -54,6 +54,7 @@ const historyListContainerRef = useTemplateRef('historyListContainer');
|
|
|
54
54
|
//Composables
|
|
55
55
|
const { t } = useI18n();
|
|
56
56
|
const playerStore = usePlayerStore();
|
|
57
|
+
const {displayTitle} = useFetchRadio();
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
//Computed
|
|
@@ -119,7 +120,7 @@ function displayPreviousItem(item: MediaRadio): string {
|
|
|
119
120
|
if (item.podcastId) {
|
|
120
121
|
return item.title;
|
|
121
122
|
}
|
|
122
|
-
return
|
|
123
|
+
return displayTitle(item);
|
|
123
124
|
}
|
|
124
125
|
</script>
|
|
125
126
|
<style lang="scss">
|
package/src/locale/de.ts
CHANGED
package/src/locale/en.ts
CHANGED
package/src/locale/es.ts
CHANGED
package/src/locale/fr.ts
CHANGED
package/src/locale/it.ts
CHANGED
package/src/locale/sl.ts
CHANGED
|
@@ -210,7 +210,7 @@ export const usePlayerStore = defineStore("PlayerStore", {
|
|
|
210
210
|
playerUpdateSeekTime(seekTime: number) {
|
|
211
211
|
this.playerSeekTime = seekTime;
|
|
212
212
|
},
|
|
213
|
-
playerMetadata(metadata: MediaRadio, history: Array<MediaRadio>) {
|
|
213
|
+
playerMetadata(metadata: MediaRadio|undefined, history: Array<MediaRadio>) {
|
|
214
214
|
if (!this.playerRadio) {
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
@@ -4,7 +4,7 @@ import { Podcast } from "./podcast";
|
|
|
4
4
|
export interface Radio {
|
|
5
5
|
canalId: number;
|
|
6
6
|
url: string;
|
|
7
|
-
metadata
|
|
7
|
+
metadata?: MediaRadio;
|
|
8
8
|
history: Array<MediaRadio>;
|
|
9
9
|
nextAdvertising: NextAdvertising;
|
|
10
10
|
isInit: boolean;
|
|
@@ -30,7 +30,7 @@ export interface NextAdvertising {
|
|
|
30
30
|
|
|
31
31
|
export interface MetadataRadio {
|
|
32
32
|
channelId: number;
|
|
33
|
-
currently: MediaRadio;
|
|
33
|
+
currently: MediaRadio|null;
|
|
34
34
|
previously: Array<MediaRadio>;
|
|
35
35
|
nextAdvertising: NextAdvertising;
|
|
36
36
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { MediaRadio } from "@/stores/class/general/player";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
displayTitle(metadata: MediaRadio): string {
|
|
5
|
-
let title = "";
|
|
6
|
-
if (metadata.title) {
|
|
7
|
-
title += metadata.title;
|
|
8
|
-
}
|
|
9
|
-
if (metadata.artist) {
|
|
10
|
-
title += " - " + metadata.artist;
|
|
11
|
-
}
|
|
12
|
-
return title;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|