Skip to content

Commit

Permalink
Merge pull request #1 from josfranmc/dev
Browse files Browse the repository at this point in the history
Puesta en producción de la versión 2.0
  • Loading branch information
josfranmc committed Nov 22, 2019
2 parents 79e83ba + ae82fbb commit ccca6d4
Show file tree
Hide file tree
Showing 131 changed files with 13,675 additions and 18,622 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Copyright (C) 2018-2019 Jose Francisco Mena Ceca <josfranmc@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

JGutenbergDownload is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with JGutenbergDownload. If not, see <https://www.gnu.org/licenses/>.

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
132 changes: 101 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,101 @@
# JGutenbergDownload
Descarga de ficheros desde los repositorios del proyecto Gutenberg.

## Contenido
+ jar-flat: fichero jar con las clases de la aplicación junto a las dependencias necesarias, que se ubican en la carpeta lib
+ jar-shaded: fichero jar con las clases de la aplicación y con las dependencias necesarias incluidas en él
+ javadoc: documentación del código
+ src: Código fuente

## Uso
Desde línea de comandos:

java -jar JGutenbergDownload-1.0-shaded.jar [*opciones*]

opciones:

-t tipo fichero (por defecto txt)
-i idioma (por defecto en)
-d tiempo de espera en milisegundos (por defecto 2000)
-s ruta donde guardar las descargas
-m total_ficheros_a_descargar (por defecto 10, el valor 0 descarga todo)
-z descomprimir (true/false, por defecto true)
-o sobreescribir existentes (true/false, por defecto false)
-x modo de descarga (SOFT/GREEDY, por defecto SOFT)

-h muestra lista de opciones

## Notas
Si se usa el jar flat hay que asegurarse que exista la carpeta lib dentro de la carpeta desde la que ejecutemos la aplicación.

El fichero de log generado se guarda en la carpeta log.
# JGutenbergDownload
This software allows you to download books from the Gutenberg project repositories.

The Gutenberg project website is intended for human users only. If you want to download many books using an automated tool like this, keep in mind that your ip address can be blocked temporarily or permanently.
The Gutenberg project is a solidarity project based on the hard work of thousands of volunteers. So please, don't abuse.

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

## Getting Started

The project is a Maven project, so you can import it in your favorite IDE as any other Maven project.

~~~
mvn install
~~~

will install the artifact in your local repository, being ready to be used as a dependency in any project:

~~~
<dependency>
<groupId>org.josfranmc.gutenberg</groupId>
<artifactId>JGutenbergDownload</artifactId>
<version>2.0</version>
</dependency>
~~~

When you build the project with Maven you get two jars in the target directory: _JGutenbergDownload-2.0.jar_ and _JGutenbergDownload-2.0-shaded.jar_. The first one is the standard jar of the project. The second one is an _uber_ jar with all necessary dependencies, which is suitable to use from command line.

