Skip to content
Snippets Groups Projects
Verified Commit 27b23486 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Remove TVDB support

parent 10f4168e
Branches
No related tags found
No related merge requests found
......@@ -704,15 +704,6 @@
}
}
},
"node-tvdb": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/node-tvdb/-/node-tvdb-4.1.0.tgz",
"integrity": "sha512-V612s3DM9xV/Nd2JkevG6AeB3H4Nn3g/Jns7xGTSaboeHZZm+GNyURY5m6yezadoNtXYaX+JNeH1OMhlhOXZ6Q==",
"requires": {
"lodash": "^4.17.4",
"node-fetch": "^2.0.0"
}
},
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
......@@ -825,24 +816,23 @@
"optional": true
},
"pg": {
"version": "8.3.3",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.3.3.tgz",
"integrity": "sha512-wmUyoQM/Xzmo62wgOdQAn5tl7u+IA1ZYK7qbuppi+3E+Gj4hlUxVHjInulieWrd0SfHi/ADriTb5ILJ/lsJrSg==",
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.5.1.tgz",
"integrity": "sha512-9wm3yX9lCfjvA98ybCyw2pADUivyNWT/yIP4ZcDVpMN0og70BUWYEGXPCTAQdGTAqnytfRADb7NERrY1qxhIqw==",
"requires": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
"pg-connection-string": "^2.3.0",
"pg-pool": "^3.2.1",
"pg-protocol": "^1.2.5",
"pg-connection-string": "^2.4.0",
"pg-pool": "^3.2.2",
"pg-protocol": "^1.4.0",
"pg-types": "^2.1.0",
"pgpass": "1.x",
"semver": "4.3.2"
"pgpass": "1.x"
}
},
"pg-connection-string": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.3.0.tgz",
"integrity": "sha512-ukMTJXLI7/hZIwTW7hGMZJ0Lj0S2XQBCJ4Shv4y1zgQ/vqVea+FLhzywvPj0ujSuofu+yA4MYHGZPTsgjBgJ+w=="
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz",
"integrity": "sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ=="
},
"pg-hstore": {
"version": "2.3.3",
......@@ -858,14 +848,14 @@
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
},
"pg-pool": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.1.tgz",
"integrity": "sha512-BQDPWUeKenVrMMDN9opfns/kZo4lxmSWhIqo+cSAF7+lfi9ZclQbr9vfnlNaPr8wYF3UYjm5X0yPAhbcgqNOdA=="
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz",
"integrity": "sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA=="
},
"pg-protocol": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.2.5.tgz",
"integrity": "sha512-1uYCckkuTfzz/FCefvavRywkowa6M5FohNMF5OjKrqo9PSR8gYc8poVmwwYQaBxhmQdBjhtP514eXy9/Us2xKg=="
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz",
"integrity": "sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA=="
},
"pg-types": {
"version": "2.2.0",
......@@ -880,11 +870,11 @@
}
},
"pgpass": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz",
"integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.4.tgz",
"integrity": "sha512-YmuA56alyBq7M59vxVBfPJrGSozru8QAdoNlWuW3cz8l+UX3cWge0vTvjKhsSHSJpo3Bom8/Mm6hf0TR5GY0+w==",
"requires": {
"split": "^1.0.0"
"split2": "^3.1.1"
}
},
"pnormaldist": {
......@@ -1034,11 +1024,6 @@
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"semver": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz",
"integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c="
},
"sequelize": {
"version": "6.3.5",
"resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.3.5.tgz",
......@@ -1081,12 +1066,24 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"split2": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz",
"integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==",
"requires": {
"through": "2"
"readable-stream": "^3.0.0"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"sqlite3": {
......@@ -1158,11 +1155,6 @@
"inherits": "2"
}
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"topo": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/topo/-/topo-3.0.3.tgz",
......@@ -1209,9 +1201,9 @@
"optional": true
},
"typescript": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz",
"integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg=="
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
"integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ=="
},
"underscore": {
"version": "1.11.0",
......@@ -1241,9 +1233,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ=="
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg=="
},
"validator": {
"version": "10.11.0",
......
......@@ -12,15 +12,14 @@
"dependencies": {
"fs": "0.0.1-security",
"node-fetch": "^2.6.1",
"node-tvdb": "^4.1.0",
"path": "^0.12.7",
"pg": "^8.3.3",
"pg": "^8.5.1",
"pg-hstore": "^2.3.3",
"pnormaldist": "^1.0.2",
"sequelize": "^6.3.5",
"sqlite3": "^5.0.0",
"typescript": "^4.0.3",
"uuid": "^8.3.0",
"typescript": "^4.1.2",
"uuid": "^8.3.1",
"xml2json": "^0.12.0"
}
}
......@@ -6,7 +6,7 @@ class FanartApi {
constructor(apiKey, baseUrl) {
this.apiKey = apiKey;
this.baseUrl = baseUrl || "http://webservice.fanart.tv/v3/";
this.baseUrl = baseUrl || "https://webservice.fanart.tv/v3/";
}
request(path, options) {
......
......@@ -115,7 +115,7 @@ class FileManager {
)
const previewFilePath = path.join(base, "spritesheets", "preview.vtt");
const previewFileExists = (await fsPromises.stat(previewFilePath)).isFile();
const previewFileExists = (await fsPromises.stat(previewFilePath).catch(() => null))?.isFile() === true;
const previewFile = previewFileExists ? previewFilePath : null;
const mediaFiles = dashManifest ? [dashManifest] : files.filter(fileName =>
......
......@@ -3,7 +3,6 @@ import sequelize from "sequelize";
import ImdbApi from './api/imdb_api';
import TmdbApi from './api/tmdb_api';
import TvdbApi from 'node-tvdb';
import FanartApi from './api/fanart_api';
import MetadataLoader from "./metadata_loader";
......@@ -23,7 +22,6 @@ async function main() {
const imdbApi = new ImdbApi(process.env.IMDB_PATH);
const tmdbApi = new TmdbApi(process.env.TMDB_API_KEY);
await tmdbApi.updateConfiguration();
const tvdbApi = new TvdbApi(process.env.TVDB_API_KEY);
const fanartApi = new FanartApi(process.env.FANART_API_KEY);
console.info("Setting up backend");
......@@ -36,6 +34,7 @@ async function main() {
host: process.env.DB_HOST,
port: +process.env.DB_PORT,
ssl: !!process.env.DB_SSL,
logging: false,
}
));
console.info("Migrating backend database");
......@@ -44,7 +43,7 @@ async function main() {
console.info("Setting up media ingestion tools");
const videoMimeParser = new VideoMimeParser(process.env.MP4INFO_PATH || "mp4info", process.env.FFPROBE_PATH || "ffprobe");
const loader = new MetadataLoader(imdbApi, tmdbApi, tvdbApi, fanartApi, storage);
const loader = new MetadataLoader(imdbApi, tmdbApi, fanartApi, storage);
const fileManager = new FileManager(basePath, videoMimeParser);
await fileManager.updateConfiguration();
......
......@@ -22,14 +22,12 @@ import {
class MetadataLoader {
imdb;
tmdb;
tvdb;
fanart;
storage;
constructor(imdb, tmdb, tvdb, fanart, storage) {
constructor(imdb, tmdb, fanart, storage) {
this.imdb = imdb;
this.tmdb = tmdb;
this.tvdb = tvdb;
this.fanart = fanart;
this.storage = storage;
}
......@@ -183,7 +181,6 @@ class MetadataLoader {
kind: "episode",
imdb_id: imdbResult.id,
tmdb_id: tmdbResult.id,
tvdb_id: null,
original_language: showTitle.original_language,
runtime: imdbResult.runtime,
}, {returning: true});
......@@ -324,39 +321,25 @@ class MetadataLoader {
}
async identifyShow(showTitle, showYear) {
const tvdbResults = await this.tvdb.getSeriesByName(showTitle)
if (!tvdbResults) return null;
const results = await this.tmdb.request(`search/tv`, {
query: showTitle,
first_air_date_year: showYear
}).catch((e) => console.error(e));
if (!results) return null;
const result = tvdbResults.find(show => {
const {year} = /^(?<year>\d+)(?:-(?<month>\d+)(?:-(?<day>\d+))?)?$/.exec(show.firstAired).groups;
return year === showYear;
});
const result = results.results.sort((a, b) => {
return b.popularity - a.popularity;
})[0];
if (!result) return null;
const tvdbId = result.id;
if (!tvdbId) return null;
const tvdbSeries = await this.tvdb.getSeriesById(tvdbId);
if (!tvdbSeries) return null;
const imdbId = tvdbSeries.imdbId;
const tmdbResults = (await this.tmdb.request(`find/${imdbId}`, {
external_source: "imdb_id"
})) || (await this.tmdb.request(`find/${tvdbId}`, {
external_source: "tvdb_id"
}))
if (!tmdbResults) return null;
const tmdbSeries = tmdbResults.tv_results ? tmdbResults.tv_results[0] : null;
if (!tmdbSeries) return null;
const tmdbId = tmdbSeries.id;
const tmdbResult = await this.tmdb.request(`tv/${result.id}/external_ids`);
if (!tmdbResult) return null;
return {
uuid: uuidv4(),
imdb: imdbId,
tvdb: tvdbId,
tmdb: tmdbId,
imdb: tmdbResult.imdb_id,
tvdb: tmdbResult.tvdb_id,
tmdb: result.id,
}
}
......
......@@ -19,12 +19,12 @@ async function processContent(basePath, fileManager, loader) {
await loader.processImageMetadata(title, imageData);
await loader.processMediaMetadata(title, media);
fsPromises.wr
await fsPromises.writeFile(path.join(filePath, "ids.json"), JSON.stringify(ids, null, 2));
console.info(`Finished movie ${name} (${year})`);
}
async function processEpisode(showIds, episodeIdentifier, filePath) {
console.info(`Processing episode`, episodeIdentifier);
const [media, {title, images}] = await Promise.all([
fileManager.findMedia(filePath),
loader.loadEpisodeMetadata(showIds, episodeIdentifier),
......@@ -32,7 +32,6 @@ async function processContent(basePath, fileManager, loader) {
const imageData = await loader.processImages(basePath, filePath, images);
await loader.processImageMetadata(title, imageData);
await loader.processMediaMetadata(title, media);
console.info(`Finished episode`, episodeIdentifier);
}
async function processShow(filePath) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment