bitmagnet-io / bitmagnet

A self-hosted BitTorrent indexer, DHT crawler, content classifier and torrent search engine with web UI, GraphQL API and Servarr stack integration.
https://bitmagnet.io/
MIT License
2.51k stars 102 forks source link

[Feature Request] Permit tags to be searchable via Torznab API #311

Open binhex opened 2 months ago

binhex commented 2 months ago

Is your feature request related to a problem?

The ability to define custom tags is great, this feature request is to enhance this functionality by permitting the custom tag to be searchable via the Torznab API. This could be done by the end user by specifying a Torznab API numeric category for the tag and then querying the torznab api for the custom category in the normal manner.

Describe the solution you'd like

The ability to define the custom value for the tag, a mock up classifier.yml could look something like this:-

$schema: "https://bitmagnet.io/schemas/classifier-0.1.json"

extensions:
  emulation_rom_extensions:
    - chd
    - nsp
    - nsz

# define tags and numeric category values (used when querying via the torznab api)
tags:
  emulation-roms: 100000

# extend the default workflow with a custom workflow:
workflows:
  custom:
    # first run the default workflow:
    - run_workflow: default
    - if_else:
        # if the extension matches the definition then add to category
        condition: "torrent.files.filter(f, f.extension in extensions.emulation_rom_extensions).size() > 0"
        if_action:
          add_tag: emulation-roms

Final thoughts

It maybe a better idea to scrap the concept of 'tags' and instead simply permit the creation of custom categories instead (viewable via web ui and searchable via torznab api), as the torznab api is all about searching categories and has no concept of tags other than to differentiate between newznab and torznab.