[banshee] [AudioCdRipper] Don't overwrite existing files when ripping (bgo#540394)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [AudioCdRipper] Don't overwrite existing files when ripping (bgo#540394)
- Date: Mon, 29 Nov 2010 20:39:13 +0000 (UTC)
commit fa577357e1cf1ccbc2e478ec6e28de1bcb846cff
Author: Olivier Dufour <olivier duff gmail com>
Date: Fri Nov 5 18:18:50 2010 +0100
[AudioCdRipper] Don't overwrite existing files when ripping (bgo#540394)
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
.../Banshee.GStreamer/AudioCdRipper.cs | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
index a9fd24a..d5d2dcc 100644
--- a/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
+++ b/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
@@ -142,6 +142,13 @@ namespace Banshee.GStreamer
using (TagList tags = new TagList (track)) {
output_path = String.Format ("{0}.{1}", outputUri.LocalPath, output_extension);
+
+ // Avoid overwriting an existing file
+ int i = 1;
+ while (Banshee.IO.File.Exists (new SafeUri (output_path))) {
+ output_path = String.Format ("{0} ({1}).{2}", outputUri.LocalPath, i++, output_extension);
+ }
+
Log.DebugFormat ("GStreamer ripping track {0} to {1}", trackIndex, output_path);
br_rip_track (handle, trackIndex + 1, output_path, tags.Handle, out taggingSupported);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]