-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete vscodecounter update gitignore Fix typo in command Update dockerfile command More modifications to s6 Remove windows only python package Typo Try changing the order More s6 stuff Typo bump Major Refactor Version Bump
- Loading branch information
Showing
38 changed files
with
4,710 additions
and
1,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,13 +35,15 @@ jobs: | |
echo "CALIBRE_VERSION=$CALIBRE_VERSION" >> $GITHUB_ENV | ||
FFF_VERSION=$(cat release-versions/fff.txt) | ||
echo "FFF_VERSION=$FFF_VERSION" >> $GITHUB_ENV | ||
S6_OVERLAY_VERSION=$(cat release-versions/s6.txt) | ||
echo "S6_OVERLAY_VERSION=$S6_OVERLAY_VERSION" >> $GITHUB_ENV | ||
- name: Print image tag | ||
run: | | ||
echo "Branch: $CI_ACTION_REF_NAME" | ||
echo "Release Version: ${{ env.RELEASE_VERSION }}" | ||
echo "Calibre Version: ${{ env.CALIBRE_VERSION }}" | ||
echo "FFF Version: ${{ env.FFF_VERSION }}" | ||
echo "S6 Overlay Version: ${{ env.S6_OVERLAY_VERSION }}" | ||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
|
@@ -60,3 +62,4 @@ jobs: | |
VERSION=${{ env.RELEASE_VERSION }} | ||
CALIBRE_RELEASE=${{ env.CALIBRE_VERSION }} | ||
FFF_RELEASE=${{ env.FFF_VERSION }} | ||
S6_OVERLAY_VERSION=${{ env.S6_OVERLAY_VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,5 @@ ENV/ | |
# mypy | ||
.mypy_cache/ | ||
|
||
# Code Counter | ||
.VSCodeCounter/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.33.0 | ||
4.34.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2024.04.01-1 | ||
2024.05.27-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.1.6.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
beautifulsoup4==4.12.3 | ||
Brotli==1.1.0 | ||
certifi==2024.2.2 | ||
chardet==5.2.0 | ||
charset-normalizer==3.3.2 | ||
cloudscraper==1.2.71 | ||
freezegun==1.5.1 | ||
html2text==2024.2.26 | ||
html5lib==1.1 | ||
idna==3.7 | ||
parameterized==0.9.0 | ||
pillow==10.3.0 | ||
pushbullet.py==0.12.0 | ||
pyparsing==3.1.2 | ||
python-dateutil==2.9.0.post0 | ||
python-magic==0.4.27 | ||
requests==2.31.0 | ||
requests-file==2.0.0 | ||
requests-toolbelt==1.0.0 | ||
setuptools==58.1.0 | ||
six==1.16.0 | ||
soupsieve==2.5 | ||
urllib3==2.2.1 | ||
webencodings==0.5.1 | ||
websocket-client==1.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import multiprocessing as mp | ||
import os | ||
from subprocess import call | ||
|
||
import ff_logging | ||
import tomllib | ||
|
||
|
||
|
||
class CalibreInfo: | ||
""" | ||
This class represents the Calibre library information. | ||
It reads the configuration from a TOML file and provides access to the Calibre library details. | ||
""" | ||
|
||
def __init__(self, toml_path: str, manager: mp.Manager): | ||
""" | ||
Initialize the CalibreInfo object. | ||
Args: | ||
toml_path (str): The path to the TOML configuration file. | ||
manager (mp.Manager): A multiprocessing Manager instance. | ||
""" | ||
# Open and load the TOML configuration file | ||
with open(toml_path, "rb") as file: | ||
config = tomllib.load(file) | ||
|
||
# Get the 'calibre' section from the configuration | ||
calibre_config = config.get("calibre", {}) | ||
|
||
# If the 'path' key is not present in the 'calibre' section, log a failure and raise an exception | ||
if not calibre_config.get("path"): | ||
message = "Calibre library location not set in the config file. Cannot search the calibre library or update it." | ||
ff_logging.log_failure(message) | ||
raise ValueError(message) | ||
|
||
# Set the Calibre library details | ||
self.location = calibre_config.get("path") | ||
self.username = calibre_config.get("username") | ||
self.password = calibre_config.get("password") | ||
self.default_ini = self._append_filename(calibre_config.get("default_ini"), "defaults.ini") | ||
self.personal_ini = self._append_filename(calibre_config.get("personal_ini"), "personal.ini") | ||
|
||
# Create a lock for thread-safe operations | ||
self.lock = manager.Lock() | ||
|
||
@staticmethod | ||
def _append_filename(path: str, filename: str) -> str: | ||
""" | ||
Append the filename to the path if it's not already there. | ||
Args: | ||
path (str): The original path. | ||
filename (str): The filename to append. | ||
Returns: | ||
str: The path with the filename appended. | ||
""" | ||
# If the path is not None and does not already end with the filename, append the filename | ||
if path and not path.endswith(filename): | ||
return os.path.join(path, filename) | ||
return path | ||
|
||
# Check if Calibre is installed | ||
def check_installed(self) -> bool: | ||
try: | ||
# Try to call calibredb | ||
with open(os.devnull, "w") as nullout: | ||
call(["calibredb"], stdout=nullout, stderr=nullout) | ||
return True | ||
except OSError: | ||
# If calibredb is not found, log a failure and return False | ||
ff_logging.log_failure( | ||
"Calibredb is not installed on this system. Cannot search the calibre library or update it." | ||
) | ||
return False | ||
except Exception as e: | ||
# If any other error occurs, log a failure | ||
ff_logging.log_failure(f"Some other issue happened. {e}") | ||
return False | ||
|
||
# String representation of the object | ||
def __str__(self): | ||
repr = f' --with-library "{self.location}"' | ||
if self.username: | ||
repr += f' --username "{self.username}"' | ||
if self.password: | ||
repr += f' --password "{self.password}"' | ||
return repr |
Oops, something went wrong.