@christianriedl/media 1.0.14 → 1.0.17

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": "@christianriedl/media",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -5,34 +5,36 @@
5
5
 
6
6
  const getMediaService = inject<() => MediaService>('get-media')!;
7
7
  const mediaService = getMediaService();
8
- const fileInput = ref<HTMLInputElement | null>(null);
9
- const loadResult = ref("");
8
+ const feedBack = ref("");
9
+ const name = ref("");
10
10
 
11
11
  async function onFileInput(event: any) {
12
- const files = event.target.files
13
- const formData = new FormData()
14
- formData.append('upload', files[0]);
15
- loadResult.value = "Start upload";
16
- const rc = await mediaService.upload(formData);
17
- loadResult.value = rc ? "Upload successful" : "Upload failed";
18
- }
19
- /*
20
- function onUpload(ev : InputEvent) {
21
- const file = fileInput.value!.files![0];
22
- const reader = new FileReader();
23
- loadResult.value = "start upload ...";
24
- reader.onload = async (e) => {
25
- var text = reader.result;
26
- var res = await stocks.upload(text as string);
27
- loadResult.value = res;
12
+ const files = event.target.files as File[];
13
+ feedBack.value = "Start Upload";
14
+ let count = 0;
15
+ for (let i = 0; i < files.length; i++) {
16
+ const formData = new FormData()
17
+ formData.append(name.value, files[i]);
18
+ const rc = await mediaService.upload(formData);
19
+ if (rc)
20
+ count++;
21
+ feedBack.value = `${files[i].name} : ${rc ? " - OK" : "- FAILED" }`;
28
22
  }
29
- reader.readAsText(file);
23
+ feedBack.value = `${count} von ${files.length} erfolgreich hochgeladen ! (Close : Upload Icon)`;
30
24
  }
31
- */
32
25
  </script>
33
26
 
34
27
  <template>
35
- <input ref="fileInput" type="file" style="width:25%" @change="onFileInput">
28
+ <v-row>
29
+ <v-col cols="2">
30
+ <v-text-field name="directory" label="Name (Directory)" type="text" v-model="name" density="compact" hide-details></v-text-field>
31
+ </v-col>
32
+ <v-col cols="4">
33
+ <input type="file" multiple @change="onFileInput">
34
+ </v-col>
35
+ <v-col cols="6">{{feedBack}}
36
+ </v-col>
37
+ </v-row>
36
38
  <!--
37
39
  <v-col cols="2">
38
40
  <v-btn @click="onUpload">
@@ -3,6 +3,7 @@
3
3
  import { IAppState, Helper } from '@christianriedl/utils';
4
4
  import { Authorize, EScope } from '@christianriedl/rest';
5
5
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IAudioFile, MediaService, EPlayState, PlayerService } from '@christianriedl/media';
6
+ import FileUpload from '../components/FileUpload.vue';
6
7
 
7
8
  const appState = inject<IAppState>('appstate')!;
8
9
  const authorize = inject<Authorize>('authorize')!;
@@ -28,6 +29,7 @@
28
29
  const playIndex = ref(-1);
29
30
  const volume = ref(0);
30
31
  const mute = ref(false);
32
+ const uploadVisible = ref(false);
31
33
 
32
34
  const isLocal = computed(() => currentPlayer.value == 'Local');
33
35
  const backVisible = computed(() => selected.value.ItemType != EItemType.AudioRoot);
@@ -315,6 +317,12 @@
315
317
  dense solo hide-details single-line>
316
318
  </v-select>
317
319
  </v-col>
320
+ <v-col v-else cols="4" lign-self="end">
321
+ <v-btn v-if="!isMobile" @click="uploadVisible = !uploadVisible">
322
+ UPLOAD
323
+ <v-icon>{{$vuetify.icons.values.upload}}</v-icon>
324
+ </v-btn>
325
+ </v-col>
318
326
  </v-row>
319
327
  </v-list-item>
