Added open api types to movies and series
This commit is contained in:
parent
a866beb676
commit
471c24d34e
3 changed files with 155 additions and 95 deletions
|
|
@ -5,6 +5,48 @@ import { MovieModel } from '../../models/MovieModel';
|
||||||
import { MediaType } from '../../utils/MediaType';
|
import { MediaType } from '../../utils/MediaType';
|
||||||
import { APIModel } from '../APIModel';
|
import { APIModel } from '../APIModel';
|
||||||
|
|
||||||
|
interface TMDBSearchMovieResult {
|
||||||
|
id: number;
|
||||||
|
original_language?: string;
|
||||||
|
original_title?: string;
|
||||||
|
overview?: string;
|
||||||
|
popularity?: number;
|
||||||
|
poster_path?: string;
|
||||||
|
release_date?: string;
|
||||||
|
title?: string;
|
||||||
|
video?: boolean;
|
||||||
|
vote_average?: number;
|
||||||
|
vote_count?: number;
|
||||||
|
adult?: boolean;
|
||||||
|
backdrop_path?: string;
|
||||||
|
genre_ids?: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TMDBSearchMovieResponse {
|
||||||
|
page: number;
|
||||||
|
results: TMDBSearchMovieResult[];
|
||||||
|
total_results: number;
|
||||||
|
total_pages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TMDBMovieDetails {
|
||||||
|
id: number;
|
||||||
|
title?: string;
|
||||||
|
original_title?: string;
|
||||||
|
release_date?: string;
|
||||||
|
overview?: string;
|
||||||
|
genres?: { id: number; name: string }[];
|
||||||
|
production_companies?: { id: number; name: string }[];
|
||||||
|
runtime?: number;
|
||||||
|
status?: string;
|
||||||
|
vote_average?: number;
|
||||||
|
poster_path?: string;
|
||||||
|
credits?: {
|
||||||
|
cast?: { name: string }[];
|
||||||
|
crew?: { name: string; job: string }[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export class TMDBMovieAPI extends APIModel {
|
export class TMDBMovieAPI extends APIModel {
|
||||||
plugin: MediaDbPlugin;
|
plugin: MediaDbPlugin;
|
||||||
typeMappings: Map<string, string>;
|
typeMappings: Map<string, string>;
|
||||||
|
|
@ -12,59 +54,46 @@ export class TMDBMovieAPI extends APIModel {
|
||||||
|
|
||||||
constructor(plugin: MediaDbPlugin) {
|
constructor(plugin: MediaDbPlugin) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.apiName = 'TMDBMovieAPI';
|
this.apiName = 'TMDBMovieAPI';
|
||||||
this.apiDescription = 'A community built Movie DB.';
|
this.apiDescription = 'A community built Movie DB.';
|
||||||
this.apiUrl = 'https://www.themoviedb.org/';
|
this.apiUrl = 'https://www.themoviedb.org/';
|
||||||
this.types = [MediaType.Movie];
|
this.types = [MediaType.Movie];
|
||||||
this.typeMappings = new Map<string, string>();
|
this.typeMappings = new Map();
|
||||||
this.typeMappings.set('movie', 'movie');
|
this.typeMappings.set('movie', 'movie');
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
|
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
|
||||||
console.log(`MDB | api "${this.apiName}" queried by Title`);
|
console.log(`MDB | api "${this.apiName}" queried by Title`);
|
||||||
|
|
||||||
if (!this.plugin.settings.TMDBKey) {
|
if (!this.plugin.settings.TMDBKey) {
|
||||||
throw new Error(`MDB | API key for ${this.apiName} missing.`);
|
throw new Error(`MDB | API key for ${this.apiName} missing.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchUrl = `https://api.themoviedb.org/3/search/movie?api_key=${this.plugin.settings.TMDBKey}&query=${encodeURIComponent(title)}&include_adult=${this.plugin.settings.sfwFilter ? 'false' : 'true'}`;
|
const searchUrl = `https://api.themoviedb.org/3/search/movie?api_key=${this.plugin.settings.TMDBKey}&query=${encodeURIComponent(title)}&include_adult=${this.plugin.settings.sfwFilter ? 'false' : 'true'}`;
|
||||||
const fetchData = await fetch(searchUrl);
|
const searchResp = await fetch(searchUrl);
|
||||||
|
if (searchResp.status === 401) {
|
||||||
if (fetchData.status === 401) {
|
|
||||||
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
||||||
}
|
}
|
||||||
if (fetchData.status !== 200) {
|
|
||||||
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
if (searchResp.status !== 200) {
|
||||||
|
throw Error(`MDB | Received status code ${searchResp.status} from ${this.apiName}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await fetchData.json();
|
const searchData = (await searchResp.json()) as TMDBSearchMovieResponse;
|
||||||
|
if (!searchData.results || searchData.total_results === 0) {
|
||||||
if (data.total_results === 0) {
|
|
||||||
if (data.Error === 'Movie not found!') {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Error(`MDB | Received error from ${this.apiName}: \n${JSON.stringify(data, undefined, 4)}`);
|
|
||||||
}
|
|
||||||
if (!data.results) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.debug(data.results);
|
|
||||||
|
|
||||||
const ret: MediaTypeModel[] = [];
|
const ret: MediaTypeModel[] = [];
|
||||||
|
for (const result of searchData.results) {
|
||||||
for (const result of data.results) {
|
|
||||||
ret.push(
|
ret.push(
|
||||||
new MovieModel({
|
new MovieModel({
|
||||||
type: 'movie',
|
type: 'movie',
|
||||||
title: result.original_title,
|
title: result.original_title ?? '',
|
||||||
englishTitle: result.title,
|
englishTitle: result.title ?? '',
|
||||||
year: result.release_date ? new Date(result.release_date).getFullYear().toString() : 'unknown',
|
year: result.release_date ? new Date(result.release_date).getFullYear().toString() : 'unknown',
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
id: result.id,
|
id: result.id.toString(),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -72,50 +101,44 @@ export class TMDBMovieAPI extends APIModel {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getById(id: string): Promise<MediaTypeModel> {
|
async getById(id: string): Promise<MovieModel> {
|
||||||
console.log(`MDB | api "${this.apiName}" queried by ID`);
|
console.log(`MDB | api "${this.apiName}" queried by ID`);
|
||||||
|
|
||||||
if (!this.plugin.settings.TMDBKey) {
|
if (!this.plugin.settings.TMDBKey) {
|
||||||
throw Error(`MDB | API key for ${this.apiName} missing.`);
|
throw Error(`MDB | API key for ${this.apiName} missing.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchUrl = `https://api.themoviedb.org/3/movie/${encodeURIComponent(id)}?api_key=${this.plugin.settings.TMDBKey}&append_to_response=credits`;
|
const searchUrl = `https://api.themoviedb.org/3/movie/${encodeURIComponent(id)}?api_key=${this.plugin.settings.TMDBKey}&append_to_response=credits`;
|
||||||
const fetchData = await fetch(searchUrl);
|
const fetchData = await fetch(searchUrl);
|
||||||
|
|
||||||
if (fetchData.status === 401) {
|
if (fetchData.status === 401) {
|
||||||
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetchData.status !== 200) {
|
if (fetchData.status !== 200) {
|
||||||
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await fetchData.json();
|
const result = (await fetchData.json()) as TMDBMovieDetails;
|
||||||
// console.debug(result);
|
|
||||||
|
|
||||||
return new MovieModel({
|
return new MovieModel({
|
||||||
type: 'movie',
|
type: 'movie',
|
||||||
title: result.title,
|
title: result.title ?? '',
|
||||||
englishTitle: result.title,
|
englishTitle: result.title ?? '',
|
||||||
year: result.release_date ? new Date(result.release_date).getFullYear().toString() : 'unknown',
|
year: result.release_date ? new Date(result.release_date).getFullYear().toString() : 'unknown',
|
||||||
premiere: this.plugin.dateFormatter.format(result.release_date, this.apiDateFormat) ?? 'unknown',
|
premiere: this.plugin.dateFormatter.format(result.release_date ?? '', this.apiDateFormat) ?? 'unknown',
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
url: `https://www.themoviedb.org/movie/${result.id}`,
|
url: `https://www.themoviedb.org/movie/${result.id}`,
|
||||||
id: result.id,
|
id: result.id.toString(),
|
||||||
|
|
||||||
plot: result.overview ?? '',
|
plot: result.overview ?? '',
|
||||||
genres: result.genres.map((g: any) => g.name) ?? [],
|
genres: result.genres?.map((g: any) => g.name) ?? [],
|
||||||
writer: result.credits.crew.filter((c: any) => c.job === 'Screenplay').map((c: any) => c.name) ?? [],
|
writer: result.credits?.crew?.filter((c: any) => c.job === 'Screenplay').map((c: any) => c.name) ?? [],
|
||||||
director: result.credits.crew.filter((c: any) => c.job === 'Director').map((c: any) => c.name) ?? [],
|
director: result.credits?.crew?.filter((c: any) => c.job === 'Director').map((c: any) => c.name) ?? [],
|
||||||
studio: result.production_companies.map((s: any) => s.name) ?? [],
|
studio: result.production_companies?.map((s: any) => s.name) ?? [],
|
||||||
|
duration: result.runtime?.toString() ?? 'unknown',
|
||||||
duration: result.runtime ?? 'unknown',
|
onlineRating: result.vote_average ?? 0,
|
||||||
onlineRating: result.vote_average,
|
actors: result.credits?.cast?.map((c: any) => c.name).slice(0, 5) ?? [],
|
||||||
actors: result.credits.cast.map((c: any) => c.name).slice(0, 5) ?? [],
|
image: result.poster_path ? `https://image.tmdb.org/t/p/w780${result.poster_path}` : '',
|
||||||
image: `https://image.tmdb.org/t/p/w780${result.poster_path}`,
|
released: ['Released'].includes(result.status ?? ''),
|
||||||
|
|
||||||
released: ['Released'].includes(result.status),
|
|
||||||
streamingServices: [],
|
streamingServices: [],
|
||||||
|
|
||||||
userData: {
|
userData: {
|
||||||
watched: false,
|
watched: false,
|
||||||
lastWatched: '',
|
lastWatched: '',
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,50 @@ import { SeriesModel } from '../../models/SeriesModel';
|
||||||
import { MediaType } from '../../utils/MediaType';
|
import { MediaType } from '../../utils/MediaType';
|
||||||
import { APIModel } from '../APIModel';
|
import { APIModel } from '../APIModel';
|
||||||
|
|
||||||
|
interface TMDBSearchTVResult {
|
||||||
|
id: number;
|
||||||
|
origin_country?: string[];
|
||||||
|
original_language?: string;
|
||||||
|
original_name?: string;
|
||||||
|
overview?: string;
|
||||||
|
popularity?: number;
|
||||||
|
poster_path?: string;
|
||||||
|
first_air_date?: string;
|
||||||
|
name?: string;
|
||||||
|
vote_average?: number;
|
||||||
|
vote_count?: number;
|
||||||
|
adult?: boolean;
|
||||||
|
backdrop_path?: string;
|
||||||
|
genre_ids?: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TMDBSearchTVResponse {
|
||||||
|
page: number;
|
||||||
|
results: TMDBSearchTVResult[];
|
||||||
|
total_results: number;
|
||||||
|
total_pages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TMDBSeriesDetails {
|
||||||
|
id: number;
|
||||||
|
name?: string;
|
||||||
|
original_name?: string;
|
||||||
|
first_air_date?: string;
|
||||||
|
last_air_date?: string;
|
||||||
|
overview?: string;
|
||||||
|
genres?: { id: number; name: string }[];
|
||||||
|
created_by?: { id: number; name: string }[];
|
||||||
|
production_companies?: { id: number; name: string }[];
|
||||||
|
episode_run_time?: number[];
|
||||||
|
number_of_episodes?: number;
|
||||||
|
status?: string;
|
||||||
|
vote_average?: number;
|
||||||
|
poster_path?: string;
|
||||||
|
credits?: {
|
||||||
|
cast?: { name: string }[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export class TMDBSeriesAPI extends APIModel {
|
export class TMDBSeriesAPI extends APIModel {
|
||||||
plugin: MediaDbPlugin;
|
plugin: MediaDbPlugin;
|
||||||
typeMappings: Map<string, string>;
|
typeMappings: Map<string, string>;
|
||||||
|
|
@ -12,59 +56,46 @@ export class TMDBSeriesAPI extends APIModel {
|
||||||
|
|
||||||
constructor(plugin: MediaDbPlugin) {
|
constructor(plugin: MediaDbPlugin) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.apiName = 'TMDBSeriesAPI';
|
this.apiName = 'TMDBSeriesAPI';
|
||||||
this.apiDescription = 'A community built Series DB.';
|
this.apiDescription = 'A community built Series DB.';
|
||||||
this.apiUrl = 'https://www.themoviedb.org/';
|
this.apiUrl = 'https://www.themoviedb.org/';
|
||||||
this.types = [MediaType.Series];
|
this.types = [MediaType.Series];
|
||||||
this.typeMappings = new Map<string, string>();
|
this.typeMappings = new Map();
|
||||||
this.typeMappings.set('tv', 'series');
|
this.typeMappings.set('tv', 'series');
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
|
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
|
||||||
console.log(`MDB | api "${this.apiName}" queried by Title`);
|
console.log(`MDB | api "${this.apiName}" queried by Title`);
|
||||||
|
|
||||||
if (!this.plugin.settings.TMDBKey) {
|
if (!this.plugin.settings.TMDBKey) {
|
||||||
throw new Error(`MDB | API key for ${this.apiName} missing.`);
|
throw new Error(`MDB | API key for ${this.apiName} missing.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchUrl = `https://api.themoviedb.org/3/search/tv?api_key=${this.plugin.settings.TMDBKey}&query=${encodeURIComponent(title)}&include_adult=${this.plugin.settings.sfwFilter ? 'false' : 'true'}`;
|
const searchUrl = `https://api.themoviedb.org/3/search/tv?api_key=${this.plugin.settings.TMDBKey}&query=${encodeURIComponent(title)}&include_adult=${this.plugin.settings.sfwFilter ? 'false' : 'true'}`;
|
||||||
const fetchData = await fetch(searchUrl);
|
const searchResp = await fetch(searchUrl);
|
||||||
|
if (searchResp.status === 401) {
|
||||||
if (fetchData.status === 401) {
|
|
||||||
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
||||||
}
|
}
|
||||||
if (fetchData.status !== 200) {
|
|
||||||
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
if (searchResp.status !== 200) {
|
||||||
|
throw Error(`MDB | Received status code ${searchResp.status} from ${this.apiName}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await fetchData.json();
|
const searchData = (await searchResp.json()) as TMDBSearchTVResponse;
|
||||||
|
if (!searchData.results || searchData.total_results === 0) {
|
||||||
if (data.total_results === 0) {
|
|
||||||
if (data.Error === 'Series not found!') {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Error(`MDB | Received error from ${this.apiName}: \n${JSON.stringify(data, undefined, 4)}`);
|
|
||||||
}
|
|
||||||
if (!data.results) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.debug(data.results);
|
|
||||||
|
|
||||||
const ret: MediaTypeModel[] = [];
|
const ret: MediaTypeModel[] = [];
|
||||||
|
for (const result of searchData.results) {
|
||||||
for (const result of data.results) {
|
|
||||||
ret.push(
|
ret.push(
|
||||||
new SeriesModel({
|
new SeriesModel({
|
||||||
type: 'series',
|
type: 'series',
|
||||||
title: result.original_name,
|
title: result.original_name ?? '',
|
||||||
englishTitle: result.name,
|
englishTitle: result.name ?? '',
|
||||||
year: result.first_air_date ? new Date(result.first_air_date).getFullYear().toString() : 'unknown',
|
year: result.first_air_date ? new Date(result.first_air_date).getFullYear().toString() : 'unknown',
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
id: result.id,
|
id: result.id.toString(),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -72,51 +103,46 @@ export class TMDBSeriesAPI extends APIModel {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getById(id: string): Promise<MediaTypeModel> {
|
async getById(id: string): Promise<SeriesModel> {
|
||||||
console.log(`MDB | api "${this.apiName}" queried by ID`);
|
console.log(`MDB | api "${this.apiName}" queried by ID`);
|
||||||
|
|
||||||
if (!this.plugin.settings.TMDBKey) {
|
if (!this.plugin.settings.TMDBKey) {
|
||||||
throw Error(`MDB | API key for ${this.apiName} missing.`);
|
throw Error(`MDB | API key for ${this.apiName} missing.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchUrl = `https://api.themoviedb.org/3/tv/${encodeURIComponent(id)}?api_key=${this.plugin.settings.TMDBKey}&append_to_response=credits`;
|
const searchUrl = `https://api.themoviedb.org/3/tv/${encodeURIComponent(id)}?api_key=${this.plugin.settings.TMDBKey}&append_to_response=credits`;
|
||||||
const fetchData = await fetch(searchUrl);
|
const fetchData = await fetch(searchUrl);
|
||||||
|
|
||||||
if (fetchData.status === 401) {
|
if (fetchData.status === 401) {
|
||||||
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetchData.status !== 200) {
|
if (fetchData.status !== 200) {
|
||||||
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await fetchData.json();
|
const result = (await fetchData.json()) as TMDBSeriesDetails;
|
||||||
// console.debug(result);
|
|
||||||
|
|
||||||
return new SeriesModel({
|
return new SeriesModel({
|
||||||
type: 'series',
|
type: 'series',
|
||||||
title: result.original_name,
|
title: result.original_name ?? '',
|
||||||
englishTitle: result.name,
|
englishTitle: result.name ?? '',
|
||||||
year: result.first_air_date ? new Date(result.first_air_date).getFullYear().toString() : 'unknown',
|
year: result.first_air_date ? new Date(result.first_air_date).getFullYear().toString() : 'unknown',
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
url: `https://www.themoviedb.org/tv/${result.id}`,
|
url: `https://www.themoviedb.org/tv/${result.id}`,
|
||||||
id: result.id,
|
id: result.id.toString(),
|
||||||
|
|
||||||
plot: result.overview ?? '',
|
plot: result.overview ?? '',
|
||||||
genres: result.genres.map((g: any) => g.name) ?? [],
|
genres: result.genres?.map((g: any) => g.name) ?? [],
|
||||||
writer: result.created_by.map((c: any) => c.name) ?? [],
|
writer: result.created_by?.map((c: any) => c.name) ?? [],
|
||||||
studio: result.production_companies.map((s: any) => s.name) ?? [],
|
studio: result.production_companies?.map((s: any) => s.name) ?? [],
|
||||||
episodes: result.number_of_episodes,
|
episodes: result.number_of_episodes ?? 0,
|
||||||
duration: result.episode_run_time[0] ?? 'unknown',
|
duration: result.episode_run_time?.[0]?.toString() ?? 'unknown',
|
||||||
onlineRating: result.vote_average,
|
onlineRating: result.vote_average ?? 0,
|
||||||
actors: result.credits.cast.map((c: any) => c.name).slice(0, 5) ?? [],
|
actors: result.credits?.cast?.map((c: any) => c.name).slice(0, 5) ?? [],
|
||||||
image: `https://image.tmdb.org/t/p/w780${result.poster_path}`,
|
image: result.poster_path ? `https://image.tmdb.org/t/p/w780${result.poster_path}` : '',
|
||||||
|
released: ['Returning Series', 'Cancelled', 'Ended'].includes(result.status ?? ''),
|
||||||
released: ['Returning Series', 'Cancelled', 'Ended'].includes(result.status),
|
|
||||||
streamingServices: [],
|
streamingServices: [],
|
||||||
airing: ['Returning Series'].includes(result.status),
|
airing: ['Returning Series'].includes(result.status ?? ''),
|
||||||
airedFrom: this.plugin.dateFormatter.format(result.first_air_date, this.apiDateFormat) ?? 'unknown',
|
airedFrom: this.plugin.dateFormatter.format(result.first_air_date ?? '', this.apiDateFormat) ?? 'unknown',
|
||||||
airedTo: ['Returning Series'].includes(result.status) ? 'unknown' : (this.plugin.dateFormatter.format(result.last_air_date, this.apiDateFormat) ?? 'unknown'),
|
airedTo: ['Returning Series'].includes(result.status ?? '') ? 'unknown' : (this.plugin.dateFormatter.format(result.last_air_date ?? '', this.apiDateFormat) ?? 'unknown'),
|
||||||
|
|
||||||
userData: {
|
userData: {
|
||||||
watched: false,
|
watched: false,
|
||||||
lastWatched: '',
|
lastWatched: '',
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,17 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
void this.plugin.saveSettings();
|
void this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName('TMDB API key')
|
||||||
|
.setDesc('API key for "https://www.themoviedb.org".')
|
||||||
|
.addText(cb => {
|
||||||
|
cb.setPlaceholder('API key')
|
||||||
|
.setValue(this.plugin.settings.TMDBKey)
|
||||||
|
.onChange(data => {
|
||||||
|
this.plugin.settings.TMDBKey = data;
|
||||||
|
void this.plugin.saveSettings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Moby Games key')
|
.setName('Moby Games key')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue