Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
2.5 kB · 79 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import * as z from "zod";import {pollingOptionsSchema} from "../common.ts";import {commonSourceConfigSchema, commonSourceDataSchema, commonSourceOptionsSchema, type EnvSourceSchema} from "./index.ts";
export const mpdDataSchema = z.object({ ...commonSourceDataSchema.shape, ...pollingOptionsSchema.shape, /** * URL:PORT of the MPD server to connect to * * To use this you must have TCP connections enabled for your MPD server https://mpd.readthedocs.io/en/stable/user.html#client-connections * * @examples ["localhost:6600"] * @default "localhost:6600" * */ url: z.string().optional().meta({ description: "URL:PORT of the MPD server to connect to", default: "localhost:6600", examples: ["localhost:6600"] }),
/** * If using socket specify the path instead of url. * * trailing `~` is replaced by your home directory * */ path: z.string().optional().meta({ description: "If using socket specify the path instead of url." }),
/** * Password for the server, if set https://mpd.readthedocs.io/en/stable/user.html#permissions-and-passwords * */ password: z.string().optional().meta({ description: "Password for the server, if set https://mpd.readthedocs.io/en/stable/user.html#permissions-and-passwords" }),
});
export type MPDData = z.infer<typeof mpdDataSchema>;
const envDataSchema = z.object({ MPD_URL: mpdDataSchema.shape.url, MPD_PASSWORD: mpdDataSchema.shape.password,});
export const envSchemas: EnvSourceSchema<typeof envDataSchema, MPDSourceConfig> = { env: envDataSchema, prefix: 'MPD', toConfig: (partial) => ({ data: { url: partial.MPD_URL, password: partial.MPD_PASSWORD } })};
export const mpdSourceOptionsSchema = z.object({ ...commonSourceOptionsSchema.shape,});
export type MPDSourceOptions = z.infer<typeof mpdSourceOptionsSchema>;
export const mpdSourceConfigSchema = z.object({ ...commonSourceConfigSchema.shape, data: mpdDataSchema, options: mpdSourceOptionsSchema,});
export type MPDSourceConfig = z.infer<typeof mpdSourceConfigSchema>;
export const mpdSourceAIOConfigSchema = z.object({ ...mpdSourceConfigSchema.shape, type: z.literal('mpd'),}).meta({title: 'MPD'});
export type MPDSourceAIOConfig = z.infer<typeof mpdSourceAIOConfigSchema>;
export type PlayerState = 'play' | 'stop' | 'pause';