@christianriedl/media 1.0.292 → 1.0.294

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.292",
3
+ "version": "1.0.294",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "author": "Christian Riedl",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@christianriedl/utils": "^1.0.200",
21
+ "@christianriedl/utils": "^1.0.201",
22
22
  "@christianriedl/rest": "^1.0.97",
23
23
  "@christianriedl/epg": "^1.0.44",
24
24
  "buffer": "^6.0.3"
@@ -2,16 +2,14 @@
2
2
  <script setup lang="ts">
3
3
  import { inject, ref, toRef, computed, onMounted, watch } from 'vue';
4
4
  import { GoogleMap } from 'vue3-google-map'
5
- import { authorizeSymbol } from '@christianriedl/rest';
6
5
  import { IPhotoMarker, IPhotoRegion, IPictureFile, getMediaBinSymbol, EOrientation, MediaHelper } from '@christianriedl/media';
7
6
 
8
- const props = defineProps<{ location: string, zoom: number, selectRegion?: IPhotoRegion, fotos?: IPhotoMarker[] }>();
7
+ const props = defineProps<{ googleApiKey: string, location: string, zoom: number, selectRegion?: IPhotoRegion, fotos?: IPhotoMarker[] }>();
9
8
  const emits = defineEmits<{ (e: 'select', value: IPhotoRegion): void }>();
10
9
 
11
- const authorize = inject(authorizeSymbol)!;
12
- const apiKey = authorize.keyGoogleMaps;
13
- const getMediaService = inject(getMediaBinSymbol)!;
14
- const mediaService = getMediaService() ;
10
+ const apiKey = props.googleApiKey;
11
+ const getMediaService = inject(getMediaBinSymbol);
12
+ const mediaService = getMediaService ?? getMediaService() : null;
15
13
 
16
14
  const mapRef = ref(GoogleMap);
