Batch rename of albums best practice

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Batch rename of albums best practice

Johnny
When I started using digikam, I was ignorant of "safe" filenaming
conventions and consequently have lots of silly characters (non-ascii
such as spaces and brackets), mainly in albums but also in a few
imagenames. I want to find and replace these names with minimal hassle
and wonder what is the best practice?

FAILED ATTEMPT:

My first attempt was to simply open digikam (I think this makes the
database change-aware, right?) and from the shell (i.e. emacs dired
mode) do a find and replace on the filenames. This was instantaneous,
and it seemed digikam picked up the changed. However, digikam became
incredibly slow and after a few minutes, I just stopped and restarted
digikam. Upon restart, it didn't recognise the database and additionally
became unresponsive, so I killed digikam from the shell. I found two
digikam processess and killed both - in retrospect I suspect maybe one
process was from the initial digikam session and it was updating the
database, and hence kept it locked from the second digikam process.

Now, this was several minutes after I did the initial file renaming, so
the question is why, if my guess is correct, digikam was so incredibly
slow?

WORKAROUND:

I recovered from my backed up database, but now directory names were
misaligned in the database and on the filesystem, so I had to manipulate
the database directly. Using sqlite3 from the command line, I did a find
and replace operation in the database - this was practically instant,
hence the query why digikam does this slowly (again, if this is really
what happened)? Now, restarting digikam, everything is back to normal
/and/ the albums are renamed. While this is doable, it is somewhat of a
workaround, are there better ways to do this?

If anyone is inclined to try my method the steps are as attached.

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users

