getdiscid.pp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {
  2. Copyright (c) 1999-2000 by Michael Van Canneyt
  3. Demonstrates DiscID unit usage.
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. program getdiscid;
  11. uses cdrom,discid;
  12. Var
  13. TheDiscID : cardinal;
  14. Tracks, i : Integer;
  15. Entries : Array[1..100] of TTocEntry;
  16. Device : string;
  17. begin
  18. Case ParamCount of
  19. 0 : Device:='/dev/cdrom';
  20. 1 : Device:=Paramstr(1);
  21. else
  22. Writeln('Usage: getdiscid [devicefile]');
  23. halt(1);
  24. end;
  25. Tracks := ReadCDTOC(Device,Entries);
  26. If Tracks<0 then
  27. Writeln('Error reading TOC of device ',device)
  28. else
  29. begin
  30. Writeln('Disk has ',tracks,' tracks.');
  31. TheDiscID := CDDBDiscID(Entries,Tracks);
  32. Writeln('Disc ID : ',lowercase(HexStr(theDiscID,8)));
  33. Writeln('CDDB Query : ',GetCDDBQueryString(Entries,Tracks));
  34. end;
  35. end.