mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat(api): add external ids to movie/tv response
This commit is contained in:
@@ -121,6 +121,17 @@ export interface TmdbCreditCrew {
|
|||||||
department: string;
|
department: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TmdbExternalIds {
|
||||||
|
imdb_id?: string;
|
||||||
|
freebase_mid?: string;
|
||||||
|
freebase_id?: string;
|
||||||
|
tvdb_id?: number;
|
||||||
|
tvrage_id?: string;
|
||||||
|
facebook_id?: string;
|
||||||
|
instagram_id?: string;
|
||||||
|
twitter_id?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TmdbMovieDetails {
|
export interface TmdbMovieDetails {
|
||||||
id: number;
|
id: number;
|
||||||
imdb_id?: string;
|
imdb_id?: string;
|
||||||
@@ -164,6 +175,7 @@ export interface TmdbMovieDetails {
|
|||||||
cast: TmdbCreditCast[];
|
cast: TmdbCreditCast[];
|
||||||
crew: TmdbCreditCrew[];
|
crew: TmdbCreditCrew[];
|
||||||
};
|
};
|
||||||
|
external_ids: TmdbExternalIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TmdbTvEpisodeDetails {
|
export interface TmdbTvEpisodeDetails {
|
||||||
@@ -242,6 +254,7 @@ export interface TmdbTvDetails {
|
|||||||
cast: TmdbCreditCast[];
|
cast: TmdbCreditCast[];
|
||||||
crew: TmdbCreditCrew[];
|
crew: TmdbCreditCrew[];
|
||||||
};
|
};
|
||||||
|
external_ids: TmdbExternalIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TheMovieDb {
|
class TheMovieDb {
|
||||||
@@ -289,7 +302,7 @@ class TheMovieDb {
|
|||||||
const response = await this.axios.get<TmdbMovieDetails>(
|
const response = await this.axios.get<TmdbMovieDetails>(
|
||||||
`/movie/${movieId}`,
|
`/movie/${movieId}`,
|
||||||
{
|
{
|
||||||
params: { language, append_to_response: 'credits' },
|
params: { language, append_to_response: 'credits,external_ids' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -308,7 +321,7 @@ class TheMovieDb {
|
|||||||
}): Promise<TmdbTvDetails> => {
|
}): Promise<TmdbTvDetails> => {
|
||||||
try {
|
try {
|
||||||
const response = await this.axios.get<TmdbTvDetails>(`/tv/${tvId}`, {
|
const response = await this.axios.get<TmdbTvDetails>(`/tv/${tvId}`, {
|
||||||
params: { language, append_to_response: 'credits' },
|
params: { language, append_to_response: 'credits,external_ids' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
|
@@ -73,6 +73,13 @@ export class MediaRequest {
|
|||||||
@Index()
|
@Index()
|
||||||
public mediaId: number;
|
public mediaId: number;
|
||||||
|
|
||||||
|
@Column({ unique: true, nullable: true })
|
||||||
|
@Index()
|
||||||
|
public tvdbId: number;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
public seasons?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
public mediaType: 'movie' | 'tv';
|
public mediaType: 'movie' | 'tv';
|
||||||
|
|
||||||
|
@@ -7,6 +7,8 @@ import {
|
|||||||
Crew,
|
Crew,
|
||||||
mapCast,
|
mapCast,
|
||||||
mapCrew,
|
mapCrew,
|
||||||
|
ExternalIds,
|
||||||
|
mapExternalIds,
|
||||||
} from './common';
|
} from './common';
|
||||||
|
|
||||||
export interface MovieDetails {
|
export interface MovieDetails {
|
||||||
@@ -45,6 +47,7 @@ export interface MovieDetails {
|
|||||||
crew: Crew[];
|
crew: Crew[];
|
||||||
};
|
};
|
||||||
request?: MediaRequest;
|
request?: MediaRequest;
|
||||||
|
externalIds: ExternalIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mapMovieDetails = (
|
export const mapMovieDetails = (
|
||||||
@@ -84,5 +87,6 @@ export const mapMovieDetails = (
|
|||||||
cast: movie.credits.cast.map(mapCast),
|
cast: movie.credits.cast.map(mapCast),
|
||||||
crew: movie.credits.crew.map(mapCrew),
|
crew: movie.credits.crew.map(mapCrew),
|
||||||
},
|
},
|
||||||
|
externalIds: mapExternalIds(movie.external_ids),
|
||||||
request,
|
request,
|
||||||
});
|
});
|
||||||
|
@@ -5,6 +5,8 @@ import {
|
|||||||
Crew,
|
Crew,
|
||||||
mapCast,
|
mapCast,
|
||||||
mapCrew,
|
mapCrew,
|
||||||
|
ExternalIds,
|
||||||
|
mapExternalIds,
|
||||||
} from './common';
|
} from './common';
|
||||||
import { MediaRequest } from '../entity/MediaRequest';
|
import { MediaRequest } from '../entity/MediaRequest';
|
||||||
import {
|
import {
|
||||||
@@ -75,6 +77,7 @@ export interface TvDetails {
|
|||||||
cast: Cast[];
|
cast: Cast[];
|
||||||
crew: Crew[];
|
crew: Crew[];
|
||||||
};
|
};
|
||||||
|
externalIds: ExternalIds;
|
||||||
request?: MediaRequest;
|
request?: MediaRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,5 +158,6 @@ export const mapTvDetails = (
|
|||||||
cast: show.credits.cast.map(mapCast),
|
cast: show.credits.cast.map(mapCast),
|
||||||
crew: show.credits.crew.map(mapCrew),
|
crew: show.credits.crew.map(mapCrew),
|
||||||
},
|
},
|
||||||
|
externalIds: mapExternalIds(show.external_ids),
|
||||||
request,
|
request,
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { TmdbCreditCast, TmdbCreditCrew } from '../api/themoviedb';
|
import {
|
||||||
|
TmdbCreditCast,
|
||||||
|
TmdbCreditCrew,
|
||||||
|
TmdbExternalIds,
|
||||||
|
} from '../api/themoviedb';
|
||||||
|
|
||||||
export interface ProductionCompany {
|
export interface ProductionCompany {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -33,6 +37,17 @@ export interface Crew {
|
|||||||
profilePath?: string;
|
profilePath?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExternalIds {
|
||||||
|
imdbId?: string;
|
||||||
|
freebaseMid?: string;
|
||||||
|
freebaseId?: string;
|
||||||
|
tvdbId?: number;
|
||||||
|
tvrageId?: string;
|
||||||
|
facebookId?: string;
|
||||||
|
instagramId?: string;
|
||||||
|
twitterId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const mapCast = (person: TmdbCreditCast): Cast => ({
|
export const mapCast = (person: TmdbCreditCast): Cast => ({
|
||||||
castId: person.cast_id,
|
castId: person.cast_id,
|
||||||
character: person.character,
|
character: person.character,
|
||||||
@@ -53,3 +68,14 @@ export const mapCrew = (person: TmdbCreditCrew): Crew => ({
|
|||||||
gender: person.gender,
|
gender: person.gender,
|
||||||
profilePath: person.profile_path,
|
profilePath: person.profile_path,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const mapExternalIds = (eids: TmdbExternalIds): ExternalIds => ({
|
||||||
|
facebookId: eids.facebook_id,
|
||||||
|
freebaseId: eids.freebase_id,
|
||||||
|
freebaseMid: eids.freebase_mid,
|
||||||
|
imdbId: eids.imdb_id,
|
||||||
|
instagramId: eids.instagram_id,
|
||||||
|
tvdbId: eids.tvdb_id,
|
||||||
|
tvrageId: eids.tvrage_id,
|
||||||
|
twitterId: eids.twitter_id,
|
||||||
|
});
|
||||||
|
@@ -433,6 +433,8 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Crew'
|
$ref: '#/components/schemas/Crew'
|
||||||
|
externalIds:
|
||||||
|
$ref: '#/components/schemas/ExternalIds'
|
||||||
request:
|
request:
|
||||||
$ref: '#/components/schemas/MediaRequest'
|
$ref: '#/components/schemas/MediaRequest'
|
||||||
Episode:
|
Episode:
|
||||||
@@ -573,6 +575,8 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Crew'
|
$ref: '#/components/schemas/Crew'
|
||||||
|
externalIds:
|
||||||
|
$ref: '#/components/schemas/ExternalIds'
|
||||||
request:
|
request:
|
||||||
$ref: '#/components/schemas/MediaRequest'
|
$ref: '#/components/schemas/MediaRequest'
|
||||||
MediaRequest:
|
MediaRequest:
|
||||||
@@ -657,6 +661,25 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
profilePath:
|
profilePath:
|
||||||
type: string
|
type: string
|
||||||
|
ExternalIds:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
facebookId:
|
||||||
|
type: string
|
||||||
|
freebaseId:
|
||||||
|
type: string
|
||||||
|
freebaseMid:
|
||||||
|
type: string
|
||||||
|
imdbId:
|
||||||
|
type: string
|
||||||
|
instagramId:
|
||||||
|
type: string
|
||||||
|
tvdbId:
|
||||||
|
type: string
|
||||||
|
tvrageId:
|
||||||
|
type: string
|
||||||
|
twitterId:
|
||||||
|
type: string
|
||||||
|
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
cookieAuth:
|
cookieAuth:
|
||||||
@@ -1219,6 +1242,16 @@ paths:
|
|||||||
mediaId:
|
mediaId:
|
||||||
type: number
|
type: number
|
||||||
example: 123
|
example: 123
|
||||||
|
tvdbId:
|
||||||
|
type: number
|
||||||
|
example: 123
|
||||||
|
seasons:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: number
|
||||||
|
required:
|
||||||
|
- mediaType
|
||||||
|
- mediaId
|
||||||
responses:
|
responses:
|
||||||
'201':
|
'201':
|
||||||
description: Succesfully created the request
|
description: Succesfully created the request
|
||||||
|
Reference in New Issue
Block a user