Skip to content

Instantly share code, notes, and snippets.

@danielmfern
Created December 19, 2024 10:08
Show Gist options
  • Select an option

  • Save danielmfern/f96dfe0d5077d170fb96df90dc55c099 to your computer and use it in GitHub Desktop.

Select an option

Save danielmfern/f96dfe0d5077d170fb96df90dc55c099 to your computer and use it in GitHub Desktop.

Revisions

  1. danielmfern created this gist Dec 19, 2024.
    71 changes: 71 additions & 0 deletions settings_workflows.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    wfs = [["ac", nil],
    ["bk",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"image-generate-marketplaces-bk",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["md",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"image-generate-marketplaces-md",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["lf",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["oy",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"image-generate-marketplaces-oy",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["pb",
    [{"workflow_id"=>"image-generate-widths",
    "conditions"=>
    {"m"=>"and",
    "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}, {"filename_does_not_match"=>".*.-[aA]19[mM].(mov|MOV|mp4|MP4|jpg|JPG|jpeg|JPEG)"}]}},
    {"workflow_id"=>"image-generate-marketplaces-pb",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>".*.-[aA]19[mM].(mov|MOV|mp4|MP4|jpg|JPG|jpeg|JPEG)"},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"image-remove-background", "conditions"=>{"m"=>"and", "g"=>[{"filename_matches"=>".*.-[aA]19[mM].(jpg|jpeg|JPG|JPEG)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["st",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"image-generate-marketplaces-st",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["zh",
    [{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
    {"workflow_id"=>"image-generate-marketplaces-zh",
    "conditions"=>
    {"m"=>"and",
    "g"=>
    [{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
    {"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
    {"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
    ["za", []]]

    Current.user = User.first;

    wfs.each do |code, wf|
    Current.account = Account.find_by(code: code);
    Setting.create!(key: 'workflows', value: wf, notes: 'Workflows to be executed on Amanda')
    end