Skip to content

Commit

Permalink
Merge branch 'unstable' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDev1 committed Jan 23, 2024
2 parents f82061a + 2e352bb commit de1938a
Show file tree
Hide file tree
Showing 35 changed files with 1,308 additions and 1,077 deletions.
13 changes: 0 additions & 13 deletions .github/FUNDING.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ __pycache__
tmp.py
env
sample_img
unit_tests_tmp
unit_tests_tmp
misc/appimagetool
misc/VC_redist.x64.exe
42 changes: 40 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
XL Converter is licensed under GNU General Public License v3 (GPLv3).
XL Converter is licensed under GNU General Public License v3.

Copyright (c) 2023 code poems <[email protected]>
Copyright (c) 2023 - 2024 Code Poems <[email protected]>

---------------------------------------------------------------------------------

This End-User License Agreement ("EULA") is a legal agreement between you (either an individual or an entity) and the software program's authors and contributors, for the software product accompanying this EULA, which includes computer software and may include associated media, printed materials, and "online" or electronic documentation ("Software").

By installing, copying, or otherwise using the Software, you agree to be bound by the terms of this EULA, which incorporates the terms and conditions of the GNU General Public License Version 3 (GPLv3) as published by the Free Software Foundation. If you do not agree to the terms of this EULA, do not install or use the Software.

COPYRIGHT: The Software is copyrighted and licensed (not sold) to you. The Software is protected by copyright laws and treaties around the world. All rights not expressly granted to you by this EULA are reserved by the copyright owners.

LICENSE: The Software is licensed under the GNU General Public License Version 3 (GPLv3), the terms of which are incorporated herein by reference. By installing, copying, or using the Software you acknowledge that you have read the GPLv3, understand it, and agree to be bound by its terms and conditions. The GPLv3 can be obtained at: http://www.gnu.org/licenses/gpl-3.0.html

LICENSE GRANT: This EULA grants you the following rights, subject to the terms of the GPLv3:
- You may copy, distribute, and modify the software provided that you track changes/dates in source files and keep intact all notices on the original software.
- You may distribute the software to anyone and for any purpose and charge no more than the cost of distributing the software.
- You may use portions of the software independently of the complete program.
- Works that you distribute or publish that contain or are derived from the Software or any part thereof must be licensed as a whole at no charge to all third parties under the terms of this License (GPLv3).

UPDATE FEATURE: The Software includes a feature to check for updates, which requires the transmission of the user's Internet Protocol (IP) address to a server in order to obtain a text file for the update process. By using this feature, you acknowledge and consent to the transmission of your IP address for this purpose. The IP address is used solely for fetching the necessary update information and will not be used for any other purposes. While the IP address may be stored for a period of up to 12 months, it is typically stored for a shorter period.

WEB LINK FEATURE: The Software includes a feature that opens a link to our webpage or our GitHub repository. By using this feature, you acknowledge and consent to the Software initiating an external connection to these sites. Please note that our webpage and GitHub repository are governed by their own terms of service and privacy policies, which we encourage you to review.

PRIVACY: The author prioritizes your privacy. Apart from the IP address used for the update feature, no other personal data is collected from you without your explicit consent.

DISCLAIMER OF WARRANTY: The Software is provided 'as is' without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the Software is with you.

LIMITATION OF LIABILITY: Except as mandated by law or as explicitly agreed upon in a written contract, neither copyright owners nor any individuals or entities that amend and/or distribute the Software under GPLv3 shall bear financial responsibility to you for any form of loss or damage. This exclusion of liability encompasses a wide range of potential issues, such as general, specific, unplanned, or secondary harm that may arise from utilizing or the failure to use the Software. Potential issues covered include, but are not limited to, data loss, data corruption, any harm suffered by you or third parties, or the inability of the Software to function with other software systems, even if such copyright owner or entity has been previously notified about the risk of such damages.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

TERMINATION: This EULA and your rights under it will terminate automatically without notice from the copyright owner if you fail to comply with any of its terms and conditions, including but not limited to the terms of the GNU General Public License Version 3 (GPLv3).

MISCELLANEOUS: This EULA is governed by the laws of the jurisdiction in which the copyright owner resides. If any part of this EULA is found to be void, invalid, or unenforceable, it will not affect the validity of the balance of the EULA, which shall remain valid and enforceable according to its terms.

