@christianriedl/media 1.0.90 → 1.0.91

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.90",
3
+ "version": "1.0.91",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -3,31 +3,34 @@
3
3
  import { IRest, IRestResult, IValueResult, Rest } from '@christianriedl/rest';
4
4
  import { MediaService, getMediaSymbol } from '@christianriedl/media';
5
5
 
6
+ const props = defineProps<{ accept: string }>();
7
+
6
8
  const getMediaService = inject(getMediaSymbol)!;
7
9
  const mediaService = getMediaService();
8
10
  const feedBack = ref("");
9
11
  const name = ref("");
12
+ const files = ref<File[]>([]);
10
13
 
11
- async function onFileInput(event: any) {
12
- const files = event.target.files as File[];
14
+ async function onUpload() {
13
15
  feedBack.value = "Start Upload";
14
16
  let count = 0;
15
17
  let rc = false;
16
- for (let i = 0; i < files.length; i++) {
17
- if (files[i].size > 20000000) {
18
+ for (let i = 0; i < files.value.length; i++) {
19
+ var file = files.value[i];
20
+ if (file.size > 20000000) {
18
21
  // Big file
19
- rc = await mediaService.uploadBigFile(files[i], name.value, (progress) => feedBack.value = progress);
22
+ rc = await mediaService.uploadBigFile(file, name.value, (progress) => feedBack.value = progress);
20
23
  }
21
24
  else {
22
25
  const formData = new FormData()
23
- formData.append(name.value, files[i]);
26
+ formData.append(name.value, file);
24
27
  rc = await mediaService.upload(formData);
25
28
  }
26
29
  if (rc)
27
30
  count++;
28
- feedBack.value = `${files[i].name} : ${rc ? " - OK" : "- FAILED"}`;
31
+ feedBack.value = `${file.name} : ${rc ? " - OK" : "- FAILED"}`;
29
32
  }
30
- feedBack.value = `${count} von ${files.length} erfolgreich hochgeladen ! (Close : Upload Icon)`;
33
+ feedBack.value = `${count} von ${files.value.length} erfolgreich hochgeladen ! (Close : Upload Icon)`;
31
34
  }
32
35
  </script>
33
36
 
@@ -37,7 +40,9 @@
37
40
  <v-text-field name="directory" label="Name (Directory)" type="text" v-model="name" density="compact" hide-details></v-text-field>
38
41
  </v-col>
39
42
  <v-col cols="4">
40
- <input type="file" multiple @change="onFileInput">
43
+ <v-file-input show-size clearable multiple v-model="files" :accept="props.accept" label="Select File"
44
+ prepend-icon="" append-icon="$upload" @click:append="onUpload">
45
+ </v-file-input>
41
46
  </v-col>
42
47
  <v-col cols="6">{{feedBack}}
43
48
  </v-col>
@@ -361,7 +361,7 @@
361
361
  </v-card-actions>
362
362
  <v-progress-linear v-if="playingTrack" v-model="positionLength" color="blue" height="25"><strong>{{positionText}}</strong></v-progress-linear>
363
363
  </v-card>
364
- <file-upload v-if="uploadVisible"></file-upload>
364
+ <file-upload v-if="uploadVisible" accept="audio/mpeg, audio/flac"></file-upload>
365
365
  <v-card :height="listHeight" class="overflow-y-auto bg-media">
366
366
  <v-list lines="two" class="bg-media">
367
367
  <v-list-item-group v-model="itemIndex">
@@ -208,7 +208,7 @@
208
208
  </v-btn>
209
209
  </v-card-actions>
210
210
  </v-card>
211
- <file-upload v-if="uploadVisible"></file-upload>
211
+ <file-upload v-if="uploadVisible" accept="image/jpeg"></file-upload>
212
212
  <v-card :max-height="listHeight" class="overflow-y-auto bg-media" ref="scrollElement" v-scroll.self="onScroll">
213
213
  <v-list v-if="!grouped">
214
214
  <v-list-item v-for="item in items" :key="item.DLNAID" :title="item.info" density="compact" @click.stop="showFolder(item)">
@@ -248,7 +248,7 @@
248
248
  </v-btn>
249
249
  </v-card-actions>
250
250
  </v-card>
251
- <file-upload v-if="uploadVisible"></file-upload>
251
+ <file-upload v-if="uploadVisible" accept="video/mp4"></file-upload>
252
252
  <v-card :max-height="listHeight" class="overflow-y-auto bg-media">
253
253
  <v-list lines="two" class="bg-media">
254
254
  <v-list-item-group v-model="itemIndex">