Skip to content

classifier multiple classifier*.yml configurations#379

Open
rraymondgh wants to merge 7 commits into
bitmagnet-io:mainfrom
rraymondgh:classifier_multiple_config_files
Open

classifier multiple classifier*.yml configurations#379
rraymondgh wants to merge 7 commits into
bitmagnet-io:mainfrom
rraymondgh:classifier_multiple_config_files

Conversation

@rraymondgh

Copy link
Copy Markdown
Contributor

I have been running torznab profiles with tag filters. sonarr RSS runs well, when torrents are pre-tagged and filtered by these tags. I have an hypothesis that 100 torrent limit means that sonarr does not poll all the torrents on content type filter alone. (I have not observed enough requests to torznab endpoint) Running a classifier config equivalent to:

flag_definitions:
  radarr: string_list
  sonarr: string_list
  sonarr_latest: string_list

workflows:
  tagcontent:
    - if_else:
        condition: "result.contentSource == 'tmdb' "
        if_action:
          add_tag: contentattached

  tagandkeep:
    # tag active content
    - find_match:
      - if_else:
          condition:
            and:
              - "result.contentType == contentType.tv_show"
              - "result.contentSource == 'tmdb' "
              - "result.contentId in flags.sonarr "
              - "result.episodes.filter(e, result.contentId + '_' + e in flags.sonarr_latest).size() > 0"
          if_action:
            add_tag: active
          else_action: unmatched

      - if_else:
          condition:
            and:
              - "result.contentType == contentType.tv_show"
              - "result.contentSource == 'tmdb' "
              - "result.contentId in flags.sonarr "
          if_action:
            add_tag: sonarr
          else_action: unmatched

      - if_else:
          condition:
            and:
              - "result.contentType == contentType.movie"
              - "result.contentSource == 'tmdb' "
              - "result.contentId in flags.radarr "
          if_action:
            add_tag: radarr
          else_action: unmatched

  tmdbproxy:
    - run_workflow: default
    - run_workflow: tagcontent
    - run_workflow: tagandkeep

This is far better server by keeping often changing flag lists in separate YaML files. Hence reason for this PR. Changing flag list files can be created with a scheduler, currently with a restart of bitmagnet.

I will look into fsnotify for watching used YaML files to automatically trigger a regeneration of CEL environment as a subsequent change.

A few notes on implementation

  • due to use of filepath.Glob(glob) code will not try to open a none existent file. Hence no checking for that any more
  • have mostly kept interfaces the same. There are some, hence amendments to two existing unit tests. Have focused on de-duplication of code

giorgiobrullo added a commit to giorgiobrullo/bitmagnet that referenced this pull request Mar 1, 2026
…ILES env

Cherry-pick of PR bitmagnet-io#379. Classifier now loads classifier*.yml glob pattern
from XDG config and CWD, allowing split configs (e.g. classifier-tags.yml,
classifier-flags.yml). Also supports EXTRA_CLASSIFIER_FILES env var for
additional config file paths (comma-separated).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
giorgiobrullo added a commit to giorgiobrullo/bitmagnet that referenced this pull request Mar 1, 2026
…agnet-io#379)

Two issues from the cherry-pick of PR bitmagnet-io#379 (multiple classifier config
files):

1. Tests referenced the old `rawSourceProvider` field which was replaced
   by `raw []byte` + `err error` in yamlSourceProvider. Updated to use
   `coreSourceProvider{}.provider()` instead.

2. JSON schema was missing the new `keywords_override` and
   `extensions_override` properties, causing validation to fail with
   additionalProperties: false. Added both as nullable object types
   since they serialize as null when unset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant