forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


detect media CD-DVD

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Mon Mar 16, 2009 2:15 am    Post subject: detect media CD-DVD Reply with quote

Hi, is there any way to detect if the media disc inserted in the DVD unit is an Audio CD, Data CD, Video DVD, Data DVD, etc?

thanks a lot

Marcelo
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Mar 17, 2009 12:54 am    Post subject: Reply with quote

I believe the only option is to look at the files on the CD.
*.CDA for Audio
VIDEO_TS folder for DVD
and if its not either of those it would probably be data.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Tue Mar 17, 2009 12:29 pm    Post subject: Reply with quote

Good idea!!!!
Very smart!!!
I think something like this will work...

Code:

parse "%D;%%F;%S",@file(D:\*.CDA,FTZ) 
   if @not(%F) 
      info Not Audio CD
   else
      if @not(@equal(%S,44))
         info Not Audio CD
      end
   end


any better idea?
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Mar 17, 2009 5:26 pm    Post subject: Reply with quote

Code:

LOADLIB kernel32.dll
%%drive = D

REM Prevent Windows messagebox telling user to insert Disk if there is none.
REM $01 = SEM_FAILCRITICALERRORS
%p = @lib(kernel32,SetErrorMode,INT:,$01)

if @greater(@volinfo(%%drive,S),0)
  REM Turn ErrorMode back to default.
  %p = @lib(kernel32,SetErrorMode,INT:,$00)
  REM Check for Audio Tracks
  %%CDA = @file(%%drive:\*.cda,F)
  REM Check for DVD Video folder
  %%VTS = @file(%%drive:\VIDEO_TS,D)
  REM Make sure there are files on the CD
  %%Data = @file(%%drive:\*.*,F)
else
  REM Turn ErrorMode back to default.
  %p = @lib(kernel32,SetErrorMode,INT:,$00)
  REM No Disc in Drive
  info No Disc in Drive %%drive.
  exit
end
   
if %%CDA
  info Audio CD.
elsif %%VTS
  info DVD
elsif %%data
  info Mixed Data.
end

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Tue Mar 17, 2009 9:41 pm    Post subject: Reply with quote

Great code!!
But, @volinfo(%%drive,S) allways return 0 if an audio CD is inserted and the info is No Disk in drive D:
is this normal?
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Mar 17, 2009 9:57 pm    Post subject: Reply with quote

Actually that part was unneeded anyway, sorry.
This looks like it works:
Code:

LOADLIB kernel32.dll
%%drive = D

REM Prevent Windows messagebox telling user to insert Disk if there is none.
REM $01 = SEM_FAILCRITICALERRORS
%p = @lib(kernel32,SetErrorMode,INT:,$01)

REM Check for Audio Tracks
%%CDA = @file(%%drive:\*.cda,F)
REM Check for DVD Video folder
%%VTS = @file(%%drive:\VIDEO_TS,D)
REM Make sure there are files on the CD
%%Data = @file(%%drive:\*.*,F)
REM Turn ErrorMode back to default.
%p = @lib(kernel32,SetErrorMode,INT:,$00)
   
if %%CDA
  info Audio CD.
elsif %%VTS
  info DVD
elsif %%data
  info Mixed Data.
else
  warn No Disc In Drive %%drive.
end

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Wed Mar 18, 2009 1:48 pm    Post subject: Reply with quote

Excellent!!!

Thanks a lot!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group