Skip to content

Commit

Permalink
Version 1.0.0
Browse files Browse the repository at this point in the history
- fixes everywhere
- a  screenshot in the README
- update to nikiroo-utils 1.0.0
- a mostly usable UI, not too ugly any more
  • Loading branch information
nikiroo committed Feb 17, 2017
1 parent 3d247bc commit b4dc6ab
Show file tree
Hide file tree
Showing 20 changed files with 273 additions and 286 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Fanfix is a small Java program that can download stories from some supported websites and render them offline.

![Main GUI](screenshots/fanfix.png?raw=true "Main GUI")

It will convert from a (supported) URL to an .epub file for stories or a .cbz file for comics (a few other output types are also available, like Plain Text or LaTeX).

To help organize your stories, it can also work as a local library.
Expand Down Expand Up @@ -37,16 +39,17 @@ We support a few file types for local story conversion (both as input and as out

Any platform with at lest Java 1.6 on it should be ok.

If you have any problems to compile it with a supported Java version (1.5 won't work, but you may try to cross-compile or change the Bundle.java class from the utilities; 1.6 and 1.8 have been tested and work), please contact me.
It has only been tested on Linux and Windows for now, but feel free to inform me if you try it on another system.

If you have any problems to compile it with a supported Java version (1.5 won't work, but you may try to cross-compile; 1.6 and 1.8 have been tested and work), please contact me.

## Usage

You can start the program in CLI mode:
You can start the program in GUI mode (as in the screenshot on top):
- ```java -jar fanfix.jar```

__TODO__: offer a GUI mode (work in progress)

The following arguments are allowed:
The following arguments are also allowed:
- ```--import [URL]```: import the story at URL into the local library
- ```--export [id] [output_type] [target]```: export the story denoted by ID to the target file
- ```--convert [URL] [output_type] [target] (+info)```: convert the story at URL into target, and force-add the .info and cover if +info is passed
Expand Down Expand Up @@ -85,7 +88,7 @@ Currently missing, but either in progress or planned:
- [ ] A GUI (work in progress)
- [x] Make one
- [x] Make it run when no args passed
- [ ] Fix the UI, it is ugly
- [x] Fix the UI, it is ugly
- [ ] Work on the UI thread is BAD
- [ ] Allow export
- [ ] Show a list of types
Expand All @@ -99,6 +102,7 @@ Currently missing, but either in progress or planned:
- [x] Make use of it
- [x] Use it for all user output (some WIP remains)
- [ ] French translation
- [ ] Allow lauching a custom application instead of Desktop.star ?
- [ ] Allow lauching a custom application instead of Desktop.start ?
- [ ] Make a wrapper for firefox to create a new, empty profile ?
- [ ] Install a mechanism to handle stories import progress update

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.5
1.0.0
Binary file not shown.
Binary file added screenshots/fanfix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 38 additions & 2 deletions src/be/nikiroo/fanfix/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.bundles.ConfigBundle;
import be.nikiroo.fanfix.bundles.StringIdBundle;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.bundles.UiConfigBundle;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.utils.resources.Bundles;

Expand All @@ -16,6 +18,7 @@
*/
public class Instance {
private static ConfigBundle config;
private static UiConfigBundle uiconfig;
private static StringIdBundle trans;
private static Cache cache;
private static Library lib;
Expand Down Expand Up @@ -45,6 +48,12 @@ public class Instance {
} catch (IOException e) {
syserr(e);
}
try {
uiconfig = new UiConfigBundle();
uiconfig.updateFile(configDir);
} catch (IOException e) {
syserr(e);
}
try {
trans = new StringIdBundle(getLang());
trans.updateFile(configDir);
Expand All @@ -55,6 +64,7 @@ public class Instance {
Bundles.setDirectory(configDir);
}

uiconfig = new UiConfigBundle();
trans = new StringIdBundle(getLang());
try {
lib = new Library(getFile(Config.LIBRARY_DIR),
Expand All @@ -67,7 +77,7 @@ public class Instance {
debug = Instance.getConfig().getBoolean(Config.DEBUG_ERR, false);
coverDir = getFile(Config.DEFAULT_COVERS_DIR);
File tmp = getFile(Config.CACHE_DIR);
readerTmp = getFile(Config.CACHE_DIR_LOCAL_READER);
readerTmp = getFile(UiConfig.CACHE_DIR_LOCAL_READER);

if (checkEnv("NOUTF")) {
trans.setUnicode(false);
Expand Down Expand Up @@ -121,6 +131,15 @@ public static ConfigBundle getConfig() {
return config;
}

/**
* Get the (unique) UI configuration service for the program.
*
* @return the configuration service
*/
public static UiConfigBundle getUiConfig() {
return uiconfig;
}

/**
* Get the (unique) {@link Cache} for the program.
*
Expand Down Expand Up @@ -186,8 +205,25 @@ public static void syserr(Exception e) {
* @return the path
*/
private static File getFile(Config id) {
return getFile(config.getString(id));
}

/**
* Return a path, but support the special $HOME variable.
*
* @return the path
*/
private static File getFile(UiConfig id) {
return getFile(uiconfig.getString(id));
}

/**
* Return a path, but support the special $HOME variable.
*
* @return the path
*/
private static File getFile(String path) {
File file = null;
String path = config.getString(id);
if (path != null && !path.isEmpty()) {
path = path.replace('/', File.separatorChar);
if (path.contains("$HOME")) {
Expand Down
2 changes: 1 addition & 1 deletion src/be/nikiroo/fanfix/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public Story save(Story story) throws IOException {
* @throws IOException
* in case of I/O error
*/
private Story save(Story story, String luid) throws IOException {
public Story save(Story story, String luid) throws IOException {
// Do not change the original metadata, but change the original story
MetaData key = story.getMeta().clone();
story.setMeta(key);
Expand Down
2 changes: 2 additions & 0 deletions src/be/nikiroo/fanfix/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import be.nikiroo.fanfix.reader.BasicReader.ReaderType;
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
import be.nikiroo.utils.UIUtils;

/**
* Main program entry point.
Expand Down Expand Up @@ -188,6 +189,7 @@ public static void main(String[] args) {
case SET_READER:
break;
case START:
UIUtils.setLookAndFeel();
BasicReader.setDefaultReaderType(ReaderType.LOCAL);
BasicReader.getReader().start(null);
break;
Expand Down
7 changes: 0 additions & 7 deletions src/be/nikiroo/fanfix/bundles/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public enum Config {
READER_TYPE, //
@Meta(what = "directory", where = "", format = "absolute path, $HOME variable supported, / is always accepted as dir separator", info = "The directory where to store temporary files, defaults to a directory 'fanfic-tmp' in the system default temporary directory")
CACHE_DIR, //
@Meta(what = "directory", where = "", format = "absolute path, $HOME variable supported, / is always accepted as dir separator", info = "The directory where to store temporary files, defaults to a directory 'fanfic-reader' in the system default temporary directory")
CACHE_DIR_LOCAL_READER, //
@Meta(what = "delay in hours", where = "", format = "integer | 0: no cache | -1: infinite time cache which is default", info = "The delay after which a cached resource that is thought to change ~often is considered too old and triggers a refresh")
CACHE_MAX_TIME_CHANGING, //
@Meta(what = "delay in hours", where = "", format = "integer | 0: no cache | -1: infinite time cache which is default", info = "The delay after which a cached resource that is thought to change rarely is considered too old and triggers a refresh")
Expand Down Expand Up @@ -46,9 +44,4 @@ public enum Config {
CHAPTER_EN, //
@Meta(what = "Chapter identification string", where = "", format = "", info = "used to identify a starting chapter in text mode")
CHAPTER_FR, //
@Meta(what = "Output type", where = "Local Reader", format = "One of the known output type", info = "The type of output for the Local Reader for non-images documents")
LOCAL_READER_NON_IMAGES_DOCUMENT_TYPE, //
@Meta(what = "Output type", where = "Local Reader", format = "One of the known output type", info = "The type of output for the Local Reader for images documents")
LOCAL_READER_IMAGES_DOCUMENT_TYPE, //

}
6 changes: 4 additions & 2 deletions src/be/nikiroo/fanfix/bundles/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
public enum Target {
/**
* Configuration options that the user can change in the
* <tt>.properties</tt> file.
* <tt>.properties</tt> file
*/
config,
/** Translation resources. */
/** Translation resources */
resources,
/** UI resources (from colours to behaviour) */
ui,
}
19 changes: 19 additions & 0 deletions src/be/nikiroo/fanfix/bundles/UiConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package be.nikiroo.fanfix.bundles;

import be.nikiroo.utils.resources.Meta;

/**
* The configuration options.
*
* @author niki
*/
public enum UiConfig {
@Meta(what = "directory", where = "", format = "absolute path, $HOME variable supported, / is always accepted as dir separator", info = "The directory where to store temporary files, defaults to a directory 'fanfic-reader' in the system default temporary directory")
CACHE_DIR_LOCAL_READER, //
@Meta(what = "Output type", where = "Local Reader", format = "One of the known output type", info = "The type of output for the Local Reader for non-images documents")
LOCAL_READER_NON_IMAGES_DOCUMENT_TYPE, //
@Meta(what = "Output type", where = "Local Reader", format = "One of the known output type", info = "The type of output for the Local Reader for images documents")
LOCAL_READER_IMAGES_DOCUMENT_TYPE, //
@Meta(what = "A background colour", where = "Local Reader Frame", format = "#rrggbb", info = "The background colour if you don't want the default system one")
BACKGROUND_COLOR, //
}
39 changes: 39 additions & 0 deletions src/be/nikiroo/fanfix/bundles/UiConfigBundle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package be.nikiroo.fanfix.bundles;

import java.io.File;
import java.io.IOException;

import be.nikiroo.utils.resources.Bundle;

/**
* This class manages the configuration of UI of the application (colours and
* behaviour)
*
* @author niki
*/
public class UiConfigBundle extends Bundle<UiConfig> {
public UiConfigBundle() {
super(UiConfig.class, Target.ui);
}

/**
* Update resource file.
*
* @param args
* not used
*
* @throws IOException
* in case of I/O error
*/
public static void main(String[] args) throws IOException {
String path = new File(".").getAbsolutePath()
+ "/src/be/nikiroo/fanfix/bundles/";
new UiConfigBundle().updateFile(path);
System.out.println("Path updated: " + path);
}

@Override
protected String getBundleDisplayName() {
return "UI configuration options";
}
}
9 changes: 0 additions & 9 deletions src/be/nikiroo/fanfix/bundles/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ READER_TYPE =
# (WHAT: directory, FORMAT: absolute path, $HOME variable supported, / is always accepted as dir separator)
# The directory where to store temporary files, defaults to a directory 'fanfic-tmp' in the system default temporary directory
CACHE_DIR =
# (WHAT: directory, FORMAT: absolute path, $HOME variable supported, / is always accepted as dir separator)
# The directory where to store temporary files, defaults to a directory 'fanfic-reader' in the system default temporary directory
CACHE_DIR_LOCAL_READER =
# (WHAT: delay in hours, FORMAT: integer | 0: no cache | -1: infinite time cache which is default)
# The delay after which a cached resource that is thought to change ~often is considered too old and triggers a refresh
CACHE_MAX_TIME_CHANGING = 24
Expand Down Expand Up @@ -59,9 +56,3 @@ CHAPTER_EN = Chapter
# (WHAT: Chapter identification string)
# used to identify a starting chapter in text mode
CHAPTER_FR = Chapitre
# (WHAT: Output type, WHERE: Local Reader, FORMAT: One of the known output type)
# The type of output for the Local Reader for non-images documents
LOCAL_READER_NON_IMAGES_DOCUMENT_TYPE = HTML
# (WHAT: Output type, WHERE: Local Reader, FORMAT: One of the known output type)
# The type of output for the Local Reader for images documents
LOCAL_READER_IMAGES_DOCUMENT_TYPE = CBZ
36 changes: 18 additions & 18 deletions src/be/nikiroo/fanfix/bundles/resources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# (WHAT: help message, WHERE: cli, FORMAT: %s = supported input, %s = supported output)
# help message for the syntax
HELP_SYNTAX = Valid options:\n\
\t--import [URL]: import into library\n\
\t--export [id] [output_type] [target]: export story to target\n\
\t--convert [URL] [output_type] [target] (+info): convert URL into target\n\
\t--read [id] ([chapter number]): read the given story from the library\n\
\t--read-url [URL] ([chapter number]): convert on the fly and read the story, without saving it\n\
\t--list: list the stories present in the library\n\
\t--set-reader [reader type]: set the reader type to CLI or LOCAL for this command\n\
\t--help: this help message\n\
t--import [URL]: import into library\n\
t--export [id] [output_type] [target]: export story to target\n\
t--convert [URL] [output_type] [target] (+info): convert URL into target\n\
t--read [id] ([chapter number]): read the given story from the library\n\
t--read-url [URL] ([chapter number]): convert on the fly and read the story, without saving it\n\
t--list: list the stories present in the library\n\
t--set-reader [reader type]: set the reader type to CLI or LOCAL for this command\n\
t--help: this help message\n\
\n\
Supported input types:\n\
%s\n\
Expand Down Expand Up @@ -82,11 +82,11 @@ INPUT_DESC_EPUB = EPUB files created by this program (we do not support "all" EP
# (WHAT: input format description, WHERE: SupportType)
# Description of this input type
INPUT_DESC_TEXT = Support class for local stories encoded in textual format, with a few rules :\n\
\tthe title must be on the first line, \n\
\tthe author (preceded by nothing, "by " or "©") must be on the second line, possibly with the publication date in parenthesis (i.e., "By Unknown (3rd October 1998)"), \n\
\tchapters must be declared with "Chapter x" or "Chapter x: NAME OF THE CHAPTER", where "x" is the chapter number,\n\
\ta description of the story must be given as chapter number 0,\n\
\ta cover image may be present with the same filename but a PNG, JPEG or JPG extension.
tthe title must be on the first line, \n\
tthe author (preceded by nothing, "by " or "©") must be on the second line, possibly with the publication date in parenthesis (i.e., "By Unknown (3rd October 1998)"), \n\
tchapters must be declared with "Chapter x" or "Chapter x: NAME OF THE CHAPTER", where "x" is the chapter number,\n\
ta description of the story must be given as chapter number 0,\n\
ta cover image may be present with the same filename but a PNG, JPEG or JPG extension.
# (WHAT: input format description, WHERE: SupportType)
# Description of this input type
INPUT_DESC_INFO_TEXT = Contains the same information as the TEXT format, but with a companion ".info" file to store some metadata
Expand All @@ -111,11 +111,11 @@ OUTPUT_DESC_EPUB = Standard EPUB file working on most e-book readers and viewers
# (WHAT: output format description, WHERE: OutputType)
# Description of this output type
OUTPUT_DESC_TEXT = Local stories encoded in textual format, with a few rules :\n\
\tthe title must be on the first line, \n\
\tthe author (preceded by nothing, "by " or "©") must be on the second line, possibly with the publication date in parenthesis (i.e., "By Unknown (3rd October 1998)"), \n\
\tchapters must be declared with "Chapter x" or "Chapter x: NAME OF THE CHAPTER", where "x" is the chapter number,\n\
\ta description of the story must be given as chapter number 0,\n\
\ta cover image may be present with the same filename but a PNG, JPEG or JPG extension.
tthe title must be on the first line, \n\
tthe author (preceded by nothing, "by " or "©") must be on the second line, possibly with the publication date in parenthesis (i.e., "By Unknown (3rd October 1998)"), \n\
tchapters must be declared with "Chapter x" or "Chapter x: NAME OF THE CHAPTER", where "x" is the chapter number,\n\
ta description of the story must be given as chapter number 0,\n\
ta cover image may be present with the same filename but a PNG, JPEG or JPG extension.
# (WHAT: output format description, WHERE: OutputType)
# Description of this output type
OUTPUT_DESC_INFO_TEXT = Contains the same information as the TEXT format, but with a companion ".info" file to store some metadata
Expand Down
16 changes: 16 additions & 0 deletions src/be/nikiroo/fanfix/bundles/ui.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# UI configuration options
#


# (WHAT: directory, FORMAT: absolute path, $HOME variable supported, / is always accepted as dir separator)
# The directory where to store temporary files, defaults to a directory 'fanfic-reader' in the system default temporary directory
CACHE_DIR_LOCAL_READER =
# (WHAT: Output type, WHERE: Local Reader, FORMAT: One of the known output type)
# The type of output for the Local Reader for non-images documents
LOCAL_READER_NON_IMAGES_DOCUMENT_TYPE = HTML
# (WHAT: Output type, WHERE: Local Reader, FORMAT: One of the known output type)
# The type of output for the Local Reader for images documents
LOCAL_READER_IMAGES_DOCUMENT_TYPE = CBZ
# (WHAT: A background colour, WHERE: Local Reader Frame, FORMAT: #rrggbb)
# The background colour if you don't want the default system one
BACKGROUND_COLOR = #FFFFFF
Loading

0 comments on commit b4dc6ab

Please sign in to comment.