Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Square Box CatDV Worker / Command Line Interface / Overwrite existing fields / Paste Metadata

  • Worker / Command Line Interface / Overwrite existing fields / Paste Metadata

    Posted by Leonid Nekrasov on January 31, 2012 at 4:09 pm

    Hi,

    I am writing a shell script, that will search for a specific clip, copy it’s metadata than make a new query for another specific clips and finally will paste the copied metadata from the first clip on all clips from the second query.

    It works great with the Command Line Interface of the worker so far. But I have one problem with it:

    1. Is there maybe already a ready to use copy&paste CLI command for this purpose, that I don’t know about?

    2. I only can use “set” to modify a clip field. But it only merges the fields. I cannot for some reason overwrite the field. For example if I want to update the “Status” field, that is already has an entry.

    Does somebody know the workaround for this problem?

    Thanx and best regards
    Leo

    Rolf Howarth replied 14 years, 3 months ago 3 Members · 4 Replies
  • 4 Replies
  • Bryson Jones

    January 31, 2012 at 6:03 pm

    That’s interesting, on my setup, a “-set” command changes the value, it doesn’t append. Is there a specific option you are passing other than -set U??=???

    So far, as I’ve seen it, the Worker CLI is one field at a time, query, return result and then pass that to the field you want to write.

    bryson

    bryson “at” hidefcowboy.com

    hidefcowboy.com

  • Rolf Howarth

    January 31, 2012 at 6:14 pm

    Can you post details of the command line you’re using? As far I can tell something like

    catdv query -set STS=

    should blank out the status field.

  • Leonid Nekrasov

    February 1, 2012 at 8:00 am

    Hi,

    that’s strange 🙂 Yesterday it didn’t work. But today it seems to work like a charm. Maybe just the restart of the system was needed, what I don’t really believe. I will do some more tests and will see if it work stable.

    Here are some code snippets for any case:

    # look up for a source clip to grab its metadata. print the metadata and wright them in a temporary text file.
    catdv -query STS="new" -query CAT:2:Catalog1 -limit 1 -format bar -print ID,U72,U1,U2,U3,U4,U6,U8,U10,U21,U23,U26,U29,U50,U42 > $tmpfile

    #read the tempfile and set new variabels
    ID=`awk -v FS='|' 'NR==2 {print $1}' $tmpfile`
    U72=`awk -v FS='|' 'NR==2 {print $2}' $tmpfile`
    U1=`awk -v FS='|' 'NR==2 {print $3}' $tmpfile`
    ...

    # now look for target clips and set the metadata from the variables
    catdv -query U72:2:"$U72" -query CAT:2:CAPTURE -set STS="updated" -set U1="$U1" -set U2="$U2" -set U3="$U3" ...

    maybe not a award winning script, but it works well for my purpose. I of course would appreciate any advises and ideas for improvement.

    Best Regards
    Leo

  • Rolf Howarth

    February 1, 2012 at 9:31 am

    As will all shell scripts, something you have to be very careful about is handling of spaces and special characters and blank values and make sure they’re properly quoted or escaped. Perhaps that’s where the problem lies and it depends on your data?

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy