Wednesday, April 15, 2009

Putting Banshee to Work

Recently I have spent some time creating a smart job scheduler for Banshee. Some jobs we have include
  • Importing
  • Saving metadata to file
  • BPM analysis
BPM analysis and saving metadata to file jobs should be paused while doing speed sensitive jobs like importing. To achieve this, each job has priority hints and a list of resources it heavily uses. The priority hints are
  • SpeedSensitive, for jobs the user is actively waiting on, such as importing
  • LongRunning, for things like BPM or Mirage analysis of the entire library
And the resources are customizable, but currently I'm using
  • CPU
  • Disk
  • Database
If two jobs use the same resource
  • SpeedSensitive jobs run immediately (more than one ok)
  • Normal jobs (not SpeedSensitive or LongRunning) then follow, one at a time
  • LongRunning jobs then follow, one at a time
It is a bit of pretty low-level polish and a pretty simple idea, but it will give better performance and a better experience. The code is in a git branch for the moment, hopefully to be merged into trunk before 1.6.