3 Uses the CD library to control the CD and return it's status.
5 Copyright 2003 Ron Kuslak <rds@rdsarts.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License.
12 This program is distributed in the hope that it will be useful
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 def set_dev(dev
='/dev/cdrom'):
26 """ Changes the CD device. Makes change. Dances poorly. """
34 temp
= cd
.get_tracks_id()
39 temp
= cd
.get_tracks_id()
44 min, sec
, temp
= cd
.get_status(1)['rel']
45 return ((min * 60) + sec
)
47 def get_track_time_total(track
=None):
48 if not track
: track
= current_track()
49 t1
, t2
, t3
, min, sec
, t4
, t5
, t6
= cd
.get_track_length(track
)
50 return ((min * 60) + sec
)
53 return str(cd
.cd
.path
)
56 # print cd.get_drive_status()
58 return cd
.get_drive_status()
60 print "IOError. Passing 0. Error was " + str(err
)
65 return cd
.get_tracks_id()['end_t']
66 # return int(cd_info['end_t'])
69 #excect: # We should not reach here!
70 # print 'ERROR IN cd.py - total_tracks(). Please report this error.'
75 temp
= cd
.get_status(1)
76 return int(temp
['cur_t'])
81 status
= cd
.get_status()
89 """ Returns CD's playing state. Yes, this is just a wrapper around
90 get_status. DEAL. ;)"""
92 status
= cd
.get_status()
94 # print "Error in play_pause"
95 # # TODO: Do something. :P
100 cd
.play(track
, total_tracks())
111 """ Advances CD one track, or puts it at track 1 if at last. """
113 next
= current_track() + 1
114 last_t
= total_tracks()
123 prev
= current_track() - 1
126 prev
= (total_tracks() - 1)