-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp_types.go
69 lines (62 loc) · 1.59 KB
/
app_types.go
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
package types
import (
"html/template"
"net/http"
"time"
"github.com/fatih/set"
"github.com/tympanix/supper/app/notify"
)
// App is the interface for the top level capabilities of the application.
// It is an HTTP handler, a provider (for subtitles) and a CLI application.
// It means App can both be used as a HTTP server and a CLI application.
type App interface {
Provider
http.Handler
Config() Config
Scrapers() []Scraper
FindMedia(...string) (LocalMediaList, error)
DownloadSubtitles(LocalMediaList, set.Interface, chan<- *notify.Entry) ([]LocalSubtitle, error)
RenameMedia(LocalMediaList) error
FindArchives(...string) ([]MediaArchive, error)
ExtractMedia(MediaReadCloser) error
}
// Config is the interface for application configuration
type Config interface {
Providers() []Provider
Scrapers() []Scraper
Languages() set.Interface
Impaired() bool
Limit() int
Modified() time.Duration
Dry() bool
Score() int
Delay() time.Duration
Force() bool
Config() string
Logfile() string
Verbose() bool
Strict() bool
Plugins() []Plugin
APIKeys() APIKeys
Movies() MediaConfig
TVShows() MediaConfig
MediaFilter() MediaFilter
RenameAction() string
Evaluator() Evaluator
ProxyPath() string
}
// APIKeys is the interface for configuration of 3rd party APIs
type APIKeys interface {
TheTVDB() string
TheMovieDB() string
}
// MediaConfig is the configuration interface for media collections
type MediaConfig interface {
Directory() string
Template() *template.Template
}
// Plugin is an interface for external functionality
type Plugin interface {
Name() string
Run(LocalSubtitle) error
}