Table of Contents |
This is about handling multi-part or stacked files as one media item, i.e. movie-cd1.avi and movie-cd2.avi.
Forum thread (feature request) for discussion
Thinking about the detection of multi-part videos, possible splitting of a video can be on
movie-cd1.avi |
movie-cd2.avi |
moviename\a\movie-a.avi |
moviename\b\movie-b.avi |
RegEx: http://code.google.com/p/moving-pict.../Utility.cs#56
// Regular expression patterns used by the multipart detection and cleaning methods // Matches the substrings "cd/dvd/disc/disk/part #" or "(# of #)" // todo: convert constants to advanced settings private const string rxFileStackPattern = @"(\W*\b(cd|dvd|dis[ck]|part)\W*([a-z]|\d+|i+)(\W|$))|\W\d+\W*(of|-)\W*\d+\W$"; private const string rxFolderStackPattern = @"^(cd|dvd|dis[ck]|part)\W*([a-z]|\d+|i+)$"; |
RegEx: http://code.google.com/p/tinymediama...Utils.java#297
and it's usage: http://code.google.com/p/tinymediama...aFile.java#137
/**
* Clean stacking markers.
*
* @param filename
* the filename
* @return the string
*/
public static String cleanStackingMarkers(String filename) {
if (!StringUtils.isEmpty(filename)) {
return filename.replaceAll("(?i)([\\( _.-]*(cd|dvd|part|pt|dis[ck])([0-9])[\\) _.-]*)", "").trim();
}
return filename;
}
/**
* Returns the stacking information from filename
*
* @param filename
* the filename
* @return the stacking information
*/
public static String getStackingMarker(String filename) {
if (!StringUtils.isEmpty(filename)) {
return StrgUtils.substr(filename, "(?i)((cd|dvd|part|pt|dis[ck])([0-9]))");
}
return "";
} |
Multi part files doesn't have to be Movies only. Could also be "other videos" or maybe episodes for series as well?
Handling multi part files is needed in various places: