diff src/filewriter/filewriter.c @ 1687:d158ce84fda7

Modified for Tuplez/plugin API changes.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2007 09:29:26 +0300
parents 25ea2127eefa
children 62e89e392227
line wrap: on
line diff
--- a/src/filewriter/filewriter.c	Wed Sep 05 07:38:21 2007 +0300
+++ b/src/filewriter/filewriter.c	Wed Sep 05 09:29:26 2007 +0300
@@ -189,6 +189,7 @@
 static gint file_open(AFormat fmt, gint rate, gint nch)
 {
     gchar *filename = NULL, *temp = NULL;
+    const gchar *directory;
     gint pos;
     gint rv;
     Playlist *playlist;
@@ -228,7 +229,7 @@
     }
     if (filename == NULL)
     {
-        filename = g_strdup(tuple_get_string(tuple, "file-name"));
+        filename = g_strdup(tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
         if (!use_suffix)
             if ((temp = strrchr(filename, '.')) != NULL)
                 *temp = '\0';
@@ -239,10 +240,8 @@
 
     if (prependnumber)
     {
-        gint number;
-        if (tuple && tuple_get_int(tuple, "track-number"))
-            number = tuple_get_int(tuple, "track-number");
-        else
+        gint number = tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL);
+        if (!tuple || !number)
             number = pos + 1;
 
         temp = g_strdup_printf("%.02d %s", number, filename);
@@ -250,15 +249,13 @@
         filename = temp;
     }
 
-    gchar *directory;
     if (save_original)
-        directory = g_strdup(tuple_get_string(tuple, "file-path"));
+        directory = tuple_get_string(tuple, FIELD_FILE_PATH, NULL);
     else
-        directory = g_strdup(file_path);
+        directory = file_path;
 
     temp = g_strdup_printf("file://%s/%s.%s",
                            directory, filename, fileext_str[fileext]);
-    g_free(directory);
     g_free(filename);
     filename = temp;