Mercurial > hg > xmms-sid
comparison 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 |
comparison
equal
deleted
inserted
replaced
38:dec37e16136e | 39:85a7753e2a9a |
---|---|
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with this program; if not, write to the Free Software | 19 along with this program; if not, write to the Free Software |
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "xmms-sid.h" | 23 #include "xs_length.h" |
24 #include "xs_support.h" | 24 #include "xs_support.h" |
25 #include "xs_length.h" | |
26 #include "xs_config.h" | 25 #include "xs_config.h" |
27 #include "xs_md5.h" | |
28 #include <stdlib.h> | 26 #include <stdlib.h> |
29 #include <stdio.h> | 27 #include <stdio.h> |
30 #include <ctype.h> | 28 #include <ctype.h> |
31 #include <string.h> | 29 #include <string.h> |
32 | 30 |
322 { | 320 { |
323 t_xs_dbentry *pCurr; | 321 t_xs_dbentry *pCurr; |
324 gint i; | 322 gint i; |
325 | 323 |
326 /* Read the database */ | 324 /* Read the database */ |
327 if (xs_cfg.playDBPath == NULL) | 325 if (xs_cfg.songlenDBPath == NULL) |
328 return -10; | 326 return -10; |
329 | 327 |
330 fprintf(stderr, "reading '%s'\n", xs_cfg.playDBPath); | 328 fprintf(stderr, "reading '%s'\n", xs_cfg.songlenDBPath); |
331 | 329 |
332 if (xs_db_read(xs_cfg.playDBPath, &xs_database) < 0) | 330 if (xs_db_read(xs_cfg.songlenDBPath, &xs_database) < 0) |
333 return -9; | 331 return -9; |
334 | 332 |
335 fprintf(stderr, "read_done, now size DB for index\n"); | 333 fprintf(stderr, "read_done, now size DB for index\n"); |
336 | 334 |
337 /* Get size of db */ | 335 /* Get size of db */ |
561 t_xs_md5hash dbHash; | 559 t_xs_md5hash dbHash; |
562 gint32 iResult; | 560 gint32 iResult; |
563 | 561 |
564 iResult = -1; | 562 iResult = -1; |
565 | 563 |
566 switch (xs_cfg.playMethod) { | 564 if (xs_cfg.songlenDBEnable) |
567 | 565 { |
568 case XMMS_SID_PMETHOD_DATABASE: | |
569 /* Get the hash and then look up from db */ | 566 /* Get the hash and then look up from db */ |
570 if (xs_get_sid_hash(fileName, dbHash) == 0) | 567 if (xs_get_sid_hash(fileName, dbHash) == 0) |
571 { | 568 { |
572 dbEntry = xs_db_get(dbHash); | 569 dbEntry = xs_db_get(dbHash); |
573 | 570 |
575 { | 572 { |
576 if ((subTune >= 0) && (subTune < dbEntry->nLengths)) | 573 if ((subTune >= 0) && (subTune < dbEntry->nLengths)) |
577 iResult = dbEntry->sLengths[subTune]; | 574 iResult = dbEntry->sLengths[subTune]; |
578 } | 575 } |
579 } | 576 } |
580 break; | 577 } |
581 | |
582 case XMMS_SID_PMETHOD_MAXSILENCE: | |
583 case XMMS_SID_PMETHOD_NONE: | |
584 iResult = -1; | |
585 break; | |
586 | |
587 default: | |
588 XSERR("Invalid play-method! (%d, unknown)\n", xs_cfg.playMethod); | |
589 break; | |
590 } | |
591 | 578 |
592 /* Check for max playtime */ | 579 /* Check for max playtime */ |
593 if (iResult == -1) | 580 if ((iResult == -1) && xs_cfg.playMaxTimeEnable) |
594 { | 581 iResult = xs_cfg.playMaxTime; |
595 if (xs_cfg.playUseMaxTime) | |
596 iResult = xs_cfg.playMaxTime; | |
597 else | |
598 iResult = -1; | |
599 } | |
600 | 582 |
601 XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult); | 583 XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult); |
602 | 584 |
603 return iResult; | 585 return iResult; |
604 } | 586 } |