Mercurial > hg > sidinfo
comparison 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 |
comparison
equal
deleted
inserted
replaced
162:7359170fbb7f | 163:179ffe97599c |
---|---|
12 #endif | 12 #endif |
13 | 13 |
14 | 14 |
15 // Some constants | 15 // Some constants |
16 #define SET_DEF_CHARSET "utf-8" | 16 #define SET_DEF_CHARSET "utf-8" |
17 #define SET_SLDB_FILENAME "Songlengths.txt" | 17 #define SET_SLDB_FILENAME "Songlengths.md5" |
18 | 18 |
19 | 19 |
20 enum | 20 enum |
21 { | 21 { |
22 OFMT_QUOTED = 0x0001, | 22 OFMT_QUOTED = 0x0001, |
92 | 92 |
93 | 93 |
94 // Option variables | 94 // Option variables |
95 char *setHVSCPath = NULL, | 95 char *setHVSCPath = NULL, |
96 *setSLDBPath = NULL; | 96 *setSLDBPath = NULL; |
97 BOOL optParsable = FALSE, | 97 BOOL setSLDBNewFormat = FALSE, |
98 optParsable = FALSE, | |
98 optNoNamePrefix = FALSE, | 99 optNoNamePrefix = FALSE, |
99 optHexadecimal = FALSE, | 100 optHexadecimal = FALSE, |
100 optOneLine = FALSE, | 101 optOneLine = FALSE, |
101 optFieldOutput = TRUE; | 102 optFieldOutput = TRUE; |
102 char *optFieldSep = NULL; | 103 char *optFieldSep = NULL; |
890 THERR("Could not open file '%s'.\n", filename); | 891 THERR("Could not open file '%s'.\n", filename); |
891 goto error; | 892 goto error; |
892 } | 893 } |
893 | 894 |
894 // Read PSID data | 895 // Read PSID data |
895 if (si_read_sid_file(inFile, &psid) != 0) | 896 if (!si_read_sid_file(inFile, &psid, setSLDBNewFormat)) |
896 { | 897 { |
897 THERR("Error reading %s\n", filename); | 898 THERR("Error reading %s\n", filename); |
898 goto error; | 899 goto error; |
899 } | 900 } |
900 | 901 |
1025 THERR("Error building SLDB index: %d, %s.\n", | 1026 THERR("Error building SLDB index: %d, %s.\n", |
1026 ret, th_error_str(ret)); | 1027 ret, th_error_str(ret)); |
1027 goto err; | 1028 goto err; |
1028 } | 1029 } |
1029 | 1030 |
1031 setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL; | |
1032 | |
1030 err: | 1033 err: |
1031 th_io_close(inFile); | 1034 th_io_close(inFile); |
1032 } | 1035 } |
1033 | 1036 |
1034 // Process files | 1037 // Process files |