@christianriedl/media 1.0.238 → 1.0.240

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.238",
3
+ "version": "1.0.240",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -15,23 +15,15 @@
15
15
  function buildText (buchstaben: string, buchstaben2: string, neuesFach: boolean, selFrom?: number, selTo?: number) : string {
16
16
  let text1 = buchstaben;
17
17
  let text2 = buchstaben2;
18
- if (neuesFach && selFrom != 0) {
19
- text1 = '<span style="font-weight: 900">' + buchstaben.substring(0, 1) + '</span>';
20
- text2 = '<span style="font-weight: 900">' + buchstaben2.substring(0, 1) + '</span>';
21
- if (buchstaben.length > 1) {
22
- text1 += '<span>' + buchstaben.substring(1) + '</span>';
23
- text2 += '<span>' + buchstaben2.substring(1) + '</span>';
24
- }
25
- }
26
- else if (selFrom !== undefined && selTo !== undefined)
18
+ if (selFrom !== undefined && selTo !== undefined)
27
19
  {
28
20
  selTo++;
29
21
  text1 = text2 = '';
30
22
  if (selFrom > 0) {
31
23
  let start = 0;
32
24
  if (neuesFach) {
33
- text1 = '<span style="font-weight: 900">' + buchstaben.substring(0, 1) + '</span>';
34
- text2 = '<span style="font-weight: 900">' + buchstaben2.substring(0, 1) + '</span>';
25
+ text1 = '<span style="color: blue; font-weight: bold">' + buchstaben.substring(0, 1) + '</span>';
26
+ text2 = '<span style="color: blue; font-weight: bold">' + buchstaben2.substring(0, 1) + '</span>';
35
27
  start = 1;
36
28
  }
37
29
  if (selFrom > start) {
@@ -39,13 +31,21 @@
39
31
  text2 += '<span>' + buchstaben2.substring(start, selFrom) + '</span>';
40
32
  }
41
33
  }
42
- text1 += '<span style="color: red; font-weight: 900">' + buchstaben.substring(selFrom, selTo) + '</span>';
43
- text2 += '<span style="color: red; font-weight: 900">' + buchstaben2.substring(selFrom, selTo) + '</span>';
34
+ text1 += '<span style="color: red; font-weight: bold">' + buchstaben.substring(selFrom, selTo) + '</span>';
35
+ text2 += '<span style="color: red; font-weight: bold">' + buchstaben2.substring(selFrom, selTo) + '</span>';
44
36
  if (selTo < buchstaben.length) {
45
37
  text1 += '<span>' + buchstaben.substring(selTo) + '</span>';
46
38
  text2 += '<span>' + buchstaben2.substring(selTo) + '</span>';
47
39
  }
48
40
  }
41
+ else if (neuesFach) {
42
+ text1 = '<span style="color: blue; font-weight: bold">' + buchstaben.substring(0, 1) + '</span>';
43
+ text2 = '<span style="color: blue; font-weight: bold">' + buchstaben2.substring(0, 1) + '</span>';
44
+ if (buchstaben.length > 1) {
45
+ text1 += '<span>' + buchstaben.substring(1) + '</span>';
46
+ text2 += '<span>' + buchstaben2.substring(1) + '</span>';
47
+ }
48
+ }
49
49
  return text1 + "<br>" + text2;
50
50
  }
51
51
 
@@ -39,7 +39,8 @@
39
39
  let regal: Regal = { faecher: [] };
40
40
  for (let j = 0; j < 6; j++) {
41
41
  const fach: IPlace = { placeName: "", vorne: "", hinten: "", vorne2: "", hinten2: "", color: regalColor,
42
- hintenAuthorId: 0, hintenBookId: 0, vorneAuthorId: 0, vorneBookId: 0 };
42
+ hintenAuthorId: 0, hintenBookId: 0, hintenNeuesFach: false,
43
+ vorneAuthorId: 0, vorneBookId: 0, vorneNeuesFach: false };
43
44
  if (i < 8) {
44
45
  // Wohnzimmer
45
46
  fach.placeName = `Wohnzimmer Regal ${Math.floor(i / 2 + 1)}, Fach ${j + 1} ${i % 2 ? "rechts" : "links"} `;
@@ -3,7 +3,8 @@
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
5
  import { IAppState, IAppConfig, EDevice, EDirection, Dictionary, Helper, appStateSymbol, appConfigSymbol } from '@christianriedl/utils';
6
- import { EMediaType, EOrientation, EPictureFlags, IPictureFile, MediaService, IMediaService, IMediaAppConfig, EPictureQuality, getMediaSymbol, getMediaBinSymbol } from '@christianriedl/media';
6
+ import { EMediaType, EOrientation, EPictureFlags, IPictureFile, IMediaFolder, MediaService, IMediaService, IMediaAppConfig, EPictureQuality,
7
+ MediaHelper, getMediaSymbol, getMediaBinSymbol } from '@christianriedl/media';
7
8
 
8
9
  const router = useRouter();
9
10
  const route = useRoute();
@@ -14,10 +15,8 @@
14
15
  const mediaService = getMediaService() as unknown as IMediaService;
15
16
  const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
16
17
  const isMobile = appState.isMobile;
17
- const albumUrl = ref('');
18
18
  const infoDialog = ref(false);
19
19
  const keyDialog = ref(false);
20
- const folderId = decodeURIComponent(route.query!.id!.toString());
21
20
  const index = ref(0);
22
21
  const items = reactive<IPictureFile[]>([]);
23
22
  const width = ref(0);
@@ -29,7 +28,7 @@
29
28
  const hasCoordinates = ref(false);
30
29
  const carousel = ref<ComponentPublicInstance | null>(null);
31
30
  const itemName = ref("");
32
- const albumName = ref("");
31
+ let album: IMediaFolder;
33
32
  let origUrl = "";
34
33
  let gpsLng: number[];
35
34
  let gpsLat: number[];
@@ -62,18 +61,27 @@
62
61
  if (!mediaService.medialists["Picture.Event"])
63
62
  await (mediaService as MediaService).getLists(EMediaType.Picture);
64
63
  }
