メインコンテンツへスキップ

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

Catalog Sets

コメント

8件のコメント

  • Larry_S
    Hi Michael,

    I needed the something similar, where I give a subset catalog to another employee to organize photos into slideshows, i.e. catalog sets, and write captions. So I wrote an AppleScript to 'copy back' the catalog sets and item descriptions. Below is a script with just the copy back feature of the catalog sets.

    What it does: Takes selected catalog sets from a subset catalog of a master catalog and copies back the sets to the master and adds the media items in the master to the newly created sets.

    What it doesn't do: There is practically no error checking. So, it will not work if the subset catalog has different media items from the master (you've added/removed items in the catalog), or the master has had items removed that were referenced in the subset catalog.

    Use at your own risk and test thoroughly on files and catalogs that have been backed up first!

    Download script here, or copy/paste following code into AppleScript Editor and compile and Save As...


    Copy Back Catalog Set.scpt
    tell application "Media Pro"
    tell catalog 1
    set mediaSetNames to name of media sets

    set choosenSets to (choose from list mediaSetNames ¬
    with title "Choose Media Sets" with prompt ¬
    "Select Media Set(s) you wish to transfer over to another catalog..." OK button name ¬
    "Select" cancel button name ¬
    "Cancel" multiple selections allowed true ¬
    without empty selection allowed)

    if class of choosenSets is boolean then return

    end tell


    set openCatNames to name of windows
    set choosenCatalog to (choose from list openCatNames ¬
    with title "Choose Destination Catalog" with prompt ¬
    "Select a Catalog destination for Media Sets..." OK button name ¬
    "Transfer" cancel button name ¬
    "Cancel" multiple selections allowed false ¬
    without empty selection allowed)

    if class of choosenCatalog is boolean then return

    set destCatName to item 1 of choosenCatalog

    set openCats to windows
    repeat with i from 1 to length of openCats
    if name of catalog i is destCatName then
    set destCatIndex to index of catalog i
    end if
    end repeat

    --show all, or the referenced media items might be hidden and unavailable
    tell application "System Events"
    keystroke ¬
    "e" using command down
    end tell
    delay 1

    select catalog destCatIndex --bring destination to front

    tell application "System Events"
    keystroke ¬
    "e" using command down
    end tell
    delay 1

    -- none of this really works right unless the catalog being worked on is frontmost
    repeat with aSet in choosenSets
    set aSet to aSet as string


    select catalog 2 --rotate between catalogs
    delay 1

    tell front catalog -- previous front catalog
    tell media set aSet

    -- why does tell block reference work and not direct ref ??
    -- set setItems to media items of media set aSet <- should work
    set setItems to media items

    end tell

    end tell

    select catalog 2 --rotate between catalogs
    delay 1

    tell front catalog -- previous front catalog
    set dupSetRef to make new media set at end with name aSet

    -- doesn't work if you just try to set the media items to the other sets (wrong catalog references?)
    -- re-add manually
    repeat with anItem in setItems
    add media item id (unique id of anItem) to dupSetRef
    end repeat
    end tell

    end repeat


    end tell



    Larry
    0
  • Michael Mährlein
    Hello Larry,
    thank you very much for the script! It does exactly what I'm looking for. Great!
    The only thing I recognized is that the first selection box also shows all (?) of my keywords. Only the last items are the catalog sets.

    Another question: Do you also have a script to export and import all the hierarchical keywords? I want to copy it from one catalog to another and also first I have to export it from Lightroom so that I can import all my x-thousands of keywords into Media Pro.

    Many, many thanks again, Michael
    0
  • Larry_S
    Hi Michael,

    Glad the script works for your needs. It's pretty bare-bones. If you want only the Catalog sets to show up, then open the script in AppleScript Editor and change the line #3 accordingly:

    set mediaSetNames to name of media sets

    to...

    set mediaSetNames to name of (media sets where its name is not "@KeywordsSet" and its level is 0)


    Then compile and Save As...

    Important Note: The script will only work on level 0 (top level) catalog sets when coded this way. The previous version would show all sets (including keywords, like you found out); and, while it would re-create the catalog sets in the master catalog, they would not be nested as in the subset catalog. This would require recursive coding. Some recursive coding could get all catalog sets (regardless of level) that are not keywords. But, without a recursive handler for rebuilding the sets, they would still be created flatly (un-nested).

    Another question: Do you also have a script to export and import all the hierarchical keywords? I want to copy it from one catalog to another and also first I have to export it from Lightroom so that I can import all my x-thousands of keywords into Media Pro.


    Not currently, but adding multiple recursive handlers to this script would allow for transfer of hierarchical keywords from one catalog to another, even whole selected sub-branches of keywords. Alternatively, if the script dumped to an export file, and could read a similar export/import file, you could then hand craft an export/import file for importing keywords from any source (e.g. Lightroom). However, you would then have to find a means of properly applying those imported terms in MP to the same actual media items again, if that's the ultimate goal. When doing so, things can get tricky if your source files live on drives with identical volume names. Still, it is possible to work out if one is diligent with acquiring more information pre-import, like volume UUIDs, etc.

    Additionally, such a script would also have to take synchronization into account (i.e. if hier. keywords already exist at particular levels, should matching imported keywords be added, or replace or update existing; and, what about the media items already linked to those keywords or items you intend to re-link). A complete solution would quickly become complicated.

    Lastly, AppleScript is way slow on recursive routines with long lists. So, such a script run on a very large catalog might take up to an hour (guess). Python or Ruby could be used to do some list subprocessing to reduce total execution time.

    Larry
    0
  • Dave Heap
    [quote="Larry_S" wrote:
    Lastly, AppleScript is way slow on recursive routines with long lists. So, such a script run on a very large catalog might take up to an hour (guess). Python or Ruby could be used to do some list subprocessing to reduce total execution time.

    -- Fast way to do repeats!
    repeat with i from 1 to length of openCats
    if name of catalog i is destCatName then
    set destCatIndex to index of catalog i
    end if
    end repeat

    -- Slow way to do repeats
    repeat with anItem in setItems
    add media item id (unique id of anItem) to dupSetRef
    end repeat


    I've had a fair bit of experience writing huge & recursive repeats, both within EM2 and for other purposes.

    There is a dramatic difference in speed between the two forms shown above, and it gets exponentially worse as the size of the list increases. Even more important if you are doing nested repeats, or using recursion.

    There is also supposed to be a speed gain using the "a reference to" operator to access large lists. See AppleScriptLanguageGuide (2.0) Page 91. But I've found it doesn't always help, but sometimes make the loop slower.

    The repeat form does make a huge difference if the list is large.
    0
  • Michael Mährlein
    WOW, thank you Larry and Dave.
    @Larry: You gave me very deep information on this topic - many thanks to you. Now I have to deal with them. It is great to know that there is someone outside with your impressive know how. For me it is ok to copy only top level catalog sets.
    Regards the hierarchical keywords I'm maintaining my keywords that are imported by importing the pictures. Now I have to think about a solution for the different kind of keywords of Lightroom (Synonyms, exportable / non-exportable keywords). Maybe the next version of Media Pro a solution for importing / exporting hierarchical keywords.
    Thank you again and today in the evening I will try only to select catalog sets and not all keywords.
    Best wishes, Michael
    0
  • Larry_S
    @ Michael: Have fun. Let me know how it goes for you.

    @ Dave: Thanks for the info on list processing. I am aware of what you discussed. Speed was never an issue with that script. So, I wrote it as fast as I could, with object lists, etc., like on the last loop you noted. Usually I forgo all large object lists when scripting MP (iVMP, EM) due to slow processing and prefer to work with media item 'unique id' lists, then reference the list in a loop via its value indices (as you noted in the first loop), if speed is a needed feature. The 'unique id' list method is the fastest processing I've come up with for looping through media items. Do you have another?

    I, too, have not seen an appreciable increase in speed when using 'a reference to,' except when initially setting up variables to pass to handlers. Don't seem to speed things up once in a recursion, though. (Semi-anecdotal on my part, just looking at ScriptDebugger's timer.)

    As for the script in question in this thread, have you worked up a keyword or catalog set recursive handler already? If not, I can put one together to round out this script.

    Thanks for the help,

    Larry
    0
  • Michael Mährlein
    Hello Larry,
    now I tried it with the change of the on line. It works perfect - thank you again.

    Best regards, Michael
    0
  • Dave Heap
    [quote="Larry_S" wrote:
    @ Dave: As for the script in question in this thread, have you worked up a keyword or catalog set recursive handler already? If not, I can put one together to round out this script.

    No, I haven't.
    0

投稿コメントは受け付けていません。