TMDB Done
This commit is contained in:
Tommy Mikkelsen 2022-09-21 14:39:45 +02:00
parent 27c8d51c50
commit 2b8a4f1913
3 changed files with 33 additions and 8 deletions

View file

@ -13,6 +13,7 @@
* [#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)
* [#607 Find Missing Episodes and episodes in the future](https://github.com/WebTools-NG/WebTools-NG/issues/607) (Enhancement)
## V1.1.1 ( 20220917 )

View file

@ -1398,8 +1398,6 @@ const etHelper = new class ETHELPER {
{
// Let's get the needed row
tmpRow = await this.addRowToTmp({ data: chunckItems[item]});
console.log('Ged 11-3', JSON.stringify(tmpRow))
if (this.Settings.csvFile){
await csv.addRowToTmp({ stream: this.Settings.csvStream, item: tmpRow})
}
@ -1830,7 +1828,6 @@ const etHelper = new class ETHELPER {
this.Settings.csvStream = fs.createWriteStream(this.Settings.csvFile, {flags:'a'});
await csv.addHeaderToTmp({ stream: this.Settings.csvStream, item: this.Settings.fields});
}
console.log('Ged 17-2', wtconfig.get("ET.ExpXLSX", false))
try
{
// Create XLSX Stream

View file

@ -22,7 +22,7 @@ const tmdb = new class TMDB {
}
async getTMDBShowInfo( { tmdbId: tmdbId, title: title } ){
log.info(`[tmdb.js] (getTMDBShowInfo) - Getting tmdb info for ${tmdbId}`);
log.info(`[tmdb.js] (getTMDBShowInfo) - Getting tmdb info for ${tmdbId} with a titler of ${title}`);
let url = `${this.baseAPIUrl}/3/tv/${tmdbId}?language=en-US`
let header = {
"Accept": "application/json"
@ -43,18 +43,45 @@ const tmdb = new class TMDB {
result['Status (Cloud)'] = JSONPath({ path: "$.status", json: response.data })[0];
// Now get season/episode
const seasons = JSONPath({ path: "$..seasons[*]", json: response.data })
let nextEpisodeToAir = JSONPath({ path: "$..next_episode_to_air.episode_number", json: response.data })[0];
let nextSeason = JSONPath({ path: "$..next_episode_to_air.season_number", json: response.data })[0];
let Seasons_Cloud = {};
for ( var idx in seasons ){
if ( JSONPath({ path: "$..season_number", json: seasons[idx]}) == 0) {
if ( !wtconfig.get('ET.noSpecials') ){
// Is season currently running
if ( nextSeason == (parseInt(idx) + 1) ){
// Season is currently running
if ( nextEpisodeToAir > 0){
// First episode has aired
log.info(`[tmdb.js] (getTMDBShowInfo) - Some episodes are in the future, so adj.`);
Seasons_Cloud[JSONPath({ path: "$..season_number", json: seasons[idx]})] = nextEpisodeToAir -1;
seasonCount++;
episodeCount = episodeCount + nextEpisodeToAir -1;
}
} 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];
}
}
} else {
// Is season currently running
if ( nextSeason == (parseInt(idx)+1) ){
// Season is currently running
console.log('Ged 88-3-2 We have a running Season', idx)
if ( nextEpisodeToAir > 0){
// First episode has aired
log.info(`[tmdb.js] (getTMDBShowInfo) - Some episodes are in the future, so adj.`);
Seasons_Cloud[JSONPath({ path: "$..season_number", json: seasons[idx]})[0]] = nextEpisodeToAir -1;
seasonCount++;
episodeCount = episodeCount + nextEpisodeToAir -1;
}
} 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];
}
} 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;