Last active
April 3, 2023 13:08
-
-
Save hectorcorrea/d70e0a7edf88bc97ee7f6725c13cde24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ======================================================================= | |
# tagAdd - adds a tag (term) to the dictionary | |
# | |
# Usage: | |
# | |
# script.execute :in file:/Users/correah/src/mediaflux/tagAdd.tcl :arg -name tagName "tagXX" :arg -name tagDescription "this is the tag XX" | |
# | |
# ======================================================================= | |
set log_name "homework-2023-03-24" | |
if { [info exists "tagName"] && [info exists "tagDescription"]} \ | |
{ | |
server.log :app ${log_name} :event info :msg "Creating tag ${tagName}" | |
# dictionary.entry.add :term ${tagName} :definition ${tagDescription} | |
set exist [xvalue exists [dictionary.exists :name hector]] | |
if { "$exist" != "true" } \ | |
{ | |
dictionary.create :name hector | |
} | |
set entryExist [ xvalue exists [ dictionary.entry.exists :dictionary hector :term hello ] ] | |
if { "$entryExist" != "true" } \ | |
{ | |
dictionary.add :dictionary hector :entry < :term $tagName :definition $tagDescription > | |
} | |
} \ | |
else \ | |
{ | |
server.log :app ${log_name} :event error :msg "tagAdd - tagName and/or tagDescription was not received" | |
error "tagAdd - tagName and/or tagDescription was not received" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ======================================================================= | |
# tagAssign - assigns an existing tag to an asset. | |
# | |
# Usage: | |
# | |
# script.execute :in file:/Users/correah/src/mediaflux/tagAssign.tcl :arg -name tagName 'tagXX' :arg -name id 1033 | |
# | |
# ======================================================================= | |
set log_name "homework-2023-03-23" | |
if { [info exists "tagName"] && [info exists "id"]} \ | |
{ | |
server.log :app ${log_name} :event info :msg "Assigning tag ${tagName} to ${id}" | |
asset.tag.add :id ${id} :tag < :name -dictionary hector ${tagName} > | |
} \ | |
else \ | |
{ | |
server.log :app ${log_name} :event error :msg "tagAssign - tagName and/or id was not received" | |
error "tagAssign - tagName and/or id was not received" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment