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


- FrostBox - 2010-10-22

fixed http://passion-xbmc.org/addons/?Page=View&ID=script.module.dialogaddonscan


- fiveisalive - 2010-10-22

FrostBox Wrote:grrr a stupide error created by me 'WindowsError' is for windows only

for a moment. change WindowsError for Exception and WindowsError.__init__( self, winError ) for self.winError = winError

soon I fixe it

sorry

Thanks! That fixes the error, I now get "0 scanned / 0 added / 0 deleted". However the actual scan doesn't seem to work for me. I tried adding a new test photo in monitored folder with a new date, but it doesn't pick it up. I also renamed a directory (108_PANA in the example below), thinking it would look like a "delete" followed by an "add", but the database doesn't change, it simply keeps the original photo list, but now can't find the actual image to open it:

Code:
9:45:52 T:140291684169488 M:2808967168   DEBUG: Saving fileitems [plugin://plugin.image.mypicsdb/?method='date'&period='date'&value='2010-10-15'&viewmode='view'&actio
n='showpics'&name='Fri+Oct+15%2C+2010+%285+pics%29']
19:45:52 T:140291684169488 M:2808967168   DEBUG:   -- items: 5, sort method: 0, ascending: false
19:45:52 T:140291684169488 M:2808967168   DEBUG: Thread 140291684169488 terminating
19:45:52 T:140291673679632 M:2808967168    INFO: Python script stopped
19:45:52 T:140291673679632 M:2808967168   DEBUG: Thread 140291673679632 terminating
19:45:52 T:140291923445520 M:2808967168   DEBUG: thread start, auto delete: 0
19:45:52 T:140293263071392 M:2808967168    INFO:   msg: PICTURE::LoadImage: Unable to open image: /foobar/108_PANA/P1080138.JPG Erro
r: (2)
19:45:52 T:140293263071392 M:2808967168   ERROR: Texture manager unable to load file: /foobar/108_PANA/P1080138.JPG
19:45:52 T:140293263071392 M:2809049088   DEBUG: python thread 165 destructed
19:45:52 T:140293263071392 M:2809049088   DEBUG: LIRC: Update - NEW at 5526052:0000000080010094 00 KEY_PROG1_UP Antec_Veris_RM200 (KEY_PROG1_UP)
19:45:52 T:140292143441680 M:2809077760   DEBUG: GetImageHash - unable to stat url /home/myth/media/Pictures/Lumix-import-old/108_PANA/P1080140.JPG
19:45:52 T:140291923445520 M:2809077760   DEBUG: Thread 140291923445520 terminating



- fiveisalive - 2010-10-22

Recursive directory *was* working for me with version 0.2, so it must be something related to the new scanning code.


- FrostBox - 2010-10-22

no idea, wait alex for this problem

sorry I have not used this plugin yet, I created dialogscan only


- fiveisalive - 2010-10-22

FrostBox Wrote:no idea, wait alex for this problem

sorry I have not used this plugin yet, I created dialogscan only

Yep, understood that this isn't a problem with the dialogscan part, that was more directed at solexalex who can hopefully help solve this.


- ppic - 2010-10-22

fiveisalive Wrote:Yep, understood that this isn't a problem with the dialogscan part, that was more directed at solexalex who can hopefully help solve this.

don't worry, he will Wink


- fiveisalive - 2010-10-22

OK, I didn't realize that this version changed all the options for paths. It appears that the path is no longer set via the "Add on settings" but through the application. I finally figured out that "Chemins racines", with a bit of help from Google Translate, was "Root paths".

Now I can choose a path, unfortunately it defaults to the sources under "Pictures", which is a problem if you haven't 1) chosen any default sources, or 2) don't want to have a default source, but want to use a random directory on the file system, because the dialog disables the "Up" feature to get to the whole filesystem.

Secondly in the "add on" under "general" are two toggle switches: "Perform a scan now!" and a blank titled one, and under "debugging" I have "Initialize the database before scanning". Have the labels somehow got confused here?


- fiveisalive - 2010-10-22

Also if I leave the plugin and re-enter while scanning I get "Script failed" error messages:

Code:
21:30:52 T:139669450782480 M:3128250368   ERROR: Traceback (most recent call last):
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 293, in ?
                                                main2()
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 97, in main2
                                                scan = AddonScan()#xbmcgui.getCurrentWindowId()
                                              File "/home/myth/.xbmc/addons/script.module.dialogaddonscan/lib/DialogAddonScan.py", line 20, in __init__
                                                Window.__init__( self, parent_win, **kwargs )
                                              File "/home/myth/.xbmc/addons/script.module.dialogaddonscan/lib/gui.py", line 224, in __init__
                                                raise xbmcguiWindowError( "DialogAddonScan IsAlive: Not possible to overscan!" )
                                            xbmcguiWindowError: <unprintable instance object>

so there probably needs to be check to ignore all new scanning attempts if there's already a job running.


- fiveisalive - 2010-10-22

There's definitely some major scanning issues. I scanned my entire collection, so far so good. Leave the plugin, return, it does a quick update scan, 0 adds, 0 deletes. Fine. Now if I create a single new subdirectory and move a file from one subdirectory to this new directory, it starts off doing a fast scan, but then at about 25% of the way in, it starts trying to re-add some of the other files again.

