git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
supported
/
BasicSupportHelper.java
diff --git
a/src/be/nikiroo/fanfix/supported/BasicSupportHelper.java
b/src/be/nikiroo/fanfix/supported/BasicSupportHelper.java
index 0c9e199fa2695af13d15493e1a121aa37a04f270..41716df4e4d17952cd0e77aeac28eee20e837aca 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/BasicSupportHelper.java
+++ b/
src/be/nikiroo/fanfix/supported/BasicSupportHelper.java
@@
-16,7
+16,7
@@
import be.nikiroo.utils.Image;
*
* @author niki
*/
*
* @author niki
*/
-class BasicSupportHelper {
+
public
class BasicSupportHelper {
/**
* Get the default cover related to this subject (see <tt>.info</tt> files).
*
/**
* Get the default cover related to this subject (see <tt>.info</tt> files).
*
@@
-25,7
+25,7
@@
class BasicSupportHelper {
*
* @return the cover if any, or NULL
*/
*
* @return the cover if any, or NULL
*/
- public
static
Image getDefaultCover(String subject) {
+ public Image getDefaultCover(String subject) {
if (subject != null && !subject.isEmpty()
&& Instance.getCoverDir() != null) {
try {
if (subject != null && !subject.isEmpty()
&& Instance.getCoverDir() != null) {
try {
@@
-48,7
+48,7
@@
class BasicSupportHelper {
*
* @return the extensions
*/
*
* @return the extensions
*/
- public
static
String[] getImageExt(boolean emptyAllowed) {
+ public String[] getImageExt(boolean emptyAllowed) {
if (emptyAllowed) {
return new String[] { "", ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
}
if (emptyAllowed) {
return new String[] { "", ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
}
@@
-61,16
+61,17
@@
class BasicSupportHelper {
* refresh the cache with it if it is.
*
* @param support
* refresh the cache with it if it is.
*
* @param support
- * the linked {@link BasicSupport}
+ * the linked {@link BasicSupport}
(can be NULL)
* @param source
* @param source
- * the story source
+ * the source of the story (for image lookup in the same path if
+ * the source is a file, can be NULL)
* @param line
* the resource to check
*
* @return the image if found, or NULL
*
*/
* @param line
* the resource to check
*
* @return the image if found, or NULL
*
*/
- public
static
Image getImage(BasicSupport support, URL source, String line) {
+ public Image getImage(BasicSupport support, URL source, String line) {
URL url = getImageUrl(support, source, line);
if (url != null) {
if ("file".equals(url.getProtocol())) {
URL url = getImageUrl(support, source, line);
if (url != null) {
if ("file".equals(url.getProtocol())) {
@@
-80,8
+81,7
@@
class BasicSupportHelper {
}
InputStream in = null;
try {
}
InputStream in = null;
try {
- in = Instance.getCache().open(url,
- BasicSupport.getSupport(url), true);
+ in = Instance.getCache().open(url, support, true);
return new Image(in);
} catch (IOException e) {
} finally {
return new Image(in);
} catch (IOException e) {
} finally {
@@
-102,16
+102,17
@@
class BasicSupportHelper {
* refresh the cache with it if it is.
*
* @param support
* refresh the cache with it if it is.
*
* @param support
- * the linked {@link BasicSupport}
+ * the linked {@link BasicSupport}
(can be NULL)
* @param source
* @param source
- * the story source
+ * the source of the story (for image lookup in the same path if
+ * the source is a file, can be NULL)
* @param line
* the resource to check
*
* @return the image URL if found, or NULL
*
*/
* @param line
* the resource to check
*
* @return the image URL if found, or NULL
*
*/
- public
static
URL getImageUrl(BasicSupport support, URL source, String line) {
+ public URL getImageUrl(BasicSupport support, URL source, String line) {
URL url = null;
if (line != null) {
URL url = null;
if (line != null) {
@@
-202,11
+203,10
@@
class BasicSupportHelper {
*
* @return the author without prefixes
*/
*
* @return the author without prefixes
*/
- public
static
String fixAuthor(String author) {
+ public String fixAuthor(String author) {
if (author != null) {
for (String suffix : new String[] { " ", ":" }) {
if (author != null) {
for (String suffix : new String[] { " ", ":" }) {
- for (String byString : Instance.getConfig()
- .getString(Config.BYS).split(",")) {
+ for (String byString : Instance.getConfig().getList(Config.CONF_BYS)) {
byString += suffix;
if (author.toUpperCase().startsWith(byString.toUpperCase())) {
author = author.substring(byString.length()).trim();
byString += suffix;
if (author.toUpperCase().startsWith(byString.toUpperCase())) {
author = author.substring(byString.length()).trim();