digikam_rename_albums_workaround.txt (895 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Batch rename of albums best practice

Rinus
Thanks Johnny!
This is realy great and exactly what we need as much as possible here, sharing knowledge for free!


Op 03-09-11 13:45, Johnny schreef:
When I started using digikam, I was ignorant of "safe" filenaming
conventions and consequently have lots of silly characters (non-ascii
such as spaces and brackets), mainly in albums but also in a few
imagenames. I want to find and replace these names with minimal hassle
and wonder what is the best practice?

FAILED ATTEMPT:

My first attempt was to simply open digikam (I think this makes the
database change-aware, right?) and from the shell (i.e. emacs dired
mode) do a find and replace on the filenames. This was instantaneous,
and it seemed digikam picked up the changed. However, digikam became
incredibly slow and after a few minutes, I just stopped and restarted
digikam. Upon restart, it didn't recognise the database and additionally
became unresponsive, so I killed digikam from the shell. I found two
digikam processess and killed both - in retrospect I suspect maybe one
process was from the initial digikam session and it was updating the
database, and hence kept it locked from the second digikam process. 

Now, this was several minutes after I did the initial file renaming, so
the question is why, if my guess is correct, digikam was so incredibly
slow?

WORKAROUND: 

I recovered from my backed up database, but now directory names were
misaligned in the database and on the filesystem, so I had to manipulate
the database directly. Using sqlite3 from the command line, I did a find
and replace operation in the database - this was practically instant,
hence the query why digikam does this slowly (again, if this is really
what happened)? Now, restarting digikam, everything is back to normal
/and/ the albums are renamed. While this is doable, it is somewhat of a
workaround, are there better ways to do this?

If anyone is inclined to try my method the steps are as attached.
ONLY ATTEMPT IF
YOU UNDERSTAND WHAT THE COMMANDS DO!
If you could elaborate a bit about what happens in each step, it would be a great learning experience.
and how to stop the sqlite session? could not think of something else than control c.
Don´t worry, I use a copy.

_______________________________________________ Digikam-users mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-users
I have something similar at hand at the moment, wrestling with the setup from virtual box, it refuses to read from existing database.
I pointed in digikamrc to the place where db exist, in my normal setup db works with my pictures in the path /media/FOTO/FOTO/ARCHIEF/
but it kept stubbornly saying: path FOTO/ARCHIEF/ not found, so it looks like it uses a reletive path and doesn know about the base media/FOTO (which is the mounted drive called ¨FOTO¨.)
any ideas?

Best regards,
Rinus


_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Batch rename of albums best practice

Johnny
sleepless <[hidden email]> writes:
> If you could elaborate a bit about what happens in each step, it would be a
> great learning experience.
I added some comments to the steps now.


> and how to stop the sqlite session? could not think of something else than
> control c.
Try '.exit'.

> I have something similar at hand at the moment, wrestling with the setup from
> virtual box, it refuses to read from existing database.
> I pointed in digikamrc to the place where db exist, in my normal setup db works
> with my pictures in the path /media/FOTO/FOTO/ARCHIEF/
> but it kept stubbornly saying: path FOTO/ARCHIEF/ not found, so it looks like
> it uses a reletive path and doesn know about the base media/FOTO (which is the
> mounted drive called ¨FOTO¨.)
> any ideas?
I don't use any virtual boxes, the only guesses is that the /FOTO folder
is duplicated, although this may of course be correct.
In digikamrc, try to verify that the correct path is set at all proper
locations, try a 'find and replace' /old/db/name to /new/db/name and
ensure you use absolute paths.

EDIT: It seems digikam edits the digikamrc file when opening
digikam. Therefore it is probably futile to edit this
directly. Exploring the database, there is a table 'albumroots'
containing a field 'identifier' that seems to be the uuid to the disk
and a 'specificPath' identifier that locates the proper folder on that
disk; in your case the FOTO/ARCHIEF part. It seems that for some reason,
the 'identifier' field pointing to the disk is not picked up correctly
when you run digikam from your VM.

Use the 'sqlite3 /your/digikam.db' and run 'select * from albumroots;'
and you will see your fields. You can take note of the uuid, '.exit'
sqlite3 and 'ls -l /dev/disk/by-uuid' from the shell, look for your
uuid, see which disk it mounts as (e.g. 'sdd7' or similar). If you do
'ls -l /dev/disk/by-label' you can see if this is your drive labelled
'FOTO'. If this is correct, make sure it is mounted.

If the above works fine from the VM, I think it should work?

--
Johnny

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users

digikam_rename_albums_workaround.txt (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Batch rename of albums best practice

Rinus
Hi Johnny,
Thanks for the explanations, it has been very informative and I am looking forward to your next contribution to the list.


For your information.
Don´t bother to much about it I am just playing around to see what I can do and to have some great answers around if someone asks. No important matters involved here.

One internal and one external drive has been correctly mounted. They are visible in nautilus I can move my files but not copy!??

ls by uuid works correct

ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 2011-09-03 20:33 2647858c-17ed-4300-a47f-5bba897ba931 -> ../../sda5
lrwxrwxrwx 1 root root 10 2011-09-03 20:33 3f9a4cff-e816-4fd3-837c-d7354a742235 -> ../../sda1
 
 
 ls by label does not. In my dayly setup it works, but not in the VM
 
ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 9 2011-09-03 20:33 VBOXADDITIONS_4.1.2_73507 -> ../../sr0
jansen@jansen-VirtualBox:~$

there is definitly something wrong, but what...

Best regards,
Rinus


Op 03-09-11 16:52, Johnny schreef:
sleepless [hidden email] writes:
If you could elaborate a bit about what happens in each step, it would be a
great learning experience.
I added some comments to the steps now.
and how to stop the sqlite session? could not think of something else than
control c.
Try '.exit'.

I have something similar at hand at the moment, wrestling with the setup from
virtual box, it refuses to read from existing database.
I pointed in digikamrc to the place where db exist, in my normal setup db works
with my pictures in the path /media/FOTO/FOTO/ARCHIEF/
but it kept stubbornly saying: path FOTO/ARCHIEF/ not found, so it looks like
it uses a reletive path and doesn know about the base media/FOTO (which is the
mounted drive called ¨FOTO¨.)
any ideas?
I don't use any virtual boxes, the only guesses is that the /FOTO folder
is duplicated, although this may of course be correct. 
In digikamrc, try to verify that the correct path is set at all proper
locations, try a 'find and replace' /old/db/name to /new/db/name and
ensure you use absolute paths.

EDIT: It seems digikam edits the digikamrc file when opening
digikam. Therefore it is probably futile to edit this
directly. Exploring the database, there is a table 'albumroots'
containing a field 'identifier' that seems to be the uuid to the disk
and a 'specificPath' identifier that locates the proper folder on that
disk; in your case the FOTO/ARCHIEF part. It seems that for some reason,
the 'identifier' field pointing to the disk is not picked up correctly
when you run digikam from your VM. 

Use the 'sqlite3 /your/digikam.db' and run 'select * from albumroots;'
and you will see your fields. You can take note of the uuid, '.exit'
sqlite3 and 'ls -l /dev/disk/by-uuid' from the shell, look for your
uuid, see which disk it mounts as (e.g. 'sdd7' or similar). If you do
'ls -l /dev/disk/by-label' you can see if this is your drive labelled
'FOTO'. If this is correct, make sure it is mounted. 

If the above works fine from the VM, I think it should work?

_______________________________________________ Digikam-users mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-users


_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Batch rename of albums best practice

Johnny
sleepless <[hidden email]> writes:
> Don´t bother to much about it I am just playing around to see what I can do and
> to have some great answers around if someone asks. No important matters
> involved here.
No problem, I find this quite interesting and may learn something about
VM solutions and methods as a bonus! :)
>
> One internal and one external drive has been correctly mounted. They are
> visible in nautilus I can move my files but not copy!??
Can you copy from the command line?
'cp /path/to/file /path/to/destination'

>
> ls by uuid works correct
>
> ls -l /dev/disk/by-uuid
> total 0
> lrwxrwxrwx 1 root root 10 2011-09-03 20:33 2647858c-17ed-4300-a47f-5bba897ba931
> -> ../../sda5
> lrwxrwxrwx 1 root root 10 2011-09-03 20:33 3f9a4cff-e816-4fd3-837c-d7354a742235
> -> ../../sda1
>
>  ls by label does not. In my dayly setup it works, but not in the VM
>  
> ls -l /dev/disk/by-label
> total 0
> lrwxrwxrwx 1 root root 9 2011-09-03 20:33 VBOXADDITIONS_4.1.2_73507 -> ../../
> sr0
> jansen@jansen-VirtualBox:~$
>
> there is definitly something wrong, but what...
The latter output is unfamiliar to me, I guess the VM setup works magic
ways! I would expect to se the same drives mapped as by-uuid. What is
mounted under /media, is that the uuid disks or is it the virtual disks
(well, it probably should be the virtual in the VM?)?

Sorry, I am running out of ideas of how to make digikam recognise the
drive through the VM. Out of interest, what platforms are you setting
up as base and as VMs?
--
Johnny
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Batch rename of albums best practice

Rinus
Op 03-09-11 20:53, Johnny schreef:

> sleepless<[hidden email]>  writes:
>> Don´t bother to much about it I am just playing around to see what I can do and
>> to have some great answers around if someone asks. No important matters
>> involved here.
> No problem, I find this quite interesting and may learn something about
> VM solutions and methods as a bonus! :)
>> One internal and one external drive has been correctly mounted. They are
>> visible in nautilus I can move my files but not copy!??
> Can you copy from the command line?
> 'cp /path/to/file /path/to/destination'
no.

