Add PyPI github action, move to package based folder structure, fix

banner
This commit is contained in:
csd4ni3l
2025-06-14 18:08:16 +02:00
parent c25d934f3c
commit efd60fd633
5 changed files with 68 additions and 15 deletions

34
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Publish to PyPI
on:
push:
tags:
- "v*"
jobs:
build-and-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade build twine
- name: Build the package
run: |
python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*

1
gp_dl/__init__.py Normal file
View File

@@ -0,0 +1 @@
__version__ = "0.1.0"

View File

@@ -22,8 +22,8 @@ BANNER = """
def parse_args():
parser = argparse.ArgumentParser(description="Download full-res images from a Google Photos album using Selenium.")
parser.add_argument("--album-urls", nargs="+", required=True, help="Google Photos album URL")
parser.add_argument("--output-dir", required=True, help="Directory to save downloaded images")
parser.add_argument("--album-urls", nargs="+", required=True, help="Google Photos album URL(s)")
parser.add_argument("--output-dir", required=True, help="Directory to save downloaded albums")
parser.add_argument("--driver-path", default=None, help="Custom Chrome driver path")
parser.add_argument("--profile-dir", default=None, help="Chrome user data directory for session reuse")
parser.add_argument("--headless", action="store_true", help="Run Chrome headlessly")
@@ -123,13 +123,13 @@ def main():
logging.debug("Clicking the download all button...")
download_all_button.click()
logging.debug("Waiting for Google to prepare the file...")
logging.info("Waiting for Google to prepare the file...")
crdownload_file = None
while not crdownload_file:
crdownload_file = find_crdownload_file()
time.sleep(0.1)
logging.debug("Waiting for the download to finish...")
logging.info("Waiting for the download to finish...")
zip_file = None
while not zip_file:
zip_file = find_zip_file()
@@ -148,7 +148,7 @@ def main():
successful_album_count += 1
album_times.append(time.perf_counter() - album_start)
logging.debug("Removing gp_temp directory.")
logging.debug("Removing temporary gp_temp directory.")
os.removedirs("gp_temp")
print("\n===== DOWNLOAD STATISTICS =====")
@@ -161,7 +161,7 @@ def main():
driver.quit()
if __name__ == '__main__':
def run_cli():
print(BANNER)
configure_logging()
main()

View File

@@ -4,4 +4,22 @@ version = "0.1.0"
description = "A Python-based Google Photos downloader built with Selenium."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "GPL v3" }
authors = [{ name = "csd4ni3l", email = "csd4ni3l@duck.com" }]
dependencies = ["selenium>=4.33.0"]
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Environment :: Console",
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
"Topic :: Utilities",
]
[project.scripts]
gp-dl = "gp_dl.main:run_cli"
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

2
uv.lock generated
View File

@@ -40,7 +40,7 @@ wheels = [
[[package]]
name = "gp-dl"
version = "0.1.0"
source = { virtual = "." }
source = { editable = "." }
dependencies = [
{ name = "selenium" },
]