]>
Commit | Line | Data |
---|---|---|
4899138e C |
1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { HooksService } from '@app/core' | |
c894a1ea C |
3 | import { VideoDetails } from '@app/shared/shared-main' |
4 | ||
4899138e C |
5 | type PluginMetadata = { |
6 | label: string | |
7 | ||
8 | value?: string | |
9 | safeHTML?: string | |
10 | } | |
11 | ||
c894a1ea C |
12 | @Component({ |
13 | selector: 'my-video-attributes', | |
14 | templateUrl: './video-attributes.component.html', | |
15 | styleUrls: [ './video-attributes.component.scss' ] | |
16 | }) | |
4899138e | 17 | export class VideoAttributesComponent implements OnInit { |
c894a1ea C |
18 | @Input() video: VideoDetails |
19 | ||
4899138e C |
20 | pluginMetadata: PluginMetadata[] = [] |
21 | ||
22 | constructor (private hooks: HooksService) { } | |
23 | ||
24 | async ngOnInit () { | |
25 | this.pluginMetadata = await this.hooks.wrapFunResult( | |
26 | this.buildPluginMetadata.bind(this), | |
27 | { video: this.video }, | |
28 | 'video-watch', | |
29 | 'filter:video-watch.video-plugin-metadata.result' | |
30 | ) | |
31 | } | |
32 | ||
7e8f1960 C |
33 | getVideoHost () { |
34 | return this.video.channel.host | |
35 | } | |
36 | ||
c894a1ea C |
37 | getVideoTags () { |
38 | if (!this.video || Array.isArray(this.video.tags) === false) return [] | |
39 | ||
40 | return this.video.tags | |
41 | } | |
4899138e C |
42 | |
43 | // Used for plugin hooks | |
44 | private buildPluginMetadata (_options: { | |
45 | video: VideoDetails | |
46 | }): PluginMetadata[] { | |
47 | return [] | |
48 | } | |
c894a1ea | 49 | } |