mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
* added convenience bindings {SxE} and {S00E00}
* added widescreen mi binding {ws}
This commit is contained in:
parent
e26ae9f4e7
commit
469de911e6
@ -5,6 +5,7 @@ package net.sourceforge.filebot.format;
|
|||||||
import static net.sourceforge.filebot.MediaTypes.*;
|
import static net.sourceforge.filebot.MediaTypes.*;
|
||||||
import static net.sourceforge.filebot.format.Define.*;
|
import static net.sourceforge.filebot.format.Define.*;
|
||||||
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
||||||
|
import static net.sourceforge.filebot.web.EpisodeFormat.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -78,6 +79,18 @@ public class MediaBindingBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Define("SxE")
|
||||||
|
public String getSxE() {
|
||||||
|
return SeasonEpisode.formatSxE(getEpisode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Define("S00E00")
|
||||||
|
public String getS00E00() {
|
||||||
|
return SeasonEpisode.formatS00E00(getEpisode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("t")
|
@Define("t")
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return getEpisode().getTitle();
|
return getEpisode().getTitle();
|
||||||
@ -187,6 +200,16 @@ public class MediaBindingBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Define("ws")
|
||||||
|
public String getWidescreen() {
|
||||||
|
float width = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Width"));
|
||||||
|
float height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height"));
|
||||||
|
|
||||||
|
// width-to-height aspect ratio greater than 1.37:1
|
||||||
|
return width / height > 1.37 ? "ws" : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("sdhd")
|
@Define("sdhd")
|
||||||
public String getVideoDefinitionCategory() {
|
public String getVideoDefinitionCategory() {
|
||||||
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
parameter.exclude: ^StreamKind|Count$
|
parameter.exclude: ^StreamKind|Count$
|
||||||
|
|
||||||
# preview expressions (keys are tagged so they can be sorted alphabetically)
|
# preview expressions (keys are tagged so they can be sorted alphabetically)
|
||||||
expressions: n,y,s,e,t,airdate,startdate,absolute,special,imdb,episode,movie,vc,ac,cf,vf,af,resolution,sdhd,source,group,crc32,fn,ext,file,pi,pn,media.title,media.durationString,media.overallBitRateString,video.codecID,video.frameRate,video.displayAspectRatioString,video.height,video.scanType,audio.format,audio.bitRateString,audio.language,text.codecInfo,text.language
|
expressions: n,y,s,e,t,airdate,startdate,absolute,special,imdb,episode,SxE,S00E00,movie,vc,ac,cf,vf,af,resolution,ws,sdhd,source,group,crc32,fn,ext,file,pi,pn,media.title,media.durationString,media.overallBitRateString,video.codecID,video.frameRate,video.displayAspectRatioString,video.height,video.scanType,audio.format,audio.bitRateString,audio.language,text.codecInfo,text.language
|
||||||
|
@ -7,9 +7,9 @@ movie.sample: Avatar (2009) Part 1
|
|||||||
# basic 1.01
|
# basic 1.01
|
||||||
episode.example[0]: {n} - {s}.{e} - {t}
|
episode.example[0]: {n} - {s}.{e} - {t}
|
||||||
# S01E01
|
# S01E01
|
||||||
episode.example[1]: {n} - {'S'+s.pad(2)}E{e.pad(2)} - {t}
|
episode.example[1]: {n} - {S00E00} - {t}
|
||||||
# 1x01
|
# airdate
|
||||||
episode.example[2]: {n} - {s+'x'}{e.pad(2)} - {t}
|
episode.example[2]: {n} [{airdate}] {t}
|
||||||
# uglyfy name
|
# uglyfy name
|
||||||
episode.example[3]: {n.space('.').lower()}.{s}{e.pad(2)}
|
episode.example[3]: {n.space('.').lower()}.{s}{e.pad(2)}
|
||||||
|
|
||||||
|
@ -59,6 +59,41 @@ public class EpisodeFormat extends Format {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String formatSxE(Episode episode) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (episode.getSeason() != null) {
|
||||||
|
sb.append(episode.getSeason()).append('x');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episode.getEpisode() != null) {
|
||||||
|
sb.append(String.format("%02d", episode.getEpisode()));
|
||||||
|
} else if (includeSpecial && episode.getSpecial() != null) {
|
||||||
|
sb.append("Special " + episode.getSpecial());
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String formatS00E00(Episode episode) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (episode.getSeason() != null) {
|
||||||
|
sb.append(String.format("S%02d", episode.getSeason()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episode.getEpisode() != null) {
|
||||||
|
sb.append(String.format("E%02d", episode.getEpisode()));
|
||||||
|
} else if (includeSpecial && episode.getSpecial() != null) {
|
||||||
|
sb.append(episode.getSeason() != null ? " - " : "");
|
||||||
|
sb.append("Special " + episode.getSpecial());
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Pattern sxePattern = Pattern.compile("- (?:(\\d{1,2})x)?(Special )?(\\d{1,3}) -");
|
private final Pattern sxePattern = Pattern.compile("- (?:(\\d{1,2})x)?(Special )?(\\d{1,3}) -");
|
||||||
private final Pattern airdatePattern = Pattern.compile("\\[(\\d{4}-\\d{1,2}-\\d{1,2})\\]");
|
private final Pattern airdatePattern = Pattern.compile("\\[(\\d{4}-\\d{1,2}-\\d{1,2})\\]");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user