Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tvdb indexer #899

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 88 additions & 1 deletion overseerr-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ components:
serverID:
type: string
readOnly: true
TvdbSettings:
type: object
properties:
apiKey:
type: string
example: 'apikey'
pin:
type: string
example: 'ABCDEFGH'
use:
type: boolean
example: true
TautulliSettings:
type: object
properties:
Expand Down Expand Up @@ -2343,6 +2355,75 @@ paths:
type: string
thumb:
type: string
/settings/tvdb:
get:
summary: Get TVDB settings
description: Retrieves current TVDB settings.
tags:
- settings
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TvdbSettings'
put:
summary: Update TVDB settings
description: Updates TVDB settings with the provided values.
tags:
- settings
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TvdbSettings'
responses:
'200':
description: 'Values were successfully updated'
content:
application/json:
schema:
$ref: '#/components/schemas/TvdbSettings'
/settings/tvdb/test:
post:
summary: Test TVDB configuration
description: Tests if the TVDB configuration is valid. Returns a list of available languages on success.
tags:
- settings
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
apiKey:
type: string
example: yourapikey
pin:
type: string
example: yourpin
required:
- apiKey
responses:
'200':
description: Succesfully connected to TVDB
content:
application/json:
schema:
type: object
properties:
languages:
type: array
items:
type: object
properties:
id:
type: number
name:
type: string
/settings/tautulli:
get:
summary: Get Tautulli settings
Expand Down Expand Up @@ -5787,7 +5868,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/TvDetails'
/tv/{tvId}/season/{seasonId}:
/tv/{tvId}/season/{seasonNumber}/{seasonId}:
get:
summary: Get season details and episode list
description: Returns season details with a list of episodes in a JSON object.
Expand All @@ -5806,6 +5887,12 @@ paths:
schema:
type: number
example: 1
- in: path
name: seasonNumber
required: true
schema:
type: number
example: 123456
- in: query
name: language
schema:
Expand Down
3 changes: 2 additions & 1 deletion server/api/externalapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DEFAULT_TTL = 300;
// 10 seconds default rolling buffer (in ms)
const DEFAULT_ROLLING_BUFFER = 10000;

interface ExternalAPIOptions {
export interface ExternalAPIOptions {
nodeCache?: NodeCache;
headers?: Record<string, unknown>;
rateLimit?: RateLimitOptions;
Expand Down Expand Up @@ -39,6 +39,7 @@ class ExternalAPI {
Accept: 'application/json',
...options.headers,
};

this.cache = options.nodeCache;
}

Expand Down
25 changes: 25 additions & 0 deletions server/api/indexer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type {
TmdbSeasonWithEpisodes,
TmdbTvDetails,
} from '@server/api/indexer/themoviedb/interfaces';

export interface TvShowIndexer {
getTvShow({
tvId,
language,
}: {
tvId: number;
language?: string;
}): Promise<TmdbTvDetails>;
getTvSeason({
tvId,
seasonId,
seasonNumber,
language,
}: {
tvId: number;
seasonId: number;
seasonNumber: number;
language?: string;
}): Promise<TmdbSeasonWithEpisodes>;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ExternalAPI from '@server/api/externalapi';
import type { TvShowIndexer } from '@server/api/indexer';
import cacheManager from '@server/lib/cache';
import { sortBy } from 'lodash';
import type {
Expand Down Expand Up @@ -97,7 +98,7 @@ interface DiscoverTvOptions {
watchProviders?: string;
}

class TheMovieDb extends ExternalAPI {
class TheMovieDb extends ExternalAPI implements TvShowIndexer {
private region?: string;
private originalLanguage?: string;
constructor({
Expand Down
Loading
Loading