Kodi Community Forum
Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db (/showthread.php?tid=80845)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Joooonaaaas - 2012-05-06

Thanks for your quick reply Xycl. I decided to try the \\server\share\folder approach since my NAS does not support AFP. This was however not as easy as I hoped it would be. First I tried adding the path through the XBMC add source command, secondly I tried to enter the path directly in the sources.xml file where XBMC seams to store all available sources. Either way I was not able to use the path in the mypicsdb addon (it seams like xbmc automatically changes all '\' into '/' but I am not sure this is the main reason it won't work).

I also spent some time looking for a list of paths for the my pictures database similar to sources.xml but I could not find it.

Is there anyone who has any idea to overcome this problem?


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - fungify - 2012-05-10

(2012-05-05, 11:39)Xycl Wrote: 1)
In your example XMP RDF there two identical keyword lists. MicrosoftPhoto:LastKeywordXMP and MicrosoftPhoto:LastKeywordIPTC. Both lists contain the same keywords.
I dont't think that it makes sense to display a keyword twice for one picture only because it's in two different keyword lists, isn't it?
I agree. The right approach would IMO be to consolidate (all) the lists - so that "Bear, Car, House" and "Bear, Jack, Jill" would equal "Bear, Car, House, Jack, Jill".
(2012-05-05, 11:39)Xycl Wrote: I don't know what's wrong with your picture.
My only explanation is that it is neither utf-8 nor cp1252 encoding.

That is so strange. I'm using Windows Live Photo Gallery to tag the pictures, so I'm hoping that isn't the issue. Will test a lot more and get back with info.

EDIT: Well - solved that problem. I deleted the captions with WLGP and re-inserted them again, and this time they were written correctly. Bizarre considering that is was WLPG that wrote the captions in the first place.

FFY



RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - mikebzh44 - 2012-05-16

Xycl, here is the full translation of strings.xml for French :

http://xbmclogs.com/show.php?id=2660


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - mikebzh44 - 2012-05-16

There is a little mistake in French translation given previous post :

Correct translation
Code:
<string id="30209">Ajouté ces %s derniers jours</string>

Is there a way to edit metadat from the addon ? For example, to add personn, category, keywords, ...

If not, how to add those metadata to pictures ?


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Xycl - 2012-05-16

Tagging software

Windows:
  1. Microsoft Picture Gallery for person & keyword tags.
  2. Irfan View. The program with the panda icon. It's for IPTC tags.
  3. ExifTool together with ExifToolGUI for EXIF, IPTC & XMP tags.

Other OS:
Don't know.


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - fungify - 2012-05-25

Hi Xycl

Need a bit of help. I'm trying to script a nightly update of the image-database, but am having some problems finding the right command to start a scan. Do I need to call scanpath.py directly, or ?

Which action / command is the right one for update all paths in database and add new pictures and remove deleted ones?

FFY




RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Xycl - 2012-05-25

Hi Fungify,

you only can start the scan from within XBMC.
The command is:
Code:
RunScript("C:\Users\Name\AppData\Roaming\XBMC\addons\plugin.image.mypicsdb\scanpath.py",--database)
As an example for Windows with user "Name".
You must use the full quailified path!

Xycl


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - fungify - 2012-05-25

(2012-05-25, 17:13)Xycl Wrote: you only can start the scan from within XBMC.
Actually - no Smile

The command you gave me works as a treat. I use wget and have scheduled a task that each night runs the following:

Code:
c:\_scripts\wget --directory-prefix=tmp --http-user=<xbmc username> --http-passwd=<xbmc password> "http://serveren:6500/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.RunScript("<full path to plugin>\plugin.image.mypicsdb\scanpath.py",--database)

Now my pictures database is automatically updated - no matter if it is me or my wife that has added or deleted pictures.

Thanks for your help.

FFY


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Xycl - 2012-05-26

Cool idea to use the HTTP api Smile

Xycl


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - mikebzh44 - 2012-05-30

Get an issue on OpenELEC 1.95.4 when adding somes pictures with accentueted names.

For exemple :

/storage/pictures/Coté.JPG

I have put some debug in your code :

