diff src/xs_length.c @ 39:85a7753e2a9a

Lots of new code
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 Jun 2003 20:49:01 +0000
parents 271be59be975
children 1788f4ce6a44
line wrap: on
line diff
--- a/src/xs_length.c	Thu Jun 19 20:48:04 2003 +0000
+++ b/src/xs_length.c	Thu Jun 19 20:49:01 2003 +0000
@@ -20,11 +20,9 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
-#include "xmms-sid.h"
+#include "xs_length.h"
 #include "xs_support.h"
-#include "xs_length.h"
 #include "xs_config.h"
-#include "xs_md5.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -324,12 +322,12 @@
  gint i;
  
  /* Read the database */
- if (xs_cfg.playDBPath == NULL)
+ if (xs_cfg.songlenDBPath == NULL)
  	return -10;
 
-fprintf(stderr, "reading '%s'\n", xs_cfg.playDBPath);
+fprintf(stderr, "reading '%s'\n", xs_cfg.songlenDBPath);
 
- if (xs_db_read(xs_cfg.playDBPath, &xs_database) < 0)
+ if (xs_db_read(xs_cfg.songlenDBPath, &xs_database) < 0)
  	return -9;
 
 fprintf(stderr, "read_done, now size DB for index\n");
@@ -563,9 +561,8 @@
 
  iResult = -1;
  
- switch (xs_cfg.playMethod) {
-
-  case XMMS_SID_PMETHOD_DATABASE:
+ if (xs_cfg.songlenDBEnable)
+	{
 	/* Get the hash and then look up from db */
 	if (xs_get_sid_hash(fileName, dbHash) == 0)
 		{
@@ -577,26 +574,11 @@
 				iResult = dbEntry->sLengths[subTune];
   			}
   		}
-  	break;
-
-  case XMMS_SID_PMETHOD_MAXSILENCE:
-  case XMMS_SID_PMETHOD_NONE:
-	iResult = -1;
-	break;
-
-  default:
-	XSERR("Invalid play-method! (%d, unknown)\n", xs_cfg.playMethod);
-	break;
- }
+	}
 
  /* Check for max playtime */
- if (iResult == -1)
- 	{
-	if (xs_cfg.playUseMaxTime)
-		iResult = xs_cfg.playMaxTime;
-		else
-		iResult = -1;
- 	}
+ if ((iResult == -1) && xs_cfg.playMaxTimeEnable)
+	iResult = xs_cfg.playMaxTime;
  
  XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult);