[addon] correctly handle season 0

This commit is contained in:
TheBeastLT
2020-11-24 15:50:35 +01:00
parent eba2e5f9cf
commit fa4fd59219
2 changed files with 4 additions and 4 deletions

View File

@@ -58,13 +58,13 @@ async function seriesRecordsHandler(args) {
if (args.id.match(/tt\d+/)) {
const parts = args.id.split(':');
const imdbId = parts[0];
const season = parts[1] ? parseInt(parts[1], 10) : 1;
const episode = parts[2] ? parseInt(parts[2], 10) : 1;
const season = parts[1] !== undefined ? parseInt(parts[1], 10) : 1;
const episode = parts[2] !== undefined ? parseInt(parts[2], 10) : 1;
return repository.getImdbIdSeriesEntries(imdbId, season, episode);
} else if (args.id.match(/kitsu:\d+/i)) {
const parts = args.id.split(':');
const kitsuId = parts[1];
const episode = parts[2] ? parseInt(parts[2], 10) : 1;
const episode = parts[2] !== undefined ? parseInt(parts[2], 10) : 1;
return repository.getKitsuIdSeriesEntries(kitsuId, episode);
}
return Promise.reject(`Unsupported id type: ${args.id}`);

View File

@@ -46,7 +46,7 @@ async function _getInstantAvailable(hashes, apiKey, retries = 3) {
if (retries > 0 && ['ESOCKETTIMEDOUT', 'EAI_AGAIN'].some(v => error.message && error.message.includes(v))) {
return _getInstantAvailable(hashes, apiKey, retries - 1);
}
console.warn('Failed RealDebrid cached torrent availability request: ', error);
console.warn('Failed RealDebrid cached torrent availability request: ', error.message);
return undefined;
});
}