mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-26 13:00:18 +00:00
Merge pull request #572 from WebTools-NG/#570-Find-Media-and-Multi-Episodes
Fix #570
This commit is contained in:
commit
080ee8b965
2 changed files with 30 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
|||
* [#553 Request Tooltips be replaced with Info or ? icons](https://github.com/WebTools-NG/WebTools-NG/issues/553) (Enhancement)
|
||||
* [#561 Find episodes I miss in my library](https://github.com/WebTools-NG/WebTools-NG/issues/561) (Enhancement)
|
||||
* [#554 Find Media and extended characters](https://github.com/WebTools-NG/WebTools-NG/issues/554) (Bug)
|
||||
* [#570 Find Media and Multi Episodes](https://github.com/WebTools-NG/WebTools-NG/issues/570) (Bug)
|
||||
* Added credits to tmdb.org for allowing us to use their API for free (Internal)
|
||||
|
||||
## V1.0.0 First Official Release (20220724)
|
||||
|
|
|
@ -140,6 +140,7 @@ const findMedia = new class FINDMEDIA {
|
|||
this.csvFile = ''; // Filename for output file
|
||||
this.csvStream; // Output stream
|
||||
this.settingsIgnoreDirs; // Directories to ignore
|
||||
this.multiEpisodes = {}; // Json of MultiEpisodes, and their count
|
||||
}
|
||||
|
||||
// Generate the filename for an export
|
||||
|
@ -349,9 +350,34 @@ const findMedia = new class FINDMEDIA {
|
|||
var lookup = pmsFile.slice(libPathFound.length + 1).normalize('NFC');
|
||||
log.silly(`[FindMedia.js] (scanPMSLibrary) - lookup is: ${lookup}`);
|
||||
if ( Object.prototype.hasOwnProperty.call(this.filesFound, lookup)) {
|
||||
// We need to remove from detected files, since we found it
|
||||
log.silly(`[FindMedia.js] (scanPMSLibrary) - Removing ${this.filesFound[lookup]}`);
|
||||
delete this.filesFound[lookup];
|
||||
// Multi Episode ?
|
||||
var re = /(s[0-9]{0,}e[0-9]{0,})-(e[0-9]{0,})/gi;
|
||||
var r = lookup.match(re);
|
||||
if (r){
|
||||
// Already registred?
|
||||
if( Object.prototype.hasOwnProperty.call( this.multiEpisodes, lookup)){
|
||||
this.multiEpisodes[lookup] = this.multiEpisodes[lookup] - 1;
|
||||
if ( this.multiEpisodes[lookup] == 0){
|
||||
// We need to remove from detected files, since we found it
|
||||
log.silly(`[FindMedia.js] (scanPMSLibrary) - Removing ${this.filesFound[lookup]}`);
|
||||
delete this.filesFound[lookup];
|
||||
delete this.multiEpisodes[lookup];
|
||||
}
|
||||
} else {
|
||||
// Add to registration
|
||||
re = /(e[0-9]{0,})/i;
|
||||
var firstEp = r[0].match(re);
|
||||
re = /(-e[0-9]{0,})/i;
|
||||
var lastEp = r[0].match(re);
|
||||
var amount = parseInt(lastEp[0].slice(2)) - parseInt(firstEp[0].slice(1), 10);
|
||||
log.silly(`[FindMedia.js] (scanPMSLibrary) - Registring MultiEpisode ${lookup} with amount ${amount}`);
|
||||
this.multiEpisodes[lookup] = amount;
|
||||
}
|
||||
} else {
|
||||
// We need to remove from detected files, since we found it
|
||||
log.silly(`[FindMedia.js] (scanPMSLibrary) - Removing ${this.filesFound[lookup]}`);
|
||||
delete this.filesFound[lookup];
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Not found, so only in PMS
|
||||
|
|
Loading…
Reference in a new issue