Floatplane channel plugin for Jellyfin 10.10.x: browse, HLS proxy, cookie session, CI release
Some checks failed
release / build-release (push) Has been cancelled
Some checks failed
release / build-release (push) Has been cancelled
- IChannel: creators -> sub-channels -> video posts (public listing API, search mapped) - IRequiresMediaInfoCallback -> signed proxy URLs; stream controller rewrites HLS so the AES-128 key is fetched server-side with the session cookie, segments stay on the CDN - delivery/info cached per token lifetime and throttled (~2/min) - config page: paste sails.sid + validate, extra creators, quality, search test - scripts/package.sh -> plugin folder + zip + md5 + manifest.json; Gitea release workflow - research docs, HAR analysis (HAR itself gitignored), install-pi5.sh Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
87
doc/research/reference-sources/fpdl_quickStart.ts
Normal file
87
doc/research/reference-sources/fpdl_quickStart.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { MyPlexAccount } from "@ctrl/plex";
|
||||
import { defaultResolutions } from "./lib/defaults";
|
||||
import { args, fApi, settings } from "./lib/helpers/index";
|
||||
import * as prompts from "./lib/prompts/index";
|
||||
import { loginFloatplane, loginPlex } from "./logins";
|
||||
|
||||
import { type Channels, type Extras } from "./lib/types";
|
||||
import { Video } from "./lib/Video";
|
||||
import { fetchSubscriptions } from "./subscriptionFetching";
|
||||
|
||||
export const promptPlexSections = async (): Promise<void> => {
|
||||
const plexApi = await new MyPlexAccount({ token: settings.plex.token }).connect();
|
||||
const servers = (await plexApi.resources()).filter((resource) => resource.provides.split(",").indexOf("server") !== -1);
|
||||
const serverSections = await Promise.all(
|
||||
servers.map(async (server) => {
|
||||
const connectedServer = await server.connect();
|
||||
const library = await connectedServer.library();
|
||||
return (await library.sections()).filter((section) => section.type === "show");
|
||||
}),
|
||||
);
|
||||
settings.plex.sectionsToUpdate = await prompts.plex.sections(
|
||||
settings.plex.sectionsToUpdate,
|
||||
serverSections.flatMap((sections) => sections),
|
||||
);
|
||||
await validatePlexSettings();
|
||||
};
|
||||
|
||||
export const validatePlexSettings = async (): Promise<void> => {
|
||||
if (settings.plex.enabled) {
|
||||
if (settings.plex.token === "") {
|
||||
console.log("Missing plex token!");
|
||||
settings.plex.token = await loginPlex();
|
||||
}
|
||||
if (settings.plex.sectionsToUpdate.length === 0) {
|
||||
console.log("No sectionsToUpdate in config! Disabling plex integration...\n");
|
||||
settings.plex.enabled = false;
|
||||
}
|
||||
await new MyPlexAccount({ token: settings.plex.token }).connect().catch((err) => {
|
||||
console.error(`Failed to connect to plex, disabling plex refreshing! ${err.message}`);
|
||||
settings.plex.enabled = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const promptChannelSelection = async (): Promise<void> => {
|
||||
const channels: Channels = [];
|
||||
for await (const subscription of fetchSubscriptions()) {
|
||||
channels.push(...subscription.channels);
|
||||
}
|
||||
const desiredChannels = await prompts.floatplane.channels(channels);
|
||||
for (const channel of channels) {
|
||||
if (!desiredChannels.includes(channel.title)) channel.skip = true;
|
||||
}
|
||||
};
|
||||
|
||||
export const quickStart = async (): Promise<void> => {
|
||||
console.log("Welcome to Floatplane Downloader! Thanks for checking it out <3.");
|
||||
console.log("According to your settings.json this is your first launch! So lets go through the basic setup...\n");
|
||||
|
||||
console.log("\n== \u001b[38;5;208mFloatplane\u001b[0m ==\n");
|
||||
// Dont re-prompt for credentials if we are already logged in
|
||||
if ((await fApi.isAuthenticated()) !== true) {
|
||||
console.log("Please login to floatplane...");
|
||||
await loginFloatplane();
|
||||
} else console.log("Already logged in!");
|
||||
|
||||
console.log("\n== \u001b[38;5;208mGeneral\u001b[0m ==\n");
|
||||
settings.floatplane.videosToSearch = await prompts.floatplane.videosToSearch(settings.floatplane.videosToSearch);
|
||||
settings.floatplane.videoResolution = await prompts.settings.videoResolution(settings.floatplane.videoResolution, defaultResolutions);
|
||||
settings.filePathFormatting = await prompts.settings.fileFormatting(settings.filePathFormatting, Video.FilePathOptions);
|
||||
|
||||
const extras = await prompts.settings.extras(settings.extras);
|
||||
if (extras !== undefined) {
|
||||
for (const extra in settings.extras) settings.extras[extra as keyof Extras] = extras.indexOf(extra) > -1 ? true : false;
|
||||
}
|
||||
|
||||
console.log("\n== \u001b[38;5;208mSubscriptions\u001b[0m ==\n");
|
||||
await promptChannelSelection();
|
||||
|
||||
console.log("\n== \u001b[38;5;208mPlex\u001b[0m ==\n");
|
||||
settings.plex.enabled = await prompts.plex.usePlex(settings.plex.enabled);
|
||||
if (settings.plex.enabled) {
|
||||
if (settings.plex.token === "") settings.plex.token = await loginPlex();
|
||||
if (args.headless !== true) await promptPlexSections();
|
||||
}
|
||||
console.log("\n== \u001b[36mAll Setup!\u001b[0m ==\n");
|
||||
};
|
||||
Reference in New Issue
Block a user