mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-10 04:07:35 +02:00
improve linting
This commit is contained in:
parent
7ee19cef23
commit
5f1ce6dd81
@ -9,7 +9,6 @@ import {SharingDTO} from '../../common/entities/SharingDTO';
|
|||||||
import {Utils} from '../../common/Utils';
|
import {Utils} from '../../common/Utils';
|
||||||
import {LoggerRouter} from '../routes/LoggerRouter';
|
import {LoggerRouter} from '../routes/LoggerRouter';
|
||||||
import {TAGS} from '../../common/config/public/ClientConfig';
|
import {TAGS} from '../../common/config/public/ClientConfig';
|
||||||
import {ConfigDiagnostics} from '../model/diagnostics/ConfigDiagnostics';
|
|
||||||
|
|
||||||
const forcedDebug = process.env['NODE_ENV'] === 'debug';
|
const forcedDebug = process.env['NODE_ENV'] === 'debug';
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import {FfmpegCommand} from 'fluent-ffmpeg';
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
export class FFmpegFactory {
|
export class FFmpegFactory {
|
||||||
public static get(): any {
|
public static get(): (path: string) => FfmpegCommand {
|
||||||
const ffmpeg = require('fluent-ffmpeg');
|
const ffmpeg = require('fluent-ffmpeg');
|
||||||
try {
|
try {
|
||||||
const ffmpegPath = require('ffmpeg-static');
|
const ffmpegPath = require('ffmpeg-static');
|
||||||
|
@ -7,7 +7,6 @@ import {SearchQueryDTO} from '../../../common/entities/SearchQueryDTO';
|
|||||||
import {SavedSearchEntity} from './enitites/album/SavedSearchEntity';
|
import {SavedSearchEntity} from './enitites/album/SavedSearchEntity';
|
||||||
import {Logger} from '../../Logger';
|
import {Logger} from '../../Logger';
|
||||||
import {IObjectManager} from './IObjectManager';
|
import {IObjectManager} from './IObjectManager';
|
||||||
import {DirectoryEntity} from './enitites/DirectoryEntity';
|
|
||||||
|
|
||||||
const LOG_TAG = '[AlbumManager]';
|
const LOG_TAG = '[AlbumManager]';
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import {MediaEntity} from './enitites/MediaEntity';
|
|||||||
import {DiskMangerWorker} from '../threading/DiskMangerWorker';
|
import {DiskMangerWorker} from '../threading/DiskMangerWorker';
|
||||||
import {ObjectManagers} from '../ObjectManagers';
|
import {ObjectManagers} from '../ObjectManagers';
|
||||||
import {DatabaseType} from '../../../common/config/private/PrivateConfig';
|
import {DatabaseType} from '../../../common/config/private/PrivateConfig';
|
||||||
import {SortingMethod} from '../../../common/entities/SortingMethods';
|
|
||||||
import {SQLConnection} from './SQLConnection';
|
import {SQLConnection} from './SQLConnection';
|
||||||
import {SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../common/entities/SearchQueryDTO';
|
import {SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../common/entities/SearchQueryDTO';
|
||||||
import {DirectoryEntity} from './enitites/DirectoryEntity';
|
import {DirectoryEntity} from './enitites/DirectoryEntity';
|
||||||
@ -111,7 +110,7 @@ export class CoverManager implements IObjectManager {
|
|||||||
.limit(1)
|
.limit(1)
|
||||||
.getOne();
|
.getOne();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error('Cant get album cover using:', JSON.stringify(album.searchQuery), JSON.stringify(Config.AlbumCover.SearchQuery));
|
Logger.error(LOG_TAG, 'Cant get album cover using:', JSON.stringify(album.searchQuery), JSON.stringify(Config.AlbumCover.SearchQuery));
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +119,7 @@ export class CoverManager implements IObjectManager {
|
|||||||
try {
|
try {
|
||||||
coverMedia = await coverQuery().limit(1).getOne();
|
coverMedia = await coverQuery().limit(1).getOne();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error('Cant get album cover using:', JSON.stringify(album.searchQuery));
|
Logger.error(LOG_TAG, 'Cant get album cover using:', JSON.stringify(album.searchQuery));
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,10 @@ import {Logger} from '../../Logger';
|
|||||||
import {ObjectManagers} from '../ObjectManagers';
|
import {ObjectManagers} from '../ObjectManagers';
|
||||||
import {DuplicatesDTO} from '../../../common/entities/DuplicatesDTO';
|
import {DuplicatesDTO} from '../../../common/entities/DuplicatesDTO';
|
||||||
import {ReIndexingSensitivity} from '../../../common/config/private/PrivateConfig';
|
import {ReIndexingSensitivity} from '../../../common/config/private/PrivateConfig';
|
||||||
import {IObjectManager} from './IObjectManager';
|
|
||||||
|
|
||||||
const LOG_TAG = '[GalleryManager]';
|
const LOG_TAG = '[GalleryManager]';
|
||||||
|
|
||||||
export class GalleryManager {
|
export class GalleryManager {
|
||||||
public static parseRelativeDirePath(relativeDirectoryName: string): {
|
public static parseRelativeDirePath(relativeDirectoryName: string): {
|
||||||
name: string;
|
name: string;
|
||||||
parent: string;
|
parent: string;
|
||||||
@ -177,7 +176,7 @@ export class GalleryManager {
|
|||||||
let duplicates = await mediaRepository
|
let duplicates = await mediaRepository
|
||||||
.createQueryBuilder('media')
|
.createQueryBuilder('media')
|
||||||
.innerJoin(
|
.innerJoin(
|
||||||
(query): any =>
|
(query) =>
|
||||||
query
|
query
|
||||||
.from(MediaEntity, 'innerMedia')
|
.from(MediaEntity, 'innerMedia')
|
||||||
.select([
|
.select([
|
||||||
@ -248,7 +247,7 @@ export class GalleryManager {
|
|||||||
duplicates = await mediaRepository
|
duplicates = await mediaRepository
|
||||||
.createQueryBuilder('media')
|
.createQueryBuilder('media')
|
||||||
.innerJoin(
|
.innerJoin(
|
||||||
(query): any =>
|
(query) =>
|
||||||
query
|
query
|
||||||
.from(MediaEntity, 'innerMedia')
|
.from(MediaEntity, 'innerMedia')
|
||||||
.select([
|
.select([
|
||||||
@ -319,7 +318,11 @@ export class GalleryManager {
|
|||||||
dir.isPartial = true;
|
dir.isPartial = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getDirIdAndTime(connection: Connection, name: string, path: string): Promise<{ id: number, lastScanned: number, lastModified: number }> {
|
protected async getDirIdAndTime(connection: Connection, name: string, path: string): Promise<{
|
||||||
|
id: number,
|
||||||
|
lastScanned: number,
|
||||||
|
lastModified: number
|
||||||
|
}> {
|
||||||
return await connection
|
return await connection
|
||||||
.getRepository(DirectoryEntity)
|
.getRepository(DirectoryEntity)
|
||||||
.createQueryBuilder('directory')
|
.createQueryBuilder('directory')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {DirectoryDTOUtils, DirectoryPathDTO, ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
import {DirectoryBaseDTO, DirectoryDTOUtils, DirectoryPathDTO, ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
||||||
import {DirectoryEntity} from './enitites/DirectoryEntity';
|
import {DirectoryEntity} from './enitites/DirectoryEntity';
|
||||||
import {SQLConnection} from './SQLConnection';
|
import {SQLConnection} from './SQLConnection';
|
||||||
import {DiskManager} from '../DiskManger';
|
import {DiskManager} from '../DiskManger';
|
||||||
@ -261,8 +261,8 @@ export class IndexingManager {
|
|||||||
// directory found
|
// directory found
|
||||||
childDirectories.splice(dirIndex, 1);
|
childDirectories.splice(dirIndex, 1);
|
||||||
} else {
|
} else {
|
||||||
// dir does not exists yet
|
// dir does not exist yet
|
||||||
directory.parent = {id: currentDirId} as any;
|
directory.parent = {id: currentDirId} as ParentDirectoryDTO;
|
||||||
(directory as DirectoryEntity).lastScanned = null; // new child dir, not fully scanned yet
|
(directory as DirectoryEntity).lastScanned = null; // new child dir, not fully scanned yet
|
||||||
const d = await directoryRepository.insert(
|
const d = await directoryRepository.insert(
|
||||||
directory as DirectoryEntity
|
directory as DirectoryEntity
|
||||||
@ -311,7 +311,7 @@ export class IndexingManager {
|
|||||||
item.directory = null;
|
item.directory = null;
|
||||||
metaFile = Utils.clone(item);
|
metaFile = Utils.clone(item);
|
||||||
item.directory = scannedDirectory;
|
item.directory = scannedDirectory;
|
||||||
metaFile.directory = {id: currentDirID} as any;
|
metaFile.directory = {id: currentDirID} as DirectoryBaseDTO;
|
||||||
metaFilesToSave.push(metaFile);
|
metaFilesToSave.push(metaFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,7 +374,7 @@ export class IndexingManager {
|
|||||||
// Media not in DB yet
|
// Media not in DB yet
|
||||||
media[i].directory = null;
|
media[i].directory = null;
|
||||||
mediaItem = Utils.clone(media[i]);
|
mediaItem = Utils.clone(media[i]);
|
||||||
mediaItem.directory = {id: parentDirId} as any;
|
mediaItem.directory = {id: parentDirId} as DirectoryBaseDTO;
|
||||||
(MediaDTOUtils.isPhoto(mediaItem)
|
(MediaDTOUtils.isPhoto(mediaItem)
|
||||||
? mediaChange.insertP
|
? mediaChange.insertP
|
||||||
: mediaChange.insertV
|
: mediaChange.insertV
|
||||||
|
Loading…
Reference in New Issue
Block a user