Saturday, March 10, 2012

Flexget - From RSS and files to Deluge

Purely theoretical examples... of course. ;)

RSS-feeds with multiple groups and settings per group

presets:
  fluff:
    set:
      main_file_only: yes
      content_filename: "{{ series_name|replace(' ','.') }}.{{ series_id }}.{{ quality }}{% if proper %}-proper{% endif %}"
      ratio: 3
      removeatratio: yes
    series:
      settings:
        groupmiff:
          min_quality: hdtv
          max_quality: 720p web-dl
          # if 720p is available within 4 hours, get it instead of hdtv.
          #quality: 720p
          #timeframe: 4 hours
        groupmoff:
          min_quality: sdtv
          max_quality: hdtv
      groupmiff:
        - Series Foo
      groupmoff:
        - Series Bar
    regexp:
      accept:
        - Regexp One:
            set:
              movedone: "/path/to/final/location with space in it"
        - Regexp Two:
            set:
              movedone: "/path/to/final/location with space in it"
    deluge:
      path: /path/to/temp/location
      movedone: /path/to/final/location
      label: miff
    exec:
      allow_background: yes
      on_output:
        for_accepted: echo "[ + ] `date +\"%F - %T\"` - {{ title|replace('.torrent','') }}" >> /path/to/logfile
feeds:
  feedmiff:
    priority: 1
    rss: http://address/of/rss/feed
    preset: fluff

Accept all from an RSS-feed
feeds:
  fluff:
    rss: http://path/to/rss/you/want/everything/from
    accept_all: yes
    deluge:
      path: /path/to/temp/location
      movedone: /path/to/final/location
      label: miff
    exec:
      allow_background: yes
      on_output:
        for_accepted: echo "[ + ] `date +\"%F - %T\"` - {{ title|replace('.torrent','') }}" >> /path/to/logfile

Files from one or more locations
feeds:
  fluff:
    find: 
      path: /path/to/torrent/files
      recursive: yes
    disable_builtins: [seen]
    regexp:
      accept:
        - \/directory miff\/:
            set:
              movedone: /path/to/final/location/miff
              label: miff
              main_file_only: yes
        - \/directory moff\/:
            set:
              movedone: /path/to/final/location/moff
              label: moff
    deluge:
      path: /path/to/temp/location
    exec:
      allow_background: yes
      on_output:
        for_accepted: |
          mv -f {{ location }} /path/to/torrent/files/`basename {{ location }}`.accepted;
          echo "[ + ] `date +\"%F - %T\"` - {{ title|replace('.torrent','') }}" >> /path/to/logfile
        for_rejected: |
          mv -f {{ location }} /path/to/torrent/files/`basename {{ location }}`.rejected;
          echo "[ - ] `date +\"%F - %T\"` - {{ title|replace('.torrent','') }}" >> /path/to/logfile

And finally we have a little bash-script for use with the execute plugin in deluge on torrent completion
#!/bin/bash
echo "[ C ] `date +\"%F - %T\"` - $2" >> /path/to/logfile