Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Closed
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #16
Hi robotica

You are doing good to write here your last requests.

* Unicode errors in the path are fixed just right now Smile It will be included in the next release.

* Datetime errors should be OK now.
It tries the standard datetime format (only dots separating the values) and if it does not work, try some others.
Sometimes it can't retrieve date time because as what I've seen in some pics, datime is 0000:00:00 00:00:00 and of course it is not a valid date time.

* XMP / picture rating
I haven't found any pure python library to retrieve XMP metadatas. I would love add this kind of metadatas as it is the most recent kind of information and it works with many different kind of file types.
If someone better than I am, knows about such a library, or if somebody knows how to use a XMP C library from python, feel free to contact me ! thank you
Picture rating may be done from scratch and only in and for mypictureDB.
Anyway, I say it again, it was not in my first thought to enable picture edition from this plugin as it requires a lot of attention to be safe and not corrupt your pics.
find
Robotica Offline
Banned
Posts: 1,202
Joined: Aug 2010
Post: #17
Thnx for fixing that!

This EXIF-tool (http://www.sno.phy.queensu.ca/~phil/exiftool/) would be great but it's written in PERL. Maybe when jfcaroll is ready http://forum.xbmc.org/showthread.php?tid=80984 ....

Also found this: http://www.zoia.org/blog/2006/08/13/extr...ng-python/
(This post was last modified: 2010-09-13 23:04 by Robotica.)
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #18
I don't understand everything he says.... lol Hope it will be usefull later !
find
mhdebokx Offline
Member
Posts: 70
Joined: Dec 2006
Reputation: 0
Location: Netherlands
Post: #19
As mentioned per e-mail 2 kind of unicode problems occure. I hope there is a solution to translate in ascii strings to unicode

If photo's are geotagged using GeoSetter/ExifTools with option save IPTC in unicode, the next error occures:

08:34:53 T:880 M:248811520 NOTICE: MyPicsDB >> >>> DB_file_insert ...
08:34:53 T:880 M:248811520 NOTICE: MyPicsDB >> exceptions.Exception - You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
08:34:53 T:880 M:248811520 NOTICE: MyPicsDB >> INSERT INTO files('GPS GPSLatitude','category','supplemental category','strFilename','country/primary location name','Image Model','Image Orientation','EXIF DateTimeOriginal','GPS GPSLongitude','UseIt','country/primary location code','EXIF DateTimeDigitized','contact','city','keywords','EXIF ExifImageWidth','idFolder','province/state','EXIF SceneCaptureType','strPath') values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)


some camera's also write unicode EXIF information, like the Canon 5D Mark II. The next error occures

08:34:53 T:880 M:248557568 ERROR: Error Type: exceptions.UnicodeEncodeError
08:34:53 T:880 M:248557568 ERROR: Error Contents: 'ascii' codec can't encode characters in position 61-62: ordinal not in range(128)
08:34:53 T:880 M:248516608 ERROR: Traceback (most recent call last):
File "C:\Documents and Settings\Michel\Application Data\XBMC\addons\plugin.image.mypicsdb\default.py", line 429, in ?
ok = scan_my_pics()#scan lorsque le plugin n'a pas de paramètres
File "C:\Documents and Settings\Michel\Application Data\XBMC\addons\plugin.image.mypicsdb\default.py", line 406, in scan_my_pics
MPDB.browse_folder(chemin,parentfolderID=None,recursive=xbmcplugin.getSetting(in​t(sys.argv[1]),'recursive')=="true",update=False,updatefunc = pupdate)
File "C:\Documents and Settings\Michel\Application Data\XBMC\addons\plugin.image.mypicsdb\resources\lib\MypicsDB.py", line 466, in browse_folder
iptc = get_iptc(dirname,picfile)
File "C:\Documents and Settings\Michel\Application Data\XBMC\addons\plugin.image.mypicsdb\resources\lib\MypicsDB.py", line 644, in get_iptc
log( "WARNING : '%s' is not a valid IPTC info (value : %s)"%(k,info.data[k][:80]) )
File "C:\Documents and Settings\Michel\Application Data\XBMC\addons\plugin.image.mypicsdb\resources\lib\MypicsDB.py", line 82, in log
print str("MyPicsDB >> %s"%msg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 61-62: ordinal not in range(128)
08:34:53 T:3732 M:248442880 ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.image.mypicsdb/
08:34:53 T:3732 M:248442880 ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.image.mypicsdb/) failed
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #20
Hum...
Your last error looks like an iptc info found in the picture is not valid. I need to test it this evening.
I think you sent me this pic and it is a good thing.
I'll add it to my library and watch for what is going wrong.
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #21
Hi all

