
proc ::mp3::ts {ts} {
	set file [file rootname [$ts get file]]

	if {[file exists $file.mp3]} {
		# Already done.
		return
	}

	if {[$ts get definition] eq "HD"} {
		# Cannot extract a useful MP3 from a HD recording.
		::auto::log "  $file - High definition." 2
		return
	}

	if {[queue check $ts mp3]} {
		::auto::log "  $file - Already queued." 2
		return
	}

	if {[::auto::inuse $ts]} {
		::auto::log "  $file - In use." 2
		return
	}

	# Enqueue file
	queue insert $ts mp3
	::auto::log "  $file - Queued for mp3." 0
}

proc ::mp3::directory {dir} {
	::auto::direntries $dir ::mp3::ts
}

proc ::mp3::rundir {dir} {
	::auto::flagscan $dir mp3 ::mp3::directory 0
}

proc ::mp3::run {} {
	::auto::flagscan $::auto::root mp3 ::mp3::directory
}

::auto::register mp3 300

