Thursday, October 7, 2021
Batman's Camera
I'm not saying I have many cameras. I'm just saying nobody has ever seen all my cameras in the same room (not even me).
Wednesday, February 13, 2019
Sunday, May 27, 2018
Saturday, November 11, 2017
Importing a collection in Lightroom using SQLite
Sometimes I need to convert a list of files into a Lighroom collection: I usually select some files in Lightroom using computer A, say I add them to a collection, but shortly I need to move to computer B (which is a clone of A) and I need to take the list with me.
In theory, I could export the collection as a catalog, but most of the time, when I try to import it, I get some conflict warning, and I don't want to risk to overwrite picture settings: I'd like to add just my collection, and nothing else.
One option is as follows: export the collection as a catalog (without the pictures, just the catalog).
Then open the catalog in sqlite and run the following query:
select printf('{{ criteria = "filename", operation = "beginsWith", value = "%s", value2 = "", }, {criteria = "folder", operation = "words", value = "%s", value2 = "", }, combine = "intersect",},', AgLibraryFile.baseName || '.' || AgLibraryFile.extension, replace(AgLibraryFolder.pathFromRoot,'/',' ')) from AgLibraryFile inner join AgLibraryFolder on AgLibraryFile.folder == AgLibraryFolder.id_local;
On windows you might have to replace the path separator '/' with '\'.
If you paste the output of this query into a template file called "List of files.lrsmcol", you can easily generate a smart collection that contains all of your selected files, and smart collections can be imported.
s = {
id = "A0FA4F65-C596-4D9E-94B8-C2BB5B6D3740",
internalName = "List of files",
title = "List of files",
type = "LibrarySmartCollection",
value = {
// paste the query output here
combine = "union",
},
version = 0,
}
This can be easily be generalized to work with any list of files.
In theory, I could export the collection as a catalog, but most of the time, when I try to import it, I get some conflict warning, and I don't want to risk to overwrite picture settings: I'd like to add just my collection, and nothing else.
One option is as follows: export the collection as a catalog (without the pictures, just the catalog).
Then open the catalog in sqlite and run the following query:
select printf('{{ criteria = "filename", operation = "beginsWith", value = "%s", value2 = "", }, {criteria = "folder", operation = "words", value = "%s", value2 = "", }, combine = "intersect",},', AgLibraryFile.baseName || '.' || AgLibraryFile.extension, replace(AgLibraryFolder.pathFromRoot,'/',' ')) from AgLibraryFile inner join AgLibraryFolder on AgLibraryFile.folder == AgLibraryFolder.id_local;
On windows you might have to replace the path separator '/' with '\'.
If you paste the output of this query into a template file called "List of files.lrsmcol", you can easily generate a smart collection that contains all of your selected files, and smart collections can be imported.
s = {
id = "A0FA4F65-C596-4D9E-94B8-C2BB5B6D3740",
internalName = "List of files",
title = "List of files",
type = "LibrarySmartCollection",
value = {
// paste the query output here
combine = "union",
},
version = 0,
}
This can be easily be generalized to work with any list of files.
Sunday, October 8, 2017
Saturday, December 24, 2016
Subscribe to:
Posts (Atom)