mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
* add cli support for outputting episode list info
This commit is contained in:
parent
55db3e62bc
commit
90f5993e10
@ -27,6 +27,9 @@ public class ArgumentBean {
|
|||||||
@Option(name = "-rename", usage = "Rename episode/movie files", metaVar = "fileset")
|
@Option(name = "-rename", usage = "Rename episode/movie files", metaVar = "fileset")
|
||||||
public boolean rename = false;
|
public boolean rename = false;
|
||||||
|
|
||||||
|
@Option(name = "-list", usage = "Fetch episode list")
|
||||||
|
public boolean list = false;
|
||||||
|
|
||||||
@Option(name = "--db", usage = "Episode/Movie database", metaVar = "[TVRage, AniDB, TheTVDB] or [OpenSubtitles, TheMovieDB]")
|
@Option(name = "--db", usage = "Episode/Movie database", metaVar = "[TVRage, AniDB, TheTVDB] or [OpenSubtitles, TheMovieDB]")
|
||||||
public String db;
|
public String db;
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ public class ArgumentBean {
|
|||||||
|
|
||||||
|
|
||||||
public boolean runCLI() {
|
public boolean runCLI() {
|
||||||
return rename || getSubtitles || check;
|
return rename || getSubtitles || check || list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,6 +64,13 @@ public class ArgumentProcessor {
|
|||||||
Analytics.trackView(ArgumentProcessor.class, "FileBot CLI");
|
Analytics.trackView(ArgumentProcessor.class, "FileBot CLI");
|
||||||
CLILogger.setLevel(args.getLogLevel());
|
CLILogger.setLevel(args.getLogLevel());
|
||||||
|
|
||||||
|
// print operations
|
||||||
|
if (args.list) {
|
||||||
|
printEpisodeList(args.query, args.getEpisodeFormat(), args.db, args.getLanguage().toLocale());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// file operations
|
||||||
try {
|
try {
|
||||||
Set<File> files = new LinkedHashSet<File>(args.getFiles(true));
|
Set<File> files = new LinkedHashSet<File>(args.getFiles(true));
|
||||||
|
|
||||||
@ -599,4 +606,17 @@ public class ArgumentProcessor {
|
|||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void printEpisodeList(String query, ExpressionFormat format, String db, Locale locale) throws Exception {
|
||||||
|
// find series on the web and fetch episode list
|
||||||
|
EpisodeListProvider service = db != null ? getEpisodeListProvider(db) : TVRage;
|
||||||
|
SearchResult hit = selectSearchResult(query, service.search(query, locale), false);
|
||||||
|
|
||||||
|
Analytics.trackEvent("CLI", "PrintEpisodeList", hit.getName());
|
||||||
|
for (Episode it : service.getEpisodeList(hit, locale)) {
|
||||||
|
String string = (format != null) ? format.format(new MediaBindingBean(it, null)) : EpisodeFormat.SeasonEpisode.format(it);
|
||||||
|
System.out.println(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user