Rissd

From Fernseher
Jump to navigationJump to search

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