Periodic tasks
Periodic tasks perform recurring actions triggered either by intervals or crontabs.
Add Periodic Task
When you add a new periodic task give it a name, choose a registered or enter a custom task and keep the checkbox "enabled" checked. To schedule the task give either an interval or a cron time format. You might add JSON encoded positional arguments or JSON encoded keyword arguments to the task (the latter are preferred, to be able to leave out the arguments left to default). And finally you may optionally set the expiration date, a tasks queue, a message broker exchange and a message broker routing key.
It is preferred to disable the task rather than deleting it.
Setting up watchfolders
Common applications of periodic tasks are so-called watchfolders. There are two different kinds of watchfolder tasks in medialoopster. All of them are configured by setting JSON encoded keyword arguments in the medialoopster administration interface.
{
"path": "/mnt/medialoopster/Watchfolder/Import/",
"production_name": "nachtblau",
"accepted_ext": [".mov", ".mxf", ".mp4", ".mpeg", ".flv"],
"last_modified_limit": 30,
"auto_detect_shots": true,
"target_path": "/mnt/medialoopster/Highres/Video/"
}
browser.tasks.scan_folder
This is the standard watchfolder task. It scans a folder for files and creates new assets from accepted files. In general a file is considered as "accepted" when the following criteria are met:
- File is not empty (size > 0)
- File has not been modified recently (see option
last_modified_limit) - File name does not start with a period (
.) or underscore (_) - File extension is in the list of accepted file extensions (see option
accepted_ext)
Options
| Name | Required | Description |
|---|---|---|
| path | yes | Absolute path of the folder to scan, as seen by medialoopster. |
| production_name | yes | Name of the target production to assign the new asset to. |
| accepted_ext | no | List of accepted file extensions. If not set, the default file extensions from settings.VIDEO_EXT, settings.AUDIO_EXT and settings.IMAGE_EXT are used. |
| target_path | no | Path of the target device. If not set, the production's default devices are used. |
| last_modified_limit | no | To identify growing files and to assure the file-writing has finished, this value indicates the minimum amount of seconds that must have passed since the last file change. Default is 30 seconds. |
| auto_detect_shots | no | Boolean value indicating whether medialoopster should perform an automatic shot detection during video asset initialization. If false, there will be no automatic shot detection. Default is true. |
| xml_transformations | no | Optional list of XMLTransformation names used for transforming XML. |
browser.tasks.scan_folder_recursively
Similar to browser.tasks.scan_folder but also scans the contents of any subfolders.
Options
This tasks accepts the same options as browser.tasks.scan_folder task, excluding auto_detect_shots, and takes an additional optional argument.
| Name | Required | Description |
|---|---|---|
| in_place | no | Boolean value indicating if files are moved to a destination folder. If true files will not be moved and thus keep their folder hierarchy. Default is false. Do not set both in_place and target_path arguments together. |