Skip to content

Commit

Permalink
Merge pull request #27 from 31December99/work
Browse files Browse the repository at this point in the history
autouploader
  • Loading branch information
31December99 authored Aug 20, 2024
2 parents 031a848 + 5b0e9e6 commit 6c53b30
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 111 deletions.
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Env file
*.env

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
68 changes: 68 additions & 0 deletions autoupdate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
import subprocess
import os
import sys


def install_git(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])


class MyGit:
"""
Install gitPython and update the repository
"""

def __init__(self, repo_local_path: str):
self.repo_local_path = repo_local_path
self.repo_url = "https://github.com/31December99/Unit3Dup.git"
self.repo_exist = os.path.exists(self.repo_local_path)

def process(self) -> bool:
if not self.repo_exist:
console.log(f"Cloning repository from {self.repo_url} to {self.repo_local_path}", style="bold blue")
git.Repo.clone_from(self.repo_url, self.repo_local_path)
return True
else:
self._update()

def _update(self):
# Check if the path is a valid Git repository
try:
repo = git.Repo(self.repo_local_path)
except git.exc.InvalidGitRepositoryError:
console.log(f"{self.repo_local_path} is not a valid Git repository", style='red bold')
exit(1)

# If there are uncommitted local changes
if repo.is_dirty(untracked_files=True):
repo.git.stash('save', '--include-untracked')

# Update the repository
origin = repo.remotes.origin
origin.pull()
console.log(f"Repository updated successfully to '{repo.tags[-1]}'", style="bold blue")
console.rule("", style='violet bold')
# Reapply stashed local changes, if any
if repo.git.stash('list'):
repo.git.stash('pop')


if __name__ == "__main__":
# Test Imports
try:
import git
import rich
except ImportError:
print("Installation in progress...")
install_git("gitpython")
install_git("rich")

import git
from rich.console import Console

console = Console(log_path=False)

console.rule("- Autoupdate for Unit3D-up -", style='violet bold')
my_git = MyGit(repo_local_path=os.getcwd())
my_git.process()
12 changes: 0 additions & 12 deletions preferences.cfg

This file was deleted.

37 changes: 3 additions & 34 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
attrs==23.2.0
babelfish==0.6.1
build==1.2.1
certifi==2024.7.4
charset-normalizer==3.3.2
click==8.1.7
diskcache==5.6.3
flatbencode==0.2.1
frozenlist==1.4.1
guessit==3.8.0
idna==3.7
markdown-it-py==3.0.0
mdurl==0.1.2
multidict==6.0.5
mypy-extensions==1.0.0
numpy==2.0.1
opencv-python==4.10.0.84
packaging==24.1
pathspec==0.12.1
platformdirs==4.2.2
Pygments==2.18.0
pdf2image==1.17.0
pymediainfo==6.1.0
pyproject_hooks==1.1.0
python-dateutil==2.9.0.post0
python-decouple==3.8
python-qbittorrent==0.4.3
rapidfuzz==3.9.5
rebulk==3.2.0
requests==2.32.3
rich==13.7.1
six==1.16.0
torf==4.2.7
tqdm==4.66.5
thefuzz==0.22.1
tmdbv3api==1.9.0
tomli==2.0.1
torf==4.2.7
tqdm==4.66.4
typing_extensions==4.12.2
ua-parser==0.18.0
Unidecode==1.3.8
urllib3==2.2.2
user-agents==2.2.0
yarl==1.9.4
unidecode==1.3.8
23 changes: 21 additions & 2 deletions service.back
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
## TMDDB API KEY - https://www.themoviedb.org/
TMDB_APIKEY=

## IMGBB API KEY - https://imgbb.com/
IMGBB_KEY=

## FREEIMAGE API_KEY - https://freeimage.host/
FREE_IMAGE_KEY=

## QBITTORRENT REMOTE CONTROL
QBIT_USER=
QBIT_PASS=
QBIT_URL=http://127.0.0.1
QBIT_PORT=
QBIT_URL=
QBIT_PORT=

## USER OPTIONS

# True = It Searches for duplicates
# False = Does not search for duplicates
duplicate_on=False

# Choose the numbers of screenshots you want upload to tracker
number_of_screenshots=4

# Path for your local torrent file
torrent_archive =''
10 changes: 1 addition & 9 deletions unit3dup/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,4 @@ def __init__(self):
console.log(
f"Configuration file '{self.args.tracker}.json' not found for tracker '{self.args.tracker}'"
)
sys.exit()

database_tracker = os.path.join(f'preferences.cfg')
if not os.path.exists(database_tracker):
console.log(
f"Configuration file 'preferences.cfg' not found'"
)
sys.exit()

sys.exit()
Loading

0 comments on commit 6c53b30

Please sign in to comment.