NHL TV Downloader allows you to download NHL game videos from the NHL TV service. It automates the process of checking for new games and downloading them.
The NHL TV Downloader is a Python script that interacts with the NHL TV API to find and download full game replays. It provides features such as:
- Checking for new games of your favorite team(s) at a configurable interval
- Downloading the full game replay videos
- Removing commercial breaks from the videos
- Obfuscating the true length of the video to avoid spoilers
- Keeping downloaded videos for a configurable retention period
You have two options for running the NHL TV Downloader using Docker:
-
Install Docker on your system if you haven't already.
-
Run the Docker container using the pre-built image from GitHub Container Registry:
docker run -d \ --name dl-nhltv \ -v /path/to/download/directory:/home/nhltv/media \ -e NHLTV_USERNAME=your_username \ -e NHLTV_PASSWORD=your_password \ ghcr.io/pppontusw/dl-nhltv:latest \ -t "Your Team Name" \ -d media
Replace
/path/to/download/directory
with the directory where you want the downloaded videos to be saved.There is also a Docker compose example provided
-
Install Docker on your system if you haven't already.
-
Clone this repository:
git clone https://github.com/pppontusw/dl-nhltv
-
Navigate to the project directory:
cd dl-nhltv
-
Build the Docker image:
docker build -t nhltv .
-
Run the Docker container:
docker run -d \ --name nhltv \ -v /path/to/download/directory:/home/nhltv/media \ -e NHLTV_USERNAME=your_username \ -e NHLTV_PASSWORD=your_password \ nhltv-downloader \ -t "Your Team" \ -d media
Replace
/path/to/download/directory
with the directory where you want the downloaded videos to be saved.
You have two options for installing and running the NHL TV Downloader using Python:
-
Download the latest wheel (.whl) file from the releases page.
-
Install the wheel file using pip:
pip install dl_nhltv-x.x.x-py3-none-any.whl
Replace
x.x.x
with the version number of the downloaded wheel file. -
Run the script:
nhltv -u your_username -p your_password -t "Your Team Name"
Provide your NHL TV username, password, and the name of your favorite team.
-
Clone this repository:
git clone https://github.com/pppontusw/dl-nhltv
-
Navigate to the project directory:
cd nhltv-downloader
-
(Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install the package using pip:
pip install .
-
Run the script:
nhltv -u your_username -p your_password -t "Your Team Name"
Provide your NHL TV username, password, and the name of your favorite team.
The NHL TV Downloader runs continuously, checking for new games at the configured interval. It will download any new full game replays it finds for the specified team(s).
You can customize the behavior using command-line arguments:
-u
,--username
: Your NHL TV username (required)-p
,--password
: Your NHL TV password (required)-t
,--team
: The name or abbreviation of the team(s) you want to download games for (required) - ex: 'Nashville Predators' or NSH-d
,--download_folder
: The directory where downloaded videos will be saved (default: current directory)-i
,--checkinterval
: The interval in minutes to check for new games (default: 10)-k
,--keep
: The number of days to keep downloaded videos (default: forever)--debug
: Enable debug mode for extra logging and debug dumps
Information about downloaded games are stored in a sqlite database in your target download folder (by default the
folder where you run the program) called nhltv_database
.
If you need to reset the info about already downloaded games you can remove this file and it will be recreated the next time the program runs.
If you know your way around sqllite you can also maintain it manually with e.g. sqlite3, the data is stored in a single table called games
.
If you want to contribute to the development of the NHL TV Downloader or modify the code for your own purposes, follow these steps:
-
Clone the repository:
git clone https://github.com/pppontusw/dl-nhltv
-
Navigate to the project directory:
cd dl-nhltv
-
Create and activate a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate
-
Install the development dependencies:
pip install -r requirements.dev.txt
-
Make your desired changes to the codebase.
-
Use the provided Makefile for common development tasks:
-
Run tests:
make test
-
Lint the code using pylint:
make lint
-
Format the code using black:
make format
-
Generate coverage report:
make coverage
-
Run type checking using mypy:
make type
-
-
Ensure that your changes pass all tests, linting, and formatting checks.
-
Submit a pull request with your changes.
The requirements.dev.txt
file contains the additional development dependencies required for tasks such as testing, linting, and formatting. These dependencies are separate from the main project dependencies listed in requirements.txt
.
The provided Makefile
includes convenient targets for common development tasks, such as running tests, linting the code, formatting the code, generating coverage reports, and running type checking. You can use these targets to ensure code quality and consistency.
Feel free to explore the codebase, make improvements, and submit pull requests to contribute to the project.
This project is licensed under the MIT License. See the LICENSE file for details.