Thread: BASH: Problem capturing output from cfv
hey
migrated kde gnome, , wanted make of of awesome nautilus-commands app integrate sfv creation context menu entries nautilus, using cfv workhorse underneath.
i've done konqueror previously, started background bash script opened kdialog in end results. time i'd little more awesome, i'm using zenity first allow me select type of checksum want (using --radiolist), select filename checksum file (--file-selection), , next part capture progress output cfv , feed zenity's --progress dialog.
enter pipe hell. cannot figure out how capture progress output cfv. wanted capture filename being processed , progress (which represented, don't know cfv, twenty characters, "####\..............." - backslash here "spinner" made -, \, |, , / alternating give constant feedback user. #s show current progress , .s show what's left processed.
okay, assembled (not pretty, functional) sed command can convert these lines lines can fed zenity, e.g. "# /home/daniel/testfile.tar.bz2\n15\n", thing cannot make output make sed. did lot of attempts , lot of googling (which pretty difficult, considering how many "false positive" results searching stuff ).
gave on output, figuring because of cursor control codes screwing pipe, due way progress being written out tty.
decided skip progress , make cfv verbose output without progress bar, means after each file has finished processing, it'll print out line this,
and i'm getting stomped, because cannot capture either. output disappears visible shell, sort of redirection going on, i've found can't @ of lines until cfv finished or killed.code:/batch1/batch1.sfv : ok (f83db1e8)
example. triggering in terminal window #1:
then, terminal window #2:code:$ touch pipe
back #1:code:$ tail -f pipe
in #2, immediately:code:$ cfv --progress no -v -rr -l -c -p ./ -t sfv -f tistest.sfv * 2>&1 > pipe
in #1 there no output shell, ctrl-c kill cfv, , after while (once has finished file working on when sent ^c, assume):code:tail: pipe: file truncated
and then, bang, in shell #2, output @ once:code:^ctraceback (most recent call last): file "/usr/bin/cfv", line 3, in <module> cfv.main() file "/usr/lib/pymodules/python2.6/cfv.py", line 2465, in main make(cftypes[typename],a,args) file "/usr/lib/pymodules/python2.6/cfv.py", line 2196, in make (filecrc,filesize),dat = dof(f) file "/usr/lib/pymodules/python2.6/cfv.py", line 1698, in make_addfile crc=hexlify(getfilecrc(filename)[0]) file "/usr/lib/pymodules/python2.6/cfv.py", line 355, in getfilecrc finfo['crc'],finfo['size'] = _getfilecrc(file) file "/usr/lib/pymodules/python2.6/cfv.py", line 726, in _getfilecrc return _getfilechecksum(file, crc32) file "/usr/lib/pymodules/python2.6/cfv.py", line 664, in _getfilechecksum m = hasher(dommap(f.fileno(), mmapsize)) file "/usr/lib/pymodules/python2.6/cfv.py", line 716, in __init__ self.value = _crc32(s) keyboardinterrupt
i'm puzzled this. seems if piped output buffered until cfv has finished, don't know why. mean, these individual lines, there must newline characters here, right? , isn't nature of piping can pick each line comes through? missing fundamental here?code:./$recycle.bin/s-1-5-21-1154372438-3869228711-277597537-1001/$id8rnsi.srt : ok (95afdca4) ./$recycle.bin/s-1-5-21-1154372438-3869228711-277597537-1001/$rd8rnsi.srt : ok (45960c1b) ./$recycle.bin/s-1-5-21-1154372438-3869228711-277597537-1001/desktop.ini : ok (b2f9f22e) ./$recycle.bin/s-1-5-21-1732984049-2036620335-315254517-1001/desktop.ini : ok (b2f9f22e) ./$recycle.bin/s-1-5-21-4277130658-3462654387-2601481779-1001/desktop.ini : ok (b2f9f22e) ./$recycle.bin/s-1-5-21-576843801-2688154282-3896425139-1000/desktop.ini : ok (b2f9f22e) ./$recycle.bin/s-1-5-21-576843801-2688154282-3896425139-500/desktop.ini : ok (b2f9f22e) ./batch1/batch1.sfv : ok (f83db1e8) ./batch1/sda1.ddimg : ok (18135beb)
hope has insight, because i'd script work
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk BASH: Problem capturing output from cfv
Ubuntu
Comments
Post a Comment