Skip to content

Commit 1bdb634

Browse files
author
cedya77
committed
fix search rating posters using wrong config keys and consolidate search UI controls
- Use catalog ID (e.g. 'gemini.search', 'anime_series') instead of content type (e.g. 'other', 'anime.series') for engineRatingPosters lookup, matching the keys the frontend stores - Change default from opt-out (!== false) to opt-in (=== true) so catalogs without an explicit entry default to no rating posters - Fix Trakt search ratings toggle affecting both movie and series by using provider.id - Strip rename/ratings controls from upper search sections, keep only in Search Catalog Order - Fix MAL studios cache TTL (was milliseconds, now seconds) - Increase JIKAN_API_TTL to 30 days to match warming interval - Update scheduleEssentialWarming default to 720 minutes - Remove dead ratingPostersEnabled variable from cacheWrapSearch
1 parent aa5b2cf commit 1bdb634

5 files changed

Lines changed: 31 additions & 195 deletions

File tree

addon/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3389,6 +3389,7 @@ addon.get("/stremio/:userUUID/catalog/:type/:id/:extra?.json", async function (r
33893389
}
33903390
config._currentSearchEngine = searchEngine;
33913391
config._currentSearchType = searchType;
3392+
config._currentSearchCatalogId = originalSearchId;
33923393

33933394
// Compute search-specific page size based on the provider's actual results per page
33943395
let searchPageSize = 20; // default (TMDB, Kitsu)
@@ -3851,7 +3852,9 @@ addon.get("/stremio/:userUUID/catalog/:type/:id/:extra?.json", async function (r
38513852
// Skip poster override for up next catalogs unless useShowPosterForUpNext is enabled
38523853
// (when disabled, up next uses episode thumbnails as posters which shouldn't be overridden)
38533854
const host = process.env.HOST_NAME.startsWith('http') ? process.env.HOST_NAME : `https://${process.env.HOST_NAME}`;
3854-
const posterPatternsEnabled = catalogConfig?.enableRatingPosters !== false;
3855+
const posterPatternsEnabled = config._currentSearchCatalogId
3856+
? (config.search?.engineRatingPosters?.[config._currentSearchCatalogId] === true)
3857+
: (catalogConfig?.enableRatingPosters !== false);
38553858
const posterPattern = posterPatternsEnabled ? (config.customPosterUrlPattern || (config.posterRatingProvider && config.posterRatingProvider !== 'custom' ? require('./utils/parseProps').getDefaultPosterPattern(config.posterRatingProvider) : null)) : null;
38563859
if ((posterPattern || config.customBackgroundUrlPattern || config.customLogoUrlPattern) && responseData?.metas && Array.isArray(responseData.metas)) {
38573860
const isUpNextCatalog = cleanId.includes('up_next') || cleanId.includes('upnext');

addon/lib/cacheWarmer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async function warmEssentialContent() {
8282
if (!shouldContinueWarming()) { isCurrentlyWarming = false; return; }
8383
await cacheWrapJikanApi('mal-studios', async () => {
8484
return await mal.getStudios(100);
85-
}, 30 * 24 * 60 * 1000, { skipVersion: true }); // Cache for 30 days
85+
}, 30 * 24 * 60 * 60, { skipVersion: true }); // Cache for 30 days
8686
warmingItemsCount++;
8787

8888
// Warm MAL available seasons
@@ -397,7 +397,7 @@ async function warmFromUserActivity() {
397397
/**
398398
* Schedule essential warming at regular intervals
399399
*/
400-
function scheduleEssentialWarming(intervalMinutes = 30) {
400+
function scheduleEssentialWarming(intervalMinutes = 720) {
401401
warmingIntervalMinutes = intervalMinutes;
402402
logger.info(`[API Cache Warming] Scheduling periodic warming every ${intervalMinutes} minutes`);
403403

addon/lib/getCache.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ADDON_VERSION = packageJson.version;
3737
const META_TTL = parseInt(process.env.META_TTL || 7 * 24 * 60 * 60, 10);
3838
const CATALOG_TTL = parseInt(process.env.CATALOG_TTL || 1 * 24 * 60 * 60, 10);
3939
const TMDB_TRENDING_TTL = parseInt(process.env.TMDB_TRENDING_TTL || 3 * 60 * 60, 10);
40-
const JIKAN_API_TTL = 1 * 24 * 60 * 60;
40+
const JIKAN_API_TTL = 30 * 24 * 60 * 60;
4141
const STATIC_CATALOG_TTL = 30 * 24 * 60 * 60;
4242
const TVDB_API_TTL = 12 * 60 * 60;
4343
const TVMAZE_API_TTL = 12 * 60 * 60;
@@ -1013,10 +1013,6 @@ async function cacheWrapSearch(userUUID, searchKey, method, searchEngine = null,
10131013
return { metas: [] };
10141014
}
10151015

1016-
// Get rating posters enablement state for this search type (movie/series)
1017-
const searchType = config._currentSearchType;
1018-
const ratingPostersEnabled = searchType ? (config.search?.engineRatingPosters?.[searchType] !== false) : true;
1019-
10201016
// Search-specific config (only relevant parameters for search results)
10211017
const defaultSearchOrder = [
10221018
'movie',

addon/utils/parseProps.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ function isRatingPostersEnabled(config) {
3737
return config._currentCatalogConfig.enableRatingPosters !== false;
3838
}
3939

40-
// Check search type-level RatingPosters setting (for search routes)
41-
if (config._currentSearchType) {
42-
// Default to true if not explicitly set to false
43-
return config.search?.engineRatingPosters?.[config._currentSearchType] !== false;
40+
// Check search catalog-level RatingPosters setting (for search routes)
41+
if (config._currentSearchCatalogId) {
42+
return config.search?.engineRatingPosters?.[config._currentSearchCatalogId] === true;
4443
}
4544

4645
// Default to true if neither catalog nor search context is set

0 commit comments

Comments
 (0)