From 1473872d6017a756aa1dcfb3a159f8624ef7db4c Mon Sep 17 00:00:00 2001 From: Olivier Savignac Date: Thu, 20 Jun 2024 12:27:20 -0400 Subject: [PATCH 01/13] fix: bump node quasar build version --- quasar.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quasar.config.js b/quasar.config.js index eafb00ae..50cabb34 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -93,7 +93,7 @@ module.exports = configure(function (/* ctx */) { target: { // browser: ['esnext', 'edge88', 'firefox78', 'chrome87', 'safari13.1'], browser: ['esnext'], - node: 'node20', + node: 'node22', }, vitePlugins: [ [ From dc3f6f165c907a3906e0183ec10a2e0d8fafe078 Mon Sep 17 00:00:00 2001 From: Olivier Savignac Date: Thu, 20 Jun 2024 14:06:02 -0400 Subject: [PATCH 02/13] fix: stop music when disabled; add video picker; --- src-electron/electron-preload.ts | 1 + src/components/media/MusicButton.vue | 10 +- src/helpers/jw-media.ts | 18 +-- src/i18n/en-US/index.json | 4 +- src/i18n/fr-CA/index.json | 4 +- src/layouts/MainLayout.vue | 180 ++++++++++++++++++++++++++- src/pages/SettingsPage.vue | 60 ++++++--- src/types/publications.ts | 96 +++++++------- 8 files changed, 299 insertions(+), 74 deletions(-) diff --git a/src-electron/electron-preload.ts b/src-electron/electron-preload.ts index 1bccfa97..417088fc 100644 --- a/src-electron/electron-preload.ts +++ b/src-electron/electron-preload.ts @@ -90,6 +90,7 @@ const moveMediaWindow = ({ const screenPreferences = JSON.parse( localStorage.getItem('screenPreferences') ?? '{}', ) as ScreenPreferences; + // todo: fix this, not reading right values console.log('screenPreferences', screenPreferences); targetScreen = screenPreferences.preferredScreenNumber; windowedMode = screenPreferences.preferWindowed; diff --git a/src/components/media/MusicButton.vue b/src/components/media/MusicButton.vue index 56de6e12..97716a87 100644 --- a/src/components/media/MusicButton.vue +++ b/src/components/media/MusicButton.vue @@ -73,7 +73,7 @@ import { date } from 'quasar'; import { getFileUrl, getPublicationDirectoryContents } from 'src/helpers/fs'; import { formatTime } from 'src/helpers/mediaPlayback'; import { useCurrentStateStore } from 'src/stores/current-state'; -import { computed, onMounted, ref } from 'vue'; +import { computed, onMounted, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; const { t } = useI18n(); @@ -207,4 +207,12 @@ const musicRemainingTime = computed(() => { }); const musicPopup = ref(false); + +watch( + () => currentSettings.value?.enableMusicButton, + (newMusicButtonEnabled) => { + console.log('newMusicButtonEnabled', newMusicButtonEnabled); + if (!newMusicButtonEnabled) stopMusic(); + }, +); diff --git a/src/helpers/jw-media.ts b/src/helpers/jw-media.ts index d28e8524..e0450c50 100644 --- a/src/helpers/jw-media.ts +++ b/src/helpers/jw-media.ts @@ -36,7 +36,8 @@ import { FileDownloader, } from 'src/types/media'; import { - MediaImages, + ImageSizes, + ImageTypeSizes, MediaItemsMediator, MediaItemsMediatorFile, MediaLink, @@ -1113,20 +1114,22 @@ const downloadMissingMedia = async (publication: PublicationFetcher) => { return downloadedFile?.path; }; -function getBestImageUrl(images: MediaImages) { - const preferredOrder = ['wss', 'lsr', 'sqr', 'pnr']; +function getBestImageUrl(images: ImageTypeSizes, size?: keyof ImageSizes) { + const preferredOrder: (keyof ImageTypeSizes)[] = ['wss', 'lsr', 'sqr', 'pnr']; for (const key of preferredOrder) { if (images.hasOwnProperty(key)) { - const sizes = ['sm', 'md', 'lg', 'xl']; + const sizes: (keyof ImageSizes)[] = size + ? [size] + : ['sm', 'md', 'lg', 'xl']; for (const size of sizes) { if (images[key].hasOwnProperty(size)) { return images[key][size]; } } // If none of the preferred sizes are found, return any other size - const otherSizes = Object.keys(images[key]).filter( - (size) => !sizes.includes(size), - ); + const otherSizes = ( + Object.keys(images[key]) as (keyof ImageSizes)[] + ).filter((size) => !sizes.includes(size)); if (otherSizes.length > 0) { return images[key][otherSizes[0]]; } @@ -1289,6 +1292,7 @@ export { downloadPubMediaFiles, dynamicMediaMapper, fetchMedia, + getBestImageUrl, getDocumentMultimediaItems, getJwMediaInfo, getMwMedia, diff --git a/src/i18n/en-US/index.json b/src/i18n/en-US/index.json index 542a59b9..ec3e6105 100644 --- a/src/i18n/en-US/index.json +++ b/src/i18n/en-US/index.json @@ -173,5 +173,7 @@ "footnote": "Footnote", "windowed": "Windowed", "you-can-also-use-the-button-below-to-browse-for-files": "You can also browse for files manually if you prefer.", - "browse": "Browse" + "browse": "Browse", + "include-audio-description": "Include videos with audio descriptions", + "filter": "Filter" } diff --git a/src/i18n/fr-CA/index.json b/src/i18n/fr-CA/index.json index 5023203b..01e30443 100644 --- a/src/i18n/fr-CA/index.json +++ b/src/i18n/fr-CA/index.json @@ -356,5 +356,7 @@ "congregationMeetings": "Réunions de l'assemblée locale", "applicationConfigurationDescription": "Personnaliser le comportement et l'apparence de cette application", "applicationConfiguration": "Configuration de l'application", - "you-can-also-use-the-button-below-to-browse-for-files": "Vous pouvez également parcourir et sélectionner des fichiers manuellement, si vous le désirez." + "you-can-also-use-the-button-below-to-browse-for-files": "Vous pouvez également parcourir et sélectionner des fichiers manuellement, si vous le désirez.", + "include-audio-description": "Inclure les vidéos avec des descriptions audio", + "filter": "Filtre" } diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 720d7bef..865e69be 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -33,7 +33,10 @@ {{ $t('song') }} @@ -152,6 +155,90 @@ + + + + + + + + {{ $t('add-media-files') }} + + + + + + +
+
+ +
+ +
+ + +
+ +
+
+ + + + + +
+