Moved contents of seasoned_api up to root folder
This commit is contained in:
34
src/plex/convertPlexToSeasoned.js
Normal file
34
src/plex/convertPlexToSeasoned.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const Plex = require("../media_classes/plex");
|
||||
|
||||
function translateAdded(date_string) {
|
||||
return new Date(date_string * 1000);
|
||||
}
|
||||
|
||||
function convertPlexToSeasoned(plex) {
|
||||
const title = plex.title;
|
||||
const year = plex.year;
|
||||
const type = plex.type;
|
||||
const summary = plex.summary;
|
||||
const poster_path = plex.thumb;
|
||||
const background_path = plex.art;
|
||||
const added = translateAdded(plex.addedAt);
|
||||
// const genre = plex.genre;
|
||||
const seasons = plex.childCount;
|
||||
const episodes = plex.leafCount;
|
||||
|
||||
const seasoned = new Plex(
|
||||
title,
|
||||
year,
|
||||
type,
|
||||
summary,
|
||||
poster_path,
|
||||
background_path,
|
||||
added,
|
||||
seasons,
|
||||
episodes
|
||||
);
|
||||
// seasoned.print();
|
||||
return seasoned;
|
||||
}
|
||||
|
||||
module.exports = convertPlexToSeasoned;
|
||||
Reference in New Issue
Block a user