@user1215 wrote:
Is there a more efficient way to do what I am doing? Currently I'm taking user-input from python and editing the
variables.yml
file, as explained below.In my config.yml, I have templates for each
item
(item1
,item2
,...,item70
), as well as two other settings templates calledmanual_import_settings
andauto_import_settings
. Input is taken from the user for both themethod
variable (which can be "move" or "copy") and thetype
variable (which can beauto_import_files
ormanual_import_files
).Upon user intervention, the python script loads
variables.yml
and replaces the value formethod
ortype
with the user input, then saves the newvariables.yml
file. Then the commandflexget --execute --tasks import_*
is run from the python script. I'd prefer not to have the script opening and editing the variables file, if it can be avoided. Is there a better way to achieve these four possible tasks (without opening and editing the variables file and also without creating 3 additional tasks for eachitem
I have)?variables.yml........................................ import: method: move type: auto_import_files .....................................................
.
.
.config.yml........................................... tasks: import_item1: template: [item1, '{? import.type ?}'] '{? import.method ?}': to: '{? dirs.main_path ?}{? vars.item1.dir ?}/' rename: '{{ jinja_stuff_here }}{{ filename | pathext}}' import_item2: template: [item2, '{? import.type ?}'] '{? import.method ?}': to: '{? dirs.main_path ?}{? vars.item2.dir ?}/' rename: '{{ jinja_stuff_here }}{{ filename | pathext}}
.....................................................
ADDITIONAL INFO:
The scheduler is set to run allimport_*
tasks regularly. When it does, it uses the default values fortype
andmethod
that are stored in thevariables.yml
file. The default variable fortype
isauto_import_files
and the default variable formethod
is determined by the user only once.When the command to execute the
flexget --execute --tasks import_*
is called manually by the user through the python script,type
is changed tomanual_import_files
andmethod
might stay the same or might change. After the command is finished. The python script, again, opens thevariables.yml
file and restores the original defaults.
Posts: 1
Participants: 1