iobroker.sayit 4.0.4 → 4.0.5

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/README.md CHANGED
@@ -267,10 +267,11 @@ The following values for engines are possible:
267
267
  ### **WORK IN PROGRESS**
268
268
  -->
269
269
  ## Changelog
270
- ### 4.0.4 (2024-07-11)
270
+ ### 4.0.5 (2024-07-12)
271
271
  * (bluefox) Packages updated
272
272
  * (bluefox) Corrected playing in vis
273
273
  * (bluefox) Corrected blockly
274
+ * (bluefox) Corrected upload of files
274
275
 
275
276
  ### 4.0.1 (2024-05-25)
276
277
  * (bluefox) Packages updated
package/io-package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sayit",
4
- "version": "4.0.4",
4
+ "version": "4.0.5",
5
5
  "news": {
6
- "4.0.4": {
7
- "en": "Packages updated\nCorrected playing in vis\nCorrected blockly",
8
- "de": "Pakete aktualisiert\nKorrigiertes Spielen in Vis\nBlockiert korrigiert",
9
- "ru": "Обновленные пакеты\nИсправленная игра в vis\nИсправлено блокно",
10
- "pt": "Pacotes atualizados\nJogo correto em vis\nCorrigido em bloco",
11
- "nl": "Pakketten bijgewerkt\nGecorrigeerd spelen in vis\nBloksgewijs gecorrigeerd",
12
- "fr": "Mise à jour des paquets\nCorrigé jouer dans vis\nCorrigé en bloc",
13
- "it": "Pacchetti aggiornati\nCorretto giocare in vis\nCorretto in blocco",
14
- "es": "Paquetes actualizados\nCorregido jugando en vis\nCorregido bloqueado",
15
- "pl": "Aktualizacja pakietów\nPoprawione gry w vis\nPoprawione blokowane",
16
- "uk": "Пакети оновлені\nПравильна гра в віках\nВиправлено блоклі",
17
- "zh-cn": "更新软件包\n已校正播放相对\n块状修正"
6
+ "4.0.5": {
7
+ "en": "Packages updated\nCorrected playing in vis\nCorrected blockly\nCorrected upload of files",
8
+ "de": "Pakete aktualisiert\nKorrigiertes Spielen in Vis\nBlockiert korrigiert\nKorrigierter Upload von Dateien",
9
+ "ru": "Обновленные пакеты\nИсправленная игра в vis\nИсправлено блокно\nИсправленная загрузка файлов",
10
+ "pt": "Pacotes atualizados\nJogo correto em vis\nCorrigido em bloco\nUpload corrigido de arquivos",
11
+ "nl": "Pakketten bijgewerkt\nGecorrigeerd spelen in vis\nBloksgewijs gecorrigeerd\nGecorrigeerde upload van bestanden",
12
+ "fr": "Mise à jour des paquets\nCorrigé jouer dans vis\nCorrigé en bloc\nTéléchargement corrigé des fichiers",
13
+ "it": "Pacchetti aggiornati\nCorretto giocare in vis\nCorretto in blocco\nCaricamento corretto dei file",
14
+ "es": "Paquetes actualizados\nCorregido jugando en vis\nCorregido bloqueado\nCarga corregida de archivos",
15
+ "pl": "Aktualizacja pakietów\nPoprawione gry w vis\nPoprawione blokowane\nPoprawione przesyłanie plików",
16
+ "uk": "Пакети оновлені\nПравильна гра в віках\nВиправлено блоклі\nВиправлено завантаження файлів",
17
+ "zh-cn": "更新软件包\n已校正播放相对\n块状修正\n更正了文件的上传"
18
18
  },
19
19
  "4.0.1": {
20
20
  "en": "Packages updated\nUsing the pre-calculated duration of the mp3 to wait long enough even for longer announcements",
package/main.js CHANGED
@@ -425,7 +425,7 @@ async function processTasks() {
425
425
  }
426
426
 
427
427
  if (!data) {
428
- // may be the file is from real FS
428
+ // maybe the file is from real FS
429
429
  if (fs.existsSync(text)) {
430
430
  try {
431
431
  data = fs.readFileSync(text);
@@ -446,7 +446,7 @@ async function processTasks() {
446
446
  } else {
447
447
  fileName = MP3FILE;
448
448
  }
449
- fs.writeFileSync(fileName, data);
449
+ fs.writeFileSync(fileName, data.file ? data.file : data);
450
450
  } catch (e) {
451
451
  adapter.log.error(`Cannot write file "${MP3FILE}": ${e.toString()}`);
452
452
  }
@@ -547,7 +547,9 @@ async function uploadFile(file) {
547
547
 
548
548
  if (!data) {
549
549
  try {
550
- await adapter.writeFileAsync(adapter.namespace, `tts.userfiles/${file}`, fs.readFileSync(path.join(`${__dirname}/mp3/`, file)));
550
+ data = fs.readFileSync(path.join(`${__dirname}/mp3/`, file));
551
+ adapter.log.debug(`Upload file: ${path.join(`${__dirname}/mp3/`, file)} (${data.length} bytes`);
552
+ await adapter.writeFileAsync(adapter.namespace, `tts.userfiles/${file}`, data);
551
553
  } catch (e) {
552
554
  adapter.log.error(`Cannot write file "${__dirname}/mp3/${file}": ${e.toString()}`);
553
555
  }
@@ -596,7 +598,7 @@ async function prepareAnnounceFiles(config) {
596
598
  const data = await adapter.readFileAsync(adapter.namespace, `tts.userfiles/${fileName}`);
597
599
  if (data) {
598
600
  try {
599
- fs.writeFileSync(path.join(__dirname, fileName), data);
601
+ fs.writeFileSync(path.join(__dirname, fileName), data.file ? data.file : data);
600
602
  config.announce = path.join(__dirname, fileName);
601
603
  } catch (e) {
602
604
  adapter.log.error(`Cannot write file: ${e.toString()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sayit",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "Text to speech interface for ioBroker.",
5
5
  "author": {
6
6
  "name": "bluefox",