net.sf.jmp3renamer
Class MagicCookieBaker
java.lang.Object
net.sf.jmp3renamer.MagicCookieBaker
public class MagicCookieBaker
- extends Object
Translates magic cookie expressions to strings with the according values.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
MagicCookieBaker
public MagicCookieBaker()
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 datasetoldname
- 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()