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
|
||||
|
||||
## Migrations
|
||||
|
||||
```bash
|
||||
# create migration
|
||||
$ npm run typeorm:create-migration -name=CreateFilesTable
|
||||
@@ -40,13 +41,4 @@ $ npm run start:prod
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
```
|
||||
this app is not tested 😞
|
||||
|
||||
Generated
+2358
-2870
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -40,7 +40,7 @@
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.2.0",
|
||||
"sqlite": "^4.1.2",
|
||||
"sqlite3": "^5.1.2",
|
||||
"sqlite3": "^5.1.5",
|
||||
"torrent-name-parser": "^0.6.5",
|
||||
"transmission": "^0.4.10",
|
||||
"typeorm": "^0.3.11",
|
||||
|
||||
@@ -27,7 +27,6 @@ export class LrtApiSearchClient {
|
||||
|
||||
const loadedCategories = new Set();
|
||||
|
||||
//todo - move to mapper
|
||||
const responseDto = new SearchResponseDto(
|
||||
parseInt(searchResponse.page),
|
||||
parseInt(searchResponse.total_found),
|
||||
|
||||
@@ -337,7 +337,9 @@ export class TorrentService {
|
||||
.catch(() => false);
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export class RequestLogMiddleware implements NestMiddleware {
|
||||
strIP = strRemoteAddress.substring(strRemoteAddress.lastIndexOf(':') + 1);
|
||||
}
|
||||
|
||||
//todo - x-forwarded-for
|
||||
if (!strIP || strIP === '1') {
|
||||
if (req.hostname === 'localhost') {
|
||||
strIP = '127.0.0.1';
|
||||
|
||||
@@ -49,7 +49,7 @@ export class FileEntity {
|
||||
transmissionId: number;
|
||||
|
||||
@Column()
|
||||
linkomanija: boolean;
|
||||
linkomanija: boolean; //todo - not linkomanija, but mustSeed (e.g. for torrentleech also)
|
||||
|
||||
@Column({ name: 'torrent_id' })
|
||||
torrentId: number;
|
||||
|
||||
@@ -14,7 +14,7 @@ import { TorrentSeedClient } from '../../SeedClient/torrent-seed.client';
|
||||
@Injectable()
|
||||
export class WebtorrentClient {
|
||||
private client: Instance;
|
||||
private readonly torrentOptions: TorrentOptions;
|
||||
//private readonly torrentOptions: TorrentOptions;
|
||||
private readonly configService = configService.getVideoFilesConfig();
|
||||
|
||||
constructor(
|
||||
@@ -27,9 +27,25 @@ export class WebtorrentClient {
|
||||
) {
|
||||
this.client = new WebTorrent();
|
||||
|
||||
this.torrentOptions = {};
|
||||
this.torrentOptions.path = this.configService.getTorrentDownloadDir();
|
||||
this.torrentOptions.getAnnounceOpts = function() {
|
||||
// this.torrentOptions = {};
|
||||
// this.torrentOptions.path = this.configService.getTorrentDownloadDir();
|
||||
// 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;
|
||||
|
||||
return {
|
||||
@@ -39,7 +55,7 @@ export class WebtorrentClient {
|
||||
};
|
||||
};
|
||||
|
||||
this.resumeNotStopped();
|
||||
return torrentOptions;
|
||||
}
|
||||
|
||||
resumeNotStopped(): void {
|
||||
@@ -123,7 +139,7 @@ export class WebtorrentClient {
|
||||
return new Promise((resolve, reject) => {
|
||||
const torrent = this.client.add(
|
||||
torrentEntity.magnet,
|
||||
this.torrentOptions,
|
||||
this.getNewTorrentOptions(),
|
||||
);
|
||||
|
||||
torrent.on('ready', () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { LinkomanijaClient } from './linkomanija.client';
|
||||
import { LinkomanijaHttpClient } from './HttpClient/linkomanija-http.client';
|
||||
import { LinkomanijaResponseParser } from './ResponseParser/linkomanija-response.parser';
|
||||
|
||||
//todo - make this as separate library
|
||||
@Module({
|
||||
imports: [],
|
||||
providers: [
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { DataSource } from 'typeorm';
|
||||
import { InjectDataSource } from '@nestjs/typeorm';
|
||||
|
||||
@Controller('try')
|
||||
export class TryController {
|
||||
constructor(@InjectDataSource() private readonly ds: DataSource) {}
|
||||
|
||||
@Get('')
|
||||
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