Having an (almost) full rescan every time you re-enter the plugin isn't workable when you have 15,000 or so photos. The previous version of the plugin (0.2) didn't seem to trigger these rescans every time a new file was added. Note that I see something like:

Code:
MyPicture Database [Adding] (56%)
foobar.jpg

in the progress dialog, so it does appear to be re-adding


- solexalex - 2010-10-22

Thanks Frost !

@Fivesalive
There may be a problem between your existing database and the new db tables formats.
You may reinitialize your DB going in the addon settings then in the 'debug' tab and activate the option to reinit the db.
Then run the plugin, go to the root folder item and choose one or several folders. It should work. If not just tell me with your log attached.


- fiveisalive - 2010-10-22

solexalex Wrote:Thanks Frost !

@Fivesalive
There may be a problem between your existing database and the new db tables formats.
You may reinitialize your DB going in the addon settings then in the 'debug' tab and activate the option to reinit the db.
Then run the plugin, go to the root folder item and choose one or several folders. It should work. If not just tell me with your log attached.

I actually completely moved aside my old database in ~/.xbmc/userdata/Database/MyPictures.db and reset all the options to "Default" and added the folder back again, but it still caused issues. After fiddling around several times with the options (some of which, I'm not sure what they are supposed to do, such "Please scan now!" seems it should be a function, not a toggle switch), it seems to have settled down and now doesn't try to rescan everything when I leave and re-enter the plugin. However, I haven't tested adding new pics to the folder as yet (that triggered the original issue).


- solexalex - 2010-10-22

hum hum...
You speak about "Please scan now!", I think it is "Perform a scan now !". Anyway, this option in the settings should not exists anymore.....
I recommend you to delete the plugin.image.mypicsdb settings folder. It seems strange that this keeps old settings...
i have to get the information if there is something to do to reset the settings from scratch...


- solexalex - 2010-10-22

about your request for the last xx pictures added or the new pictures added, I'm not sure to make it or not.
Let's think about it :
1/ last XX pics :
Need a new field in the base with timestamp to know when the pic has been included
2/ new pictures :
Need a new field in the base with timestamp to know when the pic has been included
Need a database to store the last scan timestamp
May encounter no new picture has the plugin scan automatically at boot time for pics, and as a plugin run on each view you display, it can change a brand new scanned picture into an old one...

Ok, 1/ and 2/ are doable... don't know if I'm going to code that right now.... I would prefer release a version for anybody, debug it, before going deeply into new features...

What do you think ?


- fiveisalive - 2010-10-22

solexalex Wrote:about your request for the last xx pictures added or the new pictures added, I'm not sure to make it or not.
Let's think about it :
1/ last XX pics :
Need a new field in the base with timestamp to know when the pic has been included
2/ new pictures :
Need a new field in the base with timestamp to know when the pic has been included
Need a database to store the last scan timestamp
May encounter no new picture has the plugin scan automatically at boot time for pics, and as a plugin run on each view you display, it can change a brand new scanned picture into an old one...

Ok, 1/ and 2/ are doable... don't know if I'm going to code that right now.... I would prefer release a version for anybody, debug it, before going deeply into new features...

What do you think ?

Sure, no rush, just suggestions for the future. I will look into see whether I can help. The main issue for me right now is making sure that the plugin doesn't do any unnecessary scans and/or try to re-add already included pics.

I did have a quick patch on my computer at home that tweaks the display of dates to be even more human-friendly, I'll send it when I'm back. Basically use "%a %b %d, %Y" in the day-level view so you get "Thu Oct 21, 2010" as dates, and use "%b %Y" in the month-level view to get "Oct 2010". Including the weekday is useful, because sometimes people might remember something happening 'last Tuesday' but wouldn't necessarily remember the exact date.

Ideally this would be configurable as in Europe people prefer "21 Oct 2010" and it would also be useful to retain ISO-style dates as well. So perhaps have a combo-box in the settings dialog with three options:

x Weekday Month Day, Year
x Weekday Day Month Year
x Weekday Year-Month-Day


- solexalex - 2010-10-23

fiveisalive Wrote:I did have a quick patch on my computer at home that tweaks the display of dates to be even more human-friendly, I'll send it when I'm back. Basically use "%a %b %d, %Y" in the day-level view so you get "Thu Oct 21, 2010" as dates, and use "%b %Y" in the month-level view to get "Oct 2010". Including the weekday is useful, because sometimes people might remember something happening 'last Tuesday' but wouldn't necessarily remember the exact date.

Ideally this would be configurable as in Europe people prefer "21 Oct 2010" and it would also be useful to retain ISO-style dates as well. So perhaps have a combo-box in the settings dialog with three options:

x Weekday Month Day, Year
x Weekday Day Month Year
x Weekday Year-Month-Day
I already coded something for that. It is fixed right now, but the only things I have to do is to put this into settings somehow
Include Weekday is not a very good idea because python include only english weekday. The same is for months. So if I want to use fullnameweekday and fullnamemonth, I have to put all of these inside the string.xml for translations, and put the format of the date into settings (or even inside strings.xml it is doable as well)
This is already in the svn if you want to test by your own. The format for the 'by dates' view is :
for years.... YYYY
for months : MM/YYYY
for days : DD/MM/YYYY
(French numerical dates notations)
So it is right now only to show it is doable, but not yet ported to be translated (just a matter of some easy code change)