65
- let folder = mediaService.getFolder(folderId);
66
- if (!folder) {
67
- const split = folderId.split(/[.|]/);
68
- await mediaService.getPhotosByCriteria(split[1], split[2]);
69
- folder = mediaService.getFolder(folderId);
70
- if (!folder)
71
- return false;
64
+ let list: IPictureFile[] = [];
65
+ if (route.query!.id) {
66
+ // by id usafe
67
+ const folderId = decodeURIComponent(route.query!.id!.toString());
68
+ let folder = mediaService.getFolder(folderId);
69
+ if (!folder) {
70
+ const split = folderId.split(/[.|]/);
71
+ await mediaService.getPhotosByCriteria(split[1], split[2]);
72
+ folder = mediaService.getFolder(folderId);
73
+ if (!folder)
74
+ return false;
75
+ }
76
+ album = await mediaService.getPhotos(folder);
77
+ list = album.files as IPictureFile[];
78
+ }
79
+ else if (route.query!.title) {
80
+ const title = decodeURIComponent(route.query!.title!.toString());
81
+ list = await MediaHelper.searchPictures (mediaService, title, route.query!.pers!.toString() === "true", route.query!.loc!.toString() === "true", mediaService.photoSelection.rating, mediaAppConfig.pictureSearchLimit);
72
82
  }
73
- const photos = await mediaService.getPhotos(folder);
74
- albumName.value = photos.name;
75
- if(photos.files.length > 0) {
76
- items.splice(0, items.length, ...photos.files as IPictureFile[]);
83
+ if(list && list.length > 0) {
84
+ items.splice(0, items.length, ...list);
77
85
  if (route.query.start) {
78
86
  const start = route.query.start.toString();
79
87
  const idx = items.findIndex((item) => item.dlnaid == start);
@@ -81,7 +89,6 @@
81
89
  index.value = idx;
82
90
  }
83
91
  }
84
- albumUrl.value = photos.url;
85
92
  onUpdate();
86
93
  }
87
94
  else {
@@ -127,17 +134,18 @@
127
134
  const pictureQuality = mediaAppConfig.pictureQuality;
128
135
  const quality = getQuality(pictureQuality);
129
136
  const factor = getFactor(pictureQuality);
137
+ const albumUrl = album ? album.url : mediaService.getFolder(item.dlnaParentId).url;
130
138
  if (landscape.value) {
131
139
  let h = height.value * factor;
132
140
  if (item.height <= h)
133
141
  h = 0;
134
- return mediaService.getPhotoUrl(albumUrl.value, item.url, `${0}x${h}x${item.orientation}x${quality}`);
142
+ return mediaService.getPhotoUrl(albumUrl, item.url, `${0}x${h}x${item.orientation}x${quality}`);
135
143
  }
136
144
  else {
137
145
  let w = width.value * factor;
138
146
  if (item.width <= w)
139
147
  w = 0;
140
- return mediaService.getPhotoUrl(albumUrl.value, item.url, `${w}x${0}x${item.orientation}x${quality}`);
148
+ return mediaService.getPhotoUrl(albumUrl, item.url, `${w}x${0}x${item.orientation}x${quality}`);
141
149
  }
142
150
  }
143
151
  function getHeight(item: IPictureFile) {
@@ -160,7 +168,7 @@
160
168
  }
161
169
  function showMap(ev: Event) {
162
170
  const current = items[index.value];
163
- router.options.history.replace(`/photoalbum?id=${folderId}&start=${current.dlnaid}`);
171
+ router.options.history.replace(`/photoalbum?id=${current.dlnaParentId}&start=${current.dlnaid}`);
164
172
  router.push({
165
173
  path: 'map', query: {
166
174
  lat: `${gpsLat[0]} ${gpsLat[1]}`,
@@ -291,10 +299,11 @@
291
299
  }
292
300
  }
293
301
  function setMetaData(exif: Dictionary<any>, file: IPictureFile) {
294
- origUrl = mediaService.getPhotoUrl(albumUrl.value, file.url, '0x0x0');
295
- metadata['Album'] = albumName.value;
302
+ const folder = album ? album : mediaService.getFolder(file.dlnaParentId);
303
+ origUrl = mediaService.getPhotoUrl(folder.url, file.url, '0x0x0');
304
+ metadata['Album'] = folder.name;
296
305
  metadata['Name'] = file.name;
297
- let fileName: string = albumUrl.value + file.url;
306
+ let fileName: string = folder.url + file.url;
298
307
  const idx = fileName.lastIndexOf('/');
299
308
  if (idx > 0)
300
309
  fileName = fileName.substring(idx + 1);
@@ -97,7 +97,7 @@
97
97
  if (withLocation.value)
98
98
  url += '&loc';
99
99
  router.options.history.replace (url);
100
- router.push({ path: 'photoalbum', query: { id: item.dlnaParentId, start: item.dlnaid } });
100
+ router.push({ path: 'photoalbum', query: { title: title.value, pers: withPerson.value.toString(), loc: withLocation.value.toString(), start: item.dlnaid } });
101
101
  }
102
102
  }
103
103
  }