V 0.1.3 is available :
Code:
2010/09/15 --> v 0.1.3
  In the Sort by folder view, the count of the pictures was counting only the pics within the concerned folder, not all the pics from its subfolders
  
2010/09/14
  Fixed an issue that appear when scanning non unicode IPTC metadatas
  The strings are now localized ready. Please submit string.xml in your language
    need a german update (maybe correct english lannguage too)
  
2010/09/13
  Added German language for settings
  fixed : unicode errors in the file path, filename
  Setting to force reinit of the database on each plugin start is by default set to False.
    Picture folder will be scanned only at the start of the plugin. Next start, only new pics will be added and pictures physically removed will be removed from the databasse too.
    
2010/09/10
  Count how many pics for each filter
  
2010/09/09
  New way to select pictures to add in the database.
    Many file extension can be added (as for now are : ".JPG",".TIF",".PNG",".GIF",".BMP")
    but only jpg will be scanned for EXIF and IPTC metadatas

It should be available from dharma update addons.
Hope you like it !

I need your help, this plugin is for you all. So feel free to post your language strings.xml file, report me any bug, anything you like or even you dislike, continue telling me what do you wish for this plugin.

Next release (if not too much bugs reported) I will try to add something I think it is a good thing. You should be able to save pics (individually or not) as selections. So you'll be able to make albums, easy then to display some holiday pictures wherever pictures are saved.
find
Robotica Offline
Banned
Posts: 1,202
Joined: Aug 2010
Post: #22
Great!

Is it possible to store links to the pics in the database so I don't need to scan my folder everytime (maybe as an option)?

And about creating albums... Can you use smart playlists for this so you can combine those pics with other media..

btw: Is there a seperate download for the XBOX-users?
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #23
Robotica Wrote:Is it possible to store links to the pics in the database so I don't need to scan my folder everytime (maybe as an option)?
You have this option, it is the last one, and now, it should default to False :
Initialize the database before scanning
Unmark it and then it should only scan for new pics, and remove pics that are not physically present on your drive

Robotica Wrote:And about creating albums... Can you use smart playlists for this so you can combine those pics with other media..
Why not. Do you know a format for this ? Does XBMC play pictures smartplaylists ?
If it is doable, then I may do that after 'picture selection' stuff
Robotica Wrote:btw: Is there a seperate download for the XBOX-users?
No unfortunately no... It would take me too much time to maintain the plugin for both XBMC version (pre-dharma and post dharma)
If someone fill like doing a xbox version, feel free to tell me, would love to talk about it !
find
Robotica Offline
Banned
Posts: 1,202
Joined: Aug 2010
Post: #24
beta1 worked fine on XBOX...
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #25
yes, the very first release was pre-dharma. But from this time I made many change, including necessary changes for dharma addon system.

(Oh, I hope I did'nt missed a news telling dharma was ported to xbox as well !!!)
find
solexalex Offline
Skilled Python Coder
Posts: 706
Joined: Jul 2004
Reputation: 6
Post: #26
known bug :
if you choose a month from the 'by dates' filter, and you have any picture in this month, shooted the last day of the month, it bugs. It is because to select a whole day of pictures, I take all the pictures dated between the given day of the month, and the given day +1. So if the month contain only 30 days (for example April) it selects pics from yyyy/04/30 to yyyy/04/31, which python time module says to be wrong (of course)
The correct thing should be 04/30 to 05/01 for a whole day...
I have to fix that.

Tonight I made something to sort pictures from any date to any other, so that you can easily sort all pics for a whole WE or all pics of you whole holidays. You'll have to wait for next release Wink or check my svn : https://xbmc-scripts.googlecode.com/svn/...e.mypicsdb
find
mhdebokx Offline
Member
Posts: 70
Joined: Dec 2006
Reputation: 0
Location: Netherlands
Post: #27
dutch translation is send to your email adress
in the next release this will be available
find
pko66 Offline
Senior Member
Posts: 190
Joined: Dec 2006
Reputation: 0
Post: #28
Just a suggestion, maybe is stupid at this point, but...

Both the picasa application and picasa web allow face recognition and (partially automatic) naming of the people in each picture, and it works pretty well, I have like a thousand photos face and name tagged. It would be great to have that information imported somehow into the database
find
Robotica Offline
Banned
Posts: 1,202
Joined: Aug 2010
Post: #29
@pko66: Facebook does that also...
find
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #30
the plugin already read tag, so if picasa tag the picture, it will be available in the plugin.

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find
Thread Closed