org.stanwood.media.actions.rename
Class FileNameParser
java.lang.Object
org.stanwood.media.actions.rename.FileNameParser
public class FileNameParser
- extends java.lang.Object
Used to parse a filename and work out the correct season and episode number
of the file.
It does this my attempting to match a series of regular expressions against the
file. It attempts to do a case insensitive match against each of the following
regular expressions The first one that is matched, is used to get the episode and
season number. Group 1 is always the season number and group 2 is always the
episode number.
- .*[s]([\d]+)[e]([\d]+).*
-
- .*[s]([\d]+)\.[e]([\d]+).*
- .*([\d]+)[x]([\d]+).*
- .*([\d]{2,2})([\d]{2,2}).*
- .*([\d]{1,1})([\d]{2,2}).*
- ^([\d])[\s]([\d]{2,2}).*
- ^([\d]{1,2})[\s]([\d]{2,2}).*
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileNameParser
public FileNameParser()
parse
public static ParsedFileName parse(java.io.File file)
- Parse the filename and work out the episode and season number. This does not use the media directory
to do reverse pattern lookups.
- Parameters:
file
- The file been renamed
- Returns:
- The parsed information
parse
public static ParsedFileName parse(MediaDirConfig dirConfig,
java.io.File file,
SearchResult lookupResults)
- Parse the filename and work out the episode and season number
- Parameters:
dirConfig
- The root media directoryfile
- The file been renamedlookupResults
- The results of a show/film search
- Returns:
- The parsed information