17
15
  const mapSizeStyle = computed(() => {
@@ -229,8 +227,8 @@
229
227
  photoLeft.value = { 'left': left + 'px' };
230
228
  photoHeight.value = Math.floor(h * fac);
231
229
  photoWidth.value = Math.floor(w * fac);
232
- const albumUrl = mediaService.getFolder(photo.dlnaParentId).url;
233
- photoUrl = mediaService.getPhotoUrl(albumUrl, photo.url, `${0}x${photoHeight.value}x${photo.orientation}x70`);
230
+ const albumUrl = mediaService!.getFolder(photo.dlnaParentId).url;
231
+ photoUrl = mediaService!.getPhotoUrl(albumUrl, photo.url, `${0}x${photoHeight.value}x${photo.orientation}x70`);
234
232
  console.log (`left:${left} w:${photoWidth.value} h:${photoHeight.value} : ${photoUrl}`);
235
233
  photoTitle = photo.title ? photo.title : photo.name;
236
234
  showPhoto.value = true;
@@ -3,7 +3,7 @@
3
3
  import { Dictionary, Helper } from '@christianriedl/utils';
4
4
  import { IPictureFile, EOrientation, EPictureFlags, getMediaBinSymbol } from '@christianriedl/media';
5
5
 
6
- const props = defineProps<{ file: IPictureFile, all: boolean, splitxmp: boolean }>();
6
+ const props = defineProps<{ file: IPictureFile, all: boolean, splitxmp: boolean, metadata?: Dictionary<any> }>();
7
7
 
8
8
  interface ITree {
9
9
  id: number;
@@ -15,24 +15,34 @@
15
15
  const properties = ref<Dictionary<any>>({});
16
16
  const propertiesVisible = ref(false);
17
17
  const getMediaService = inject(getMediaBinSymbol)!;
18
- const mediaService = getMediaService();
18
+ const mediaService = getMediaService ? getMediaService() : null;
19
19
  const treeColumns = computed(() => props.splitxmp ? 3 : 2);
20
20
  let metadata: Dictionary<any>;
21
21
  let allMetaData: Dictionary<any>;
22
-
23
- watch(() => props.all, async () => await fetchMetaData(), { immediate: true });
24
- watch(() => props.splitxmp, () => buildTree());
25
-
22
+ if (props.metadata) {
23
+ if (props.all) {
24
+ allMetaData = props.metadata;
25
+ buildTree();
26
+ }
27
+ else {
28
+ setMetaData(props.metadata, props.file);
29
+ properties.value = metadata;
30
+ }
31
+ }
32
+ else {
33
+ watch(() => props.all, async () => await fetchMetaData(), { immediate: true });
34
+ watch(() => props.splitxmp, () => buildTree());
35
+ }
26
36
  async function fetchMetaData() {
27
37
  if (props.all) {
28
38
  if (!allMetaData) {
29
- allMetaData = await mediaService.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
39
+ allMetaData = await mediaService!.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
30
40
  }
31
41
  buildTree();
32
42
  }
33
43
  else {
34
44
  if (!metadata) {
35
- const data = await mediaService.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
45
+ const data = await mediaService!.getExifInfo(props.file.dlnaParentId, props.file.dlnaid, props.all, props.splitxmp);
36
46
  setMetaData(data, props.file);
37
47
  }
38
48
  properties.value = metadata;
@@ -177,26 +187,33 @@
177
187
  </script>
178
188
  <template>
179
189
  <v-container v-if="props.all">
180
- <v-row density="compact">
181
- <v-col :cols="treeColumns">
182
- <v-treeview :items="tree" item-value="id" open-all activatable slim active-startegy="leaf"
183
- density="compact" @update:activated="onSelectTree">
184
- </v-treeview>
185
- </v-col>
186
- <v-col v-if="propertiesVisible" :cols="12 - treeColumns">
187
- <v-row density="compact" v-for="(prop,key) in properties" :key="key">
188
- <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
189
- <v-col cols="8">{{prop}}</v-col>
190
- <v-divider></v-divider>
191
- </v-row>
192
- </v-col>
193
- </v-row>
190
+ <v-row density="compact">
191
+ <v-col :cols="treeColumns">
192
+ <v-treeview :items="tree" item-value="id" open-all activatable slim active-startegy="leaf"
193
+ density="compact" @update:activated="onSelectTree">
194
+ </v-treeview>
195
+ </v-col>
196
+ <v-col v-if="propertiesVisible" :cols="12 - treeColumns">
197
+ <v-row density="compact" v-for="(prop,key) in properties" :key="key">
198
+ <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
199
+ <v-col cols="8">{{prop}}</v-col>
200
+ <v-divider></v-divider>
201
+ </v-row>
202
+ </v-col>
203
+ </v-row>
194
204
  </v-container>
195
205
  <v-container v-else>
196
- <v-row v-for="(value, key) in properties" :key="key">
197
- <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
198
- <v-col cols="8">{{value}}</v-col>
199
- <v-divider></v-divider>
200
- </v-row>
206
+ <v-row v-for="(value, key) in properties" :key="key">
207
+ <v-col cols="4" class="font-weight-bold">{{key}}</v-col>
208
+ <v-col cols="8">{{value}}</v-col>
209
+ <v-divider></v-divider>
210
+ </v-row>
201
211
  </v-container>
202
212
  </template>
213
+
214
+ <style scoped>
215
+ .v-row--density-default {
216
+ --v-col-gap-x: 0px;
217
+ --v-col-gap-y: 0px;
218
+ }
219
+ </style>
@@ -7,6 +7,7 @@
7
7
  EMediaType, EPictureFlags, IPictureFile, IMediaFolder, IMediaService, IMediaAppConfig, EPictureQuality,
8
8
  MediaHelper, getMediaBinSymbol, getPlayerSymbol
9
9
  } from '@christianriedl/media';
10
+ import { authorizeSymbol } from '@christianriedl/rest';
10
11
 
11
12
  import PhotoMetaData from '../components/PhotoMetaData.vue';
12
13
  import PhotoMap from '../components/PhotoMap.vue';
@@ -15,6 +16,8 @@
15
16
 
16
17
  const router = useRouter();
17
18
  const route = useRoute();
19
+ const authorize = inject(authorizeSymbol)!;
20
+ const googleApiKey = authorize.keyGoogleMaps;
18
21
  const appState = inject(appStateSymbol)!;
19
22
  const appConfig = inject(appConfigSymbol)!;
20
23
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
@@ -481,7 +484,7 @@
481
484
  <v-dialog v-model="showMap" :fullscreen="isMobile" width="50%">
482
485
  <v-card>
483
486
  <v-card-text>
484
- <photo-map :location="location" :zoom="zoom"></photo-map>
487
+ <photo-map :googleApiKey="googleApiKey" :location="location" :zoom="zoom"></photo-map>
485
488
  </v-card-text>
486
489
  <v-card-actions>
487
490
  <v-btn size="large" @click="showMap = false">
@@ -2,7 +2,7 @@
2
2
  import { inject, ref, shallowRef, computed, onMounted, StyleValue } from 'vue';
3
3
  import { useRouter, useRoute } from 'vue-router';
4
4
  import { IAppState, appStateSymbol, IAppConfig, appConfigSymbol, EDevice, Helper } from '@christianriedl/utils';
5
- import { IRestResult, IValueResult } from '@christianriedl/rest';
5
+ import { IRestResult, IValueResult, authorizeSymbol } from '@christianriedl/rest';
6
6
  import { EOrientation, EMediaType, IMediaFolder, IPictureFile, IMediaService, IMediaAppConfig,
7
7
  EPictureFlags, getMediaBinSymbol, MediaHelper, IPhotoRegion, IPhotoMarker
8
8
  } from '@christianriedl/media';
@@ -13,7 +13,10 @@
13
13
  const appConfig = inject(appConfigSymbol)!;
14
14
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
15
15
  const getMediaService = inject(getMediaBinSymbol)!;
16
- const mediaService = getMediaService() ;
16
+ const mediaService = getMediaService();
17
+ const authorize = inject(authorizeSymbol)!;
18
+ const googleApiKey = authorize.keyGoogleMaps;
19
+
17
20
  const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
18
21
  const isMobile = appState.isMobile && appState.device !== EDevice.iPad;
19
22
  const router = useRouter();
@@ -299,7 +302,7 @@
299
302
  <v-dialog v-model="showMap">
300
303
  <v-card>
301
304
  <v-card-text>
302
- <photo-map :location="center" :zoom="zoom" :selectRegion="selectedRegion" :fotos="foundFotos" @select="onGpsSelect"></photo-map>
305
+ <photo-map :googleApiKey="googleApiKey" :location="center" :zoom="zoom" :selectRegion="selectedRegion" :fotos="foundFotos" @select="onGpsSelect"></photo-map>
303
306
  </v-card-text>
304
307
  <v-card-actions>
305
308
  <v-btn size="large" @click="onCloseGps">