Author Topic: [VB.net] Noob problem with freedb.org data  (Read 9876 times)

Ben87

  • Posts: 5
Hello,

i use this code to get the CDDB information:

Code: [Select]
Dim CDDB As String
        Dim i As Integer = 0
        CDDB = BassCd.BASS_CD_GetID(drive, BASSCDId.BASS_CDID_CDDB_READ_CACHE) 'first look for cached entry
        If CDDB = Nothing Then
            CDDB = BassCd.BASS_CD_GetID(drive, BASSCDId.BASS_CDID_CDDB_QUERY) 'get CDDB matches
            CDDB = BassCd.BASS_CD_GetID(drive, BASSCDId.BASS_CDID_CDDB_READ + i) 'get CDDB entry
        End If

My problem is, i don't get any title, artist or album information. :(
How can i do this? I want the artist, title and album information to show in a listview.
Has someone an example source for me, please?

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: [VB.net] Noob problem with freedb.org data
« Reply #1 on: 8 Aug '12 - 16:53 »
Please confirm what each of those BASS_CD_GetID calls is returning and what their error codes are (use BASS_ErrorGetCode to get the error code after each BASS_CD_GetID call).

Ben87

  • Posts: 5
Re: [VB.net] Noob problem with freedb.org data
« Reply #2 on: 8 Aug '12 - 17:12 »
Hello,

i get no errors from BASS_ErrorGetCode. I get this :

Code: [Select]
210 misc 0610bd14 CD database entry follows (until terminating `.')
# xmcd
#
# Track frame offsets:
#        150
#        18427
#        35629
#        53150
#        68374
#        84192
#        96775
#        112222
#        127782
#        143381
#        157734
#        172976
#        186549
#        202992
#        216389
#        233280
#        252442
#        273923
#        288930
#        304762
#
# Disc length: 4287 seconds
#
# Revision: 1
# Processed by: cddbd v1.5.2PL0 Copyright (c) Steve Scherf et al.
# Submitted via: ExactAudioCopy v1.0b3
#
DISCID=0610bd14
DTITLE=Diverse / RTL - Sommerhits 2012 CD 2
DYEAR=2012
DGENRE=Pop
TTITLE0=David Guetta FEAT: sia / Titanium
TTITLE1=Sean Paul / She Doesen't Mind
TTITLE2=Flo Rida / Wild Ones
TTITLE3=Olly Murs Feat. Rizzle Kicks / Heart Skips A Beat
TTITLE4=Oceana / Endless Summer
TTITLE5=Mike Candys / 2012 ( If The World would End )
TTITLE6=Guru Josh / Infinity 2012
TTITLE7=R.I.O. / Party Shaker
TTITLE8=Darius & Finlay / Do It All Night 2k12
TTITLE9=DJ Antoine / Ma Cherie
TTITLE10=Project B. Feat. Kelly Rowland / Summerdreaming 2012
TTITLE11=Loreen / Euphoria
TTITLE12=Mandinga / Zaleilah
TTITLE13=Djane Housecat / My Party
TTITLE14=Remady & Manu - L / Single Ladies
TTITLE15=Martin Solveig / The Night Out
TTITLE16=Bob Sinclar & Fatman Scoop / Rock The Beat
TTITLE17=Timomatic / Set It Off
TTITLE18=Breathe Carolina / Blackout
TTITLE19=Luca Hänni / Don't Think about Me
EXTD=
EXTT0=
EXTT1=
EXTT2=
EXTT3=
EXTT4=
EXTT5=
EXTT6=
EXTT7=
EXTT8=
EXTT9=
EXTT10=
EXTT11=
EXTT12=
EXTT13=
EXTT14=
EXTT15=
EXTT16=
EXTT17=
EXTT18=
EXTT19=
PLAYORDER=
.

but i only need this:

Code: [Select]
David Guetta FEAT: sia / Titanium
Sean Paul / She Doesen't Mind
Flo Rida / Wild Ones
Olly Murs Feat. Rizzle Kicks / Heart Skips A Beat
Oceana / Endless Summer
Mike Candys / 2012 ( If The World would End )
Guru Josh / Infinity 2012
R.I.O. / Party Shaker
Darius & Finlay / Do It All Night 2k12
DJ Antoine / Ma Cherie
Project B. Feat. Kelly Rowland / Summerdreaming 2012
Loreen / Euphoria
Mandinga / Zaleilah
Djane Housecat / My Party
Remady & Manu - L / Single Ladies
Martin Solveig / The Night Out
Bob Sinclar & Fatman Scoop / Rock The Beat
Timomatic / Set It Off
Breathe Carolina / Blackout
Luca Hänni / Don't Think about Me

Is there no function in Bass to get only the track infos?
If not, how can i do this?

Thank you
« Last Edit: 8 Aug '12 - 17:26 by Ben87 »

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: [VB.net] Noob problem with freedb.org data
« Reply #3 on: 9 Aug '12 - 18:01 »
BASS_CD_GetID returns the CDDB server's response as is, and you can then extract the information that you want from it. I'm not sure if there is currently any example .Net code available for this, but you could have a look at the CDTEST.C example that's included in the BASSCD package, eg. here's how it looks for a track title in the CDDB info...

Code: [Select]
int taglen=sprintf(tag, "TTITLE%d=", a); // the CDDB tag to look for
const char *t=strstr(cddb, tag);
if (t) { // found it
char *e=strpbrk(t+taglen, "\r\n"); // get end of line
if (e) sprintf(text,"%.*s", e-(t+taglen), t+taglen);
}

Ben87

  • Posts: 5
Re: [VB.net] Noob problem with freedb.org data
« Reply #4 on: 10 Aug '12 - 12:16 »
Yes I know the example. The problem is, there is no vb.net equivalent for: sprintf, strstr, strpbrk :(

Ian @ un4seen

  • Administrator
  • Posts: 21016
Re: [VB.net] Noob problem with freedb.org data
« Reply #5 on: 10 Aug '12 - 16:28 »
I'm not a VB.Net user myself, so I'm afraid I can't give a code example for that, but you can probably replace the "strstr" call with "IndexOf" and the final "sprintf" line with "Substring"...

   http://msdn.microsoft.com/en-us/library/system.string.indexof.aspx
   http://msdn.microsoft.com/en-us/library/system.string.substring.aspx

You could probably use "IndexOf" to implement the "strpbrk" line too.

Ben87

  • Posts: 5
Re: [VB.net] Noob problem with freedb.org data
« Reply #6 on: 11 Aug '12 - 16:20 »
Thank you very much! With your help it works now.