forked from madwind/flexget_qbittorrent_mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_entry.py
30 lines (25 loc) · 947 Bytes
/
show_entry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flexget import plugin
from flexget.event import event
from flexget.task import Task
from loguru import logger
class PluginHtmlRss:
schema = {
'type': 'object',
'properties': {
'state': {'type': 'string'},
'attribute': {'oneOf': [{'type': 'boolean'}, {'type': 'array', 'items': {'type': 'string'}}]}
}
}
@plugin.priority(plugin.PRIORITY_LAST)
def on_task_output(self, task: Task, config: dict) -> None:
state = config['state']
attribute = config.get('attribute')
entries = getattr(task, state)
for entry in entries:
for key, value in entry.items():
if isinstance(attribute, list) and key not in attribute:
continue
logger.info('key: {}, value: {}', key, value)
@event('plugin.register')
def register_plugin() -> None:
plugin.register(PluginHtmlRss, 'show_entry', api_ver=2)