@christianriedl/media 1.0.24 → 1.0.26

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.24",
3
+ "version": "1.0.26",
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.63",
21
+ "@christianriedl/utils": "^1.0.65",
22
22
  "@christianriedl/rest": "^1.0.33"
23
23
  },
24
24
  "devDependencies": {
@@ -12,7 +12,8 @@
12
12
  const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
13
13
  const isMobile = appState.isMobile;
14
14
  const url = ref('');
15
- const dialog = ref(false);
15
+ const infoDialog = ref(false);
16
+ const keyDialog = ref(false);
16
17
  const folderId = decodeURIComponent(route.query!.id!.toString());
17
18
  const index = ref(0);
18
19
  const items = reactive<IPictureFile[]>([]);
@@ -22,6 +23,9 @@
22
23
  const metadata = reactive<Dictionary<any>>({});
23
24
  const cycle = ref(false);
24
25
  const interval = ref(8000);
26
+ const hasCoordinates = ref(false);
27
+ let gpsLng: number[];
28
+ let gpsLat: number[];
25
29
 
26
30
  watch([appState.bodyHeight, appState.pageWidth], () => {
27
31
  width.value = appState.pageWidth.value;
@@ -83,6 +87,14 @@
83
87
  else
84
88
  return mediaService.getPhotoUrl(url.value, item.Url, `${width.value}x${0}x${item.Orientation}`);
85
89
  }
90
+ function showMap(ev: Event) {
91
+ router.push({
92
+ path: 'gps', query: {
93
+ lat: `${gpsLat[0]} ${gpsLat[1]}`,
94
+ lng: `${gpsLng[0]} ${gpsLng[1]}`
95
+ }
96
+ });
97
+ }
86
98
  function onInput(idx: number) {
87
99
  idx++;
88
100
  if (idx < items.length) {
@@ -93,8 +105,8 @@
93
105
  });
94
106
  }
95
107
  }
96
- function onClick(ev: Event) {
97
- dialog.value = true;
108
+ function onDblClick(ev: Event) {
109
+ keyDialog.value = true;
98
110
  }
99
111
  async function onKey(ev: KeyboardEvent) {
100
112
  switch (ev.code) {
@@ -113,9 +125,10 @@
113
125
  const item = items[index.value];
114
126
  const exif = await mediaService.getExifInfo(item.DLNAParentID, item.DLNAID);
115
127
  setMetaData(exif, item);
116
- dialog.value = true;
128
+ infoDialog.value = true;
117
129
  break;
118
130
  case "KeyP":
131
+ case "KeyC":
119
132
  cycle.value = true;
120
133
  break;
121
134
  case "Digit0":
@@ -150,6 +163,13 @@
150
163
  break;
151
164
  }
152
165
  }
166
+ function onKeyClick(code: string) {
167
+ keyDialog.value = false;
168
+ if (code != 'close') {
169
+ const keyEvent = new KeyboardEvent("key", { "code": code, "bubbles": true, "cancelable": false });
170
+ onKey(keyEvent);
171
+ }
172
+ }
153
173
  function itemWidth(item: IPictureFile): number {
154
174
  const fac = item.Height / height.value;
155
175
  return Math.floor(item.Width * fac);
@@ -184,6 +204,11 @@
184
204
  metadata['Zeit'] = exif.DateTimeOriginal;
185
205
  else
186
206
  metadata['Zeit'] = file.Date.toLocaleString();
207
+ if (exif.GPSLatitude && exif.GPSLongitude) {
208
+ gpsLat = exif.GPSLatitude as number[];
209
+ gpsLng = exif.GPSLongitude as number[];
210
+ hasCoordinates.value = true;
211
+ }
187
212
  }
188
213
  else {
189
214
  delete metadata['Kamera'];
@@ -220,13 +245,13 @@
220
245
  <v-container fluid :style="heightStyle">
221
246
  <v-carousel hide-delimiters :show-arrows="false" v-model="index"
222
247
  :width="width" :height="height" :cycle="cycle" :interval="interval"
223
- @change="onInput">
248
+ @change="onInput" @dblclick="onDblClick">
224
249
  <v-carousel-item v-for="item in items" :key="item.DLNAID">
225
250
  <img :src="item.realUrl" />
226
251
  </v-carousel-item>
227
252
  </v-carousel>
228
- <v-dialog v-model="dialog" :fullscreen="isMobile">
229
- <v-card v-if="dialog" width="400">
253
+ <v-dialog v-model="infoDialog" :fullscreen="isMobile">
254
+ <v-card v-if="infoDialog" width="400">
230
255
  <v-card-title class="headline">Metadata</v-card-title>
231
256
  <v-card-text>
232
257
  <v-container>
@@ -237,12 +262,47 @@
237
262
  </v-container>
238
263
  </v-card-text>
239
264
  <v-card-actions>
240
- <v-btn @click="dialog = false">
265
+ <v-btn @click="infoDialog = false">
241
266
  <v-icon large icon="$stop" />
242
267
  </v-btn>
268
+ <v-btn v-if="hasCoordinates" @click="showMap">
269
+ <v-icon large icon="$gps" />
270
+ </v-btn>
243
271
  </v-card-actions>
244
272
  </v-card>
245
273
  </v-dialog>
274
+ <v-dialog v-model="keyDialog" :fullscreen="isMobile">
275
+ <v-card v-if="keyDialog" width="400">
276
+ <v-card-text>
277
+ <v-container>
278
+ <v-row dense>
279
+ <v-col cols="4"><v-btn @click="onKeyClick('Escape')">Back</v-btn></v-col>
280
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit0')">Pause</v-btn></v-col>
281
+ <v-col cols="4"><v-btn @click="onKeyClick('KeyC')">Cont</v-btn></v-col>
282
+ </v-row>
283
+ <v-row dense>
284
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit1')">1</v-btn></v-col>
285
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit2')">2</v-btn></v-col>
286
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit3')">3</v-btn></v-col>
287
+ </v-row>
288
+ <v-row dense>
289
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit4')">4</v-btn></v-col>
290
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit5')">5</v-btn></v-col>
291
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit6')">6</v-btn></v-col>
292
+ </v-row>
293
+ <v-row dense>
294
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit7')">7</v-btn></v-col>
295
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit8')">8</v-btn></v-col>
296
+ <v-col cols="4"><v-btn @click="onKeyClick('Digit9')">9</v-btn></v-col>
297
+ </v-row>
298
+ <v-row dense>
299
+ <v-col cols="4"><v-btn @click="onKeyClick('KeyI')">Info</v-btn></v-col>
300
+ <v-col cols="4"><v-btn @click="onKeyClick('close')">Close</v-btn></v-col>
301
+ </v-row>
302
+ </v-container>
303
+ </v-card-text>
304
+ </v-card>
305
+ </v-dialog>
246
306
  </v-container>
247
307
  </template>
248
308