org.musicontroller.core.jobs
Class MetadataExtractJob

java.lang.Object
  extended by org.musicontroller.core.jobs.MetadataExtractJob

public class MetadataExtractJob
extends java.lang.Object

This Job is responsible for extracting and finding metadata from music-files. Job that must be called periodically. When this Job is run, look in the Unpack-directory for work to do. When there were files to be inspected, they are inspected one by one. Finally, a new MusicArchiveBean is added to the internal collection of beans in this class.

Every once in a while, this Collection should be read and processed.

TODO The 'unpack'-directory should be periodically scanned. Empty directories can be deleted.

Version:
$Id: MetadataExtractJob.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
Author:
Varienaja

Constructor Summary
MetadataExtractJob()
          Creates a new MetadataExtractJob object.
 
Method Summary
 int execute()
          Call this method to execute the job: scan for work to do, and work!
static java.util.List<MusicArchiveBean> getMusicArchiveBeanList()
           
protected static java.io.File getPersistentStorage()
           
protected  java.lang.String guessName(MusicArchiveBean archiveBean)
          Tries to generate a human-readable name for a music archive.
static void removeMusicArchiveBean(MusicArchiveBean archiveBean)
          Removes a music archive bean from (persistent) storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataExtractJob

public MetadataExtractJob()
Creates a new MetadataExtractJob object. On object-creation, the _inspected-property is initialized from persistent storage.

Method Detail

getMusicArchiveBeanList

public static java.util.List<MusicArchiveBean> getMusicArchiveBeanList()
Returns:
The List of inspected songs in the form of MusicArchiveBeans.

removeMusicArchiveBean

public static void removeMusicArchiveBean(MusicArchiveBean archiveBean)
                                   throws ImporterException
Removes a music archive bean from (persistent) storage. All inspected music-files are removed too!

Only directories within the unpack directory can be removed. Path specifications containing .. are forbidden.

Parameters:
archiveBean - The archive bean to be removed.
Throws:
ImporterException

getPersistentStorage

protected static java.io.File getPersistentStorage()

execute

public int execute()
Call this method to execute the job: scan for work to do, and work!

Returns:
The amount of files processed

guessName

protected java.lang.String guessName(MusicArchiveBean archiveBean)
Tries to generate a human-readable name for a music archive. It will return something like "Bandname - Playlistname". If there are several bands or several playlists in the music archive, the bandname will be "Various" and the playlistname will be "Various". If no information whatsoever could be found, the result will be "Unknown".

Parameters:
archiveBean - The music archive.
Returns:
A human-readable name.


Copyright © 2010 A.J.V.. All Rights Reserved.