320
328
  <v-card-actions>
@@ -342,16 +350,17 @@
342
350
  <v-icon>{{$vuetify.icons.values.download}}</v-icon>
343
351
  </v-btn>
344
352
  <v-slider v-if="!isLocal && playingTrack" style="width:30%" color="red" track-color="blue" track-fill-color="red" v-model="volume" hide-details density="compact"
345
- min="0" max="100" step="5" @update:modelValue="changeVolume">
353
+ min="0" max="100" step="5" @update:modelValue="changeVolume">
346
354
  </v-slider>
347
355
  </v-card-actions>
348
356
  <v-progress-linear v-if="playingTrack" v-model="positionLength" color="blue" height="25"><strong>{{positionText}}</strong></v-progress-linear>
349
357
  </v-card>
358
+ <file-upload v-if="uploadVisible"></file-upload>
350
359
  <v-card :height="listHeight" class="overflow-y-auto bg-media">
351
360
  <v-list two-line class="bg-media">
352
- <v-list-item-group v-model="itemIndex" >
353
- <v-list-item v-for="(item,index) in items" :key="item.DLNAID" :title="item.title" :subtitle="item.subTitle"
354
- active-color="blue" :active="index == playIndex" @click="listItem(item)">
361
+ <v-list-item-group v-model="itemIndex">
362
+ <v-list-item v-for="(item,index) in items" :key="item.DLNAID" :title="item.title" :subtitle="item.subTitle"
363
+ active-color="blue" :active="index == playIndex" @click="listItem(item)">
355
364
  <!--
356
365
  <v-list-item-content>
357
366
  <v-list-item-title v-html="item.title"></v-list-item-title>
@@ -4,7 +4,7 @@
4
4
  import { useRouter } from 'vue-router';
5
5
  import { IAppState } from '@christianriedl/utils';
6
6
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IPhotoSelection, MediaService } from '@christianriedl/media';
7
- import FileUpload from '../components/FileUpload.vue'
7
+ import FileUpload from '../components/FileUpload.vue';
8
8
 
9
9
  const appState = inject<IAppState>('appstate')!;
10
10
  const getMediaService = inject<() => MediaService>('get-media')!;
@@ -18,6 +18,7 @@
18
18
  const selected = reactive<IPhotoSelection>(mediaService.photoSelection);
19
19
  const listHeight = ref(0);
20
20
  const listhead = ref<any>(null);
21
+ const uploadVisible = ref(false);
21
22
 
22
23
  const roots: string[] = ['Jahr', 'Orte', 'Ereignisse', 'Personen'];
23
24
  const criterias: string[] = ['ye', 'lo', 'ev', 'pe'];
@@ -161,15 +162,19 @@
161
162
  <v-icon large>{{$vuetify.icons.values.back}}</v-icon>Back
162
163
  </v-btn>
163
164
  <v-rating clearable length="2" v-model="selected.rating" @update:modelValue="onRating" />
164
- <v-select v-model="selected.root"
165
- :items="roots"
166
- persistent-hint
167
- @update:modelValue="onRootChange"
168
- dense solo hide-details single-line>
165
+ <v-select v-model="selected.root"
166
+ :items="roots"
167
+ persistent-hint
168
+ @update:modelValue="onRootChange"
169
+ dense solo hide-details single-line>
169
170
  </v-select>
170
- <file-upload></file-upload>
171
+ <v-btn v-if="!isMobile" @click="uploadVisible = !uploadVisible">
172
+ UPLOAD
173
+ <v-icon>{{$vuetify.icons.values.upload}}</v-icon>
174
+ </v-btn>
171
175
  </v-card-actions>
172
176
  </v-card>
177
+ <file-upload v-if="uploadVisible"></file-upload>
173
178
  <v-card :max-height="listHeight" class="overflow-y-auto">
174
179
  <v-list v-if="!grouped" class="bg-media" >
175
180
  <v-list-item-group v-model="itemIndex" color="primary">