Files
proxy_tmdb/lib/paths.js

27 lines
781 B
JavaScript

import { join } from 'node:path';
import { MOVIE_DIR, TV_DIR, JUSTWATCH_MOVIE_DIR, JUSTWATCH_TV_DIR } from '../config.js';
export function bucket(id) {
return String(Math.floor(id / 1000));
}
export function entryPath(type, id) {
const base = type === 'movie' ? MOVIE_DIR : TV_DIR;
return join(base, bucket(id), `${id}.json`);
}
export function entryDir(type, id) {
const base = type === 'movie' ? MOVIE_DIR : TV_DIR;
return join(base, bucket(id));
}
export function justwatchPath(type, id) {
const base = type === 'movie' ? JUSTWATCH_MOVIE_DIR : JUSTWATCH_TV_DIR;
return join(base, bucket(id), `${id}.json`);
}
export function justwatchDir(type, id) {
const base = type === 'movie' ? JUSTWATCH_MOVIE_DIR : JUSTWATCH_TV_DIR;
return join(base, bucket(id));
}