Download the latest _uber_ jar from [Releases](https://github.com/josfranmc/JGutenbergDownload/releases).

## Usage

The main class to use is `JGutenbergDownload`, which offers some methods to set up the download process.

The following code will download 20 english books in a folder called _mybooks_:

~~~
try {
JGutenbergDownload jg = new JGutenbergDownload();
jg.setLanguage("en");
jg.setSavePath("mybooks");
jg.setMaxFilesToDownload(20);
jg.downloadBooks();
} catch(GutenbergException e) {
System.err.println(e.getMessage());
}
~~~

You can also use the `DownloadParams` class to set up:

~~~
try {
DownloadParams params = new DownloadParams();
params.setLanguage("en");
params.setSavePath("mybooks");
params.setMaxFilesToDownload(20);
JGutenbergDownload jg = new JGutenbergDownload();
jg.setParameters(params);
jg.downloadBooks();
} catch(GutenbergException e) {
System.err.println(e.getMessage());
}
~~~

Finally, you can execute the `JGutenbergDownload`'s main method by passing the setting options as argument. The following code perfoms the same function as the previous ones:

~~~
try {
String[] args = {"-l", "en", "-s", "mybooks", "-m", "20" };
JGutenbergDownload.main(args);
} catch(GutenbergException e) {
System.err.println(e.getMessage());
}
~~~

These are the options you can use as arguments:

~~~
-f xxx (xxx type of files to download, default: txt)
-l xx (xx language of books to download, default: es)
-s xxx (xxx download path on local machine, default: program folder)
-d xxx (xxx delay between downloads in milliseconds, default 2000)
-m xx (xx max number of downloads (default 10, 0 for dowload all)
-o ( overwrite existing files, default: false)
-z ( don't unzip downloads, default: true)
(only -h to show options list)");
~~~

---

It is possible to run the program from the command line. To this purpose, you may use the _JGutenbergDownload-2.0-shaded.jar_ package with any of the options above:

~~~
java -jar JGutenbergDownload-2.0-shaded.jar -l en -s mybooks -m 20
~~~

## License

[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
[LICENSE](LICENSE) for more details.
Binary file removed jar-flat/JGutenbergDownload-1.0.jar
Binary file not shown.
Binary file removed jar-flat/lib/hamcrest-core-1.3.jar
Binary file not shown.
Binary file removed jar-flat/lib/junit-4.12.jar
Binary file not shown.
Binary file removed jar-flat/lib/log4j-1.2.17.jar
Binary file not shown.
Binary file removed jar-shaded/JGutenbergDownload-1.0-shaded.jar
Binary file not shown.
20 changes: 5 additions & 15 deletions javadoc/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,28 @@
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_102) on Tue Sep 11 12:42:13 CEST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Generated by javadoc (1.8.0_65) on Wed Nov 20 21:31:34 CET 2019 -->
<title>All Classes</title>
<meta name="date" content="2018-09-11">
<meta name="date" content="2019-11-20">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/josfranmc/gutenberg/download/AbstractDownload.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">AbstractDownload</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadBooks.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadBooks</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineFactory.html" title="class in org.josfranmc.gutenberg.download.engine" target="classFrame">DownloadEngineFactory</a></li>
<li><a href="org/josfranmc/gutenberg/engine/DownloadEngineFactoryTest.html" title="class in org.josfranmc.gutenberg.engine" target="classFrame">DownloadEngineFactoryTest</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineType.html" title="enum in org.josfranmc.gutenberg.download.engine" target="classFrame">DownloadEngineType</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadFactory.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadFactory</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadGreedy.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadGreedy</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadHttpUrlConnection.html" title="class in org.josfranmc.gutenberg.download.engine" target="classFrame">DownloadHttpUrlConnection</a></li>
<li><a href="org/josfranmc/gutenberg/engine/DownloadHttpUrlConnectionTest.html" title="class in org.josfranmc.gutenberg.engine" target="classFrame">DownloadHttpUrlConnectionTest</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadMode.html" title="enum in org.josfranmc.gutenberg.download" target="classFrame">DownloadMode</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadParams.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadParams</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadResult.html" title="class in org.josfranmc.gutenberg.download.engine" target="classFrame">DownloadResult</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadSoft.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadSoft</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadThread.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">DownloadThread</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileManager.html" title="class in org.josfranmc.gutenberg.util" target="classFrame">FileManager</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileManagerTest.html" title="class in org.josfranmc.gutenberg.util" target="classFrame">FileManagerTest</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileScraping.html" title="class in org.josfranmc.gutenberg.util" target="classFrame">FileScraping</a></li>
<li><a href="org/josfranmc/gutenberg/util/GutenbergException.html" title="class in org.josfranmc.gutenberg.util" target="classFrame">GutenbergException</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/IDownloadEngine.html" title="interface in org.josfranmc.gutenberg.download.engine" target="classFrame"><span class="interfaceName">IDownloadEngine</span></a></li>
<li><a href="org/josfranmc/gutenberg/download/IGutenbergDownload.html" title="interface in org.josfranmc.gutenberg.download" target="classFrame"><span class="interfaceName">IGutenbergDownload</span></a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownload.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">JGutenbergDownload</a></li>
<li><a href="org/josfranmc/gutenberg/download/client/JGutenbergDownloadClient.html" title="class in org.josfranmc.gutenberg.download.client" target="classFrame">JGutenbergDownloadClient</a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownloadFactory.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">JGutenbergDownloadFactory</a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownloadTest.html" title="class in org.josfranmc.gutenberg.download" target="classFrame">JGutenbergDownloadTest</a></li>
</ul>
</div>
</body>
Expand Down
70 changes: 30 additions & 40 deletions javadoc/allclasses-noframe.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_102) on Tue Sep 11 12:42:13 CEST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All Classes</title>
<meta name="date" content="2018-09-11">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/josfranmc/gutenberg/download/AbstractDownload.html" title="class in org.josfranmc.gutenberg.download">AbstractDownload</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineFactory.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadEngineFactory</a></li>
<li><a href="org/josfranmc/gutenberg/engine/DownloadEngineFactoryTest.html" title="class in org.josfranmc.gutenberg.engine">DownloadEngineFactoryTest</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineType.html" title="enum in org.josfranmc.gutenberg.download.engine">DownloadEngineType</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadFactory.html" title="class in org.josfranmc.gutenberg.download">DownloadFactory</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadGreedy.html" title="class in org.josfranmc.gutenberg.download">DownloadGreedy</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadHttpUrlConnection.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadHttpUrlConnection</a></li>
<li><a href="org/josfranmc/gutenberg/engine/DownloadHttpUrlConnectionTest.html" title="class in org.josfranmc.gutenberg.engine">DownloadHttpUrlConnectionTest</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadMode.html" title="enum in org.josfranmc.gutenberg.download">DownloadMode</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadParams.html" title="class in org.josfranmc.gutenberg.download">DownloadParams</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadResult.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadResult</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadSoft.html" title="class in org.josfranmc.gutenberg.download">DownloadSoft</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileManager.html" title="class in org.josfranmc.gutenberg.util">FileManager</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileManagerTest.html" title="class in org.josfranmc.gutenberg.util">FileManagerTest</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileScraping.html" title="class in org.josfranmc.gutenberg.util">FileScraping</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/IDownloadEngine.html" title="interface in org.josfranmc.gutenberg.download.engine"><span class="interfaceName">IDownloadEngine</span></a></li>
<li><a href="org/josfranmc/gutenberg/download/IGutenbergDownload.html" title="interface in org.josfranmc.gutenberg.download"><span class="interfaceName">IGutenbergDownload</span></a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownload.html" title="class in org.josfranmc.gutenberg.download">JGutenbergDownload</a></li>
<li><a href="org/josfranmc/gutenberg/download/client/JGutenbergDownloadClient.html" title="class in org.josfranmc.gutenberg.download.client">JGutenbergDownloadClient</a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownloadFactory.html" title="class in org.josfranmc.gutenberg.download">JGutenbergDownloadFactory</a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownloadTest.html" title="class in org.josfranmc.gutenberg.download">JGutenbergDownloadTest</a></li>
</ul>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_65) on Wed Nov 20 21:31:34 CET 2019 -->
<title>All Classes</title>
<meta name="date" content="2019-11-20">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/josfranmc/gutenberg/download/DownloadBooks.html" title="class in org.josfranmc.gutenberg.download">DownloadBooks</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineFactory.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadEngineFactory</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadEngineType.html" title="enum in org.josfranmc.gutenberg.download.engine">DownloadEngineType</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadHttpUrlConnection.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadHttpUrlConnection</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadParams.html" title="class in org.josfranmc.gutenberg.download">DownloadParams</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/DownloadResult.html" title="class in org.josfranmc.gutenberg.download.engine">DownloadResult</a></li>
<li><a href="org/josfranmc/gutenberg/download/DownloadThread.html" title="class in org.josfranmc.gutenberg.download">DownloadThread</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileManager.html" title="class in org.josfranmc.gutenberg.util">FileManager</a></li>
<li><a href="org/josfranmc/gutenberg/util/FileScraping.html" title="class in org.josfranmc.gutenberg.util">FileScraping</a></li>
<li><a href="org/josfranmc/gutenberg/util/GutenbergException.html" title="class in org.josfranmc.gutenberg.util">GutenbergException</a></li>
<li><a href="org/josfranmc/gutenberg/download/engine/IDownloadEngine.html" title="interface in org.josfranmc.gutenberg.download.engine"><span class="interfaceName">IDownloadEngine</span></a></li>
<li><a href="org/josfranmc/gutenberg/download/JGutenbergDownload.html" title="class in org.josfranmc.gutenberg.download">JGutenbergDownload</a></li>
</ul>
</div>
</body>
</html>
Loading

0 comments on commit ccca6d4

Please sign in to comment.