Rissd
This daemon attaches to the database and a particular optical drive. When a new disk is inserted to the drive, it determines if it is an audio CD or a DVD. If an audio CD, it determines if the music from it has already been gotten and of sufficient quality (each track is checked individually, to allow for bad track regrabbing). If so, it does nothing. If it needs to get some of the music, it grabs it to wave format, adds information to the database about it, and places jobs in the transcoder queue for transcoding once the wave has been completely ripped.
Several of these daemons can be running, but each needs a dedicated optical drive (the optical drive can be shared with a player though, for playing DVDs. The rissd will yield the drive to the player once it has determined it has nothing it needs to do for the disk in question.
SIGHUP causes the daemon to stop ripping the current track, delete the wave associated with it, and move on to the next track.
SIGINT causes the daemon to stop ripping the entire CD and give it up to the player if one is associated.
SIGTERM causes the daemon to stop ripping the current track, give up the device to a player, and quit the daemon.
Locking and Synchronization
- On Startup:
- trylock host:device in devicedb, or exit
- update daemondb with pid and status
- daemonize
- On Exit:
- remove entry from daemondb
- unlock host:device from devicedb
- exit
- On rip determination:
- lock trackdb
- check if track needs reripping
- lock track if we need to rerip
- unlock trackdb
- On finishing rip:
- update track data and unlock it
Nonexistant Files
When checking to see if we should replace the old file or not, make sure the old file actually exists if we are going to depend on it to be the better copy. Also, when we move the new file into place, ensure it exists in the new place before just quitting. If we can't find a resultant file, we should probably set the state to Not Ripped and the quality to 0, so we automatically update it next time through.
I think right now there is about 30 or 40 track entries without a file to match. I need to get something going to find out which ones they are, what happened, and what CDs I need to rerip. *update: found most of the files. There are still a few that are not ripped, because they are data tracks from the end of some cds that have "extras". Kinda silly. At any rate, they don't get ripped. That's probably fine. As long as we can still find the cd's in cddb while including that track in our toc calculation, I think all is well.