getdiscid.pp 1.2 KB

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