mirror of
https://github.com/seerr-team/seerr.git
synced 2025-12-23 23:58:07 -05:00
* feat(tvdb): get tv seasons/episodes with tvdb * fix: fix rate limiter index tvdb indexer * fix(usersettings): remove unused column tvdbtoken * refactor(tvdb): replace tvdb api by skyhook * fix: error during get episodes * fix: error if tmdb poster is null * refactor: clean tvdb indexer code * fix: wrong language with tmdb indexer * style: replace avalaible to available * style: tvdb.login to tvdb.test * fix(test): fix discover test * fix(test): wrong url tv-details * test(tvdb): add tvdb tests * style(tvdb): rename pokemon to correct tv show * refactor(indexer): remove unused getSeasonIdentifier method * refactor(settings): replace tvdb object to boolean type * refactor(tmdb): reduce still path condition * test(tvdb): change 'use' to 'tvdb' condition check * fix(tmdb): fix build fix build after rebase * fix(build): revert package.json * fix(tvdb): ensure that seasons contain data * refactor(swagger): fix /tvdb/test response * fix(scanner): add tvdb indexer for scanner * refactor(tvdb): remove skyhook api * refactor(tvdb): use tvdb api * fix(tvdb): rename tvdb to medatada * refactor(medata): add tvdb settings * refactor(metadata): rewrite metadata settings * refactor(metadata): refactor metadata routes * refactor(metadata): remove french comments * refactor(metadata): refactor tvdb api calls * style(prettier): run prettier * fix(scanner): fix jellyfin scanner with tvdb provider * fix(scanner): fix plex scanner tvdb provider * style(provider): change provider name in info section * style(provider): full provider name in select * style(provider): remove french comment * fix(tests): fix all cypress tests * refactor(tvdb): fix apikey * refactor(tmdb): apply prettier * refactor(tvdb): remove logger info * feat(metadata): replace fetch with axios for API calls * feat(provider): replace indexer by provider * fix(tests): fix cypress test * chore: add project-wide apikey for tvdb * chore: add correct application-wide key * fix(test): fix test with default provider tmdb anime * style(cypress): fix anime name variable * chore(i18n): remove french translation + apply i18n:extract * style(wording): standardize naming to "Metadata Provider" in UI text * docs(comments): translate from French to English * refactor(tvdb): remove unnecessary try/catch block * feat(i18n): add missing translations * fix(scanner): correct metadata provider ID from Tmdb to Tvdb * style(settings): clarify navigation label from "Metadata" to "Metadata Providers" * style(logs): update error log label from "Metadata" to "MetadataProvider" * refactor(tvdb): replace indexer by metadata providers * refactor(settings): remove metadata providers logo * fix(config): restore missing config/db/.gitkeep file --------- Co-authored-by: TOomaAh <ubuntu@PC> Co-authored-by: fallenbagel <98979876+Fallenbagel@users.noreply.github.com>
92 lines
2.0 KiB
TypeScript
92 lines
2.0 KiB
TypeScript
import NodeCache from 'node-cache';
|
|
|
|
export type AvailableCacheIds =
|
|
| 'tmdb'
|
|
| 'radarr'
|
|
| 'sonarr'
|
|
| 'rt'
|
|
| 'imdb'
|
|
| 'github'
|
|
| 'plexguid'
|
|
| 'plextv'
|
|
| 'plexwatchlist'
|
|
| 'tvdb';
|
|
|
|
const DEFAULT_TTL = 300;
|
|
const DEFAULT_CHECK_PERIOD = 120;
|
|
|
|
class Cache {
|
|
public id: AvailableCacheIds;
|
|
public data: NodeCache;
|
|
public name: string;
|
|
|
|
constructor(
|
|
id: AvailableCacheIds,
|
|
name: string,
|
|
options: { stdTtl?: number; checkPeriod?: number } = {}
|
|
) {
|
|
this.id = id;
|
|
this.name = name;
|
|
this.data = new NodeCache({
|
|
stdTTL: options.stdTtl ?? DEFAULT_TTL,
|
|
checkperiod: options.checkPeriod ?? DEFAULT_CHECK_PERIOD,
|
|
});
|
|
}
|
|
|
|
public getStats() {
|
|
return this.data.getStats();
|
|
}
|
|
|
|
public flush(): void {
|
|
this.data.flushAll();
|
|
}
|
|
}
|
|
|
|
class CacheManager {
|
|
private availableCaches: Record<AvailableCacheIds, Cache> = {
|
|
tmdb: new Cache('tmdb', 'The Movie Database API', {
|
|
stdTtl: 21600,
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
radarr: new Cache('radarr', 'Radarr API'),
|
|
sonarr: new Cache('sonarr', 'Sonarr API'),
|
|
rt: new Cache('rt', 'Rotten Tomatoes API', {
|
|
stdTtl: 43200,
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
imdb: new Cache('imdb', 'IMDB Radarr Proxy', {
|
|
stdTtl: 43200,
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
github: new Cache('github', 'GitHub API', {
|
|
stdTtl: 21600,
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
plexguid: new Cache('plexguid', 'Plex GUID', {
|
|
stdTtl: 86400 * 7, // 1 week cache
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
plextv: new Cache('plextv', 'Plex TV', {
|
|
stdTtl: 86400 * 7, // 1 week cache
|
|
checkPeriod: 60,
|
|
}),
|
|
plexwatchlist: new Cache('plexwatchlist', 'Plex Watchlist'),
|
|
tvdb: new Cache('tvdb', 'The TVDB API', {
|
|
stdTtl: 21600,
|
|
checkPeriod: 60 * 30,
|
|
}),
|
|
};
|
|
|
|
public getCache(id: AvailableCacheIds): Cache {
|
|
return this.availableCaches[id];
|
|
}
|
|
|
|
public getAllCaches(): Record<string, Cache> {
|
|
return this.availableCaches;
|
|
}
|
|
}
|
|
|
|
const cacheManager = new CacheManager();
|
|
|
|
export default cacheManager;
|