-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
58 lines (49 loc) · 1.82 KB
/
index.ts
File metadata and controls
58 lines (49 loc) · 1.82 KB
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
import * as plexTypes from '../../plex/types';
import { IncomingPlexAPIRequest } from '../../plex/requesthandling';
import {
PseuplexApp,
PseuplexMetadataProvider,
PseuplexPlugin,
PseuplexPluginClass,
PseuplexReadOnlyResponseFilters,
PseuplexRouterApp,
} from '../../pseuplex';
//import { TemplateMetadataProvider } from './metadata'; // uncomment if defining a custom metadata provider
import { TemplatePluginConfig } from './config';
import { TemplatePluginDef } from './plugindef';
export default (class TemplatePlugin implements TemplatePluginDef, PseuplexPlugin {
static slug = '<plugin_name>';
readonly slug = TemplatePlugin.slug;
readonly app: PseuplexApp;
//readonly metadata: TemplateMetadataProvider; // uncomment if defining a custom metadata provider
constructor(app: PseuplexApp) {
this.app = app;
// create custom metadata provider
/*this.metadata = new TemplateMetadataProvider({
basePath: `${this.basePath}/metadata`,
plexMetadataClient: this.app.plexMetadataClient,
relatedHubsProviders: [
//this.hubs.similar, // if you define a "similar items" hub in this plugin, you can include that
],
plexIdToInfoCache: this.app.plexIdToInfoCache,
});*/
}
// if you define custom routes or a metadata provider, its useful to have a common base path
/*get basePath(): string {
return `/${this.app.slug}/${this.slug}`;
}*/
get metadataProviders(): PseuplexMetadataProvider[] {
return [
//this.metadata // if you want the plugin to define a custom metadata provider
];
}
get config(): TemplatePluginConfig {
return this.app.config as TemplatePluginConfig;
}
responseFilters?: PseuplexReadOnlyResponseFilters = {
// TODO define any functions to modify plex server responses
}
defineRoutes(router: PseuplexRouterApp) {
// TODO define any custom routes
}
} satisfies PseuplexPluginClass);