Code:
21:21:30 T:140391854565120  NOTICE: MyPicsDB >> SQL > SELECT DISTINCT strPath FROM files
21:21:30 T:140391854565120  NOTICE: MyPicsDB >> /storage/pictures/
21:21:30 T:140391854565120  NOTICE: ('picfile=', 'Cot\xc3\xa9.JPG')
21:21:30 T:140391854565120  NOTICE: ('type=', <type 'str'>)
21:21:30 T:140391854565120   ERROR: Traceback (most recent call last):
21:21:30 T:140391854565120   ERROR:   File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 154, in main2
21:21:30 T:140391854565120   ERROR:     browse_folder(unquote_plus(options.rootpath),parentfolderID=None,recursive=options.recursive,updatepics=True,addpics=True,delpics=True,rescan=False,updatefun
21:21:30 T:140391854565120   ERROR:   File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 312, in browse_folder
21:21:30 T:140391854565120   ERROR:     MPDB.DB_del_pic(dirname,picfile)
21:21:30 T:140391854565120   ERROR:   File "/storage/.xbmc/addons/plugin.image.mypicsdb/resources/lib/MypicsDB.py", line 900, in DB_del_pic
21:21:30 T:140391854565120   ERROR:     Request("""DELETE FROM files WHERE idFolder = (SELECT idFolder FROM folders WHERE FullPath='%s') AND strFilename='%s'"""%(picpath,picfile))
21:21:30 T:140391854565120   ERROR: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

So picfile is a string variable and contains Cot\xc3\xa9.JPG instead of Coté.JPG

But it's quite strange because Fmronan used your addon under Ubuntu and I know that he get some accents in directories names and his pictures were scanned with no problems.

He can't do more tests has he's upgrading his HTPC (HDD -> SSD).

Are your running under Linux ? Did you have try with german letters in path or picture name ?


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Xycl - 2012-05-31

(2012-05-30, 21:33)mikebzh44 Wrote: So picfile is a string variable and contains Cot\xc3\xa9.JPG instead of Coté.JPG

Hi Mikael,

what do you see when using a console window?
I mean do a "ls /storage/pictures".
I'm pretty sure that the ls command don't list Coté but something else.

I tried it with XBMCuntu in a VMWare session. When copying pictures from windows to ubuntu with winscp (protokoll scp) all unicode characters get lost because scp doesn't support utf-8 encoding, but Winscp displayed them correctly! When using Winscp with protokoll SFTP everything worked.

Xycl


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - mikebzh44 - 2012-05-31

I have copy Coté.JPG and other files from my Windows 7 laptop to my OpenELEC HTPC using SMB sharing.

On a puTTy terminal, I get :

Code:
root ~ # cd /storage/pictures/
root ~/pictures # ls -l
total 3132
-rwxr--r--    1 root     root        477401 Sep 18  2010 Arrière.JPG
-rwxr--r--    1 root     root        497919 Sep 18  2010 Avant.JPG
-rwxr--r--    1 root     root        406994 Sep 18  2010 Banquette.JPG
-rwxr--r--    1 root     root        319696 Sep 18  2010 Compteur.JPG
-rwxr--r--    1 root     root        507214 Sep 18  2010 Conducteur.JPG
-rwxr--r--    1 root     root        548651 Sep 18  2010 Coté.JPG
-rwxr--r--    1 root     root        435196 Sep 18  2010 Passager.JPG

But XBMC display good names :

Image

After changing my puTTy settings (Latin-1 to UTF-8), ls is OK :

Code:
root ~/pictures # ls -l
total 3132
-rwxr--r--    1 root     root        477401 Sep 18  2010 Arrière.JPG
-rwxr--r--    1 root     root        497919 Sep 18  2010 Avant.JPG
-rwxr--r--    1 root     root        406994 Sep 18  2010 Banquette.JPG
-rwxr--r--    1 root     root        319696 Sep 18  2010 Compteur.JPG
-rwxr--r--    1 root     root        507214 Sep 18  2010 Conducteur.JPG
-rwxr--r--    1 root     root        548651 Sep 18  2010 Coté.JPG
-rwxr--r--    1 root     root        435196 Sep 18  2010 Passager.JPG

How my openelec is set up by default :

Code:
root ~/.xbmc/temp # locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

And now, scanning is KO :

Code:
06:34:32 T:140422180857664   ERROR: Control 2006 in window 13000 has been asked to focus, but it can't
06:34:32 T:140422180857664   ERROR: ClearBlock: Trying to clear non existent block /storage/.xbmc/addons/script.module.dialogaddonscan
06:34:32 T:140421832210176   ERROR: Error Type: <type 'exceptions.UnicodeDecodeError'>
06:34:32 T:140421832210176   ERROR: Error Contents: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
06:34:32 T:140421832210176   ERROR: Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 503, in <module>
                                                main2()
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 172, in main2
                                                count_files(unquote_plus(path),False)
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 223, in count_files
                                                walk(path, processDirectory, None )
                                              File "/usr/lib/python2.7/posixpath.py", line 231, in walk
                                                name = join(top, name)
                                              File "/usr/lib/python2.7/posixpath.py", line 69, in join
                                                path +=  b
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

Rename Coté.JPG to Cote.JPG and Arrière.JPG to Arriere.JPG and everything is OK.

Has I never use accented characters in path or filename, it doesn't matter but I want to try my mods under Linux.


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Xycl - 2012-05-31

Please try: MyPicsDB 0.7.1.1 Beta
It works with XBMCbuntu flawless.

Image


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - mikebzh44 - 2012-05-31

I will try it this evening.

I will install XBMCbuntu also on my HTPC for tests.

Thanks.


RE: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - fungify - 2012-05-31

Shouldn't this thread be moved to the forum Picture Add-ons? I would think that many users would like to try the addon, but simple doesn't know it exists. One of the participants of GSOC even seems to be coding a new image database - probably because he didn't know this one exists and works quite well.

And another idea - It would be great to have a widget that could display the latest images added. Unfortunately I have no idea where to start, but someone else might?

FFY