mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
add todos and small changes
This commit is contained in:
@@ -9,6 +9,7 @@ A rewrite attempt from "vanilla" node.js into framework based (Nest.js).
|
|||||||
No licence
|
No licence
|
||||||
|
|
||||||
## Migrations
|
## Migrations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# create migration
|
# create migration
|
||||||
$ npm run typeorm:create-migration -name=CreateFilesTable
|
$ npm run typeorm:create-migration -name=CreateFilesTable
|
||||||
@@ -40,13 +41,4 @@ $ npm run start:prod
|
|||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|
||||||
```bash
|
this app is not tested 😞
|
||||||
# unit tests
|
|
||||||
$ npm run test
|
|
||||||
|
|
||||||
# e2e tests
|
|
||||||
$ npm run test:e2e
|
|
||||||
|
|
||||||
# test coverage
|
|
||||||
$ npm run test:cov
|
|
||||||
```
|
|
||||||
|
|||||||
Generated
+2357
-2869
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -40,7 +40,7 @@
|
|||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"rxjs": "^7.2.0",
|
"rxjs": "^7.2.0",
|
||||||
"sqlite": "^4.1.2",
|
"sqlite": "^4.1.2",
|
||||||
"sqlite3": "^5.1.2",
|
"sqlite3": "^5.1.5",
|
||||||
"torrent-name-parser": "^0.6.5",
|
"torrent-name-parser": "^0.6.5",
|
||||||
"transmission": "^0.4.10",
|
"transmission": "^0.4.10",
|
||||||
"typeorm": "^0.3.11",
|
"typeorm": "^0.3.11",
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export class LrtApiSearchClient {
|
|||||||
|
|
||||||
const loadedCategories = new Set();
|
const loadedCategories = new Set();
|
||||||
|
|
||||||
//todo - move to mapper
|
|
||||||
const responseDto = new SearchResponseDto(
|
const responseDto = new SearchResponseDto(
|
||||||
parseInt(searchResponse.page),
|
parseInt(searchResponse.page),
|
||||||
parseInt(searchResponse.total_found),
|
parseInt(searchResponse.total_found),
|
||||||
|
|||||||
@@ -337,7 +337,9 @@ export class TorrentService {
|
|||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
|
|
||||||
return new NotificationResponse(
|
return new NotificationResponse(
|
||||||
result ? 'torrent deleted' : 'deleting from wt not implemented',
|
result
|
||||||
|
? 'torrent deleted'
|
||||||
|
: 'deleting from wt not implemented, \nadd to transmission and delete',
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export class RequestLogMiddleware implements NestMiddleware {
|
|||||||
strIP = strRemoteAddress.substring(strRemoteAddress.lastIndexOf(':') + 1);
|
strIP = strRemoteAddress.substring(strRemoteAddress.lastIndexOf(':') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo - x-forwarded-for
|
||||||
if (!strIP || strIP === '1') {
|
if (!strIP || strIP === '1') {
|
||||||
if (req.hostname === 'localhost') {
|
if (req.hostname === 'localhost') {
|
||||||
strIP = '127.0.0.1';
|
strIP = '127.0.0.1';
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class FileEntity {
|
|||||||
transmissionId: number;
|
transmissionId: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
linkomanija: boolean;
|
linkomanija: boolean; //todo - not linkomanija, but mustSeed (e.g. for torrentleech also)
|
||||||
|
|
||||||
@Column({ name: 'torrent_id' })
|
@Column({ name: 'torrent_id' })
|
||||||
torrentId: number;
|
torrentId: number;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { TorrentSeedClient } from '../../SeedClient/torrent-seed.client';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class WebtorrentClient {
|
export class WebtorrentClient {
|
||||||
private client: Instance;
|
private client: Instance;
|
||||||
private readonly torrentOptions: TorrentOptions;
|
//private readonly torrentOptions: TorrentOptions;
|
||||||
private readonly configService = configService.getVideoFilesConfig();
|
private readonly configService = configService.getVideoFilesConfig();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -27,9 +27,25 @@ export class WebtorrentClient {
|
|||||||
) {
|
) {
|
||||||
this.client = new WebTorrent();
|
this.client = new WebTorrent();
|
||||||
|
|
||||||
this.torrentOptions = {};
|
// this.torrentOptions = {};
|
||||||
this.torrentOptions.path = this.configService.getTorrentDownloadDir();
|
// this.torrentOptions.path = this.configService.getTorrentDownloadDir();
|
||||||
this.torrentOptions.getAnnounceOpts = function() {
|
// this.torrentOptions.getAnnounceOpts = function() {
|
||||||
|
// const that = this as Torrent;
|
||||||
|
//
|
||||||
|
// return {
|
||||||
|
// uploaded: 0, //this.uploaded,
|
||||||
|
// downloaded: 0, //this.downloaded,
|
||||||
|
// left: that.length, //Math.max(this.length - this.downloaded, 0)
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
this.resumeNotStopped();
|
||||||
|
}
|
||||||
|
|
||||||
|
getNewTorrentOptions(): TorrentOptions {
|
||||||
|
const torrentOptions: Record<string, any> = {};
|
||||||
|
torrentOptions.path = this.configService.getTorrentDownloadDir();
|
||||||
|
torrentOptions.getAnnounceOpts = function () {
|
||||||
const that = this as Torrent;
|
const that = this as Torrent;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -39,7 +55,7 @@ export class WebtorrentClient {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
this.resumeNotStopped();
|
return torrentOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
resumeNotStopped(): void {
|
resumeNotStopped(): void {
|
||||||
@@ -123,7 +139,7 @@ export class WebtorrentClient {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const torrent = this.client.add(
|
const torrent = this.client.add(
|
||||||
torrentEntity.magnet,
|
torrentEntity.magnet,
|
||||||
this.torrentOptions,
|
this.getNewTorrentOptions(),
|
||||||
);
|
);
|
||||||
|
|
||||||
torrent.on('ready', () => {
|
torrent.on('ready', () => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { LinkomanijaClient } from './linkomanija.client';
|
|||||||
import { LinkomanijaHttpClient } from './HttpClient/linkomanija-http.client';
|
import { LinkomanijaHttpClient } from './HttpClient/linkomanija-http.client';
|
||||||
import { LinkomanijaResponseParser } from './ResponseParser/linkomanija-response.parser';
|
import { LinkomanijaResponseParser } from './ResponseParser/linkomanija-response.parser';
|
||||||
|
|
||||||
|
//todo - make this as separate library
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [
|
providers: [
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
|
import { DataSource } from 'typeorm';
|
||||||
|
import { InjectDataSource } from '@nestjs/typeorm';
|
||||||
|
|
||||||
@Controller('try')
|
@Controller('try')
|
||||||
export class TryController {
|
export class TryController {
|
||||||
|
constructor(@InjectDataSource() private readonly ds: DataSource) {}
|
||||||
|
|
||||||
@Get('')
|
@Get('')
|
||||||
main() {
|
main() {
|
||||||
return { hello: 'world' };
|
//return this.ds.query('select category_url from lrt_categories where category_id = $1', ['2720']);
|
||||||
|
// return this.ds
|
||||||
|
// .createQueryBuilder()
|
||||||
|
// .select()
|
||||||
|
// .from(null, 'lrt_categories')
|
||||||
|
// .getMany();
|
||||||
|
return this.ds.query('select * from lrt_categories');
|
||||||
|
//return { hello: 'world' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user