Repository: Flexget/Flexget

Issue:
Adding labels to torrents in transmission
Since version 3.00 transmission now supports labels for torrents. They can be provided at add-time, see [Sec. 3.4 of the RPC spec](https://github.com/transmission/transmission/blob/main/docs/rpc-spec.md#32-torrent-mutator-torrent-set).

It would be neat if the transmission plugin accepted the `labels` keyword so Flexget could automatically label torrents., E.g. one could do
```yml
set:
    path: '/var/Downloads/{{series_name}}'
    label:
        - '{{series_name}}'
        - flexget
```



Discussion:
This isn't an issue, it's a feature request.
> This isn't an issue, it's a feature request.

The Feature requests section of your README.md links to a completely non-functional website. Many projects on Github use the issue tracker for feature requests, too, and often even have a dedicated label for such. In fact, Flexget [is one of those](https://github.com/Flexget/Flexget/issues?q=is%3Aissue+label%3AEnhancement). Hope this helps.
> The Feature requests section of your README.md links to a completely non-functional website. Many projects on Github use the issue tracker for feature requests, too, and often even have a dedicated label for such. In fact, Flexget [is one of those](https://github.com/Flexget/Flexget/issues?q=is%3Aissue+label%3AEnhancement). Hope this helps.

Good point. I ripped that bit out of the readme. This is a good place for enhancement requests, given we don't have any better place I think. Would be happy to accept a PR with this feature, ideally mimicking the label features in deluge plugin so transitioning example configs between the two clients is easy.
> given we don't have any better place I think

How about https://github.com/Flexget/Flexget/discussions/categories/ideas ? Not necessarily better, mostly reminding it exists 😅
This issue is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 30 days.

Resolving patch:
diff --git a/flexget/plugins/clients/transmission.py b/flexget/plugins/clients/transmission.py
--- a/flexget/plugins/clients/transmission.py
+++ b/flexget/plugins/clients/transmission.py
@@ -226,6 +226,7 @@ def on_task_input(self, task, config):
                 'secondsDownloading',
                 'secondsSeeding',
                 'torrentFile',
+                'labels',
             ]:
                 try:
                     value = getattr(torrent, attr)
@@ -317,6 +318,7 @@ class PluginTransmission(TransmissionBase):
                     'skip_files': one_or_more({'type': 'string'}),
                     'rename_like_files': {'type': 'boolean'},
                     'queue_position': {'type': 'integer'},
+                    'labels': {'type': 'array', 'items': {'type': 'string'}},
                 },
                 'additionalProperties': False,
             },
@@ -672,6 +674,7 @@ def _make_torrent_options_dict(self, config, entry):
             'skip_files',
             'rename_like_files',
             'queue_position',
+            'labels',
         ):
             # Values do not merge config with task
             # Task takes priority then config is used
@@ -723,6 +726,9 @@ def _make_torrent_options_dict(self, config, entry):
         if 'queue_position' in opt_dic:
             change['queuePosition'] = opt_dic['queue_position']
 
+        if 'labels' in opt_dic:
+            change['labels'] = opt_dic['labels']
+
         post = options['post']
         # set to modify paused status after
         if 'add_paused' in opt_dic:


Test patch: