I am trying to use the “Flow” feature to convert files. The “run script” should run when “tag assigned” is set. I would now like to pass the tag name as a parameter for the run script. But in the manual at GitHub - nextcloud/workflow_script: Rule based processing of files through specified external scripts there is no matching placeholder documented.
Is there a placeholder, or how else could I pass a parameters of the script depending on the tag assigned?
Run script: /tmp/script.sh %n %XYZ
where script could look like:
ffmpeg -i $1 $2.webm
(where $2 should contain the tagname (%XYZ))
Thanks for any comments or Ideas!
RainerP
j-ed
October 13, 2020, 8:05am
2
I think that isn’t possible yet. You have to create multiple script calls each one for a single tag, or you try to read/extract assigned tags using e.g. an API call as described here . The example api calls are to set or delete a tag, but it shouldn’t be that difficult to create a get request based on it.
Additionally you can create feature request in the app specific GitHub repository:
1 Like
gas85
October 13, 2020, 11:03am
3
You know file ID (%i - file id
), so you can easily retrive TAG via API. E.g. based on this
-X PUT -H "Content-Type: application/json" \
--data '{"userVisible":true,\
"userAssignable":true,\
"canAssign":true,\
"id":"'$tag'",\
"name":"'$tagName'"}'
echo "[PROGRESS] Setting tag $tagName for $fileToTag."
}
checkIfTagIsSet () {
if [[ -z "$fileid" ]]; then
getAllTags="$(curl -s -m 10 -u $user:$password ''$NextcloudURL'/remote.php/dav/systemtags-relations/files/'$fileid'' \
-X PROPFIND --data '<?xml version="1.0" ?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:prop>
<oc:id />
<oc:display-name />
<oc:user-visible />
it could be something like:
curl -s -m 10 -u $user:$password ''$NextcloudURL'/remote.php/dav/systemtags-relations/files/'$fileid'' \
-X PROPFIND --data '<?xml version="1.0" ?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
<d:prop>
<oc:id />
<oc:display-name />
<oc:user-visible />
<oc:user-assignable />
<oc:can-assign />
</d:prop>
</d:propfind>' | xml_pp | grep -w "$tagName"
You only need to have a user that will have an access to this file to be able to call this API.
1 Like
haching
October 14, 2020, 11:07am
4
thanks @gas85 and @j-ed for your comments. I will try to extend my script to retrieve the tag via curl. But this would require to store the user and password in the script. This may be a quick hack, but I don’t like it …
So I will try to prepare a feature request.
1 Like
gas85
October 14, 2020, 11:23am
5
Please create an Application password for it. You can also store it in a config file with 400 permissions for you Web user.