1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-25 02:04:15 +02:00

fixing db and gallery indexing, minor fronend bugfix

This commit is contained in:
Patrik Braun 2017-12-19 18:20:37 -05:00
parent d4318c31c3
commit 9d84c410cd
6 changed files with 11 additions and 11 deletions

View File

@ -36,7 +36,7 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
.getOne();
if (dir && dir.lastScanned == null) {
if (dir && dir.lastScanned != null) {
//If it seems that the content did not changed, do not work on it
if (knownLastModified && knownLastScanned
&& lastModified == knownLastModified &&
@ -53,7 +53,6 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
if (dir.photos) {
for (let i = 0; i < dir.photos.length; i++) {
dir.photos[i].directory = dir;
//PhotoMetadataEntity.open(dir.photos[i].metadata);
dir.photos[i].readyThumbnails = [];
dir.photos[i].readyIcon = false;
}
@ -84,6 +83,7 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
return this.indexDirectory(relativeDirectoryName);
}
//not indexed since a while, index it in a lazy manner
if ((Date.now() - dir.lastScanned > Config.Server.indexing.cachedFolderTimeout &&
Config.Server.indexing.reIndexingSensitivity >= ReIndexingSensitivity.medium) ||
Config.Server.indexing.reIndexingSensitivity >= ReIndexingSensitivity.high) {
@ -96,6 +96,8 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
}
//never scanned (deep indexed), do it and return with it
return this.indexDirectory(relativeDirectoryName);

View File

@ -33,7 +33,7 @@ export class SQLConnection {
SharingEntity
];
options.synchronize = true;
options.logging = "all";
// options.logging = "all";
this.connection = await createConnection(options);
}
return this.connection;

View File

@ -123,9 +123,9 @@ export class GalleryCacheService {
localStorage.setItem(key, JSON.stringify(directory));
directory.directories.forEach((dir: DirectoryDTO) => {
let name = Utils.concatUrls(dir.path, dir.name);
if (localStorage.getItem(name) == null) { //don't override existing
localStorage.setItem(Utils.concatUrls(dir.path, dir.name), JSON.stringify(dir));
const sub_key = GalleryCacheService.CONTENT_PREFIX + Utils.concatUrls(dir.path, dir.name);
if (localStorage.getItem(sub_key) == null) { //don't override existing
localStorage.setItem(sub_key, JSON.stringify(dir));
}
});

View File

@ -29,10 +29,10 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="folder">Thumbnail folder</label>
<label class="col-sm-2 control-label" for="th_folder">Thumbnail folder</label>
<div class="col-sm-10">
<input type="text" class="form-control" placeholder="path"
id="folder"
id="th_folder"
[(ngModel)]="settings.server.folder"
name="path" required>
<span class="help-block">Thumbnails will be saved in this folder. Write access is required</span>

View File

@ -37,7 +37,7 @@
"ts-exif-parser": "0.1.23",
"ts-node-iptc": "1.0.9",
"typeconfig": "1.0.5",
"typeorm": "0.1.9",
"typeorm": "0.1.8",
"winston": "2.4.0"
},
"devDependencies": {

View File

@ -190,9 +190,7 @@ describe('Typeorm integration', () => {
});
it('should open and close connection twice with photo added ', async () => {
console.log("start-------------------------------------");
let conn = await SQLConnection.getConnection();
console.log("opnenn-------------------------------------");
const dir = await conn.getRepository(DirectoryEntity).save(getDir());
let dir2 = getDir();
dir2.parent = dir;