I have an (almost) working config file which outputs info (mostly from the imdb_lookup plugin) to a file, this is
the script:
variables: variables.yml
templates:
movies:
transmission:
host: localhost
port: __PORT__
username: __TRANSMISSION_USERNAME__
password: __TRANSMISSION_PASS__
path: __PATH__
include_subs: yes
addpaused: no
clean_transmission:
host: localhost
port: __PORT__
username: __TRANSMISSION_USERNAME__
password: __TRANSMISSION_PASS__
#finished_for: 7 days
enabled: Yes
tasks:
_base1: &base1
accept_all: yes
template: movies
imdb_lookup: yes
set:
content_filename: "{{ title|replace(' ','.') }}.{{ imdb_year }}"
exec:
auto_escape: yes
on_output:
for_accepted:
- echo "title {{ title|replace(' ','.') }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_plot_outline {{ imdb_plot_outline }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_actors {{ imdb_actors|replace("'", "\'") }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_directors {{ imdb_directors }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_genres {{ imdb_genres }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_score {{ imdb_score }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_id {{ imdb_id }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_url {{ imdb_url }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
- echo "imdb_photo {{ imdb_photo }}" >> "{{ info_path }}/{{ title|replace(' ','.') }}.{{ imdb_year }}.info.txt"
get720:
<<: *base1
rss: __RSS1__
set:
path: __RSS1_PATH__
info_path: __RSS1_INFO_PATH__
get1080:
<<: *base1
rss: __RSS2__
set:
path: __RSS2_PATH__
info_path: __RSS2_INFO_PATH__
Now, I've tried all approaches I could find to escape the echo lines but for some cases it fails (I can't properly escape some single or double quotes),
here are some of this issues, from the log:
2017-07-18 21:38 VERBOSE exec get720 Executing: echo "imdb_directors {u'nm0478286': u"John L'Ecuyer"}" >> "/storage3/flexget-test-downloads/720/info/__MOVIE_TITLE__.2015.info.txt"
2017-07-18 21:38 INFO exec get720 Stdout: /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
2017-07-17 23:59 VERBOSE exec get1080 Executing: echo "imdb_plot_outline; The life story of one of Britain's most notorious bare-knuckle fighters, Lenny McLean, also known as "the Guv'nor."" >> "/storage3/flexget-test-downloads/1080/info/__MOVIE_TITLE__.2017.info.txt"
2017-07-17 23:59 INFO exec get1080 Stdout: /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
2017-07-17 23:59 VERBOSE exec get1080 Executing: echo "imdb_actors; {u'nm5429086': u'Duan Sanderson', u'nm8401402': u'Shariff Earp', u'nm5480894': u'Ashton Sanders', u'nm6211068': u'Edson Jean', u'nm7747557': u'Rudi Goblen', u'nm1847117': u'Janelle Mon\xe1e', u'nm0991810': u'Mahershala Ali', u'nm7683380': u'Jaden Piner', u'nm8401407': u'Eddie Blanchard', u'nm8401406': u'Keomi Givens', u'nm8401405': u'Kamal Ani-Bellow', u'nm8401404': u"Herman 'Caheei McGloun", u'nm8401409': u'Patrick Decile', u'nm0365140': u'Naomie Harris', u'nm7683379': u'Alex R. Hibbert'}" >> "/storage3/flexget-test-downloads/1080/info/__MOVIE_TITLE__.2016.info.txt"
2017-07-17 23:59 INFO exec get1080 Stdout: /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
So far, those got confused by single quotes, but the next ones get confused by double quotes:
2017-07-17 23:59 VERBOSE exec get1080 Executing: echo "imdb_actors; {u'nm2110736': u'Victoria Staley', u'nm5390436': u'Sadie Robertson', u'nm5302034': u'Cory Chapman', u'nm3412582': u'Taylor Kalupa', u'nm5512177': u'David Errigo Jr.', u'nm4910117': u'Ben VanderMey', u'nm4558567': u'Masey McLain', u'nm4068476': u'Cameron McKendry', u'nm5652970': u'Emma Elle Roberts', u'nm3910031': u'Ben Davies', u'nm3239836': u'Mark Daugherty', u'nm0642198': u"Jennifer O'Neill", u'nm4009603': u'Justin Cone', u'nm1100853': u'Jaci Velasquez', u'nm3675178': u'Terri Minton'}" >> "/storage3/flexget-test-downloads/1080/info/I'm.Not.Ashamed.2016.UNKNOWN.info.txt"
2017-07-17 23:59 INFO exec get1080 Stdout: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
2017-07-17 23:59 VERBOSE exec get1080 Executing: echo "imdb_plot_outline; Brandon Burlsworth is perhaps the greatest walk-on in the history of college football. Brandon had always dreamed of playing for the Arkansas Razorbacks, but was considered too short and too fat to play Division I. Undeterred, Brandon took a big risk and walked on in 1994. Written off by fellow teammates and coaches, Brandon displayed dogged determination in the face of staggering odds. An extremely devoted Christian, Brandon never cursed or drank. He was genuinely humble and low-key. He worked harder than anybody, on and off the field, becoming the first Razorback to earn a Bachelor's and Master's degree while still playing. The overly-fat kid who was once an embarrassment to his teammates and an annoyance to his coaches, ended up becoming the most respected player in the history of the program, changing the lives of all he touched. Eleven days after being drafted into the NFL, Brandon was tragically killed in a car accident, crushing all who knew him. Brandon was "too good to be ..." >> "/storage3/flexget-test-downloads/1080/info/Greater.2016.UNKNOWN.info.txt"
2017-07-17 23:59 INFO exec get1080 Stdout: /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
Beyond the auto_escape option (which is present in the above script) I've also tried with
{{ imdb_actors|escape }}
but still fails
If anyone can give me a clue on how to fix this it would be great, thanks in advance !