1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 08:48:51 -05:00

* new binding {age} meaning "days since airdate"

This commit is contained in:
Reinhard Pointner 2014-05-12 15:45:19 +00:00
parent 5a287ab4c4
commit ffcf61472d
2 changed files with 9 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import java.util.Scanner;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -146,12 +147,12 @@ public class MediaBindingBean {
} }
@Define("d") @Define("d")
public Object getReleaseDate() { public SimpleDate getReleaseDate() {
if (infoObject instanceof Episode) { if (infoObject instanceof Episode) {
return getEpisode().getAirdate(); return getEpisode().getAirdate();
} }
if (infoObject instanceof Movie) { if (infoObject instanceof Movie) {
return getMetaInfo().getProperty("released"); return (SimpleDate) getMetaInfo().getProperty("released");
} }
if (infoObject instanceof AudioTrack) { if (infoObject instanceof AudioTrack) {
return getMusic().getAlbumReleaseDate(); return getMusic().getAlbumReleaseDate();
@ -166,6 +167,11 @@ public class MediaBindingBean {
return getEpisode().getAirdate(); return getEpisode().getAirdate();
} }
@Define("age")
public Number getAgeInDays() {
return TimeUnit.MILLISECONDS.toDays(getNow() - getReleaseDate().getTimeStamp());
}
@Define("startdate") @Define("startdate")
public SimpleDate startdate() { public SimpleDate startdate() {
return getEpisode().getSeriesStartDate(); return getEpisode().getSeriesStartDate();

View File

@ -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,es,sxe,s00e00,t,d,startdate,absolute,special,episode,series,primaryTitle,alias,movie,tmdbid,imdbid,music,artist,albumArtist,album,pi,pn,lang,actors,director,collection,genre,genres,certification,rating,vc,ac,cf,vf,hpi,af,resolution,dim,ws,sdhd,source,group,original,fn,ext,mediaType,file,file.name,folder,folder.name,crc32,info,info.runtime,info.status,imdb,imdb.rating,imdb.votes,duration,seconds,minutes,media,media.title,media.overallBitRateString,video,video.codecID,video.frameRate,video.displayAspectRatioString,video.scanType,audio,audio.bitRateString,audio.language,audios,audios.language,text,text.codecInfo,text.language,texts,texts.language expressions: n,y,s,e,es,sxe,s00e00,t,d,startdate,absolute,special,episode,series,primaryTitle,alias,movie,tmdbid,imdbid,music,artist,albumArtist,album,pi,pn,lang,actors,director,collection,genre,genres,certification,rating,vc,ac,cf,vf,hpi,af,resolution,dim,ws,sdhd,source,group,original,fn,ext,mediaType,file,file.name,folder,folder.name,crc32,info,info.runtime,info.status,imdb,imdb.rating,imdb.votes,age,duration,seconds,minutes,media,media.title,media.overallBitRateString,video,video.codecID,video.frameRate,video.displayAspectRatioString,video.scanType,audio,audio.bitRateString,audio.language,audios,audios.language,text,text.codecInfo,text.language,texts,texts.language