X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FLibrary.java;h=b5f246c6abe8eaa3f9a034da164ee99f290434c8;hp=15b81e44db7aca3caf8869f8f0b53539e1ddb8aa;hb=333f0e7b5e333e8f6222881ce35398f403fc4121;hpb=a6395bef99a8e917f67341ef1906917b87df24a4 diff --git a/src/be/nikiroo/fanfix/Library.java b/src/be/nikiroo/fanfix/Library.java index 15b81e4..b5f246c 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -52,6 +52,23 @@ public class Library { dir.mkdirs(); } + /** + * List all the known types of stories. + * + * @return the types + */ + public List getTypes() { + List list = new ArrayList(); + for (Entry entry : getStories().entrySet()) { + String storyType = entry.getValue().getParentFile().getName(); + if (!list.contains(storyType)) { + list.add(storyType); + } + } + + return list; + } + /** * List all the stories of the given source type in the {@link Library}, or * all the stories if NULL is passed as a type. @@ -61,13 +78,11 @@ public class Library { * * @return the stories */ - public List getList(SupportType type) { - String typeString = type == null ? null : type.getSourceName(); - + public List getList(String type) { List list = new ArrayList(); for (Entry entry : getStories().entrySet()) { String storyType = entry.getValue().getParentFile().getName(); - if (typeString == null || typeString.equalsIgnoreCase(storyType)) { + if (type == null || type.equalsIgnoreCase(storyType)) { list.add(entry.getKey()); } }