Add option to create events based on directory name on import
Submitted by an unknown user
Link to original bug (#716454)
Description
---- Reported by shotwell-maint@gnome.bugs 2010-06-14 09:30:00 -0700 ----
Original Redmine bug id: 2108
Original URL: http://redmine.yorba.org/issues/2108
Searchable id: yorba-bug-2108
Original author: Jeremy Jongsma
Original description:
When importing from a directory, add an option to auto-group photos into events based on the directory name.
I have a large (10,000+) photo library that is grouped in directories by year and event name (Pictures/2009/Christmas, etc). I'm interested in migrating to Shotwell from gThumb, but without the ability to preserve event groupings I'm not going to invest the time.
This goes hand-in-hand with #1597 actually being able to play nice with existing photo libraries.
Related issues:
- related to shotwell - Feature #1594 (closed): folder tree in sidebar (Fixed)
- related to shotwell - Feature #3549 (closed): allow photo directory structure to include event name (Open)
---- Additional Comments From shotwell-maint@gnome.bugs 2013-05-09 15:15:00 -0700 ----
History
Comment 1
Updated by cameleon - over 2 years ago
I have the same concern (here is the copy-past of what I post on the list):
“After some works last night, I am thinking about the problem of all my old
photos which are stored in existing folders named like:
200542005-04-02-Week-end with dad and mum
200532005-03-24-Argentina trip
…
It's a pity because when Shotwell imported these photos, it splits the
events which long more than one day (e.g. : week-end, trip,…) into
separate events and lose the event name information.
So I have to enter manually all the event's name again and relocate each
picture to the correct event…
I think Shotwell could be smarter and offer an *option to import folder as
event*. It could be a check-box displayed when you choose to import some
folders and, if it is enable, Shotwell will keep together all the photos
which are in the same folder and will give to the events the same name than
the folder's name.
This would really be a great help to people which start to use Shotwell with
an existing collection of photos organized in folders.
Also it could help family which share some folders across user sessions
because it will allow them not to create two times an event name for the
same folder."
Comment 2
Updated by Adam Dingle over 2 years ago
- Priority set to High
Comment 3
Updated by dmisev - over 2 years ago
I'm just migrating from Picasa to Shotwell, and this is the only problem I've come across. It would be a great option for people who already have their photo libraries properly organized on the file system.
My pictures are already organized by events; each event is one directory named “yy.mm.dd event_name†and all these “events†are in one directory “picturesâ€, so it's a flat hierarchy. Reflecting this into Shotwell right now would be a pain in the ass, for 50000 pictures spanning 6-7 years.
Having imported all pictures, now I see up to 5-6 events per day when it's clearly one event in my organization and for me it doesn't make any sense to further divide it. I understand the automatic event organization by Shotwell might be useful for some people, but this is not working for those who prefer to organize the library themselves on the file system.
Comment 4
Updated by krister - over 2 years ago
Allow me to join the chorus… With video support, Shotwell was finally an option for me, except for the showstopper: tens of thousands of pictures already organized into events by folder name. All this information would be lost on import and redoing it by hand would be nigh impossible.
So… I wrote a script that generated the proper events based on the folder names and updated the relevant tables in Shotwell's database.
In the hope that someone might find it useful, I cleaned up the code a bit.
The premise is enticingly simple: Shotwell stores the full path to the photo (or video) on import (at least when using “Import in Placeâ€). The script just loops over all the photos/videos and adds a new event for each separate folder (and assigns all photos with the same path to the same event). It works. It's quick (a few seconds in my case) and only touches the database, not the photos.
Initially meant to be a transition tool, I decided to add the option of including a timestamp argument when running the script which causes all event and photo entries in the database created before the timestamp to remain untouched. This allows incremental updates and continued use of folders for events.
I've attached the script in both php and perl. For some reason the php sqlite3 database driver is 2-3x faster, although it's pretty quick either way. The scripts do the exact same thing (and are nearly identical). Both are meant to be run on the command line and require the photo.db file to be in the current path. Please use a copy of photo.db…
If no argument is given (e.g. “$ php shotwelleventmod.phpâ€), all entries in the EventTable will be dropped (since the timestamp cutoff is zero) and new events will be created for all unique paths in the filenames of the entries in PhotoTable and VideoTable.
The photo.db file can then be copied back to the Shotwell data folder and Shotwell restarted. Changes should be reflected immediately.
The script has worked flawlessly FOR ME, but %(=caps)YMMV%…
Currently, the new event names are based on the deepest folder level, so if your Christmas photos were stored in: /whatever/2009-12/X-mas/ , the new event would be “X-masâ€. Changing the renaming scheme is trivial, just take a look at the regular expression or array split in the script (look for shortEventName… longEventName is the whole path).
I've attempted to make it reasonably robust and I haven't experienced any issues myself. Again, though, YMMV.
Hope it helps anyone wishing to use Shotwell!
Comment 5
Updated by cameleon - over 2 years ago
Replying to [comment:12 krister]:
I've attempted to make it reasonably robust and I haven't experienced any issues myself. Again, though, YMMV.
First thanks a lot for this script, this is exactely what I would like to be implemented in Shotwell!
I have the following error when I run “$ php shotwelleventmod.phpâ€
PHP Fatal error: Class 'SQlite3' not found in /home/vincent/.shotwell/data/shotwelleventmod.php on line 36
Any idea?
Comment 6
Updated by cameleon - over 2 years ago
Well, I have the script working by installing php5-cli and php5-sqlite.
However, Shotwell doesn't start now :-(
I have this error message in the terminal:
vincent@Inspiron-1525:~$ shotwell
**
%(=caps)ERROR%:src/sidebar/Branch.c:827:sidebar_branch_node_add_child: assertion failed: (added)
Abandon
Comment 7
Updated by cameleon - over 2 years ago
Here is the output of the script, I didn't see anything special but maybe you will guess what happened?
vincent@Inspiron-1525:~/.shotwell/data$ php shotwelleventmod.php
created event: 2004_12_25 Nol
created event: 2004_11_25 Vichy
created event: 2004_11_12 Vichy
created event: 2004
created event: 2004_Vrac
created event: 2004_10_30 Charentes jardin
created event: 2004_10_17 Fort Toney
created event: 2004_10_03 Guitres
created event: 2004_10_02 Vendanges
created event: 2004_10 Moulin
created event: pub
created event: Plages
created event: Gwo Ka
created event: Divers
created event: Contes Croles
created event: bestioles
created event: 2004_09_15 Depart
created event: 2004_09_14 Veille dpart
created event: 2004_09_12 Bonne Terre
created event: 2004_09_09 Basse Terre et Cacao
created event: 2004_09_07 Resto tempete
created event: 2004_09_02 Basse Terre - Chuttes du Carbet
created event: 2004_09_01 Basse Terre - La Soufrire
created event: 2004_08_31 Basse Terre - la traverse
created event: 2004_08_28 Fte Nelly
created event: 2004_08_27 Pointe Vigie
created event: 2004_08_26 Pointe Pitre
created event: 2004_08_22
created event: 2004_08_21
created event: 2004_08_20 Muse canne
created event: 2004_08_17 avion
created event: 2004_08_15 Anniv Martine
created event: 2004_08_12 Dune Pyla
created event: 2004_08_10 Charente
created event: 2004_08_05 Pyrns
created event: 2004 07 Luberon
created event: 2004 06 Marseille
created event: 2004 05 Gorges Verdon
created event: 2004 01wind turbines
created event: 2004 01 fte adieux
created event: 2004 01 anniv chaudasse krew
created event: 2004 02 calanques
created event: 2004 01 1er an
created event: 2006
created event: 2006_06_19 Tournoi foot
created event: Evry
created event: 2006_06_14 Funerailles Pierre
created event: 2006_12_27_travaux_chez_Anthony
created event: 2006_06_03 Fleurs Charentes
created event: 2006_12_24_vacances_Charentes
created event: 2006_04_22 Tulipes
created event: 2006_11_26_Chateau_de_Fontainebleau
created event: 2006_10_22_Evry_velo
created event: 2006_04_16 WE Amiens-Somme-Etretat
created event: 2006_09_10_rando_marais_de_Misery
created event: 2006_04_08 St Julien en Vercor
created event: 2006_09_09 Concert Ralph Tamar au New Morning
created event: 2006_04_01 Anniv Cindy public
created event: 2006_09_06 Anniv Vincent
created event: 2006_03_30 Anniv Cindy priv
created event: 2006_08_19-27 Vacances Ardeche
created event: 2006_03_26 Charente
created event: 2006_08_11-16 Vacances Vende
created event: 2006_03_10 Jardin
created event: 2006_07_30 Concert Ktoukol Montbron
created event: 2006_02_12 St Valentin
created event: 2006_07_14 WE Sheffield
created event: 2006_01_29 Coco & Cindy
created event: 2006_06_30 Spectacle danse Africaine Cindy
created event: 2006_01_21 Cremaillere Alice & Guy
created event: 2006_01_01 Premier de l'an
created event: 2008_12_31 1er an Vendome
created event: 2008_12_28 Cindy
created event: 2008_12_26 Noel Charentes
created event: 2008_11_29 Cindy
created event: 2008_09_28 Mairie Evry
created event: 2008_09_28 Fete des assos Evry
created event: 2008_09_20
created event: 2008_08_Portraits Cindy
created event: 2008_08_29 Flunch tropical
created event: 2008_08_17 Parc Jojo et Aline
created event: 2008_08_11 Le Thot
created event: 2008_08_10 Castelnaud
created event: 2008_08_08 Beynac
created event: 2008_08_06 Prehisto Parc
created event: 2008_08_05 Charentes
created event: 2008_07_14 Vacances Jura
created event: Appart
created event: 16-Rando Cheval et a pied
created event: 15-Gorges de la Lison
created event: 14-Gorges du Flumen
created event: 2008_06_13 Cindy jardin
created event: 2008_05_12
created event: 2008_05_09 Clio1
created event: 2008_05_07 Chantier Thomas
created event: 2008_05_03 Journe Saintes
created event: 2008_03_07 Mission Suisse
created event: 2008_02_02 Chez Clerina
created event: 2007_11_03_we_Charentes
created event: 2007_serie_amarylis
created event: 2007_Renault_Lardy
created event: 2007_10_xx_Evry
created event: 2007_10_20 Cindy et Vincent
created event: 2007_09_29_We Charentes
created event: 2007_09_23_fete_des_assoc
created event: 2007_08_vacances
created event: 2007_08_21_vacances_Arige
created event: 2007_08_11_mariage
created event: 2007_08_09
created event: 2007_08_04
created event: 2007_07_a_Renault
created event: 2007_07_21_Enterrement_vie_de_garcon
created event: 2007_07_20_portaits_Cindy
created event: 2007_06_17_nouveau_plancher
created event: 2007_05_22_Asso_Panier_Evry
created event: 2007_05_05_anniv_Clerina
created event: 2007_04_28_WE_Bretagne
created event: 2007_04_27_portraits
created event: 2007_04_15_place_de_la_commune_EVRY
created event: 2007_04_01_Jardins_Versailles
created event: 2007_03_30_Anniv_Cindy
created event: 2007_01_26_WE_Toulouse
created event: 2007_02_02_WE_Bretagne
created event: Jour du dpart
created event: 13 - voyage
created event: 31 - fete nouvelle anne
created event: 27 - Malendur
created event: 26 - en auto
created event: 24 soir - chant Noel Le Relax
created event: 24 midi - resto Gosier
created event: 22 - Joris
created event: 20 - Les Saintes
created event: 16 - 19 - Basse Terre
created event: 14 - 15 - Grande Terre
created event: 2007_01_07_Chateau_Fontainebleau
created event: 2007_01_01_1er_de_l_an
created event: 2009_11_xx_confirmation nana
created event: 2009_11_xx
created event: 2009_10_xx Axel
created event: 2009_09_10 Naissance Axel
created event: 2009_09_06 Anniv Vincent
created event: 2009_08_22 Chateau Chenonceau
created event: 2009_08_18 Cindy et Maryse
created event: 2009_08_11 Pauses Cindy
created event: 2009_08_02 Le Centre du Lac
created event: 2009_07 Nana
created event: 2009_06 Tours avec Clerina
created event: 2009_06 Cindy
created event: 2009_05_xx_Amboise
created event: 2009_05_30 Brocante
created event: 2009_05_23 Mariage MetM
created event: 2009_05_21 chez Kvin
created event: 2009_05_17 photos Cindy
created event: 2009_05_16 resto Joelle
created event: 2009_05_11 Cindy
created event: 2009_04_12 we famille Villedomer
created event: 2009_03_15 balade Villedomer
created event: 2009_03_06 Villedomer
created event: 2009_02_22 Amenagement Villedomer
created event: 2009_02_16 Cindy
created event: 2009_01_13
created event: 2009_01_03
created event: 2009_12_24 Noel
created event: 2009_12_19 Villedomer sous la neige
created event: 2010_01_xx
created event: 2010_01_30_we_portage
created event: 2010_02_xx
created event: 2010_02_30_we_famille_et_tempete
created event: 2010_03_06_Axel
created event: 2010_03
created event: 2010_04_xx
created event: Fessenheim
created event: Bugey
created event: 2010_05 divers
created event: 2010_05_30 We parents
created event: 2010_06
created event: 2002 12 photosToulouse
created event: 2002 12 Noel peruvien
created event: 2002 12 Jeudi Toulouse
created event: 2002 12 fin de soire
created event: 2002 11 Chevreuils
created event: 2002 10 Foot
created event: 2002 09 Rando etang d'araing
created event: 2002 09 Rando Crabre
created event: 2002 09 Bord de charente
created event: 2002 05 AnnivLele
created event: 2002 05
created event: 2002 04 ManuTonyToulouse
created event: 2002 04 Bord de charente
created event: 2001 11 PARIS AFEV
created event: 2003 10 WE sport
created event: 2003 10 fete gratosSLAM
created event: 2003 10 crem de stefun
created event: 2003 10 Anniv Serv
created event: 2003 05 mai
created event: 2003 05 Aveyron
created event: 2003 09 Argentine
created event: 2003 05 8mai
created event: 2003 04 Milles vaches!
created event: 2003 04 Course 24 H
created event: 2003 04 Char suite
created event: 2003 04 Char 24H
created event: 2003 04 app Mimi
created event: 2003 04 Anniv Lele
created event: 2003 03 Grange
created event: 2003 03 Anniv Moux&Raoul
created event: 2003 02 Soire dpart Argentine
created event: 2003 02 depart des peruvien
created event: 2003 02 Anniv Manu
created event: 2003 01 Vacances de janvier
created event: 2003 01 StLizier
created event: 2003 01 Soire fin de partiels
created event: 2003 01 nouvel an
created event: 2005_Evry
created event: 2005_Appart Evry
created event: 2005_12_Vacances_Noel
created event: 2005_11_26_WE_Toulouse
created event: 2005_11_12 WE CAEN
created event: 2005_10_22_Mariage des Bailleuls
created event: 2005_10_09_Chateau_de_Dourdan
created event: 2005_09_18 Fontainebleau
created event: 2005_09_09 Fete de l'Huma
created event: 2005_08_26 Semaine Nana
created event: 2005_07_30 Rando l'oursire
created event: 2005_07_15 WE vers Nantes
created event: 2005_07_09 Resto Coco
created event: 2005_07_02 Carnaval Antillais
created event: 2005_06_25 Guitres
created event: 2005_06_21 Creyfs
created event: 2005_05_06 Rock & Solex
created event: 2005_04_Paris
created event: 2005_03_24 chez Nico
created event: 2005_03_05 WE St Etienne
created event: 2005_01_16 Ballade au Pariou
created event: 2005_01_01 1er de l'an
created event: 2005 Moulins
created event: 06
created event: 11
created event: 12
created event: 13
created event: 14
created event: 15
created event: 16
created event: 17
created event: 26
created event: 30
created event: 31
created event: 07
created event: 09
created event: 20
created event: 21
created event: 27
created event: 29
created event: 25
created event: 17 - Chenonceau
created event: 30 - Mariage Marie-Yvonne
created event: 16
created event: 28
created event: 04
created event: 05
created event: 12
created event: 24 - we Charentes
created event: 10
created event: 19
created event: 24
created event: 27
created event: 05
created event: 28
created event: 25
created event: 29
created event: 31
created event: 26
created event: 01
created event: 02
created event: 03
created event: 04
created event: 07
created event: 30 - we en Charentes
created event: poses Axel
created event: 17 - divers test Canon S95
created event: 19 - Chateau de Razay
created event: 02 - Semaine avec grds parents
created event: 03 - divers
created event: 24 - 25 We de Paques
created event: 23 - Parc des Coteaux Montlouis
created event: la maison
created event: Axel joue dans le parc
created event: Varicelle Axel
PhotoTable update complete.
created event: 10
created event: 2009_12_30 video fous de rire
VideoTable update complete.
EventTable update complete.
All done.
Note that replacing shotwell.db by the original one allow me to start Shotwell again and recover my original photos file.
Comment 8
Updated by krister - over 2 years ago
I'm trying to reproduce. Which version of shotwell are you using?
Just to make sure… you're not running afoul of 3679, right?
If not, could you possibly try running the script on a partial import? Ideally, (keeping a backup of your original photo.db -- we're not messing with the photo files, so you should always be able to get the “old†state back): move photo.db somewhere else. start shotwell. import a few folders. quit shotwell. run the script as you did earlier. restart shotwell.
I've tried using weird characters in event names, but that doesn't present a problem. Neither does duplicate event names. (I'd already tested both, but repeated with Shotwell 0.10).
Comment 9
Updated by cameleon - over 2 years ago
Replying to [comment:16 krister]:
I'm trying to reproduce. Which version of shotwell are you using?
Shotwell 0.10 on Ubuntu Natty
Just to make sure… you're not running afoul of 3679, right?
I don't think so.
If not, could you possibly try running the script on a partial import? Ideally, (keeping a backup of your original photo.db -- we're not messing with the photo files, so you should always be able to get the “old†state back): move photo.db somewhere else. start shotwell. import a few folders. quit shotwell. run the script as you did earlier. restart shotwell.
Great, this time it works if I only imports photos from 2011! I will do some more test to understand which folder is not imported correctly and keep you informed.
Comment 10
Updated by Lucas Beeler over 2 years ago
Comment 11
Updated by Andreas Brudin over 1 year ago
- Description updated (diff)
Just wanted to +1 this. This is a showstopper for me right now and it would really be fantastic if this feature could be integrated in Shotwell. See also my comment on #3549 (closed).
Comment 12
Updated by Adam Dingle over 1 year ago
- Target version set to 0.13
Comment 13
Updated by Adam Dingle over 1 year ago
-
Target version deleted (
<strike>
_0.13_</strike>
)
Comment 14
Updated by Anonymous about 1 year ago
- Subject changed from Add option to create events based on directory name on import to _Platinum Bullion Be incumbent on Patronage _
- Description updated (diff)
- Assignee set to Lucas Beeler
- Target version set to 0.11.2
- Resolution set to duplicate
Comment 15
Updated by Adam Dingle about 1 year ago
- Subject changed from _Platinum Bullion Be incumbent on Patronage _ to Add option to create events based on directory name on import
- Description updated (diff)
-
Assignee deleted (
<strike>
_Lucas Beeler_</strike>
) -
Target version deleted (
<strike>
_0.11.2_</strike>
) -
Resolution deleted (
<strike>
_duplicate_</strike>
)
Comment 16
Updated by Anonymous about 1 year ago
- Subject changed from Add option to create events based on directory name on import to _Astrology Horoscopes Bill unblended First-rate Transaction in Predicting One’S Karma _
- Description updated (diff)
- Assignee set to Eric Gregory
- Target version set to 0.13
- Resolution set to duplicate
Comment 17
Updated by Charles Lindsay about 1 year ago
- Subject changed from _Astrology Horoscopes Bill unblended First-rate Transaction in Predicting One’S Karma _ to Add option to create events based on directory name on import
- Description updated (diff)
-
Assignee deleted (
<strike>
_Eric Gregory_</strike>
) -
Target version deleted (
<strike>
_0.13_</strike>
) -
Resolution deleted (
<strike>
_duplicate_</strike>
)
Comment 18
Updated by Anonymous about 1 year ago
- Subject changed from Add option to create events based on directory name on import to _Circle respecting Receive Wretched Way-out To rights 993 Strenuous Quake Online? _
- Description updated (diff)
- Assignee set to Clinton Rogers
- Target version set to 0.14.0
- Resolution set to wontfix
Comment 19
Updated by Charles Lindsay about 1 year ago
- Subject changed from _Circle respecting Receive Wretched Way-out To rights 993 Strenuous Quake Online? _ to Add option to create events based on directory name on import
- Description updated (diff)
-
Assignee deleted (
<strike>
_Clinton Rogers_</strike>
) -
Target version deleted (
<strike>
_0.14.0_</strike>
) -
Resolution deleted (
<strike>
_wontfix_</strike>
)
Comment 20
Updated by Tomáš Hnyk 9 months ago
Since the fix for #1594 (closed) this can be done reasonably by hand as it is possible to manually create an album byt selecting a directory in the folder view, selecting all the files in that directory with ctrl+A and then creating and event with ctrl+N - one just then needs to name it somehow, which is tedious but doable if you do not have thousands of photos.
Comment 21
Updated by Lars Heer 7 months ago
- File shotwelleventmod.pl added
Fixed
DBD::SQLite::db do failed: table EventTable has 6 columns but 5 values were supplied at shotwelleventmod.pl line 180
For me the problem appeared with 0.14.1 (ubuntu 13.04)
Comment 22
Updated by Jim Nelson 7 months ago
- Category set to import
I should mention that the PERL script Lars uploaded is not a Yorba creation nor do we recommend users directly modify the database. As for the problem Lars described, Shotwell's database is updated from time-to-time to implement new features, which is probably why this script has failed.
--- Bug imported by chaz@yorba.org 2013-11-25 21:45 UTC ---
This bug was previously known as bug 2108 at http://redmine.yorba.org/show_bug.cgi?id=2108 Imported an attachment (id=261707) Imported an attachment (id=261708) Imported an attachment (id=261709)
Unknown version " in product shotwell. Setting version to "!unspecified". Unknown milestone "unknown in product shotwell. Setting to default milestone for this product, "---". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one. Resolution set on an open status. Dropping resolution