a progress report while copying from the DVD is missing

Bug #537690 reported by flipflip
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dvdbackup
Fix Released
Wishlist
Unassigned

Bug Description

The attached patch against dvdbackup-0.4.1 adds a --progress|-p flag, which will enable a progress report ("xx% done, x/y MiB") while copying from the DVD in DVDCopyBlocks().

Related branches

Revision history for this message
flipflip (flipflip) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thanks for the patch. At a glance it looks good.
One feature I like to see: Update the status line in a VT compliant terminal.

Revision history for this message
flipflip (flipflip) wrote :

I don't understand. Do you like to see some sort of abstraction that can handle the "\r" stuff in every terminal? Curses? Wouldn't "\r" work in every terminal?

Revision history for this message
Benjamin Drung (bdrung) wrote :

I didn't test your patch and wasn't aware that "\r" does exactly what I wanted.

Changed in dvdbackup:
assignee: nobody → Benjamin Drung (bdrung)
Benjamin Drung (bdrung)
Changed in dvdbackup:
assignee: Benjamin Drung (bdrung) → nobody
assignee: nobody → Benjamin Drung (bdrung)
status: New → Fix Committed
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thanks for the patch. I have modified it slightly (modified patch attached) and applied it in bzr revision 73.
* Mention the new switch in the man page.
* Convert spaces to tabs and change the coding style to my preferences.
* print progress on stdout instead of stderr
* simplified calculation to totalMiB = (float)(total) / 512.0f;

Changed in dvdbackup:
assignee: Benjamin Drung (bdrung) → nobody
importance: Undecided → Wishlist
Revision history for this message
flipflip (flipflip) wrote :

Great!

We should probably add some code that detects if we're running in an interactive terminal or not. If we're running from a script or a GUI frontend we should probably not use "\r" but rather print a full line for each progress update. I think isatty() can do the detection. I have local modified version that uses this but I didn't have much time to test it.

What do you think?

Revision history for this message
Benjamin Drung (bdrung) wrote :

Do we need this? I ran "dvdbackup -pM > log" and log contains one line per progress update.

It would be nice to have an overall status.

Revision history for this message
flipflip (flipflip) wrote :

I think a GUI would use a line oriented input (fgets(), $foo = <STDIN>, etc.) to get the output of dvdbackup. And that would block until a \n is received.

What if you

cat log

One line or many lines? Isn't your reader (less?) assuming a DOS file and translating \r to \n?

Revision history for this message
Benjamin Drung (bdrung) wrote :

"cat log" outputs only one line. So you are right. I used gedit (less show ^M and no new lines).

It would be nice to have a detection. Patches are welcome ;) You may want to open a new bug report then.

Benjamin Drung (bdrung)
Changed in dvdbackup:
milestone: none → 0.4.2
Benjamin Drung (bdrung)
Changed in dvdbackup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.