This repository has been archived by the owner on Feb 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3513573
Showing
11 changed files
with
2,692 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4, | ||
{ | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"windows" | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-empty": [ | ||
"error", | ||
{ | ||
"allowEmptyCatch": true | ||
} | ||
], | ||
"no-console": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"warn", | ||
"error" | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules/ | ||
.vscode/* | ||
database* | ||
dbbrowser* | ||
DBstructure* | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# plex-ttp | ||
[Plex](http://plex.tv) is an amazing software to organize, stream, and share your personal multimedia collections, including photos. | ||
|
||
[Tag That Photo](http://tagthatphoto.com), aka TTP, is an amazing software to recognise faces from your collection of photos. | ||
|
||
Unfortunately, Plex does not recognise the XMP tags created by TTP. This script allows one to insert TTP faces recorded into the photos into Plex database. | ||
|
||
## Warning | ||
**The script interacts directly with Plex database.** | ||
Make sure you have a [backup of your database](https://support.plex.tv/articles/201539237-backing-up-plex-media-server-data/) before using this script. | ||
In case of any issues, [restore your database](https://support.plex.tv/articles/201539237-backing-up-plex-media-server-data/) ! | ||
|
||
## Installation | ||
|
||
1/ assuming node.js and npm are already installed, install the package as follow: | ||
|
||
npm install plex-ttp | ||
|
||
## Usage | ||
|
||
usage node plex-ttp.js [-s] [-h] [-l tag] [-d tag] | ||
-s : scan images and put face tags into Plex | ||
-l [tag] : list matching tags | ||
-d tag: delete the tag | ||
-h : show this help | ||
|
||
|
||
**node plex-ttp.js -s** is the basic command to run to scan all photos from our Plex library, extract the tag faces and insert them into Plex. Face names are then available within the [Tag list of Plex](http:plex_screenshot.jpg) | ||
|
||
|
||
* * * | ||
|
||
© 2020 devbab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
//const exiftool = require("exiftool-vendored").exiftool; | ||
|
||
const ExifTool = require("exiftool-vendored").ExifTool; | ||
let numCPUs = require("os").cpus().length; | ||
const exiftool = new ExifTool({ | ||
maxProcs: numCPUs | ||
}); | ||
|
||
// maxProcs: DefaultMaxProcs, | ||
|
||
/** | ||
* look for XMP tag and return an array of it | ||
* @param {} filename | ||
* @returns {modif,tags} | ||
*/ | ||
function getFromImage(filename) { | ||
// console.log(`getting exif for ${filename}`); | ||
|
||
return new Promise(function (resolve, reject) { | ||
exiftool | ||
.read(filename) | ||
.then(tags => { | ||
|
||
//console.log("exif tags ",tags); | ||
const d = tags.FileModifyDate; | ||
const modif = new Date(d.year, d.month - 1, d.day, d.hour, d.minute, d.second, 0); | ||
//console.log("fileModifyDate: ",d ); | ||
|
||
const lat = tags.GPSLatitude; | ||
const lng = tags.GPSLongitude; | ||
let pos = null; | ||
if (lat && lng) | ||
pos = { | ||
lat: lat, | ||
lng: lng | ||
}; | ||
|
||
let faces = []; | ||
if (Object.prototype.hasOwnProperty.call(tags, "PersonInImage")) | ||
faces = tags.PersonInImage; | ||
|
||
resolve({ | ||
modif: modif, | ||
faces: faces, | ||
pos: pos, | ||
tags: tags | ||
}); | ||
|
||
}) | ||
.catch(err => { | ||
reject(err); | ||
|
||
}); | ||
|
||
}); | ||
|
||
} | ||
|
||
function end() { | ||
exiftool.end(); | ||
} | ||
|
||
|
||
module.exports = { | ||
getFromImage: getFromImage, | ||
end: end | ||
}; |
Oops, something went wrong.