Hi, (first of all, I would have prefered to go through the bugzilla to report this but it seems that bugzilla.gnome.org is not available at the moment). I noticed that when copying a bunch of tracks from the library to my ipod, if there weren't enough space on the ipod rhythmobx (version 0.12.5 as well as git HEAD) would just happily transfer the files until an I/O error occurs. This particularly problematic for IPods since it leaves incomplete files on the device and the database in a sorry state (e.g. gtkpod can detect orphaned tracks or even a corrupted database if there weren't enough space to save it). The situation can also arise with other devices. I attach the following proof of concept patch (against git master) which corrects this behaviour for all removable devices. I took the simple approach of checking that the size of all tracks to be copied is less than the available space on the destination and abort the copy if this isn't the case (the user is warned with a rb_error_dialog). This approach seems to cover 90% of the use cases but has some problems. 1) It checks the size of the original file, which means that this can be innacurate in case of transcoding. If transcoding occurs and the transcoded files are bigger than the original one there is still a problem. 2) It only works for RHYTHMDB_ENTRY_NORMAL at the moment, I don't really know if it's possible to copy a stream to a removable device, and don't cover this case. Obviously a better approach would be to do this per track but warning the user for each track is cumbersome. So a better way would be: - For each track check (after transcoding) that the remaining size is more than the track size. - if it's not, abort and maybe ask the user if (s)he wants to remove the tracks that where added during the operation (as a user I don't like to have half albums on my player but that's a matter of taste I guess, one can always manually remove half finished albums). I did not implement this for the moment since it seems that rb transcodes directly to the destination device (see rb-removable-media-manager.c/do_transfer). It seems more robust to transcode to /tmp and then copy the track to the device. If this solution is prefered, I can cook up the patch implementing it. Best, -- Kim
Attachment:
check_available_space_before_copying_tracks_to_removable_device.patch
Description: Binary data