@ianstalk wrote:
The
template
plugin in Flexget is great, but it has its limitations; you wind up repeating yourself a lot anyway. Enter: YAML anchors! They'll let you do templating at a much more granular level. Here's an example config (NOTE: the below config relies on the fact that Flexget doesn't validate tasks/templates prefixed by an underscore):templates: anchors: _transmission: &transmission enabled: yes host: '{{ secrets.transmission.host }}' port: 9091 username: '{{ secrets.transmission.username }}' password: '{{ secrets.transmission.password }}' _trakt_credentials: &trakt-credentials username: '{{secrets.trakt.username}}' account: '{{secrets.trakt.account}}' series-transmission: transmission: <<: *transmission ratio: 5 path: '/Volumes/Drobo/downloads/tv/' movies-transmission: transmission: <<: *transmission ratio: 5 path: '/Volumes/Drobo/downloads/movies/' series-trakt-list: &series-trakt-list trakt_list: <<: *trakt-credentials list: 'TV Queue' type: shows strip_dates: yes tasks: series-trakt-clean: priority: 107 template: [series-trakt-list] disable: seen list_remove: - <<: *series-trakt-list transmission-clean: priority: 999 disable: details no_entries_ok: yes clean_transmission: <<: *transmission transmission_seed_limits: yes delete_files: yes finished_for: 5 days directories: - "/Volumes/Drobo/downloads/tv/.*" - "/Volumes/Drobo/downloads/movies/.*"
Use
&achrorname
to define an anchor, then you can reference it with<<: *anchroname
. Anything scoped below the anchor will be copied when you reference it. You can even override values defined in an anchor, though my example doesn't show anything like that. https://gist.github.com/bowsersenior/979804 is a good quick overview of anchor syntax if you want to learn more.
Posts: 2
Participants: 2