Add SQLite library with API, library desktop apps and MobyGames scraper
This commit is contained in:
1 parent
6674428346
commit
a16444451a
69 files changed
+2988
-1026
No files matched your search
@@ -1,26 +1,20 @@
|
||||
import { about } from '#lib/content';
|
||||
import { getAniListProfile } from '#lib/server/anilist';
|
||||
import { getMediaDetails } from '#lib/server/omdb';
|
||||
import { storedDetailsFor } from '#lib/media/stored';
|
||||
import { getLibrary } from '#lib/server/library';
|
||||
import { getListeningProfile } from '#lib/server/lastfm/profile';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
const mediaUrls = [...about.shows, ...about.movies].map((item) => item.url);
|
||||
const anilistUsername = about.anilistUsername;
|
||||
const storedDetails = storedDetailsFor(mediaUrls);
|
||||
const unsavedUrls = mediaUrls.filter((url) => !storedDetails[url]);
|
||||
|
||||
const [anime, manga, fetchedDetails, listening] = await Promise.all([
|
||||
const [anime, manga, library, listening] = await Promise.all([
|
||||
anilistUsername ? getAniListProfile(anilistUsername, 'ANIME') : null,
|
||||
anilistUsername ? getAniListProfile(anilistUsername, 'MANGA') : null,
|
||||
unsavedUrls.length ? getMediaDetails(unsavedUrls) : {},
|
||||
getLibrary(),
|
||||
about.lastfmUsername ? getListeningProfile(about.lastfmUsername) : null
|
||||
]);
|
||||
|
||||
const hasManga = !!manga?.statusCounts.some((item) => item.count > 0);
|
||||
|
||||
const mediaDetails = { ...fetchedDetails, ...storedDetails };
|
||||
|
||||
return { anime, manga: hasManga ? manga : null, mediaDetails, listening };
|
||||
return { anime, manga: hasManga ? manga : null, library, listening };
|
||||
};
|
||||
Reference in new issue
Block a user