summaryrefslogtreecommitdiff
blob: 80026e5f63a799635a90056692c2f88dbdec0ea6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Index: src/sj-main.c
===================================================================
--- src/sj-main.c	(revision 2168)
+++ src/sj-main.c	(working copy)
@@ -1576,12 +1576,13 @@
   GnomeProgram *program;
   GError *error = NULL;
   GtkTreeSelection *selection;
-  char *device = NULL;
+  char *device = NULL, **uris = NULL;
   GOptionContext *ctx;
   const GOptionEntry entries[] = {
     { "auto-start", 'a', 0, G_OPTION_ARG_NONE, &autostart, N_("Start extracting immediately"), NULL },
     { "play", 'p', 0, G_OPTION_ARG_NONE, &autoplay, N_("Start playing immediately"), NULL},
     { "device", 'd', 0, G_OPTION_ARG_FILENAME, &device, N_("What CD device to read"), N_("DEVICE") },
+    { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &uris, N_("URI to the CD device to read"), NULL },
     { NULL }
   };
 
@@ -1803,10 +1804,26 @@
   eject_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_EJECT, NULL, TRUE, NULL), NULL);
   open_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_OPEN, NULL, TRUE, NULL), NULL);
   audio_volume_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_AUDIO_VOLUME, NULL, TRUE, NULL), NULL);
-  if (device == NULL) {
+  if (device == NULL && uris == NULL) {
     device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), GINT_TO_POINTER (TRUE));
   } else {
-    set_device (device, TRUE);
+    if (device)
+      set_device (device, TRUE);
+    else {
+      char *d;
+
+      /* Mash up the CDDA URIs into a device path */
+      if (g_str_has_prefix (uris[0], "cdda://")) {
+        guint len;
+        d = g_strdup_printf ("/dev/%s", uris[0] + strlen ("cdda://"));
+        len = strlen (d);
+        d[len - 1] = '\0';
+	set_device (d, TRUE);
+	g_free (d);
+      } else {
+        device_changed_cb (gconf_client, -1, gconf_client_get_entry (gconf_client, GCONF_DEVICE, NULL, TRUE, NULL), GINT_TO_POINTER (TRUE));
+      }
+    }
   }
 
   if (sj_extractor_supports_encoding (&error) == FALSE) {
Index: data/sound-juicer.desktop.in.in
===================================================================
--- data/sound-juicer.desktop.in.in	(revision 2168)
+++ data/sound-juicer.desktop.in.in	(working copy)
@@ -2,7 +2,7 @@
 Encoding=UTF-8
 _Name=Audio CD Extractor
 _Comment=Copy music from your CDs
-Exec=sound-juicer
+Exec=sound-juicer %u
 Icon=sound-juicer
 StartupNotify=true
 MimeType=x-content/audio-cdda;