-
Notifications
You must be signed in to change notification settings - Fork 955
/
Copy pathindex.ts
133 lines (129 loc) · 2.91 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import { createPlugin } from '@/utils';
import { t } from '@/i18n';
import { onMenu } from './menu';
import { backend } from './main';
export interface ScrobblerPluginConfig {
enabled: boolean;
/**
* Attempt to scrobble other video types (e.g. Podcasts, normal YouTube videos)
*
* @default true
*/
scrobbleOtherMedia: boolean;
/**
* Use alternative titles for scrobbling (Useful for non-roman song titles)
*
* @default false
*/
alternativeTitles: boolean;
scrobblers: {
lastfm: {
/**
* Enable Last.fm scrobbling
*
* @default false
*/
enabled: boolean;
/**
* Token used for authentication
*/
token: string | undefined;
/**
* Session key used for scrobbling
*/
sessionKey: string | undefined;
/**
* Root of the Last.fm API
*
* @default 'http://ws.audioscrobbler.com/2.0/'
*/
apiRoot: string;
/**
* Last.fm api key registered by @semvis123
*
* @default '04d76faaac8726e60988e14c105d421a'
*/
apiKey: string;
/**
* Last.fm api secret registered by @semvis123
*
* @default 'a5d2a36fdf64819290f6982481eaffa2'
*/
secret: string;
};
listenbrainz: {
/**
* Enable ListenBrainz scrobbling
*
* @default false
*/
enabled: boolean;
/**
* Listenbrainz user token
*/
token: string | undefined;
/**
* Root of the ListenBrainz API
*
* @default 'https://api.listenbrainz.org/1/'
*/
apiRoot: string;
};
slack: {
/**
* Enable Slack scrobbling
*
* @default false
*/
enabled: boolean;
/**
* Slack OAuth token
*/
token: string | undefined;
/**
* Slack cookie token (d cookie value)
*/
cookieToken: string | undefined;
/**
* Name to use for the custom emoji in Slack
*
* @default 'my-album-art'
*/
emojiName: string;
};
};
}
export const defaultConfig: ScrobblerPluginConfig = {
enabled: false,
scrobbleOtherMedia: true,
alternativeTitles: false,
scrobblers: {
lastfm: {
enabled: false,
token: undefined,
sessionKey: undefined,
apiRoot: 'https://ws.audioscrobbler.com/2.0/',
apiKey: '04d76faaac8726e60988e14c105d421a',
secret: 'a5d2a36fdf64819290f6982481eaffa2',
},
listenbrainz: {
enabled: false,
token: undefined,
apiRoot: 'https://api.listenbrainz.org/1/',
},
slack: {
enabled: false,
token: undefined,
cookieToken: undefined,
emojiName: 'my-album-art',
},
},
};
export default createPlugin({
name: () => t('plugins.scrobbler.name'),
description: () => t('plugins.scrobbler.description'),
restartNeeded: true,
config: defaultConfig,
menu: onMenu,
backend,
});