Skip to content

Commit

Permalink
Version 3.5: New downloader totally rewritten in Java.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheep-y committed Jul 20, 2016
2 parents 695ebd6 + 19348c9 commit d5ec61b
Show file tree
Hide file tree
Showing 110 changed files with 3,940 additions and 7,875 deletions.
6 changes: 4 additions & 2 deletions .gitignore
@@ -1,2 +1,4 @@
/4e_database_files
nbproject/
/4e_database_files
nbproject/
/build/
/dist/

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Example/_index.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Example/_listing.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Example/_raw.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Sample/SamplesampleId001html.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Sample/SamplesampleId002html.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Sample/_index.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Sample/_listing.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/Sample/_raw.js

This file was deleted.

1 change: 0 additions & 1 deletion 4e_database_files_sample/catalog.js

This file was deleted.

48 changes: 31 additions & 17 deletions README.md
@@ -1,26 +1,40 @@
# Offline 4e Database #
# 4e Compendium Downloader #

**For executable code please see <a href="http://github.com/Sheep-y/trpg-dnd-4e-db/tree/deployment">deployment branch</a>.**

This script can be used to reterives and locally stores entries from online 4e <a href="http://www.wizards.com/dndinsider/compendium/database.aspx">D&D Compendium</a>.
This app can be used to reterives and locally stores entries from online 4e [D&D Compendium](http://www.wizards.com/dndinsider/compendium/database.aspx).
<br/>
Stored entries can be browsed and searched using a Google-like index with multi-word term search, wildcast, exclusion, inclusion ("OR"), and even regular expression.
Stored entries can be exported, then browsed and searched with exact phase search, wildcast, exclusion, join ("OR"), and even regular expression.

This is a fan-made project and does not contain any copyrighted data.
You will need an active <a href="http://www.wizards.com/DnD/Subscription.aspx">Dungeons & Dragons Insider subscription</a> to reterive or update data.
This is not an independent program, nor is it automated.
<br/>
The script is in Alpha prototype stage.
Basic feature is usable, but is far from stable and mature.
This is a fan-made project and does not come with copyrighted data.

## How To Download Data ##

1. You need an active [Dungeons & Dragons Insider subscription](http://ddi.wizards.com/) to retrieve data.
2. [Download](http://www.java.com/) and install Java (latest version 8 or above).
3. [Download](https://github.com/Sheep-y/trpg-dnd-4e-db/releases/) the downloader exe (Windows) or downloader jar (Linux/Mac).
4. Open a folder for the downloader, put it in, and run it.
5. (Jar version) If the file is opened by a compression program, change system settings to let Java handles it, or open console and run "java -jar 4e_compendium_downloader.jar".
6. In the downloader, fill in DDI username and password, then click "Download".
7. Download can be stopped and resumed any time.
8. See in-downloader help for details and troubleshoots.
9. Once all data is downloaded, you can export the data to an HTML file, which can be opened in any browser.

If you find a typo or obvious mistake in the data, please [file an issue](https://github.com/Sheep-y/trpg-dnd-4e-db/issues/).
I cannot update the official compendium, but I can update this downloader's data export.

## Building ##

* Viewer source code is in html folder.
* Downloader source code is in java folder.
* Use Ant (build.xml) to compile both into an executable jar.
* The jar can also be extracted to a new folder; use Ant to move the extracted files back to original structure.

The source code is split into multiple files for easy management, and must be put together by the included Ant script before it can be run.
The <a href="http://github.com/Sheep-y/trpg-dnd-4e-db/tree/deployment">deployment branch</a> contains compiled releases. <br/>
Due to technical reason the download page only works in Internet Explorer, but browsing would work in any modern browsers, including mobile phones.
Part of the build process uses the [CocoDoc](https://github.com/Sheep-y/CocoDoc/) app builder, which is bundled and must run in GUI.
Try to use 64 bits java runtime; 32 bits may stackoverfow on js minify, but won't affect functionality.

When importing the project into your favorite IDE, consider using the src folder as root so that the IDE won't scan data folder for changes.
Because, when fully loaded, there will be 25k+ files for it to scan.
If you use an IDE, be careful not to export data to project folder.
Otherwise, it can take a long time for the IDE to scan all the data files.

<small>
This script and its documentations are open source and licensed under <a href="www.gnu.org/licenses/agpl.html">GNU AGPL v3</a>. <br/>
Code, documentations, and related resources are open source and licensed under <a href="https://www.gnu.org/licenses/agpl-3.0.en.html">GNU AGPL v3</a>. <br/>
D&D and Dungeons & Dragons are trademarks of Wizards of the Coast LLC.
</small>
113 changes: 113 additions & 0 deletions build.xml
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="oddi" default="make" basedir=".">
<description> D&amp;D 4e Compendium Viewer / Downloader </description>

<!-- Launch4j directory -->
<property name="launch4j.dir" location="C:/Program Files (x86)/Launch4j" />

<!-- Jar main class -->
<property name="jar.main" value="db4e.Main" />
<!-- App title -->
<property name="app.title" value="4e Compendium Downloader" />
<!-- Source code folder -->
<property name="dir.src" value="java" />
<!-- Jar compilation folder -->
<property name="dir.jar" value="dist" />
<!-- Jar file name -->
<property name="jar.name" value="4e_compendium_downloader.jar" />

<target name="-make-html">
<!-- Build viewer. -->
<delete file="res/4e_database.html" failonerror="false" />
<java jar="java_lib/CocoDoc.1.1.1.jar">
<arg line="html/html_template.html" />
</java>
</target>

<target name="make" depends="-make-html" description="Compile html and jar">
<!-- Cleanup -->
<delete file="${jar.name}" />
<delete includeemptydirs="true" failonerror="false"><fileset dir ="${dir.jar}" /></delete>
<mkdir dir="${dir.jar}" />

<!-- Compile -->
<javac srcdir="${dir.src}" destdir="${dir.jar}" encoding="UTF-8" debug="true" includeantruntime="false">
<classpath>
<pathelement path="java_lib/sqljet/sqljet-1.1.10.jar" />
</classpath>
</javac>

<!-- Copy support files -->
<property name="jar.root" value="${dir.jar}" />
<copy todir="${jar.root}/res"><fileset dir="res" excludes="img/" /></copy>
<unjar src="java_lib/antlr/antlr-3.5.2-runtime.jar" dest="${jar.root}" />
<unjar src="java_lib/sqljet/sqljet-1.1.10.jar" dest="${jar.root}" />

<!-- Copy source code -->
<copy todir="${jar.root}">
<fileset file="build.xml" />
<fileset file="launch4j.xml" />
<fileset file="license_agpl.html" />
<fileset file="README.md" />
</copy>
<copy todir="${jar.root}/src/html"><fileset dir="html"/></copy>
<copy todir="${jar.root}/src/java"><fileset dir="java"/></copy>

<!-- Make jar -->
<jar destfile="${jar.name}">
<fileset dir="${dir.jar}"/>
<manifest>
<attribute name="Main-Class" value="${jar.main}" />
<attribute name="Application-Name" value="${jar.main}" />
<attribute name="Permissions" value="all-permissions" />
</manifest>
</jar>
</target>

<!-- Wrap jar file into exe, will make jar if not exists -->
<target name="make_exe" depends="-make-if-no-jar" description="Compile and build a Windows deliverable.">
<!-- Call launch4j -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<launch4j configFile="launch4j.xml" />
</target>

<!-- With an extracted jar structure, convert it back to original (pre-make) structure. -->
<target name="setup_from_jar" depends="-check-is-jar-structure" if="is.jar.structure" description="Restore a jar folder structure to original project structures.">
<move todir=".">
<fileset dir="src"/>
</move>
<zip destfile="java_lib/antlr/antlr-3.5.2-runtime.jar">
<fileset dir="." includes="org/antlr/**/*"/>
</zip>
<zip destfile="java_lib/sqljet/sqljet-1.1.10.jar">
<fileset dir="." includes="org/tmatesoft/**/*,sqljet.build.properties"/>
</zip>
<delete includeemptydirs="true">
<fileset dir="org"/>
<fileset dir="db4e"/>
<fileset dir="sheepy"/>
<fileset dir="META-INF"/>
<fileset file="sqljet.build.properties"/>
</delete>
<get src="https://github.com/Sheep-y/CocoDoc/releases/download/v1.1.1.0/CocoDoc.1.1.1.jar"
dest="java_lib/CocoDoc.1.1.1.jar" verbose="true" skipexisting="true" ignoreerrors="true" />
</target>

<!-- Compile viewer and copy to user home, will always rebuild -->
<target name="make_viewer" depends="-make-html" description="Compile the HTML viewer and moves it to default export location (user home)" >
<copy todir="${user.home}"><fileset file="res/4e_database.html"/></copy>
</target>

<target name="-check-jar">
<available file="${jar.name}" property="has.jar"/>
</target>

<target name="-make-if-no-jar" depends="-check-jar" unless="has.jar">
<antcall target="make" />
</target>

<target name="-check-is-jar-structure">
<available file="sqljet.build.properties" property="is.jar.structure"/>
</target>

</project>
116 changes: 0 additions & 116 deletions doc/3.0 High Level Design Doc.md

This file was deleted.

0 comments on commit d5ec61b

Please sign in to comment.