From 73733b871dca836d87fd7641010237eb15f13086 Mon Sep 17 00:00:00 2001 From: Tommy Mikkelsen Date: Fri, 3 Jun 2022 01:14:26 +0200 Subject: [PATCH] Fix #498 --- CHANGELOG.md | 13 ++ package.json | 2 +- .../modules/ExportTools/defs/def-Fields.json | 60 ++++++- .../modules/ExportTools/defs/def-Levels.json | 2 +- .../modules/ExportTools/defs/def-Show.json | 7 + .../modules/ExportTools/scripts/ethelper.js | 167 ++++++++++++++++++ src/components/modules/General/time.js | 5 - 7 files changed, 247 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b63def1..0c78172 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log +## V0.3.18 (Not Yet Released) + +**Note**: This version is a Beta version + +**Note 2**: In this version, the following is disabled: + +* Export to xlsx format ([See #331](https://github.com/WebTools-NG/WebTools-NG/issues/331)) +* Photo export + +**Changes**: + +* [#498 Add preferences to shows export](https://github.com/WebTools-NG/WebTools-NG/issues/498) + ## V0.3.17 (20220601) **Note**: This version is a Beta version diff --git a/package.json b/package.json index 60b192f..c7f5a40 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webtools-ng", "productName": "WebTools-NG", - "version": "0.3.17", + "version": "0.3.18", "description": "WebTools Next Generation 4 Plex", "author": "dane22 & CPSO", "license": "MPL-2.0", diff --git a/src/components/modules/ExportTools/defs/def-Fields.json b/src/components/modules/ExportTools/defs/def-Fields.json index f6ef2ed..e31ec6a 100644 --- a/src/components/modules/ExportTools/defs/def-Fields.json +++ b/src/components/modules/ExportTools/defs/def-Fields.json @@ -390,7 +390,7 @@ "key": "$.createdAtTZOffset", "call": 1, "type": "time" - }, + }, "Deleted": { "key": "$.deletedAt", @@ -591,7 +591,7 @@ "key": "$.leafCount", "call": 1, "type": "string" - }, + }, "Key": { "key": "$.ratingKey", @@ -1092,6 +1092,62 @@ "call": 1, "type": "string" }, + "Show Prefs Delete episodes after playing": + { + "key": "$..Preferences.Setting[?(@.id=='autoDeletionItemPolicyWatchedLibrary')].value", + "call": 2, + "type": "int", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Episode ordering": + { + "key": "$..Preferences.Setting[?(@.id=='showOrdering')].value", + "call": 2, + "type": "string", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Episode sorting": + { + "key": "$..Preferences.Setting[?(@.id=='episodeSort')].value", + "call": 2, + "type": "string", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Keep": + { + "key": "$..Preferences.Setting[?(@.id=='autoDeletionItemPolicyUnwatchedLibrary')].value", + "call": 2, + "type": "int", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Metadata language": + { + "key": "$..Preferences.Setting[?(@.id=='languageOverride')].value", + "call": 2, + "type": "int", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Seasons": + { + "key": "$..Preferences.Setting[?(@.id=='flattenSeasons')].value", + "call": 2, + "type": "int", + "include": "includePreferences=1", + "postProcess": true + }, + "Show Prefs Use original title": + { + "key": "$..Preferences.Setting[?(@.id=='useOriginalTitle')].value", + "call": 2, + "type": "int", + "include": "includePreferences=1", + "postProcess": true + }, "Show Title": { "key": "$.parentTitle", diff --git a/src/components/modules/ExportTools/defs/def-Levels.json b/src/components/modules/ExportTools/defs/def-Levels.json index e99503a..cd146ce 100644 --- a/src/components/modules/ExportTools/defs/def-Levels.json +++ b/src/components/modules/ExportTools/defs/def-Levels.json @@ -78,7 +78,7 @@ "Include": { "Level 1": "", "Level 2": "", - "all": "" + "all": "includePreferences=1" } }, "10": { diff --git a/src/components/modules/ExportTools/defs/def-Show.json b/src/components/modules/ExportTools/defs/def-Show.json index 07c8c7c..1607412 100644 --- a/src/components/modules/ExportTools/defs/def-Show.json +++ b/src/components/modules/ExportTools/defs/def-Show.json @@ -50,6 +50,13 @@ "Rating", "Release Date", "Roles", + "Show Prefs Delete episodes after playing", + "Show Prefs Episode ordering", + "Show Prefs Episode sorting", + "Show Prefs Keep", + "Show Prefs Metadata language", + "Show Prefs Seasons", + "Show Prefs Use original title", "Show Title", "Similar", "Sort title", diff --git a/src/components/modules/ExportTools/scripts/ethelper.js b/src/components/modules/ExportTools/scripts/ethelper.js index 302bf04..dea7ca5 100644 --- a/src/components/modules/ExportTools/scripts/ethelper.js +++ b/src/components/modules/ExportTools/scripts/ethelper.js @@ -404,6 +404,53 @@ const etHelper = new class ETHELPER { }; this.intSep = '{*WTNG-ET*}'; this.StackedFilesName = ['cd', 'disc', 'dvd', 'part', 'pt']; + this.MetadataLang = { + "": "Library default", + "ar-SA": "Arabic (Saudi Arabia)", + "bg-BG": "Bulgarian", + "ca-ES": "Catalan", + "zh-CN": "Chinese", + "zh-HK": "Chinese (Hong Kong)", + "zh-TW": "Chinese (Taiwan)", + "hr-HR": "Croatian", + "cs-CZ": "Czech", + "da-DK": "Danish", + "nl-NL": "Dutch", + "en-US": "English", + "en-AU": "English (Australia)", + "en-CA": "English (Canada)", + "en-GB": "English (UK)", + "et-EE": "Estonian", + "fi-FI": "Finnish", + "fr-FR": "French", + "fr-CA": "French (Canada)", + "de-DE": "German", + "el-GR": "Greek", + "he-IL": "Hebrew", + "hi-IN": "Hindi", + "hu-HU": "Hungarian", + "id-ID": "Indonesian", + "it-IT": "Italian", + "ja-JP": "Japanese", + "ko-KR": "Korean", + "lv-LV": "Latvian", + "lt-LT": "Lithuanian", + "nb-NO": "Norwegian Bokmål", + "fa-IR": "Persian", + "pl-PL": "Polish", + "pt-BR": "Portuguese", + "pt-PT": "Portuguese (Portugal)", + "ro-RO": "Romanian", + "ru-RU": "Russian", + "sk-SK": "Slovak", + "es-ES": "Spanish", + "es-MX": "Spanish (Mexico)", + "sv-SE": "Swedish", + "th-TH": "Thai", + "tr-TR": "Turkish", + "uk-UA": "Ukrainian", + "vi-VN": "Vietnamese" + } } resetETHelper() { @@ -850,6 +897,126 @@ const etHelper = new class ETHELPER { //var path = require('path'); retVal = path.join('Metadata', libTypeName, sha1[0], sha1.slice(1) + '.bundle'); break; + case "Show Prefs Episode sorting": + switch (val){ + case "-1": + retVal = "Library default"; + break; + case "0": + retVal = "Oldest first"; + break; + case "1": + retVal = "Newest first"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; + case "Show Prefs Keep": + switch (val){ + case "0": + retVal = "All episodes"; + break; + case "5": + retVal = "5 latest episodes"; + break; + case "3": + retVal = "3 latest episodes"; + break; + case "1": + retVal = "Latest episode"; + break; + case "-3": + retVal = "Episodes added in the past 3 days"; + break; + case "-7": + retVal = "Episodes added in the past 7 days"; + break; + case "-30": + retVal = "Episodes added in the past 30 days"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; + case "Show Prefs Delete episodes after playing": + switch (val){ + case "0": + retVal = "Never"; + break; + case "1": + retVal = "After a day"; + break; + case "7": + retVal = "After a week"; + break; + case "100": + retVal = "On next refresh"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; + case "Show Prefs Seasons": + switch (val){ + case "-1": + retVal = "Library default"; + break; + case "0": + retVal = "Show"; + break; + case "1": + retVal = "Hide"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; + case "Show Prefs Episode ordering": + switch (val){ + case wtconfig.get('ET.NotAvail'): + retVal = "Library default"; + break; + case "tmdbAiring": + retVal = "The Movie Database (Aired)"; + break; + case "aired": + retVal = "TheTVDB (Aired)"; + break; + case "dvd": + retVal = "TheTVDB (DVD)"; + break; + case "absolute": + retVal = "TheTVDB (Absolute)"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; + case "Show Prefs Metadata language": + retVal = this.MetadataLang[val]; + break; + case "Show Prefs Use original title": + switch (val){ + case "-1": + retVal = "Library default"; + break; + case "0": + retVal = "No"; + break; + case "1": + retVal = "Yes"; + break; + default: + retVal = wtconfig.get('ET.NotAvail'); + break; + } + break; default: log.error(`[ethelper.js] (postProcess) no hit for: ${name}`) break; diff --git a/src/components/modules/General/time.js b/src/components/modules/General/time.js index 6dd9dda..99de39a 100644 --- a/src/components/modules/General/time.js +++ b/src/components/modules/General/time.js @@ -158,14 +158,9 @@ const time = new class Time { } else { const options = { dateStyle: wtconfig.get('General.DateOption'), timeStyle: wtconfig.get('General.TimeOption') }; - console.log('Ged 17-1: ' + datetime) - console.log('Ged 17-2: ' + localFormat) - console.log(new Intl.DateTimeFormat(localFormat, options).format(datetime)); return new Intl.DateTimeFormat(localFormat, options).format(datetime); - } - } async convertToLocalTime( time ){