Project

General

Profile

post-processor parameters

Added by Bernd Gravenfeld over 9 years ago

A post-processor script generates NFO files for my recordings.
The script collects the format strings

/home/hts/tvhscript.sh "%d" 

and echoes the variables to the NFO file
...
VDESCRIPTION=$1
...
echo "<plot>"${VDESCRIPTION}"</plot>" >> $INFOFILE
...

Everything went fine, but for about 2 weeks the description is cut at the first linefeed and at some charcaters like quotation marks. I compile tvheadend from github, so far with no (further) issues.
Is there anyone, using the post-processor, who could help me?
Thanks!


Replies (8)

RE: post-processor parameters - Added by Bernd Gravenfeld over 9 years ago

Further investigations:
1. when calling the script on commandline with a string as argument "%d" the result is as expected.
2. calling the script inside tvheadend post-processor with any recordings the outputfile "echo $VDESCRIPTION" is always 128 Byte

No success yet - may anyone help?

Thanks

RE: post-processor parameters - Added by Prof Yaffle over 9 years ago

I would guess at the shell that's being used to execute the script. You might find, for example, that a command shell is bash but the post-processing script is running under /bin/sh or similar.

Try either explicitly setting the shell type in a shebang at the beginning, or specifying the shell as you call the script (e.g. /bin/bash /path/to/script.sh).

The other thing I wondered was code pages, especially if you have non-ASCII characters (e.g. UTF-8 accented characters) - maybe they're taking multiple bytes when echoed? Guesswork there, though.

RE: post-processor parameters - Added by Bernd Gravenfeld over 9 years ago

Thank you for your response!
I continued trying to find the reasons for my issue by compiling older versions via github;
with git reset --hard $HCOMMIT went back to some commits on May 31, 2015, where changes regarding DVR format strings had been made.
Before this day, everything was fine, afterwards the reported issue appeared.
It appears to me, that either commit 9037150d3c3bbfe4e5ccde39f0e8ede31a0f649e or 59732e04b596903ec8fb7f1223b535340295c1d5 are responsible for my problem.
I might be wrong.
Regarding your suggestions:
the script is owned by user hts and is called with its path (btw.: no problems before May 31)
changing code pages (I suggested this at first) did not help.

RE: post-processor parameters - Added by Prof Yaffle over 9 years ago

Hmmm - looking at that commit (commit:9037150d)... lines 426+ of dvr_rec.c...

static const char *dvr_sub_str_separator(const char *id, const void *aux)
{
  static char buf[128];
  strncpy(buf, (const char *)aux, sizeof(buf)-1);
  buf[sizeof(buf)-1] = '\0';
  return dvr_clean_directory_separator(buf);
}

Now, I'm no C guru, but that's suspicious. If you're building it yourself, I'd suggest trying a different value in the buf declaration (e.g. static char buf512) and see if it fixes your problem. If it does, either raise an issue or propose a patch; if it doesn't, then raise an issue anyway, as you've clearly found something that wasn't intended.

RE: post-processor parameters - Added by Bernd Gravenfeld over 9 years ago

Thanks,
unfortunately no success - i get the same size of the file.
How should I raise an issue on github or contact perexg, whose commits probably might have something to do with it?

RE: post-processor parameters - Added by Bernd Gravenfeld over 9 years ago

Oups, awkward ;-) ...

RE: post-processor parameters - Added by Bernd Gravenfeld about 9 years ago

Thanks to perexg for solving the buffer problem.
Now, a new problem: The program description "%d", sometimes contains quotes. I found no solution to pass the whole description to my script via command line arguments: Bash cuts the text from the first quotation mark. The output of "Broadcast Details" within the webgui is correct.
Would it be possible to remove all quotes in the description text (or replace them), before passing it to the post-processor?

    (1-8/8)