File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export class ConfigService {
18
18
public static readonly DOWNLOAD_LOCATION : string = 'DOWNLOAD_LOCATION'
19
19
public static readonly OPENSUBTITLES_USERNAME : string = 'OPENSUBTITLES_USERNAME'
20
20
public static readonly OPENSUBTITLES_PASSWORD : string = 'OPENSUBTITLES_PASSWORD'
21
+ public static readonly SUBTITLES_LANGUAGES : string = 'SUBTITLES_LANGUAGES'
21
22
public static readonly MAX_CONCURRENT_DOWNLOADS : string = 'MAX_CONCURRENT_DOWNLOADS'
22
23
public static readonly TRAKT_KEY : string = 'TRAKT_KEY'
23
24
@@ -103,7 +104,11 @@ export class ConfigService {
103
104
104
105
[ ConfigService . OPENSUBTITLES_USERNAME ] : Joi . string ( ) ,
105
106
106
- [ ConfigService . OPENSUBTITLES_PASSWORD ] : Joi . string ( )
107
+ [ ConfigService . OPENSUBTITLES_PASSWORD ] : Joi . string ( ) ,
108
+
109
+ [ ConfigService . SUBTITLES_LANGUAGES ] : Joi . string ( )
110
+ . default ( 'en' ) ,
111
+
107
112
[ ConfigService . MAX_CONCURRENT_DOWNLOADS ] : Joi . number ( )
108
113
. default ( 1 ) ,
109
114
} )
Original file line number Diff line number Diff line change @@ -18,20 +18,15 @@ export class SubtitlesService {
18
18
19
19
private readonly enabled : boolean = true
20
20
21
- /**
22
- * TODO:: Get from ENV
23
- */
24
- private readonly supportedLanguages = [
25
- 'en' ,
26
- 'nl'
27
- ]
21
+ private readonly supportedLanguages
28
22
29
23
constructor (
30
24
private readonly httpService : HttpService ,
31
25
private readonly configService : ConfigService
32
26
) {
33
27
const username = this . configService . get ( ConfigService . OPENSUBTITLES_USERNAME )
34
28
const password = this . configService . get ( ConfigService . OPENSUBTITLES_PASSWORD )
29
+ this . supportedLanguages = this . configService . get ( ConfigService . SUBTITLES_LANGUAGES )
35
30
36
31
if ( username && password ) {
37
32
this . client = new OpenSubtitles ( {
@@ -52,7 +47,7 @@ export class SubtitlesService {
52
47
* @param {TorrentFile } torrent - The torrent to search subtitles for.
53
48
* @param {boolean } retry - Are we allowed to retry or not.
54
49
*/
55
- public async searchForSubtitles ( download : Model < Download > , torrent : TorrentFile , retry = true ) {
50
+ public async searchForSubtitles ( download : Model < Download > , torrent : TorrentFile , retry = true ) : Promise < void > {
56
51
// Only search for subtitles when it's enabled
57
52
if ( ! this . enabled ) {
58
53
return
You can’t perform that action at this time.
0 commit comments