diff --git a/beamup.json b/beamup.json index 9c86737..d96ecd6 100644 --- a/beamup.json +++ b/beamup.json @@ -1,4 +1,4 @@ { "projectName": "tmdb-addon", - "lastCommit": "c2b4805" + "lastCommit": "0c74237" } \ No newline at end of file diff --git a/lib/getManifest.js b/lib/getManifest.js index 0e131cb..464fdbc 100644 --- a/lib/getManifest.js +++ b/lib/getManifest.js @@ -87,22 +87,6 @@ function getOptionsForCatalog(catalogDef, type, { years, genres_movie, genres_se } } -function sortCatalogs(catalogs) { - return catalogs.sort((a, b) => { - const typeA = a.id.split('.')[1]; - const typeB = b.id.split('.')[1]; - - const orderA = Object.keys(CATALOG_TYPES).findIndex(category => CATALOG_TYPES[category][typeA]); - const orderB = Object.keys(CATALOG_TYPES).findIndex(category => CATALOG_TYPES[category][typeB]); - - if (orderA !== orderB) { - return orderA - orderB; - } - - return a.type === "movie" && b.type === "series" ? -1 : 1; - }); -} - async function getManifest(config) { const language = config.language || DEFAULT_LANGUAGE; const tmdbPrefix = config.tmdbPrefix === "true"; @@ -127,29 +111,27 @@ async function getManifest(config) { const filterLanguages = setOrderLanguage(language, languagesArray); const options = { years, genres_movie, genres_series, filterLanguages }; - const catalogs = sortCatalogs( - userCatalogs - .filter(userCatalog => { - const catalogDef = getCatalogDefinition(userCatalog.id); - if (!catalogDef) return false; - if (catalogDef.requiresAuth && !sessionId) return false; - return true; - }) - .map(userCatalog => { - const catalogDef = getCatalogDefinition(userCatalog.id); - const catalogOptions = getOptionsForCatalog(catalogDef, userCatalog.type, options); - - return createCatalog( - userCatalog.id, - userCatalog.type, - catalogDef, - catalogOptions, - tmdbPrefix, - translatedCatalogs, - userCatalog.showInHome - ); - }) - ); + const catalogs = userCatalogs + .filter(userCatalog => { + const catalogDef = getCatalogDefinition(userCatalog.id); + if (!catalogDef) return false; + if (catalogDef.requiresAuth && !sessionId) return false; + return true; + }) + .map(userCatalog => { + const catalogDef = getCatalogDefinition(userCatalog.id); + const catalogOptions = getOptionsForCatalog(catalogDef, userCatalog.type, options); + + return createCatalog( + userCatalog.id, + userCatalog.type, + catalogDef, + catalogOptions, + tmdbPrefix, + translatedCatalogs, + userCatalog.showInHome + ); + }); const descriptionSuffix = language && language !== DEFAULT_LANGUAGE ? ` with ${language} language.` : ".";