~ubuntu-branches/debian/sid/grip/sid

« back to all changes in this revision

Viewing changes to debian/patches/02-empty-m3u.dpatch

  • Committer: Package Import Robot
  • Author(s): Tiago Ilieve
  • Date: 2016-04-04 14:26:23 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20160404142623-zw16rooy7z3xadvu
Tags: 4.1.0-1
Initial release (Closes: #790611)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh /usr/share/dpatch/dpatch-run
2
 
## 02-empty-m3u.dpatch by Taku YASUI <tach@debian.or.jp>
3
 
##
4
 
## DP: Fix: empty .m3u files left around if "rip whole CD?" dialog
5
 
## DP: (closes: #179878)
6
 
 
7
 
@DPATCH@
8
 
 
9
 
diff -Naur grip-3.3.1.orig/src/rip.c grip-3.3.1/src/rip.c
10
 
--- grip-3.3.1.orig/src/rip.c   2005-06-25 18:00:55.000000000 +0000
11
 
+++ grip-3.3.1/src/rip.c        2006-07-29 08:02:31.000000000 +0000
12
 
@@ -636,6 +636,31 @@
13
 
   return TRUE;
14
 
 }
15
 
 
16
 
+void RemoveM3U(GripInfo *ginfo)
17
 
+{
18
 
+  FILE *fp;
19
 
+  EncodeTrack enc_track;
20
 
+  char testchar;
21
 
+  GString *str;
22
 
+
23
 
+  if (!ginfo->have_disc) return;
24
 
+
25
 
+  str=g_string_new(NULL);
26
 
+
27
 
+  FillInTrackInfo(ginfo, 0, &enc_track);
28
 
+  TranslateString(ginfo->m3ufileformat, str, TranslateSwitch,
29
 
+                 &enc_track, TRUE, &(ginfo->sprefs));
30
 
+
31
 
+  fp=fopen(str->str, "r");
32
 
+  if (fp==NULL)
33
 
+    return;
34
 
+  testchar = fgetc(fp);
35
 
+  fclose(fp);
36
 
+  if (testchar == EOF)
37
 
+    remove(str->str);
38
 
+  return;
39
 
+}
40
 
+
41
 
 void KillRip(GtkWidget *widget,gpointer data)
42
 
 {
43
 
   GripInfo *ginfo;
44
 
@@ -1341,7 +1366,10 @@
45
 
   int track;
46
 
   GripInfo *ginfo;
47
 
 
48
 
-  if(reply) return;
49
 
+  if(reply) {
50
 
+    RemoveM3U((GripInfo *) data);
51
 
+    return;
52
 
+  }
53
 
 
54
 
   Debug(_("Ripping whole CD\n"));
55