mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
dockerise server
This commit is contained in:
@@ -322,7 +322,10 @@ export class TorrentService {
|
||||
const torrId = parseInt(id);
|
||||
const result = await this.torrSeedClient
|
||||
.addTorrentById(torrId)
|
||||
.catch(() => false);
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
return false;
|
||||
});
|
||||
|
||||
return new NotificationResponse(
|
||||
result ? 'torrent added to transmission' : 'adding failed',
|
||||
|
||||
@@ -29,7 +29,10 @@ export class TorrentSeedClient {
|
||||
return Promise.reject('torrent not found');
|
||||
}
|
||||
|
||||
const torrInfo = await this.addTorrent(torrentEntity).catch(() => null);
|
||||
const torrInfo = await this.addTorrent(torrentEntity).catch((e) => {
|
||||
console.log(e);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (torrInfo) {
|
||||
await this.torrentRepository.update(
|
||||
|
||||
@@ -13,7 +13,7 @@ export class ConfigService {
|
||||
private videoFilesConfig: VideoFilesConfig = new VideoFilesConfig(this);
|
||||
private recentSearches: RecentSearchesConfig = new RecentSearchesConfig(this);
|
||||
|
||||
public getEnv(key: string): any {
|
||||
public getEnv(key: string): string {
|
||||
return process.env[key];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,14 @@ export class PathsConfig {
|
||||
}
|
||||
|
||||
public getStaticRequestsLogPath(): string {
|
||||
return this.getPathByEnvKey('LOG_FILE_REQUESTS');
|
||||
return join(
|
||||
'/srv/data/requests-log',
|
||||
this.configService.getEnv('LOG_FILE_REQUESTS_NAME'),
|
||||
);
|
||||
}
|
||||
|
||||
public getStaticFolder(): string {
|
||||
return this.getPathByEnvKey('STATIC_SERVE_FOLDER');
|
||||
return '/srv/data/static';
|
||||
}
|
||||
|
||||
public getPathByEnvKey(key: string) {
|
||||
|
||||
@@ -6,9 +6,7 @@ export class RecentSearchesConfig {
|
||||
}
|
||||
|
||||
public getRecentSearchesFolder(): string {
|
||||
return this.configService
|
||||
.getPaths()
|
||||
.getPathByEnvKey('RECENT_SEARCHES_FOLDER');
|
||||
return '/srv/data/recent-searches';
|
||||
}
|
||||
|
||||
public getRecentSearchesLimit(): number {
|
||||
|
||||
@@ -4,11 +4,12 @@ import { EntityClassOrSchema } from '@nestjs/typeorm/dist/interfaces/entity-clas
|
||||
import { TitleEntity } from '../Shared/Entity/title.entity';
|
||||
import { FileEntity } from '../Shared/Entity/file.entity';
|
||||
import { TorrentEntity } from '../Shared/Entity/torrent.entity';
|
||||
import { join } from 'path';
|
||||
|
||||
export class TypeOrmConfig {
|
||||
constructor(configService: ConfigService) {
|
||||
this.type = 'sqlite';
|
||||
this.database = configService.getEnv('DB_PATH');
|
||||
this.database = join('/srv/data/db', configService.getEnv('DB_FILENAME'));
|
||||
this.entities = [LrtCategory, TitleEntity, FileEntity, TorrentEntity];
|
||||
}
|
||||
type: 'sqlite';
|
||||
|
||||
@@ -6,7 +6,7 @@ export class VideoFilesConfig {
|
||||
}
|
||||
|
||||
public getVideoFilesFolders(): string[] {
|
||||
return JSON.parse(this.configService.getEnv('VIDEO_FILES_FOLDERS'));
|
||||
return [this.configService.getEnv('VIDEO_FILES_FOLDER')];
|
||||
}
|
||||
|
||||
public getVideoFilesExt(): string[] {
|
||||
@@ -18,17 +18,15 @@ export class VideoFilesConfig {
|
||||
}
|
||||
|
||||
public getTorrentDownloadDir(): string {
|
||||
return this.configService
|
||||
.getPaths()
|
||||
.getPathByEnvKey('TORRENT_DOWNLOAD_DIR');
|
||||
return this.configService.getEnv('VIDEO_FILES_FOLDER');
|
||||
}
|
||||
|
||||
public getTransmissionOptions() {
|
||||
return {
|
||||
host: this.configService.getEnv('TRANSMISSION_CLIENT_HOST'), // # default 'localhost'
|
||||
//port: 9091, // # default 9091
|
||||
//username: "username", // # default blank
|
||||
//password: "password", // # default blank
|
||||
username: this.configService.getEnv('TRANSMISSION_CLIENT_USER'), // # default blank
|
||||
password: this.configService.getEnv('TRANSMISSION_CLIENT_PASSWORD'), // # default blank
|
||||
//ssl: true, //# default false use https
|
||||
//url: "/my/other/url" // # default '/transmission/rpc'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user