add optional anime notes
This commit is contained in:
8
build.ts
8
build.ts
@@ -1,5 +1,5 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { readdirSync, existsSync } from 'fs';
|
import { readdirSync, readFileSync, existsSync } from 'fs';
|
||||||
import { Renderer } from './ryuji.js';
|
import { Renderer } from './ryuji.js';
|
||||||
import { Builder } from './saki.js';
|
import { Builder } from './saki.js';
|
||||||
import _favourites_info from './favourites_info.json';
|
import _favourites_info from './favourites_info.json';
|
||||||
@@ -34,6 +34,7 @@ type MusicVars = ListingVars;
|
|||||||
|
|
||||||
interface AnimeVars extends ListingVars {
|
interface AnimeVars extends ListingVars {
|
||||||
higher_quality_available: boolean;
|
higher_quality_available: boolean;
|
||||||
|
notes: string | boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface MangaVars extends ListingVars {
|
interface MangaVars extends ListingVars {
|
||||||
@@ -118,10 +119,15 @@ for (let i = 0; i < listings.length; i++) {
|
|||||||
};
|
};
|
||||||
const serve_path = `/${listing.type}/${listing.name}/${chapter}`;
|
const serve_path = `/${listing.type}/${listing.name}/${chapter}`;
|
||||||
if (listing.type === "anime") {
|
if (listing.type === "anime") {
|
||||||
|
let notes: string | boolean = false;
|
||||||
|
try {
|
||||||
|
notes = readFileSync(`notes/${listing.name}_${chapter}.txt`, "utf-8");
|
||||||
|
} catch (_) {}
|
||||||
anime_serve_paths.push(serve_path);
|
anime_serve_paths.push(serve_path);
|
||||||
anime_vars.push({
|
anime_vars.push({
|
||||||
...base,
|
...base,
|
||||||
higher_quality_available: existsSync(path.join(__dirname, `/static_assets/${listing.type}_assets/${listing.name}`, `${chapter}_higher_quality.mp4`)),
|
higher_quality_available: existsSync(path.join(__dirname, `/static_assets/${listing.type}_assets/${listing.name}`, `${chapter}_higher_quality.mp4`)),
|
||||||
|
notes,
|
||||||
});
|
});
|
||||||
} else if (listing.type === "manga") {
|
} else if (listing.type === "manga") {
|
||||||
manga_serve_paths.push(serve_path);
|
manga_serve_paths.push(serve_path);
|
||||||
|
|||||||
2
notes/joshiraku_s01e01.txt
Normal file
2
notes/joshiraku_s01e01.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Test note!
|
||||||
|
Wei wei wei wei wei wei
|
||||||
@@ -45,6 +45,12 @@
|
|||||||
</script>
|
</script>
|
||||||
[[ endif ]]
|
[[ endif ]]
|
||||||
[[ component:nav ]]
|
[[ component:nav ]]
|
||||||
|
[[ if:notes ]]
|
||||||
|
<div>
|
||||||
|
<h2>Notes</h2>
|
||||||
|
[[ notes ]]
|
||||||
|
</div>
|
||||||
|
[[ endif ]]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user