feat: create script to initialize "next episode" queue
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { findBestMatchingTitle } from "~/libs/findBestMatchingTitle";
|
||||
|
||||
import { Episode, type EpisodesResponse } from "./episode";
|
||||
import { Episode, type EpisodesResponse } from "~/types/episode";
|
||||
|
||||
export async function getEpisodesFromAniwatch(
|
||||
aniListId: number,
|
||||
): Promise<EpisodesResponse | null> {
|
||||
try {
|
||||
const animeTitle = await import("~/controllers/title/anilist")
|
||||
const animeTitle = await import("~/libs/anilist/getTitle")
|
||||
.then(({ fetchTitleFromAnilist }) =>
|
||||
fetchTitleFromAnilist(aniListId, undefined),
|
||||
)
|
||||
|
||||
@@ -10,6 +10,10 @@ export async function getSourcesFromAniwatch(
|
||||
)
|
||||
.then((res) => res.json<AniwatchEpisodeUrlResponse>())
|
||||
.then(({ intro, outro, sources, tracks }) => {
|
||||
if (!sources || sources.length === 0) {
|
||||
return { source: null };
|
||||
}
|
||||
|
||||
return {
|
||||
intro: convertSkipTime(intro),
|
||||
outro: convertSkipTime(outro),
|
||||
|
||||
Reference in New Issue
Block a user