ENTIRE AGREEMENT: This EULA (including the GPLv3) is the entire agreement between you and the copyright owner relating to the Software and supersedes all prior or contemporaneous oral or written communications, proposals, and representations with respect to the Software or any other subject matter covered by this EULA.

By installing, copying, or using the Software you acknowledge that you have read this EULA, understand it, and agree to be bound by its terms and conditions. You also agree that this EULA is the complete and exclusive statement of the agreement between us and supersedes all proposals or prior agreements, oral or written, and any other communications relating to the subject matter of this EULA.

You can contact me at this email address: [email protected]

-----------------------------------------------------------------------------------

Expand Down
59 changes: 24 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,17 @@ Available for Windows and Linux.

![](misc/screenshots/screenshot_0.png)

## Support This Project

- [Patreon](https://patreon.com/codepoems) - get rewards
- [Ko-Fi](https://ko-fi.com/codepoems) - one-time donation
- [Libera](https://liberapay.com/CodePoems/donate)

## Knowledge-base

Easy to digest documentation [here](https://xl-converter-docs.codepoems.eu)
The [documentation](https://xl-docs.codepoems.eu)

## Supported Formats

Encode to **JPEG XL, AVIF, WEBP, and JPG**. [read more](https://xl-converter-docs.codepoems.eu/supported-formats)
Encode to **JPEG XL, AVIF, WEBP, and JPG**. Convert from **HEIF** and [more](https://xl-docs.codepoems.eu/supported-formats)

## Features
### JPEG XL

#### Intelligent Effort

Optimizes `Effort` for smaller size.

#### JPG Reconstruction

Reconstructs the original JPG from a JPEG XL file.

### Technical
#### Multithreading

Speeds up JPEG XL encoding significantly.
Expand All @@ -45,32 +30,42 @@ Avoid picky encoders. A proxy is generated when an encoder doesn't support a spe

For example, this enables HEIF -> JPEG XL conversion.

### General
#### Downscaling

Scale down images to resolution, percent, shortest (and longest) side, or file size.

#### Lossless (Only If Smaller)

Picks the smallest out of two.

#### Smallest Lossless

Utilize multiple formats to achieve the smallest size.

![](misc/screenshots/screenshot_2.png)

#### Intelligent Effort

Optimizes `Effort` for smaller size.

#### Lossless (Only If Smaller)

Picks the smallest out of two.

## Bug Reports

You can submit a bug report in 2 ways
- \[public\] Submit a new [GitHub Issue](https://github.com/JacobDev1/xl-converter/issues)
- \[private\] Email me at [email protected]

## Building from Source

### Windows 10

Install Python `3.11.6` from [here](https://www.python.org/downloads).

Check `Add Python to environment variables` and `pip` as option features.
Prerequisites:
- Python `3.11.6` (with `pip`)
- `git`

Download and enter the repo.
Clone the repo.

```cmd
git clone -b v0.9.6 --depth 1 https://github.com/JacobDev1/xl-converter.git
cd xl-converter
```

Expand All @@ -82,7 +77,7 @@ env\Scripts\activate.bat
pip install -r requirements.txt
```

Install redistributables
Install redistributable

```cmd
misc\VC_redist.x64.exe
Expand Down Expand Up @@ -113,8 +108,8 @@ sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev
Clone and set up the repo.

```bash
git clone https://github.com/JacobDev1/xl-converter.git
chmod -R 755 xl-converter
git clone -b v0.9.6 --depth 1 https://github.com/JacobDev1/xl-converter.git
chmod -R +x xl-converter
cd xl-converter
```

Expand Down Expand Up @@ -176,12 +171,6 @@ make build

The project runs on Python `3.11.6`. The one in your repo should work, but If it doesn't use `pyenv` to get this one specifically.

## Bug Reports

You can submit a bug report in 2 ways
- \[public\] Submit a new [GitHub Issue](https://github.com/JacobDev1/xl-converter/issues)
- \[private\] Email me at [email protected]

## Contributions

Pull requests are ignored to avoid potential legal complications when reusing the code.
Expand Down
74 changes: 64 additions & 10 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import platform, os, shutil, glob, subprocess, PyInstaller.__main__, argparse, shutil, stat
import platform
import os
import shutil
import subprocess
import argparse
import stat
from pathlib import Path

import PyInstaller.__main__
import requests

from data.constants import VERSION

PROGRAM_FOLDER = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -67,6 +77,35 @@ def rmTree(path):
if os.path.isdir(path):
shutil.rmtree(path)

class Downloader():
"""Downloads dependencies."""
def __init__(self):
self.appimagetool_url = "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage"
self.appimagetool_dst = "misc/appimagetool"

self.redist_url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
self.redist_dst = "misc/VC_redist.x64.exe"

def download(self, url, dst):
if Path(dst).is_file():
return

print(f"[Downloading] Downloading \"{dst}\"")
response = requests.get(url)
if response.status_code == 200:
with open(Path(dst), 'wb') as f:
f.write(response.content)
else:
print(f"[Downloading] Downloading failed ({dst})")

addExecPerm(dst)

def downloadAppImageTool(self):
self.download(self.appimagetool_url, self.appimagetool_dst)

def downloadRedistributable(self):
self.download(self.redist_url, self.redist_dst)

class Args():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
Expand All @@ -89,9 +128,10 @@ def getArg(self, arg):
return self.args[arg]

class Builder():
# You can use "/" paths (the functions will normalize it)
# You can use the "/" symbol to divide paths (the functions will normalize it)
def __init__(self):
self.args = Args()
self.downloader = Downloader()

# General
self.project_name = "xl-converter"
Expand Down Expand Up @@ -136,7 +176,7 @@ def build(self):
self._appendInstaller()
self._appendDesktopEntry()
self._appendMisc()
self._appendRedistributables()
self._appendRedistributable()
self._appendUpdateFile()
self._finish()

Expand Down Expand Up @@ -170,7 +210,8 @@ def _buildBinaries(self):
print("[Building] Generating binaries")
makedirs(self.dst_dir)
PyInstaller.__main__.run([
'main.spec'
"--log-level=ERROR",
str(Path("misc/main.spec"))
])

def _copyDependencies(self):
Expand Down Expand Up @@ -209,12 +250,13 @@ def _appendMisc(self):
makedirs(f"{self.internal_dir}/icons")
copy(self.icon_svg_path, f"{self.internal_dir}/icons/{os.path.basename(self.icon_svg_path)}")

def _appendRedistributables(self):
def _appendRedistributable(self):
if platform.system() != "Windows":
return

print("[Building] Appending redistributables")
redist_dst = f"{self.dst_dir}/{self.project_name}/redistributables"
self.downloader.downloadRedistributable()
print("[Building] Appending redistributable")
redist_dst = f"{self.dst_dir}/{self.project_name}/redist"
makedirs(redist_dst)
copy(self.redist_path, redist_dst)

Expand All @@ -231,6 +273,12 @@ def _finish(self):

# _build methods transform the directory!
def _buildAppImage(self):
if platform.system() != "Linux":
return

self.downloader.downloadAppImageTool()

print("[Building] Building an AppImage")
dsk_ent_f = os.path.basename(self.desktop_entry_path)
dsk_ent_p = f"{self.dst_dir}/{dsk_ent_f}"
appdir = f"{self.dst_dir}/AppDir"
Expand Down Expand Up @@ -260,7 +308,13 @@ def _build7z(self):
move(f"{self.dst_dir}/{os.path.basename(self.desktop_entry_path)}", dst)
subprocess.run(("7z", "a", f"{dst_direct}.7z", dst_direct), cwd=self.dst_dir)


if __name__ == '__main__':
builder = Builder()
builder.build()
try:
builder = Builder()
builder.build()
except (KeyboardInterrupt, SystemExit):
print("[Building] Interrupted")
exit()
except (Exception, OSError) as err:
print(f"[Building] Error - ({err})")
exit()
4 changes: 2 additions & 2 deletions core/conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def checkForConflicts(self, ext, _format, int_e, effort, downscaling):

return self.conflict

def conflictOccured(self):
def conflictOccurred(self):
return self.conflict

def getConflictsMsg(self):
return self.conflict_msg

def jxlConflictOccured(self):
def jxlConflictOccurred(self):
return self.jxl_conflict

def jxlGetNormEffort(self, effort):
Expand Down
Loading

0 comments on commit de1938a

Please sign in to comment.