diff sidinfo.c @ 163:179ffe97599c

Implement support for the "new" MD5 format of SLDB.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 16 Feb 2018 22:07:19 +0200
parents 58fe784a6e48
children 9cc9ce46f4a0
line wrap: on
line diff
--- a/sidinfo.c	Fri Feb 16 21:24:28 2018 +0200
+++ b/sidinfo.c	Fri Feb 16 22:07:19 2018 +0200
@@ -14,7 +14,7 @@
 
 // Some constants
 #define SET_DEF_CHARSET   "utf-8"
-#define SET_SLDB_FILENAME "Songlengths.txt"
+#define SET_SLDB_FILENAME "Songlengths.md5"
 
 
 enum
@@ -94,7 +94,8 @@
 // Option variables
 char   *setHVSCPath = NULL,
        *setSLDBPath = NULL;
-BOOL	optParsable = FALSE,
+BOOL	setSLDBNewFormat = FALSE,
+        optParsable = FALSE,
         optNoNamePrefix = FALSE,
         optHexadecimal = FALSE,
         optOneLine = FALSE,
@@ -892,7 +893,7 @@
     }
 
     // Read PSID data
-    if (si_read_sid_file(inFile, &psid) != 0)
+    if (!si_read_sid_file(inFile, &psid, setSLDBNewFormat))
     {
         THERR("Error reading %s\n", filename);
         goto error;
@@ -1027,6 +1028,8 @@
             goto err;
         }
 
+        setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL;
+
 err:
         th_io_close(inFile);
     }