[go: up one dir, main page]

File: cdloop

package info (click to toggle)
cdtool 2.1.5-13
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 316 kB
  • ctags: 185
  • sloc: ansic: 2,375; makefile: 181; sh: 134
file content (78 lines) | stat: -rwxr-xr-x 1,443 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# Module:  cdloop
# Purpose: to restart a CD when it ceases playing
# Author:  M. M. Eccles
# Date:    30 December 1997
# 
# Notes:   If argument v is specified, writes messages to standard out 
#          when status is checked.
#
# RCS:
# $Log: cdloop,v $
# Revision 1.2  1998/01/06 21:00:33  wadeh
# Added DoCr, changes to fix cdeject crash.
#
# Revision 1.1  1997/12/30 23:04:10  wadeh
# Initial revision
#
# Notes:
# 1) This program uses cdloop and cdplay....
# 2) By default, this uses the default CDROM compiled in cdtools
# 3) Usage:
#       cdloop     -- loop default CDROM
#       cdloop v   -- verbose operation
#       cdloop 1   -- use second CDROM
#       cdloop v 1 -- verbose, use second CDROM
# 4) If verbose mode, this will write a log to cdloop.log
# 

INT=60
DONE=0
DEV=0

#assumes cd is already opened

if [ "$1" = "1" ]
then
  DEV=1
  echo using drive 1
fi
    
if [ "$2" = "1" ]
then
  DEV=1
  echo using drive 1
fi
    
until [ "$DONE" -eq 1 ]
do
  STATUS=`cdinfo -$DEV`
  if [ "$1" = "v" ]
  then
    echo Status is "$STATUS"
  fi

  if [ "$1" = "v" ]
  then
    NOW=`date +"%m/%d/%y %H:%M:%S"`
  fi 

  if [ "$STATUS" = "play " ] 
  then 
    if [ "$1" = "v" ]
    then
      echo "$NOW  Already playing..."	
    fi
  else
    if [ "$1" = "v" ]
    then
      date
      echo "$NOW:  Starting play...."
      echo "$NOW:  $DEV starting play" >>cdloop.log
    fi
    cdplay -$DEV 1
  fi

  sleep $INT
done