Portage complet PHP/Bash vers Node.js (Fastify + worker_threads)
This commit is contained in:
26
lib/paths.js
Normal file
26
lib/paths.js
Normal file
@@ -0,0 +1,26 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user