net.sf.jmp3renamer
Class MagicCookieBaker

java.lang.Object
  extended by net.sf.jmp3renamer.MagicCookieBaker

public class MagicCookieBaker
extends Object

Translates magic cookie expressions to strings with the according values.


Field Summary
static String COOKIE_ALBUM
           
static String COOKIE_ARTIST
           
static String COOKIE_ARTIST_FC
           
static String COOKIE_COMPOSER
           
static String COOKIE_COPYRIGHT
           
static String COOKIE_ENCODED_BY
           
static String COOKIE_GENRE
           
static String COOKIE_ORIG_ARTIST
           
static String COOKIE_TITLE
           
static String COOKIE_TRACK
           
static String COOKIE_YEAR
           
private static String cookieText
           
private static Logger logger
           
 
Constructor Summary
MagicCookieBaker()
           
 
Method Summary
static String createPreview(String regex)
          Creates a preview with default values according to a given regex.
private static String escapeSpecialChars(String value)
           
static DataSet evaluateCookie(String userRegex, String oldname)
          Tries to create a DataSet from a given filename and a regex.
static String evaluateDataSet(DataSet dataset)
          Every dataset comes with its' own magic cookie regex.
static String evaluatePath(String path, DataSet dataset)
           
static String getCookieText()
           
private static boolean isToEscape(char c)
           
static String replace(String string, String regex, String rep)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Logger logger

COOKIE_ARTIST

public static final String COOKIE_ARTIST
See Also:
Constant Field Values

COOKIE_ARTIST_FC

public static final String COOKIE_ARTIST_FC
See Also:
Constant Field Values

COOKIE_TRACK

public static final String COOKIE_TRACK
See Also:
Constant Field Values

COOKIE_TITLE

public static final String COOKIE_TITLE
See Also:
Constant Field Values

COOKIE_ALBUM

public static final String COOKIE_ALBUM
See Also:
Constant Field Values

COOKIE_YEAR

public static final String COOKIE_YEAR
See Also:
Constant Field Values

COOKIE_GENRE

public static final String COOKIE_GENRE
See Also:
Constant Field Values

COOKIE_COMPOSER

public static final String COOKIE_COMPOSER
See Also:
Constant Field Values

COOKIE_ORIG_ARTIST

public static final String COOKIE_ORIG_ARTIST
See Also:
Constant Field Values

COOKIE_COPYRIGHT

public static final String COOKIE_COPYRIGHT
See Also:
Constant Field Values

COOKIE_ENCODED_BY

public static final String COOKIE_ENCODED_BY
See Also:
Constant Field Values

cookieText

private static String cookieText
Constructor Detail

MagicCookieBaker

public MagicCookieBaker()
Method Detail

evaluateDataSet

public static String evaluateDataSet(DataSet dataset)
Every dataset comes with its' own magic cookie regex. With this method you get the name of the dataset according to its' regex.

Parameters:
dataset - The DataSet you want to translate.
Returns:
the name of the dataset according to its' regex

createPreview

public static String createPreview(String regex)
Creates a preview with default values according to a given regex.

Parameters:
regex - Your magic cookie regex
Returns:
a preview according to your regex

evaluateCookie

public static DataSet evaluateCookie(String userRegex,
                                     String oldname)
Tries to create a DataSet from a given filename and a regex.
 
  Example: oldname: "Artist - 02 - Title.mp3"
           regex:   "%artist - %track - %title.mp3"
  
 

Parameters:
regex - The regex which should be used to create the dataset
oldname - The filename, which should be converted to a dataset
Returns:
a dataset with the values from the filename

escapeSpecialChars

private static String escapeSpecialChars(String value)

evaluatePath

public static String evaluatePath(String path,
                                  DataSet dataset)

replace

public static String replace(String string,
                             String regex,
                             String rep)

isToEscape

private static boolean isToEscape(char c)

getCookieText

public static String getCookieText()