mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 11:03:13 +00:00
Merge pull request #605 from WebTools-NG/ukdtom/issue596
[RFE] Find missing episodes specials
This commit is contained in:
commit
d1761c575c
7 changed files with 77 additions and 46 deletions
|
@ -12,6 +12,7 @@
|
|||
* [#598 Refactor tvdb rutines](https://github.com/WebTools-NG/WebTools-NG/issues/598) (Internal)
|
||||
* [#597 Add PMS Season/EP Count to FindMissing](https://github.com/WebTools-NG/WebTools-NG/issues/597) (Enhancement)
|
||||
* [#603 Find Missing Episodes Reorder columns](https://github.com/WebTools-NG/WebTools-NG/issues/603) (Enhancement)
|
||||
* [#596 Find missing episodes specials](https://github.com/WebTools-NG/WebTools-NG/issues/596) (Enhancement)
|
||||
|
||||
## V1.1.1 ( 20220917 )
|
||||
|
||||
|
|
|
@ -242,7 +242,8 @@
|
|||
"Note": "Note: * Click here for general settings regarding export *",
|
||||
"Return": "Return to @:Modules.ET.Name",
|
||||
"NoTimeStamp": "Don't add a timestamp to export file name",
|
||||
"NoItemRange": "Don't add item range to export file name"
|
||||
"NoItemRange": "Don't add item range to export file name",
|
||||
"FindMissingNoSpecials": "Ignore specials in 'Find missing episodes'"
|
||||
},
|
||||
"LevelInfo": "Export level determines which data are going to be exported.",
|
||||
"SelectLevel": "Select level",
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
{ text: i18n.t('Modules.ET.Settings.suggestedFileNoExtra'), value: 'suggestedFileNoExtra' },
|
||||
{ text: i18n.t('Modules.ET.Settings.suggestedUseOrigenTitle'), value: 'suggestedUseOrigenTitle' },
|
||||
{ text: i18n.t('Modules.ET.Settings.NoTimeStamp'), value: 'NoTimeStamp' },
|
||||
{ text: i18n.t('Modules.ET.Settings.NoItemRange'), value: 'NoItemRange' }
|
||||
{ text: i18n.t('Modules.ET.Settings.NoItemRange'), value: 'NoItemRange' },
|
||||
{ text: i18n.t('Modules.ET.Settings.FindMissingNoSpecials'), value: 'noSpecials' }
|
||||
],
|
||||
SelectedMoviesIDOptions: ['imdb', 'tmdb'],
|
||||
SelectedMoviesID: '',
|
||||
|
@ -97,7 +98,7 @@
|
|||
dialog.ShowMsg( i18n.t("Modules.ET.Name"), i18n.t("Common.Ok"), i18n.t("Common.AppName"), 'For this version, export to XLSX is currently disabled', 'info');
|
||||
},
|
||||
getDefaults(){
|
||||
const cbItems = ["ExpCSV","ExpXLSX", "OrgTitleNull", "SortTitleNull", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen", "ExportPostersArtsTree"];
|
||||
const cbItems = ["ExpCSV","ExpXLSX", "OrgTitleNull", "SortTitleNull", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen", "ExportPostersArtsTree", "noSpecials"];
|
||||
for(let i = 0; i < cbItems.length; i++){
|
||||
if (wtconfig.get("ET." + cbItems[i], false)){
|
||||
this.cbSelected.push(cbItems[i]);
|
||||
|
@ -112,7 +113,7 @@
|
|||
},
|
||||
filterTable(){
|
||||
this.$nextTick(()=>{console.log(this.cbSelected);})
|
||||
for( var cbItem of ["ExpCSV","ExpXLSX","OrgTitleNull", "SortTitleNull", "AutoXLSCol", "AutoXLSRow", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen", "ExportPostersArtsTree"]){
|
||||
for( var cbItem of ["ExpCSV","ExpXLSX","OrgTitleNull", "SortTitleNull", "AutoXLSCol", "AutoXLSRow", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen", "ExportPostersArtsTree", "noSpecials"]){
|
||||
wtconfig.set("ET." + cbItem, (this.cbSelected.includes(cbItem)))
|
||||
}
|
||||
this.PosterDimDisabled = this.cbSelected.includes('ArtPostersOrigen');
|
||||
|
|
|
@ -437,9 +437,9 @@
|
|||
"postProcess": true
|
||||
},
|
||||
"Episode Count (PMS)": {
|
||||
"key": "$.leafCount",
|
||||
"key": "$.title",
|
||||
"call": 1,
|
||||
"type": "string",
|
||||
"type": "int",
|
||||
"postProcess": true
|
||||
},
|
||||
"Export Art":
|
||||
|
@ -1088,9 +1088,9 @@
|
|||
"postProcess": true
|
||||
},
|
||||
"Season Count (PMS)": {
|
||||
"key": "$.childCount",
|
||||
"key": "$.title",
|
||||
"call": 1,
|
||||
"type": "string",
|
||||
"type": "int",
|
||||
"postProcess": true
|
||||
},
|
||||
"Seasons (Cloud)": {
|
||||
|
|
|
@ -556,12 +556,14 @@ const etHelper = new class ETHELPER {
|
|||
}
|
||||
break;
|
||||
case "Episode Count (PMS)":
|
||||
this.Settings.showInfo['PMSEPCount'] = parseInt(val);
|
||||
retVal = val;
|
||||
retVal = wtconfig.get('ET.NotAvail');
|
||||
if ( this.Settings.showInfo['Episode Count (PMS)']){
|
||||
retVal = this.Settings.showInfo['Episode Count (PMS)'];
|
||||
}
|
||||
break;
|
||||
case "Missing":
|
||||
retVal = i18n.t('Common.Ok');
|
||||
if ( this.Settings.showInfo['Episode Count (Cloud)'] != this.Settings.showInfo['PMSEPCount']){
|
||||
if ( this.Settings.showInfo['Episode Count (Cloud)'] != this.Settings.showInfo['Episode Count (PMS)']){
|
||||
retVal = "Episode mismatch"
|
||||
}
|
||||
if (!this.Settings.showInfo['Episode Count (Cloud)']){
|
||||
|
@ -864,8 +866,10 @@ const etHelper = new class ETHELPER {
|
|||
}
|
||||
break;
|
||||
case "Season Count (PMS)":
|
||||
this.Settings.showInfo['PMSSCount'] = parseInt(val);
|
||||
retVal = val;
|
||||
retVal = wtconfig.get('ET.NotAvail');
|
||||
if ( this.Settings.showInfo['Season Count (PMS)']){
|
||||
retVal = this.Settings.showInfo['Season Count (PMS)'];
|
||||
}
|
||||
break;
|
||||
case "Seasons (Cloud)":
|
||||
retVal = wtconfig.get('ET.NotAvail');
|
||||
|
@ -1048,16 +1052,27 @@ const etHelper = new class ETHELPER {
|
|||
} else {
|
||||
this.Settings.showInfo['showOrdering'] = await this.SelectedLibShowOrdering();
|
||||
}
|
||||
console.log('Ged 88-3', JSON.stringify(resp))
|
||||
let seasonCountPMS = {};
|
||||
let seasonCount = 0;
|
||||
let episodeCount = 0;
|
||||
const children = JSONPath({path: `$..Children.Metadata[*]`, json: resp});
|
||||
for (var idx in children){
|
||||
const child = children[idx];
|
||||
seasonCountPMS[JSONPath({path: `$..index`, json: child})] = JSONPath({path: `$..leafCount`, json: child})[0];
|
||||
if ( JSONPath({path: `$..index`, json: child})[0] == 0) {
|
||||
if ( !wtconfig.get('ET.noSpecials') ){
|
||||
seasonCountPMS[JSONPath({path: `$..index`, json: child})] = JSONPath({path: `$..leafCount`, json: child})[0];
|
||||
seasonCount++;
|
||||
episodeCount = episodeCount + JSONPath({path: `$..leafCount`, json: child})[0];
|
||||
}
|
||||
} else {
|
||||
seasonCountPMS[JSONPath({path: `$..index`, json: child})] = JSONPath({path: `$..leafCount`, json: child})[0];
|
||||
seasonCount++;
|
||||
episodeCount = episodeCount + JSONPath({path: `$..leafCount`, json: child})[0];
|
||||
}
|
||||
}
|
||||
this.Settings.showInfo['Seasons (PMS)'] = seasonCountPMS;
|
||||
console.log('Ged 77-3', JSON.stringify(this.Settings.showInfo['Seasons (PMS)']))
|
||||
|
||||
this.Settings.showInfo['Episode Count (PMS)'] = episodeCount;
|
||||
this.Settings.showInfo['Season Count (PMS)'] = seasonCount;
|
||||
}
|
||||
|
||||
async addRowToTmp( { data }) {
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
// TMDB stuff used
|
||||
//import store from '../../../store';
|
||||
//import { wtconfig } from './wtutils';
|
||||
import axios from 'axios';
|
||||
import { wtutils } from './wtutils';
|
||||
import { wtconfig, wtutils } from './wtutils';
|
||||
|
||||
const log = require('electron-log');
|
||||
const {JSONPath} = require('jsonpath-plus');
|
||||
|
||||
|
||||
|
||||
const tmdb = new class TMDB {
|
||||
constructor() {
|
||||
this.baseUrl = 'https://www.themoviedb.org/';
|
||||
|
@ -35,6 +31,8 @@ const tmdb = new class TMDB {
|
|||
const apiKey = wtutils.envVarLocal( 'Key_tmdb' );
|
||||
url = `${url}&api_key=${apiKey}`;
|
||||
const result = {};
|
||||
let seasonCount = 0;
|
||||
let episodeCount = 0;
|
||||
await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
|
@ -43,13 +41,21 @@ const tmdb = new class TMDB {
|
|||
.then((response) => {
|
||||
log.debug('[tmdb.js] (getTMDBShowInfo) - Response from getTMDBShowInfo recieved');
|
||||
result['Status (Cloud)'] = JSONPath({ path: "$.status", json: response.data })[0];
|
||||
result['Episode Count (Cloud)'] = JSONPath({ path: "$.number_of_episodes", json: response.data })[0];
|
||||
result['Season Count (Cloud)'] = JSONPath({ path: "$.number_of_seasons", json: response.data })[0];
|
||||
// Now get season/episode
|
||||
const seasons = JSONPath({ path: "$..seasons[*]", json: response.data })
|
||||
let Seasons_Cloud = {};
|
||||
for ( var idx in seasons ){
|
||||
Seasons_Cloud[JSONPath({ path: "$..season_number", json: seasons[idx]})] = JSONPath({ path: "$..episode_count", json: seasons[idx]})[0];
|
||||
if ( JSONPath({ path: "$..season_number", json: seasons[idx]}) == 0) {
|
||||
if ( !wtconfig.get('ET.noSpecials') ){
|
||||
Seasons_Cloud[JSONPath({ path: "$..season_number", json: seasons[idx]})] = JSONPath({ path: "$..episode_count", json: seasons[idx]})[0];
|
||||
seasonCount++;
|
||||
episodeCount = episodeCount + JSONPath({ path: "$..episode_count", json: seasons[idx]})[0];
|
||||
}
|
||||
} else {
|
||||
Seasons_Cloud[JSONPath({ path: "$..season_number", json: seasons[idx]})] = JSONPath({ path: "$..episode_count", json: seasons[idx]})[0];
|
||||
seasonCount++;
|
||||
episodeCount = episodeCount + JSONPath({ path: "$..episode_count", json: seasons[idx]})[0];
|
||||
}
|
||||
}
|
||||
result['Seasons (Cloud)'] = Seasons_Cloud;
|
||||
})
|
||||
|
@ -75,6 +81,8 @@ const tmdb = new class TMDB {
|
|||
return result;
|
||||
}
|
||||
})
|
||||
result['Episode Count (Cloud)'] = episodeCount;
|
||||
result['Season Count (Cloud)'] = seasonCount;
|
||||
log.silly(`[tmdb.js] (getTMDBShowInfo) - Returning: ${JSON.stringify(result)}`);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// TVDB stuff used
|
||||
//import store from '../../../store';
|
||||
//import { wtconfig } from './wtutils';
|
||||
import axios from 'axios';
|
||||
import { wtutils } from './wtutils';
|
||||
import { wtconfig, wtutils } from './wtutils';
|
||||
|
||||
const log = require('electron-log');
|
||||
const {JSONPath} = require('jsonpath-plus');
|
||||
|
@ -43,10 +41,11 @@ const tvdb = new class TVDB {
|
|||
}
|
||||
|
||||
async getTVDBShow( {tvdbId: tvdbId, bearer: bearer, title: title, order: order} ){
|
||||
log.info(`[tvdb.js] (getTVDBShowDVD) - Getting tmdb ${order} info for ${tvdbId}`);
|
||||
log.info(`[tvdb.js] (getTVDBShowDVD) - Getting tmdb ${order} info for ${tvdbId} with a title of: ${title}`);
|
||||
let url = `${this.baseAPIUrl}series/${tvdbId}/episodes/${order}?page=0`;
|
||||
let headers = this.headers;
|
||||
let seasons = {};
|
||||
let episodeCount = 0;
|
||||
headers["Authorization"] = `Bearer ${bearer}`;
|
||||
let result = {};
|
||||
await axios({
|
||||
|
@ -55,29 +54,33 @@ const tvdb = new class TVDB {
|
|||
headers: headers
|
||||
})
|
||||
.then((response) => {
|
||||
log.debug('[tvdb.js] (getTVDBShow) - Response from getTVDBShow recieved');
|
||||
log.debug('[tvdb.js] (getTVDBShow) - Response from getTVDBShow recieved. Use silly logging to see the data');
|
||||
log.silly(JSON.stringify(response.data))
|
||||
result['Link (Cloud)'] = `https://thetvdb.com/series/${JSONPath({ path: "$..slug", json: response.data })[0]}`;
|
||||
result['Status (Cloud)'] = JSONPath({ path: "$..status.name", json: response.data })[0];
|
||||
// Sadly, the tvdb doesn't have a count field for seasons and episodes, so we need to count each :-(
|
||||
let episodes = JSONPath({ path: "$..episodes[*]", json: response.data });
|
||||
// Gather season/episode info
|
||||
for ( var idx in episodes ){
|
||||
const season = JSONPath({ path: "$..seasonNumber", json: episodes[idx] })[0];
|
||||
if( Object.prototype.hasOwnProperty.call(seasons, season) ){
|
||||
seasons[season] = seasons[season] + 1;
|
||||
} else {
|
||||
seasons[season] = 1;
|
||||
}
|
||||
}
|
||||
// Get Season Count
|
||||
result['Season Count (Cloud)'] = Object.keys(seasons).length;
|
||||
// Get episode count
|
||||
let episodeCount = 0;
|
||||
Object.entries(seasons).forEach(([key, value]) => {
|
||||
episodeCount = episodeCount + parseInt(value);
|
||||
key;
|
||||
})
|
||||
result['Episode Count (Cloud)'] = episodeCount;
|
||||
const seasonNumber = JSONPath({ path: "$..seasonNumber", json: episodes[idx] })[0];
|
||||
if ( JSONPath({ path: "$..seasonNumber", json: episodes[idx] })[0] == 0) {
|
||||
if ( !wtconfig.get('ET.noSpecials') ){
|
||||
episodeCount++;
|
||||
if( Object.prototype.hasOwnProperty.call(seasons, seasonNumber) ){
|
||||
seasons[seasonNumber] = seasons[seasonNumber] + 1;
|
||||
} else {
|
||||
seasons[seasonNumber] = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
episodeCount++;
|
||||
if( Object.prototype.hasOwnProperty.call(seasons, seasonNumber) ){
|
||||
seasons[seasonNumber] = seasons[seasonNumber] + 1;
|
||||
} else {
|
||||
seasons[seasonNumber] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
result['Seasons (Cloud)'] = seasons;
|
||||
})
|
||||
.catch(function (error) {
|
||||
|
@ -102,6 +105,8 @@ const tvdb = new class TVDB {
|
|||
return result;
|
||||
}
|
||||
})
|
||||
result['Episode Count (Cloud)'] = episodeCount;
|
||||
result['Season Count (Cloud)'] = Object.keys(seasons).length;
|
||||
log.silly(`[tmdb.js] (getTVDBShowDVD) - Returning: ${JSON.stringify(result)}`);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue