Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
markozajc committed Mar 19, 2024
0 parents commit 211157e
Show file tree
Hide file tree
Showing 14 changed files with 2,109 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/repository/

# IDE files
/.project
/.classpath
/.settings/
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# gogarchiver-ng
A Java rewrite of [gogarchiver](https://github.com/markozajc/gogarchiver), the GOG.com archival tool written in bash, with many improvements:

* a better, more flexible CLI
* parallel download support
* DLC support
* account library retrieval
* a much improved interface

## Building
Prerequisites:
- JDK (>= 17)
- Maven (>= 3.2.5)

Run the following:
```
$ mvn clean package
```
The output runnable JAR will be written to `target/gogarchiver-ng.jar`. There will be another JAR with the version number in that directory - ignore it.

## Finding the authorization token
1. Open firefox
2. Log into GOG.COM
3. Open developer tools (Ctrl + Shift + Alt)
4. Navigate to the *Storage* tab
5. Select *Cookies*, and then *https://www.gog.com/* on the left sidebar
6. Locate the `gog-al` cookie, and copy its value

The cookie can be passed to gogarchiver-ng directly (via `-k`) or through a file for better security (via `-K`).

## Available on:
* [https://git.zajc.eu.org/gogarchiver-ng.git/](https://git.zajc.eu.org/gogarchiver-ng.git/)
* [https://github.com/markozajc/gogarchiver-ng/](https://github.com/markozajc/gogarchiver-ng/)

Prebuilt binaries are available at [https://files.zajc.eu.org/builds/gogarchiver-ng/](https://files.zajc.eu.org/builds/gogarchiver-ng/).

<div class="sect1">
<h2 id="_options">Usage</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-k</strong>, <strong>--token</strong>=<em>TOKEN</em></dt>
<dd>
<p>GOG token, which can be extracted from the gog-al cookie</p>
</dd>
<dt class="hdlist1"><strong>-K</strong>, <strong>--token-file</strong>=<em>PATH</em></dt>
<dd>
<p>read GOG token from a file</p>
</dd>
<dt class="hdlist1"><strong>-o</strong>, <strong>--output</strong>=<em>PATH</em></dt>
<dd>
<p>directory to write downloaded games to</p>
</dd>
<dt class="hdlist1"><strong>-t</strong>, <strong>--threads</strong>=<em>THREADS</em></dt>
<dd>
<p>number of download threads</p>
<div class="literalblock">
Default: (same as machine's thread count)
</div>
</dd>
<dt class="hdlist1"><strong>-q</strong>, <strong>--quiet</strong></dt>
<dd>
<p>disable progress bars</p>
</dd>
<dt class="hdlist1"><strong>-c</strong>, <strong>--color</strong>=<em>MODE</em></dt>
<dd>
<p>control output color. Supported are auto, on, off</p>
</dd>
<dt class="hdlist1"><strong>-h</strong>, <strong>--help</strong></dt>
<dd>
<p>Show this help message and exit.</p>
</dd>
<dt class="hdlist1"><strong>-V</strong>, <strong>--version</strong></dt>
<dd>
<p>Print version information and exit.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_filter_options">Filter options</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--[no-]installers</strong></dt>
<dd>
<p>download installers</p>
<div class="literalblock">
Default: true
</div>
</dd>
<dt class="hdlist1"><strong>--[no-]patches</strong></dt>
<dd>
<p>download version patches</p>
<div class="literalblock">
Default: true
</div>
</dd>
<dt class="hdlist1"><strong>--[no-]dlcs</strong></dt>
<dd>
<p>download available DLCs</p>
<div class="literalblock">
Default: true
</div>
</dd>
<dt class="hdlist1"><strong>-i</strong>, <strong>--include-game</strong>=<em>ID</em>[,<em>ID</em>&#8230;&#8203;]</dt>
<dd>
<p>only the listed game IDs will be downloaded. Game IDs can be obtained from <a href="https://www.gogdb.org/" class="bare">https://www.gogdb.org/</a></p>
</dd>
<dt class="hdlist1"><strong>-e</strong>, <strong>--exclude-game</strong>=<em>ID</em>[,<em>ID</em>&#8230;&#8203;]</dt>
<dd>
<p>all games owned by the account except those listed will be downloaded</p>
</dd>
<dt class="hdlist1"><strong>--include-platform</strong>=<em>PLATFORM</em>[,<em>PLATFORM</em>&#8230;&#8203;]</dt>
<dd>
<p>platforms to download for. Supported are linux, windows, mac</p>
</dd>
<dt class="hdlist1"><strong>--exclude-platform</strong>=<em>PLATFORM</em>[,<em>PLATFORM</em>&#8230;&#8203;]</dt>
<dd>
<p>platforms to not download for</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_advanced_options">Advanced options</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong>, <strong>--verbose</strong></dt>
<dd>
<p>display verbose log messages</p>
</dd>
<dt class="hdlist1"><strong>--[no-]unknown-types</strong></dt>
<dd>
<p>download unknown download types</p>
<div class="literalblock">
Default: false
</div>
</dd>
</dl>
</div>
</div>
</div>
159 changes: 159 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>zajc</groupId>
<artifactId>gogarchiver-ng</artifactId>
<version>2.0</version>

<name>gogarchiver-ng</name>
<description>An archival tool for GOG.com</description>
<inceptionYear>2024</inceptionYear>

<licenses>
<license>
<name>The GNU General Public License, Version 3.0</name>
<url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>

<!-- HTTP Client -->
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.14.5</version>
</dependency>

<!-- CLI support -->
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.5</version>
</dependency>
<dependency>
<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
<version>0.10.0</version>
</dependency>

<!-- Lambda Improvement -->
<dependency>
<groupId>org.eu.zajc</groupId>
<artifactId>extended-functions</artifactId>
<version>1.4.2</version>
</dependency>

<!-- Annotations -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>

<!-- Version checker -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
<configuration>
<rulesUri>file://${project.basedir}/versions-ruleset.xml</rulesUri>
</configuration>
</plugin>

<!-- Version enforcer -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<!-- Analyzer -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<ignoreNonCompile>true</ignoreNonCompile>
</configuration>
</plugin>

<!-- Shader -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/LICENSE*</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/NOTICE*</exclude>
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>LICENSE*</exclude>
<exclude>CHANGELOG*</exclude>
<exclude>README*</exclude>
<exclude>about.html</exclude>
<exclude>.keep</exclude>
<exclude>**/module-info.class</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>zajc.gogarchiver.Main</mainClass>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>${project.build.directory}/${project.artifactId}.jar</outputFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

</project>
Loading

0 comments on commit 211157e

Please sign in to comment.