@saooti/octopus-sdk 36.0.12 → 36.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "36.0.12",
3
+ "version": "36.0.13",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -244,7 +244,7 @@ export default defineComponent({
244
244
  if (
245
245
  undefined !== this.podcast &&(
246
246
  (this.playerPodcast?.podcastId ===this.podcast.podcastId) ||
247
- (this.playerLive?.livePodcastId ===this.podcast.podcastId))
247
+ (this.playerLive?.podcastId ===this.podcast.podcastId))
248
248
  ) {
249
249
  timeline = Math.round(
250
250
  this.playerElapsed * this.playerTotal
@@ -88,7 +88,7 @@ export default defineComponent({
88
88
  this.fetchCurrentlyPlaying();
89
89
  this.radioInterval = setInterval(() => {
90
90
  this.fetchCurrentlyPlaying();
91
- }, 1000);
91
+ }, 5000);
92
92
  },
93
93
  methods: {
94
94
  async fetchCurrentlyPlaying(): Promise<void>{
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <div class="module-box">
3
+ <h2 class="big-h2 mb-3 height-40">{{ $t('Program') }}</h2>
4
+ <div class="border">
5
+ <div class="d-flex align-items-center w-100">
6
+ <button
7
+ v-for="day in arrayDays"
8
+ :key="day.date"
9
+ class="d-flex flex-column align-items-center flex-grow-1"
10
+ :class="day.date==daySelected?'bg-primary text-white':''"
11
+ @click="changeDate(day.date)"
12
+ >
13
+ <span class="text-capitalize">{{day.dayOfWeek}}</span>
14
+ <span>{{day.title}}</span>
15
+ </button>
16
+ </div>
17
+ <div class="d-flex flex-column p-3">
18
+ <ClassicLoading
19
+ :loading-text="loading?$t('Loading content ...'):undefined"
20
+ :error-text="error?$t(`Error`):undefined"
21
+ />
22
+ <template v-if="!loading && !error">
23
+ <div v-if="!planning[daySelected].length" class="text-center">{{$t('No programming')}}</div>
24
+ <div
25
+ v-else
26
+ v-for="planningItem in planning[daySelected]"
27
+ :key="planningItem.occurrence.occurrenceId"
28
+ class="d-flex align-items-center mb-3"
29
+ >
30
+ <div class="program-item-date fw-bold flex-shrink-0">{{dateDisplay(planningItem.occurrence.startDate)}}</div>
31
+ <component
32
+ :is="planningItem.podcast.availability.visibility ? 'router-link' : 'div'"
33
+ class="d-flex align-items-center text-dark"
34
+ :to="{
35
+ name: 'podcast',
36
+ params: { podcastId: planningItem.podcast.podcastId },
37
+ query: { productor: filterOrgaId },
38
+ }"
39
+ >
40
+ <img
41
+ v-lazy="proxyImageUrl(planningItem.podcast.imageUrl, '150')"
42
+ width="150"
43
+ height="150"
44
+ class="m-2"
45
+ :title="$t('Episode name image', {name:planningItem.podcast.title})"
46
+ :alt="$t('Episode name image', {name:planningItem.podcast.title})"
47
+ >
48
+ <div class="d-flex flex-column">
49
+ <div class="flex-grow-1 text-truncate mb-2">{{planningItem.occurrence.podcastData.title}}</div>
50
+ <ParticipantDescription
51
+ :participants="planningItem.podcast.animators"
52
+ />
53
+ </div>
54
+ </component>
55
+
56
+ </div>
57
+ </template>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </template>
62
+
63
+ <script lang="ts">
64
+ import { useFilterStore } from '@/stores/FilterStore';
65
+ import { mapState } from 'pinia';
66
+ import dayjs from 'dayjs';
67
+ import utc from 'dayjs/plugin/utc';
68
+ dayjs.extend(utc);
69
+ import octopusApi from '@saooti/octopus-api';
70
+ import imageProxy from '../../mixins/imageProxy';
71
+ import ParticipantDescription from '../podcasts/ParticipantDescription.vue';
72
+ import ClassicLoading from '../../form/ClassicLoading.vue';
73
+ import { defineComponent } from 'vue';
74
+ import { Canal } from '@/stores/class/radio/canal';
75
+ import { PlanningOccurrence } from '@/stores/class/radio/recurrence';
76
+ import { Podcast } from '@/stores/class/general/podcast';
77
+ export default defineComponent({
78
+ name: 'RadioPlanning',
79
+
80
+ components: {
81
+ ClassicLoading,
82
+ ParticipantDescription
83
+ },
84
+
85
+ props: {
86
+ radio: { default: undefined, type: Object as ()=>Canal},
87
+ },
88
+
89
+ mixins: [imageProxy],
90
+
91
+ data() {
92
+ return {
93
+ planning: {} as {[key: number]:Array<{podcast: Podcast, occurrence: PlanningOccurrence}>},
94
+ daySelected: dayjs().valueOf(),
95
+ arrayDays: [] as Array<{title: string, date: number, dayOfWeek: string }>,
96
+ loading: true as boolean,
97
+ error: false as boolean,
98
+ };
99
+ },
100
+
101
+ computed:{
102
+ ...mapState(useFilterStore, ['filterOrgaId']),
103
+ startOfDay(): number{
104
+ return dayjs(this.daySelected).utcOffset(0).startOf('date').valueOf();
105
+ },
106
+ endOfDay(): number{
107
+ return dayjs(this.daySelected).utcOffset(0).endOf('date').valueOf();
108
+ },
109
+ },
110
+
111
+ mounted(){
112
+ this.createArrayDays();
113
+ this.fetchOccurrences();
114
+ },
115
+
116
+ methods: {
117
+ createArrayDays(){
118
+ for (let index = -7; index < 3; index++) {
119
+ const dayToAdd = dayjs().add(index, 'day');
120
+ if(0===index){
121
+ this.daySelected = dayToAdd.valueOf();
122
+ }
123
+ this.arrayDays.push({title: dayToAdd.format('D/MM'), dayOfWeek:dayToAdd.format('dddd'), date : dayToAdd.valueOf()});
124
+ }
125
+ },
126
+ async fetchOccurrences(): Promise<void>{
127
+ if(this.planning[this.daySelected]){return;}
128
+ this.loading = true;
129
+ this.error = false;
130
+ try {
131
+ const occurrences = await octopusApi.fetchDataWithParams<Array<PlanningOccurrence>>( 14, 'planning/occurrence/list',{
132
+ canalId: this.radio?.id,
133
+ from: this.startOfDay,
134
+ to: this.endOfDay
135
+ });
136
+ this.planning[this.daySelected] = [];
137
+ for (let oc of occurrences) {
138
+ if(oc.podcastId){
139
+ const data : Podcast = await octopusApi.fetchData<Podcast>(0, 'podcast/'+oc.podcastId);
140
+ this.planning[this.daySelected].push({podcast: data, occurrence:oc});
141
+ }
142
+ }
143
+ } catch {
144
+ this.error = true;
145
+ }
146
+ this.loading = false;
147
+ },
148
+ changeDate(date: number){
149
+ this.daySelected = date;
150
+ this.fetchOccurrences();
151
+ },
152
+ dateDisplay(date: Date): string{
153
+ return dayjs(date).format('HH:mm:ss');
154
+ }
155
+ },
156
+ })
157
+ </script>
158
+ <style lang="scss">
159
+ .octopus-app{
160
+ .program-item-date{
161
+ width: 100px;
162
+ }
163
+ }
164
+ </style>
@@ -266,14 +266,7 @@ export default defineComponent({
266
266
  if (!this.recordingLive) {
267
267
  this.playerPlay(this.podcast);
268
268
  }else{
269
- this.playerPlay({
270
- title: this.podcast.title,
271
- audioUrl: this.podcast.audioUrl,
272
- duration: this.podcast.duration,
273
- conferenceId: this.fetchConference?.conferenceId,
274
- livePodcastId: this.podcast.podcastId,
275
- organisation: this.podcast.organisation,
276
- });
269
+ this.playerPlay({...this.podcast, ...{conferenceId:this.fetchConference?.conferenceId}});
277
270
  }
278
271
  if(this.clickPlayGoPage){
279
272
  this.$router.push('/main/pub/podcast/'+this.podcast.podcastId);
@@ -322,7 +315,7 @@ export default defineComponent({
322
315
  background-color: rgba(255, 255, 255, 0.5);
323
316
  }
324
317
 
325
- .play-button-error-icon {
318
+ .image-play-button .play-button-error-icon {
326
319
  background: #0000009d !important;
327
320
  cursor: default !important;
328
321
  align-self: center;
@@ -70,7 +70,7 @@ export const playerComment = defineComponent({
70
70
  podcastId = this.playerPodcast.podcastId;
71
71
  organisation = this.playerPodcast.organisation.id;
72
72
  } else if (this.playerLive) {
73
- podcastId = this.playerLive.livePodcastId;
73
+ podcastId = this.playerLive.podcastId;
74
74
  organisation = this.playerLive.organisation.id;
75
75
  }
76
76
  if (
@@ -61,17 +61,17 @@ export const playerLive = defineComponent({
61
61
  }
62
62
  },
63
63
  async initLiveDownloadId(){
64
- if(!this.playerLive){ return;}
65
- let downloadId = null;
64
+ if(!this.playerLive || this.downloadId){ return;}
66
65
  try {
67
- downloadId = await octopusApi.putDataPublic<string | null>(0, 'podcast/prepare/live/'+this.playerLive.livePodcastId, undefined);
68
- await octopusApi.fetchDataPublicWithParams<string | null>(0,'podcast/download/live/' + this.playerLive.livePodcastId+".m3u8",{
66
+ let downloadId = await octopusApi.putDataPublic<string | null>(0, 'podcast/prepare/live/'+this.playerLive.podcastId, undefined);
67
+ await octopusApi.fetchDataPublicWithParams<string | null>(0,'podcast/download/live/' +this.playerLive.podcastId +".m3u8",{
69
68
  'downloadId': null!==downloadId ? downloadId : undefined,
70
69
  'origin':'octopus',
71
70
  'distributorId':this.authOrgaId
72
71
  });
73
72
  this.setDownloadId(downloadId);
74
73
  } catch (error) {
74
+ this.downloadId = null;
75
75
  console.log('ERROR downloadId');
76
76
  }
77
77
  this.hlsReady = true;
@@ -28,6 +28,9 @@
28
28
  :radio="radio"
29
29
  />
30
30
  </div>
31
+ <RadioPlanning
32
+ :radio="radio"
33
+ />
31
34
  <SharePlayerRadio
32
35
  v-if="authenticated"
33
36
  :canal="radio"
@@ -59,6 +62,7 @@ const ShareButtons = defineAsyncComponent(() => import('../display/sharing/Share
59
62
  const EditBoxRadio = defineAsyncComponent(() => import('@/components/display/edit/EditBoxRadio.vue'));
60
63
  const RadioCurrently = defineAsyncComponent(() => import('../display/live/RadioCurrently.vue'));
61
64
  const RadioImage = defineAsyncComponent(() => import('../display/live/RadioImage.vue'));
65
+ const RadioPlanning = defineAsyncComponent(() => import('../display/live/RadioPlanning.vue'));
62
66
  export default defineComponent({
63
67
  components: {
64
68
  SharePlayerRadio,
@@ -66,7 +70,8 @@ export default defineComponent({
66
70
  EditBoxRadio,
67
71
  ClassicLoading,
68
72
  RadioCurrently,
69
- RadioImage
73
+ RadioImage,
74
+ RadioPlanning
70
75
  },
71
76
  mixins: [displayMethods, handle403, orgaComputed, imageProxy],
72
77
  props: {
package/src/locale/fr.ts CHANGED
@@ -329,4 +329,7 @@ export default{
329
329
  'In the process of being published': 'En cours de publication',
330
330
  "Radio":"Radio",
331
331
  "Currently":"Actuellement",
332
+
333
+ "Program":"Programme",
334
+ "No programming":"Aucune programmation",
332
335
  };
@@ -39,7 +39,6 @@ export interface Podcast {
39
39
  title: string;
40
40
  weekDownloadCount?: number;
41
41
  order?: number;
42
- livePodcastId?: number
43
42
  }
44
43
  export function emptyPodcastData(): Podcast {
45
44
  return {