@mekberg wrote:
I'm trying to tweak my Telegram notifications, so I wrote a simple test task that simulates what I would get with my real tasks without having to hammer my RSS feeds or input stuff to the databases.
This is what I'm using:
tasks: teltest: filesystem: path: /opt/flexget/teltest-dir mask: '*.torrent' quality: 1080p+ bluray+ h264+ exec: on_output: for_accepted: - echo "imdb_name = {{ imdb_name }}" - echo "imdb_url = {{ imdb_url }}" - echo "imdb_plot_outline = {{ imdb_plot_outline }}" - echo "imdb_score = {{ imdb_score }}" accept_all: yes download: /opt/flexget/teltest-dir-dl/ imdb_lookup: yes tmdb_lookup: yes notify: task: #template: telegram_msg message: |+ {% if task['name'] == 'queue-imdb' %}_Adding to watchlist:_{% elif task['name'] == 'movies-hdbits-4k-upgrade' %}_4K upgrade available:_{% else %}_Downloading:_{% endif %} {% if imdb_name is defined %}{{ imdb_name }}{% else %}{{ title|d('Unknown title') }}{% endif %} via: - telegram: bot_token: '{? telegram.bot_token ?}' parse_mode: markdown recipients: - username: '{? telegram.username ?}'
Nothing complicated, and I run it with this oneliner:
flexget check && flexget daemon reload && flexget --test execute -vvv --tasks teltest
The problem is that I get the correct "imdb_name" output from the
exec:
plugin, as well as everything else, but none of those variables work in any way when I send my Telegram message. The variables aren't even defined. If I change the output slightly, it even tells me outright "imdb_name is undefined"...So am I missing something obvious? Why would the task be able to output the variables to stdout, but not be able to use them in my telegram message body?
Sample output:
(flexget) [flexget@archivist flexget]$ flexget check && flexget daemon reload && flexget --test execute -vvv --tasks teltest There is a FlexGet process already running for this config, sending execution there. 2018-10-10 09:14 VERBOSE check Checking config file `/opt/flexget/config.yml` 2018-10-10 09:14 WARNING check Config line 231 is likely missing ':' at the end 2018-10-10 09:14 WARNING check Config line 450 is likely missing ':' at the end 2018-10-10 09:14 WARNING check Config line 453 is likely missing ':' at the end 2018-10-10 09:14 WARNING check Config line 456 is likely missing ':' at the end 2018-10-10 09:14 WARNING check Config line 461 is likely missing ':' at the end 2018-10-10 09:14 VERBOSE check Pre-checked 470 configuration lines 2018-10-10 09:14 VERBOSE check Config passed check. There is a FlexGet process already running for this config, sending execution there. 2018-10-10 09:14 INFO manager Reloading config from disk. 2018-10-10 09:14 INFO manager Config successfully reloaded from disk. 2018-10-10 09:14 INFO manager Test mode, creating a copy from database ... 2018-10-10 09:14 INFO manager Test database created 2018-10-10 09:14 VERBOSE task_queue There are 1 tasks to execute. Shutdown will commence when they have completed. 2018-10-10 09:14 VERBOSE filesystem teltest Starting to scan folders. 2018-10-10 09:14 VERBOSE filesystem teltest Scanning folder /opt/flexget/teltest-dir. Recursion is set to False. 2018-10-10 09:14 INFO filesystem teltest Test mode. Entry includes: 2018-10-10 09:14 INFO filesystem teltest Title: Skyscraper.2160p.10bit.bluray.x265.atmos 2018-10-10 09:14 INFO filesystem teltest URL: file:///opt/flexget/teltest-dir/Skyscraper.2160p.10bit.bluray.x265.atmos.torrent 2018-10-10 09:14 INFO filesystem teltest Filename: Skyscraper.2160p.10bit.bluray.x265.atmos.torrent 2018-10-10 09:14 INFO filesystem teltest Location: /opt/flexget/teltest-dir/Skyscraper.2160p.10bit.bluray.x265.atmos.torrent 2018-10-10 09:14 INFO filesystem teltest Timestamp: 2018-10-10 08:29:31.471283 2018-10-10 09:14 VERBOSE details teltest Produced 1 entries. 2018-10-10 09:14 VERBOSE task teltest ACCEPTED: `Skyscraper.2160p.10bit.bluray.x265.atmos` by accept_all plugin 2018-10-10 09:14 INFO download teltest Would download: Skyscraper.2160p.10bit.bluray.x265.atmos 2018-10-10 09:14 VERBOSE details teltest Summary - Accepted: 1 (Rejected: 0 Undecided: 0 Failed: 0) 2018-10-10 09:14 INFO download teltest Would write `Skyscraper.2160p.10bit.bluray.x265.atmos` to `/opt/flexget/teltest-dir-dl/` 2018-10-10 09:14 INFO exec teltest Would execute: echo "imdb_name = Skyscraper" 2018-10-10 09:14 INFO exec teltest Would execute: echo "imdb_url = https://www.imdb.com/title/tt5758778/" 2018-10-10 09:14 INFO exec teltest Would execute: echo "imdb_plot_outline = FBI Hostage Rescue Team leader and U.S. war veteran Will Sawyer now assesses security for skyscrapers. On assignment in Hong Kong he finds the tallest, safest building in the world suddenly ablaze and he's been framed for it. A wanted man on the run, Will must find those responsible, clear his name and somehow rescue his family who are trapped inside the building - above the fire line." 2018-10-10 09:14 INFO exec teltest Would execute: echo "imdb_score = 5.9" 2018-10-10 09:14 VERBOSE notify teltest Successfully sent a notification to `telegram` 2018-10-10 09:14 INFO manager Removed test database
Thanks for any help, input, tips or assistance.
Posts: 6
Participants: 2