mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
feat(koito): Add koito types/config
This commit is contained in:
@@ -67,11 +67,13 @@ export const lowGranularitySources: SourceType[] = ['subsonic', 'ytmusic'];
|
||||
export type ClientType =
|
||||
'maloja'
|
||||
| 'lastfm'
|
||||
| 'listenbrainz';
|
||||
| 'listenbrainz'
|
||||
| 'koito';
|
||||
export const clientTypes: ClientType[] = [
|
||||
'maloja',
|
||||
'lastfm',
|
||||
'listenbrainz'
|
||||
'listenbrainz',
|
||||
'koito'
|
||||
];
|
||||
export const isClientType = (data: string): data is ClientType => {
|
||||
return clientTypes.includes(data as ClientType);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { KoitoClientAIOConfig, KoitoClientConfig } from "./koito.js";
|
||||
import { LastfmClientAIOConfig, LastfmClientConfig } from "./lastfm.js";
|
||||
import { ListenBrainzClientAIOConfig, ListenBrainzClientConfig } from "./listenbrainz.js";
|
||||
import { MalojaClientAIOConfig, MalojaClientConfig } from "./maloja.js";
|
||||
|
||||
export type ClientConfig = MalojaClientConfig | LastfmClientConfig | ListenBrainzClientConfig;
|
||||
export type ClientConfig = MalojaClientConfig | LastfmClientConfig | ListenBrainzClientConfig | KoitoClientConfig;
|
||||
|
||||
export type ClientAIOConfig = MalojaClientAIOConfig | LastfmClientAIOConfig | ListenBrainzClientAIOConfig;
|
||||
export type ClientAIOConfig = MalojaClientAIOConfig | LastfmClientAIOConfig | ListenBrainzClientAIOConfig | KoitoClientAIOConfig;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { RequestRetryOptions } from "../common.js"
|
||||
import { CommonClientConfig, CommonClientData } from "./index.js"
|
||||
|
||||
export interface ListensResponse {
|
||||
items: ListenObjectResponse[]
|
||||
total_record_count: number
|
||||
@@ -27,4 +30,41 @@ export interface TrackResponse {
|
||||
export interface ArtistResponse {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface KoitoData extends RequestRetryOptions {
|
||||
/**
|
||||
* URL for the Koito server
|
||||
*
|
||||
* @examples ["http://192.168.0.100:4110"]
|
||||
* */
|
||||
url: string
|
||||
/**
|
||||
* User token for the user to scrobble for
|
||||
*
|
||||
* @examples ["pM195xPV98CDpk0QW47FIIOR8AKATAX5DblBF-Jq0t1MbbKL"]
|
||||
* */
|
||||
token: string
|
||||
|
||||
/**
|
||||
* Username of the user to scrobble for
|
||||
* */
|
||||
username: string
|
||||
}
|
||||
|
||||
export interface KoitoClientData extends KoitoData, CommonClientData {}
|
||||
|
||||
export interface KoitoClientConfig extends CommonClientConfig {
|
||||
/**
|
||||
* Should always be `client` when using Koito as a client
|
||||
*
|
||||
* @default client
|
||||
* @examples ["client"]
|
||||
* */
|
||||
configureAs?: 'client' | 'source'
|
||||
data: KoitoClientData
|
||||
}
|
||||
|
||||
export interface KoitoClientAIOConfig extends KoitoClientConfig {
|
||||
type: 'koito'
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { KoitoData } from "../client/koito.js";
|
||||
import { ListenBrainzData } from "../client/listenbrainz.js";
|
||||
import { PollingOptions } from "../common.js";
|
||||
import { CommonSourceConfig, CommonSourceData } from "./index.js";
|
||||
|
||||
export interface KoitoSourceData extends KoitoData, CommonSourceData, PollingOptions {
|
||||
}
|
||||
|
||||
export interface KoitoSourceConfig extends CommonSourceConfig {
|
||||
/**
|
||||
* When used in `koito.config` this tells multi-scrobbler whether to use this data to configure a source or client.
|
||||
*
|
||||
* @default source
|
||||
* @examples ["source"]
|
||||
* */
|
||||
configureAs?: 'source'
|
||||
data: KoitoSourceData
|
||||
}
|
||||
|
||||
export interface KoitoSourceAIOConfig extends KoitoSourceConfig {
|
||||
type: 'koito'
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import { VLCSourceAIOConfig, VLCSourceConfig } from "./vlc.js";
|
||||
import { WebScrobblerSourceAIOConfig, WebScrobblerSourceConfig } from "./webscrobbler.js";
|
||||
import { YTMusicSourceAIOConfig, YTMusicSourceConfig } from "./ytmusic.js";
|
||||
import { IcecastSourceAIOConfig, IcecastSourceConfig } from "./icecast.js";
|
||||
import { KoitoSourceAIOConfig, KoitoSourceConfig } from "./koito.js";
|
||||
|
||||
|
||||
export type SourceConfig =
|
||||
@@ -49,7 +50,8 @@ export type SourceConfig =
|
||||
| MPDSourceConfig
|
||||
| VLCSourceConfig
|
||||
| IcecastSourceConfig
|
||||
| AzuracastSourceConfig;
|
||||
| AzuracastSourceConfig
|
||||
| KoitoSourceConfig;
|
||||
|
||||
export type SourceAIOConfig =
|
||||
SpotifySourceAIOConfig
|
||||
@@ -77,4 +79,5 @@ export type SourceAIOConfig =
|
||||
| MPDSourceAIOConfig
|
||||
| VLCSourceAIOConfig
|
||||
| IcecastSourceAIOConfig
|
||||
| AzuracastSourceAIOConfig;
|
||||
| AzuracastSourceAIOConfig
|
||||
| KoitoSourceAIOConfig;
|
||||
|
||||
Reference in New Issue
Block a user