Browse Source

Remove Plex Library update code as it is going to be moved.

dev
David Ludwig 4 years ago
parent
commit
c95412df3e
1 changed files with 0 additions and 32 deletions
  1. +0
    -32
      services/request/src/server/services/PlexLibrary.ts

+ 0
- 32
services/request/src/server/services/PlexLibrary.ts View File

@ -59,38 +59,6 @@ export default class PlexLibrary extends InternalService<Application>
* Update the movie catalog
*/
public async updateMovies() {
if (this.isUpdating) {
return;
}
this.isUpdating = true;
let start = Date.now();
this.log("Updating movies...");
// Fetch the current and new sets of IMDb IDs
let [currentIds, newIds] = await Promise.all([
PlexMovie.imdbSet(),
this.plex.movies(this.KEY_MOVIES),
]);
// Calculate the updates
let toInsert = new Set(Object.keys(newIds).filter(id => !currentIds.has(id)));
let toRemove = new Set([...currentIds].filter(id => !(id in newIds)));
// Remove ald Ids and insert new ones
await PlexMovie.removeImdbSet(toRemove);
await PlexMovie.insertMovies([...toInsert].map(imdbId => ({imdbId, plexKey: newIds[imdbId]})));
// Update TMDb IDs
for (let movie of await PlexMovie.find({ where: { tmdbId: null } })) {
let result = await this.app.service<MovieSearch>("Movie Search").findImdb(movie.imdbId);
if (result !== null) {
movie.tmdbId = result.id;
await movie.save();
}
await sleep(API_DATABASE_THROTTLE);
}
this.log("Movies updated. Took", (Date.now() - start)/1000, "seconds");
this.isUpdating = false;
}
}

Loading…
Cancel
Save