com.melloware.jukes.file
Class MusicDirectory

java.lang.Object
  extended by com.melloware.jukes.file.MusicDirectory

public final class MusicDirectory
extends Object

This class is used for working with music file directories. Functions said as loading a directory into the database, updating ID3 tags, etc.

Copyright (c) 2006 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III
See Also:
AZ - some modifications 2009, 2010

Method Summary
static JukesValidationMessage createNewDisc(Object[] aTags, File aCoverImage, File aDirectory, JukesValidationMessage aMessage, boolean aUpdateTags)
          Creates a new disc in the catalog and optionally updates its ID3 tags.
static File findLargestImageFile(File aDirectory)
          Loops through an array of files and determines the largest one in bytes.
static Collection findMusicFiles(File aDirectory)
          For a directory gets all of its music type files into a collection.
static JukesValidationMessage loadDiscFromDirectory(File aDirectory, boolean aUpdateTags)
          Silently loads all tracks and one image file from the aDirectory.
static boolean removeDiscIfNoLongerExists(Disc aDisc)
          Checks for the disc at the location on the hard drive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createNewDisc

public static JukesValidationMessage createNewDisc(Object[] aTags,
                                                   File aCoverImage,
                                                   File aDirectory,
                                                   JukesValidationMessage aMessage,
                                                   boolean aUpdateTags)
Creates a new disc in the catalog and optionally updates its ID3 tags.

Parameters:
aTags - the array of MusicTag objects
aCoverImage - the cover image
aDirectory - the directory where these files are located
aUpdateTags - true to update tags, false to not modify them
Returns:
a validation message containing the result

findLargestImageFile

public static File findLargestImageFile(File aDirectory)
Loops through an array of files and determines the largest one in bytes.

Parameters:
aDirectory - the directory to look for the largest file in.
Returns:
the file found to be the largest

findMusicFiles

public static Collection findMusicFiles(File aDirectory)
For a directory gets all of its music type files into a collection. If none are found return null, and set the validation message.

Parameters:
aDirectory - the directory to scan
Returns:
a collection of files or NULL if not found

loadDiscFromDirectory

public static JukesValidationMessage loadDiscFromDirectory(File aDirectory,
                                                           boolean aUpdateTags)
Silently loads all tracks and one image file from the aDirectory. It must be a directory and if any exception is thrown all we do is return false to silently report the error.

Parameters:
aDirectory - the directory to add
aUpdateTags - boolean whether to overwrite new tags or not
Returns:
true if successful, false if any error

removeDiscIfNoLongerExists

public static boolean removeDiscIfNoLongerExists(Disc aDisc)
Checks for the disc at the location on the hard drive. If that location no longer exists on the hard drive then this disc is removed from the database. This is useful for when using the Jukes with portable storage devices like Archos Jukebox. Thanks to Bill Farkas for suggesting this feature.

Parameters:
aDisc - the disc to check the hard drive for
Returns:
true if the disc was OK, false if the disc was removed


Copyright © 1999-2010 Melloware Inc. All Rights Reserved.