decoder-snd.c
branchtrunk
changeset 34 afc13760179b
parent 29 640ce9201139
equal deleted inserted replaced
33:65ed49cbc08b 34:afc13760179b
   577 }
   577 }
   578 
   578 
   579 bool cCDDBDisc::Split(const char *source, char div, char * &first, char * &second, bool only3)
   579 bool cCDDBDisc::Split(const char *source, char div, char * &first, char * &second, bool only3)
   580 {
   580 {
   581   int pos=-1, n=0;
   581   int pos=-1, n=0;
   582   char *p, l[4]={ ' ',div,' ',0 };
   582   const char *p;
       
   583   char l[4]={ ' ',div,' ',0 };
   583   if ((p=strstr(source,l))) { pos=p-source; n=3; }
   584   if ((p=strstr(source,l))) { pos=p-source; n=3; }
   584   else if(!only3 && (p=strchr(source,div)))  { pos=p-source; n=1; }
   585   else if(!only3 && (p=strchr(source,div)))  { pos=p-source; n=1; }
   585   if(pos>=0) {
   586   if(pos>=0) {
   586     free(first); first=strdup(source); first[pos]=0; compactspace(first);
   587     free(first); first=strdup(source); first[pos]=0; compactspace(first);
   587     free(second); second=strdup(source+pos+n); compactspace(second);
   588     free(second); second=strdup(source+pos+n); compactspace(second);
   858 
   859 
   859 bool cSndInfo::CDDBLookup(const char *filename)
   860 bool cSndInfo::CDDBLookup(const char *filename)
   860 {
   861 {
   861   if(id->Get()) {
   862   if(id->Get()) {
   862     int tr;
   863     int tr;
   863     char *s=strstr(filename,CDFS_TRACK);
   864     const char *s=strstr(filename,CDFS_TRACK);
   864     if(s && sscanf(s+strlen(CDFS_TRACK),"%d",&tr)==1) {
   865     if(s && sscanf(s+strlen(CDFS_TRACK),"%d",&tr)==1) {
   865       d(printf("snd: looking up disc id %08x track %d\n",id->discid,tr))
   866       d(printf("snd: looking up disc id %08x track %d\n",id->discid,tr))
   866       return cddb.Lookup(id,tr-1,this);
   867       return cddb.Lookup(id,tr-1,this);
   867       }
   868       }
   868     }
   869     }