Example #1
0
def set_dev(dev='/dev/cdrom'):
	""" Changes the CD device. Makes change. Dances poorly. """
	cd.cd_close()
	cd.cd.path = str(dev)
	cd.cd_open()
	updated = False
	return
Example #2
0
    def read_disc_info(self):
        """ emit an event if cd status has changed. """
        if self.is_ripping:
            return
        elif CDLow.get_drive_status() in [CDROM.CDS_TRAY_OPEN, CDROM.CDS_NO_DISC, -1]:
            self.disc_id = None
            return
        elif CDLow.get_disc_type() != CDROM.CDS_AUDIO:
            return


        disc_id = cd_logic.get_disc_id()
        #if self.disc_id <> disc_id:
        self.disc_id = disc_id
        self.cddb_thd = self.runit(self.get_tracks)
Example #3
0
def check_dev():
	# print cd.get_drive_status()
	try:
		return cd.get_drive_status()
	except IOError, err:
		print "IOError. Passing 0. Error was " + str(err)
		return -1
Example #4
0
def update():
	try:
		status = cd.get_status()
	except:
		status = 0

	if status == 0:
		updated = True
Example #5
0
def get_status():
	""" Returns CD's playing state. Yes, this is just a wrapper around
	    get_status. DEAL. ;)"""
	try:
		status = cd.get_status()
	except:
		# print "Error in play_pause"
		# # TODO: Do something. :P
		return 0
	return status
Example #6
0
    def sendUpdate(self):
        """ something happened. """
        if self._status in [CDROM.CDS_TRAY_OPEN, CDROM.CDS_NO_DISC]:
            self.emit(SIGNAL('ejected()'))
            
        elif self._status == CDROM.CDS_DISC_OK:
            disc_type = CDLow.get_disc_type()
            if disc_type == CDROM.CDS_AUDIO:
                self.emit(SIGNAL('audioInserted()'))
            elif disc_type in (CDROM.CDS_DATA_1, CDROM.CDS_DATA_2):
                self.emit(SIGNAL('dataInserted()'))
            else:
                print 'cdnotify: unknown disc type (%i)' % disc_type

        elif self._status == -1:
            print 'cdnotify: status -1'
            
        else:
            print 'cdnotify: unknown status (%i)' % self._status
Example #7
0
def play(track = 1):
	cd.play(track, total_tracks())
Example #8
0
def current_track():
	# try:
		temp = cd.get_status(1)
		return int(temp['cur_t'])
	# except:
		return -1
Example #9
0
def total_tracks():
	#try:
	return cd.get_tracks_id()['end_t']
Example #10
0
def eject():
	cd.eject()
	update()
Example #11
0
def get_track_time():
	min, sec, temp = cd.get_status(1)['rel']
	return ((min * 60) + sec)
Example #12
0
def get_cddb_id():
	temp = cd.get_tracks_id()
	id = temp['id']
	return id
Example #13
0
def get_disc_id():
	temp = cd.get_tracks_id()
	id = temp['id']
	return int(id[0])
Example #14
0
def jump(seconds):
	cd.skip(0, seconds)
Example #15
0
def pause():
	cd.pause()
	update()
Example #16
0
def get_track_time_total(track=None):
	if not track: track = current_track()
	t1, t2, t3, min, sec, t4, t5, t6 = cd.get_track_length(track)
	return ((min * 60) + sec)
Example #17
0
def stop():
	cd.stop()
	update()