From eb99ec004d8995ef261c04a7b37a77a0367c84ca Mon Sep 17 00:00:00 2001 From: kagahd Date: Mon, 26 Apr 2021 15:22:12 +0200 Subject: [PATCH] #274 use ExifReader 3.15.0 to avoid overwriting Rating by RatingPercent --- package-lock.json | 25 +++++++++--------- package.json | 4 +-- test/backend/assets/two_ratings.jpg | Bin 0 -> 4877 bytes test/backend/assets/two_ratings.json | 18 +++++++++++++ .../model/threading/DiskMangerWorker.spec.ts | 2 +- .../model/threading/MetaDataLoader.spec.ts | 6 +++++ 6 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 test/backend/assets/two_ratings.jpg create mode 100644 test/backend/assets/two_ratings.json diff --git a/package-lock.json b/package-lock.json index 47baa963..92b73db7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8490,9 +8490,9 @@ "integrity": "sha1-WKnS1ywCwfbwKg70qRZicrd2CSI=" }, "exifreader": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/exifreader/-/exifreader-3.14.1.tgz", - "integrity": "sha512-SUxpOk39IvFc+KqglisSy42P8nNTrX/8HC6VijSQUzDRBolqa0ps7M8patMWCZ4NKuleLVq6qR41pOvF5ITdKg==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/exifreader/-/exifreader-3.15.0.tgz", + "integrity": "sha512-4zv6c6MLUt1V95moV/IHf7fReLTucrkVv8WJCE2fUVxPgqKFG5Au62MJGWh0nGWEAnZ/BhG4CPftyCxQNA26Ug==", "requires": { "xmldom": "^0.1.31" } @@ -21524,9 +21524,9 @@ }, "dependencies": { "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -21549,18 +21549,19 @@ } }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "dev": true, "requires": { + "is-core-module": "^2.2.0", "path-parse": "^1.0.6" } }, "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true } } diff --git a/package.json b/package.json index 6442e959..b707d131 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "cookie-session": "2.0.0-rc.1", "csurf": "1.11.0", "ejs": "3.1.6", - "exifreader": "3.14.1", + "exifreader": "3.15.0", "express": "4.17.1", "express-unless": "0.5.0", "fluent-ffmpeg": "2.1.2", @@ -135,7 +135,7 @@ "rxjs-compat": "6.6.7", "ts-helpers": "1.1.2", "ts-node": "9.1.1", - "tslint": "6.1.3", + "tslint": "^6.1.3", "typescript": "4.1.5", "xlf-google-translate": "1.0.0-beta.21", "xml2js": "0.4.23", diff --git a/test/backend/assets/two_ratings.jpg b/test/backend/assets/two_ratings.jpg new file mode 100644 index 0000000000000000000000000000000000000000..804b463ae09feb22ebeec37e6b2e17f600fc9c71 GIT binary patch literal 4877 zcmeHKTW}Lq7(RQ;Wn~~~OIm`$vZaus&2F|SkW5+zdZ9(iKnqeGUeY9OV@Wn7TN0{{ zf+*nl0Oh8P7m$kJ3^Sl2US?DfZ@ht`r95asM17H)cZc|&-AxmiK3GR)e8}mX{$Kv{ z{pbAOfBv1>O%J5ML6!v#O$~@32-FCFC_TiSt51bH5Nc|gflLUYF$fVfA^@>42^}+l z#}TB;cmc2luo>(=m<0r-@^OrvU{rh>@I)OC0(R&e60i$m$AUcsQvzHB_C1(|WOkqM z1}%s4;NK5H34bKf6YWH;%@y-Kv#J^pQcYW1tEYb1JQtEg$>kN@Ua69EN#4rYUiU04 zPt7G`?P%9JExQ%4iD3pHq$d1o6dc9upr1ReGb(k1I-v1+F)P|Mx(*RT3FU>W{bv- z8)GRhDk&*0vf1o+l})x!EWOiab3_`(D|9;MLb&f8)rTN8ft;o#P*#_~_$LKK<CeA7^W|3qX9tJQ zU-m`qxwNw7^7!`nDb_aCJydoDOH-BoGhyrgm9k-BSzUu@3`M}@ zQC2huUF`AjmTqEC8r@q=*T*+>*A*k?0+$%Lwj#J==cK@+Cyrk`kVZQW-f%BjG2q^{ z{m&a4zb+YEbyPm{V)|_Kp@O~W($>e)L+sivMTvO@A)0XdgK~Sw8IU7F${!P4PEkO< zIjNXG&>d2^_E2XyTFw9T?)y9!4p#HatD42;SZ$~)+}Ilrwe~Jr8tCl~c!K<#8rGNc zrXsOONbz&2$jWHKo2us3&AouJTi`jBqI6gDZOx0hS~(u#W;#Wu$k(tO$NA#H4sT0c zgB}jQs(C%nWHRYYRyyT)r{MB3icg&MGy4}xTHBH*6vUB!UaMv2*b^wE)7@wc7d#>+jRo$n?Gb!#m$#1U#?MA tU{vIMcje19stSyXobRsxtXypNbutu%cgQ5XEatzF^500k|Hp5nzX7Nt;|Tx& literal 0 HcmV?d00001 diff --git a/test/backend/assets/two_ratings.json b/test/backend/assets/two_ratings.json new file mode 100644 index 00000000..6fc7c554 --- /dev/null +++ b/test/backend/assets/two_ratings.json @@ -0,0 +1,18 @@ +{ + "cameraData": { + "ISO": 500, + "exposure": 0.01, + "fStop": 2.4, + "focalLength": 4.32, + "make": "samsung", + "model": "SM-G975F" + }, + "creationDate": 1619181527000, + "fileSize": 4877, + "orientation": 1, + "rating":3, + "size": { + "height": 5, + "width": 10 + } +} diff --git a/test/backend/unit/model/threading/DiskMangerWorker.spec.ts b/test/backend/unit/model/threading/DiskMangerWorker.spec.ts index e537d1b7..3b7c98ed 100644 --- a/test/backend/unit/model/threading/DiskMangerWorker.spec.ts +++ b/test/backend/unit/model/threading/DiskMangerWorker.spec.ts @@ -12,7 +12,7 @@ describe('DiskMangerWorker', () => { ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets'); const dir = await DiskMangerWorker.scanDirectory('/'); // should match the number of media (photo/video) files in the assets folder - expect(dir.media.length).to.be.equals(7); + expect(dir.media.length).to.be.equals(8); const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json')); const i = dir.media.findIndex(m => m.name === 'test image öüóőúéáű-.,.jpg'); expect(Utils.clone(dir.media[i].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg'); diff --git a/test/backend/unit/model/threading/MetaDataLoader.spec.ts b/test/backend/unit/model/threading/MetaDataLoader.spec.ts index 60e2bb1e..3a4e77eb 100644 --- a/test/backend/unit/model/threading/MetaDataLoader.spec.ts +++ b/test/backend/unit/model/threading/MetaDataLoader.spec.ts @@ -27,6 +27,12 @@ describe('MetadataLoader', () => { }); + it('should load Rating and not overwrite its value by RatingPercent', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/two_ratings.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/two_ratings.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + it('should load jpg 2', async () => { const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/old_photo.jpg')); const expected = require(path.join(__dirname, '/../../../assets/old_photo.json'));