>> ls by uuid works correct
>>
>> ls -l /dev/disk/by-uuid
>> total 0
>> lrwxrwxrwx 1 root root 10 2011-09-03 20:33 2647858c-17ed-4300-a47f-5bba897ba931
>> ->  ../../sda5
>> lrwxrwxrwx 1 root root 10 2011-09-03 20:33 3f9a4cff-e816-4fd3-837c-d7354a742235
>> ->  ../../sda1
>>
>>   ls by label does not. In my dayly setup it works, but not in the VM
>>
>> ls -l /dev/disk/by-label
>> total 0
>> lrwxrwxrwx 1 root root 9 2011-09-03 20:33 VBOXADDITIONS_4.1.2_73507 ->  ../../
>> sr0
>> jansen@jansen-VirtualBox:~$
>>
>> there is definitly something wrong, but what...
> The latter output is unfamiliar to me, I guess the VM setup works magic
> ways! I would expect to se the same drives mapped as by-uuid. What is
> mounted under /media, is that the uuid disks or is it the virtual disks
> (well, it probably should be the virtual in the VM?)?
>
> Sorry, I am running out of ideas of how to make digikam recognise the
> drive through the VM. Out of interest, what platforms are you setting
> up as base and as VMs?
I am on windows 7 on an amd64 laptop using oracle virtualbox installed
ubuntu 11.04

Now I have got the password from jdd I tried to do it in opensuse, but
vboxsf not recognized and installation failed, reinstalling guest
additions failed.

Lost in the swamp. It is how I started 6 months ago and got it to
¨work¨. I saw quick that I had to look for a better solution and made a
dual boot.

I think I better leave it as is and continu not to encourage poeple to
go this way.

Best,
Rinus

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users