Debian Codegraph @

cdloop

raw symbols SCIP
1 #!/bin/sh
2 #
3 # Module: cdloop
4 # Purpose: to restart a CD when it ceases playing
5 # Author: M. M. Eccles
6 # Date: 30 December 1997
7 #
8 # Notes: If argument v is specified, writes messages to standard out
9 # when status is checked.
10 #
11 # Changes:
12 # Remove logfile, default to empty $DEV for automatic detection.
13 #
14 # RCS:
15 # $Log: cdloop,v $
16 # Revision 1.2 1998/01/06 21:00:33 wadeh
17 # Added DoCr, changes to fix cdeject crash.
18 #
19 # Revision 1.1 1997/12/30 23:04:10 wadeh
20 # Initial revision
21 #
22 # Notes:
23 # 1) This program uses cdloop and cdplay....
24 # 2) By default, this uses the default CDROM compiled in cdtools
25 # 3) Usage:
26 # cdloop -- loop default CDROM
27 # cdloop v -- verbose operation
28 # cdloop 1 -- use second CDROM
29 # cdloop v 1 -- verbose, use second CDROM
30 #
31
32 INT=60
33 DONE=0
34 DEV=
35
36 # fail on errors
37 set -e
38
39 #assumes cd is already opened
40
41 if [ "$1" = "1" ]
42 then
43 DEV=-1
44 echo using drive 1
45 fi
46
47 if [ "$2" = "1" ]
48 then
49 DEV=-1
50 echo using drive 1
51 fi
52
53 until [ "$DONE" -eq 1 ]
54 do
55 STATUS=`cdinfo $DEV`
56 if [ "$1" = "v" ]
57 then
58 echo Status is "$STATUS"
59 fi
60
61 if [ "$1" = "v" ]
62 then
63 NOW=`date +"%m/%d/%y %H:%M:%S"`
64 fi
65
66 if [ "$STATUS" = "play " ]
67 then
68 if [ "$1" = "v" ]
69 then
70 echo "$NOW Already playing..."
71 fi
72 else
73 if [ "$1" = "v" ]
74 then
75 echo "$NOW: Starting play...."
76 fi
77 cdplay $DEV 1
78 fi
79
80 sleep $INT
81 done