net.shredzone.ifish.db
Class SmartRenameCallback
java.lang.Object
net.shredzone.ifish.db.RenameCallback.DefaultRenameCallback
net.shredzone.ifish.db.SmartRenameCallback
- All Implemented Interfaces:
- RenameCallback
- Direct Known Subclasses:
- IFishRenameCallback
public class SmartRenameCallback
- extends RenameCallback.DefaultRenameCallback
This SmartRenameCallback will try to shorten the filename by applying
a sequence of tricks until the name is short enough.
- Remove all text in brackets.
- Remove all "feat."
- From right to left, remove all parts following a minus '-'
- From right to left, remove word by word
- Just take the first sequence of numbers
- Brute force cut after 40 chars.
- Version:
- $Id: SmartRenameCallback.java 291 2009-04-28 21:29:27Z shred $
|
Method Summary |
File |
renameFile(File base,
File file)
A file name exceeded the maximum length of 52 characters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SmartRenameCallback
public SmartRenameCallback()
renameFile
public File renameFile(File base,
File file)
throws DatabaseException,
IOException
- A file name exceeded the maximum length of 52 characters.
This method will try to truncate the file name, rename the file
and return the new file name.
- Specified by:
renameFile in interface RenameCallback- Overrides:
renameFile in class RenameCallback.DefaultRenameCallback
- Parameters:
base - Base directory (jukebox mount point)file - File with the bad name
- Returns:
- New file name, null if this file is to be ignored
- Throws:
DatabaseException - Directory could not be renamed
IOException - An IO error occured during nenaming
Copyright © 2007-2011
shredzone.org. All Rights Reserved.