Skip to content

refactor: migrate to audio_downloader package, fix promo to Spots, filter NW date files, add --download-promo#5

Open
wardbryan3 wants to merge 11 commits into
mainfrom
fix/promo-fixes
Open

refactor: migrate to audio_downloader package, fix promo to Spots, filter NW date files, add --download-promo#5
wardbryan3 wants to merge 11 commits into
mainfrom
fix/promo-fixes

Conversation

@wardbryan3

@wardbryan3 wardbryan3 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Reorganize the project into a proper audio_downloader Python package, fix promo file handling across multiple sources, and add CLI improvements for promo downloads.

Changes

Package Reorganization (10 commits)

  • Move all source files (main.py, config.py, gui.py, browser_manager.py, constants.py, download_utils.py, sources/) into audio_downloader/ package
  • Add pyproject.toml with setuptools build config and audio_downloader/__main__.py for python -m audio_downloader entry point
  • Update all internal imports to use audio_downloader. prefix, removing sys.path.insert(0,...) workarounds
  • Move test scripts to tests/ and Windows batch files to scripts/ for cleaner project root
  • Update PyInstaller spec (AudioDownloader.spec) with new package paths and hidden imports
  • Update .github/workflows/windows_build.yml for new file locations
  • Update AGENTS.md with new project structure and developer commands

Promo File Handling Fixes

  • WITC promos now go to Spots/ directory instead of staying in the global features output directory. Promos are moved to Spots/WITC_PROMO_MM-DD-YY.mp3 with dated filenames.
  • NW Outdoors date-stamped files filtered: Files matching NWoutdoors<6digits>.mp3 are now skipped after ZIP extraction, preventing stale date-stamped content from being copied into the global features folder.
  • NW Outdoors promo labeling consistency: Progress messages and class docstrings updated from "Global Features" to "GLOBAL FEATURES".
  • GUI button text updated from "Download Global Features" to "Download GLOBAL FEATURES".

Config & Path Changes

  • Add get_spots_dir() to ConfigManager — creates and manages a Spots/ subdirectory under the output base
  • Add Spots/ to ensure_folders() and validate_config() checks
  • Rename "Global Features" reference path to "GLOBAL FEATURES" (uppercase) for consistency with actual folder naming
  • .gitignore: add docs/superpowers/ to ignore AI design docs

CLI Improvements

  • Add --download-promo flag and run_promo_download() function for downloading the Northwest Outdoors promo standalone via CLI
  • Add python -m audio_downloader --download-promo as a supported invocation
  • Update batch scripts (scripts/download_global_features.bat, scripts/download_promos.bat) to use correct working directory (%~dp0.. instead of %~dp0)

Documentation

  • Add scripts/witc_promo_rename.bat — PowerShell-based WITC promo renaming script that finds the upcoming Saturday's promo and copies it to WITC_PROMO.mp3
  • Add weekly automation design spec at docs/superpowers/specs/2026-06-26-weekly-automation-design.md covering the future consolidated weekly download pipeline

Testing

  • Update all test files for package restructuring (audio_downloader. prefix, new module paths)
  • Update test imports and mock patches to use audio_downloader. package references
  • Update WITC tests (test_weekend_in_the_country.py) to verify promos are moved to Spots/ directory instead of staying in-place — all 8 tests pass
  • Add test_northwest_outdoors_date_stamped_file_filter to test_sources.py — verifies the regex pattern for filtering NWoutdoors<6digits>.mp3 files
  • Remove sys.path.insert(0,...) hacks from test files, using proper package imports instead

Test Plan

.venv/bin/python tests/test_sources.py
.venv/bin/python tests/test_weekend_in_the_country.py
.venv/bin/python tests/test_config_edge_cases.py
.venv/bin/python tests/test_download_utils.py
.venv/bin/python tests/test_browser_manager.py
.venv/bin/python tests/test_integration.py

Source files now live inside the audio_downloader/ package, so sibling
module imports are updated from bare names to the package-qualified form
(e.g. 'from config import' -> 'from audio_downloader.config import').
Also remove the sys.path.insert hack from main.py that is no longer
needed now that the code is importable as a package.
- Update all bare imports (config, sources, browser_manager, download_utils)
  to use audio_downloader. prefix
- Fix tests/__init__.py sys.path to point to project root (parent.parent)
- Add sys.path.insert to test_downloads.py for project root discovery
- Update mock patch paths in test_integration.py and test_browser_manager.py
  to use audio_downloader. prefix
- Keep sys.path.insert lines in test files for direct execution
- audio_downloader/__main__.py enables 'python -m audio_downloader'
- pyproject.toml enables 'pip install -e .' with setuptools backend
- Declares dependencies: selenium, webdriver-manager, psutil
- bat scripts: cd to %~dp0.. to navigate from scripts/ to repo root
- AGENTS.md: update all references from root-level .py files to audio_downloader/ paths
- CI: update sed/git add to target audio_downloader/__init__.py
@wardbryan3 wardbryan3 changed the title fix: promo fixes - Spots directory, date stamp filter, package reorganization refactor: migrate to audio_downloader package, fix promo to Spots, filter NW date files, add --download-promo Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant