Reddit Wallpaper Puller, a simple CLI to pull wallpapers from Reddit.
Project description
Reddit Wallpaper Puller (rwpp)
This project is a simple python command line application to download images from Reddit built using Typer and Redditwarp.
Setup
For general usage as a user you can simply install the program using pip install rwpp
.
Development Environment
For development you can simply create a virtualenv and install the required dependencies.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
The project now uses Poetry to build and upload the project to PyPi. You can setup and manage your virtual environments with Poetry.
cd rwpp
poetry shell
poetry install
Usage
After installing the program using pip
you can call it from the command line using rwpp
.
The CLI will prompt you for a limit and a download path, press enter to use the defaults.
rwpp earthporn
# Output
How many images would you like to download? [10]:
Where would you like to save the images? [./downloads]:
Development
After setting up rwpp
for development, you can call the rwpp/main.py
file with the name of a subreddit.
The CLI will prompt you for a limit and a download path, press enter to use the defaults.
python rwpp/main.py earthporn
# Output
How many images would you like to download? [10]:
Where would you like to save the images? [./downloads]:
To run the program with Poetry simply use poetry run
.
poetry run rwpp earthporn
Publishing
Publishing the project to Pypi or Test Pypi is now done using Poetry. After you have made all the necessary commits, tested everything to ensure it runs as expected and setup your Pypi tokens in Poetry (read more here), the process is as follows below.
First add your pypi API token using poetry config
.
poetry config pypi-token.pypi <token>
For uploading to Test Pypi first add the repository to your config and then your token.
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi <token>
Each time you need to publish the project you can use poetry publish
.
# Bump version
poetry version patch
# Publish
poetry publish
# poetry publish -r test-pypi
Notes
This project is currently in beta and dev mode, no code is assumed to be safe. Run at your own risk, there is currently no check to make sure the url pulled from top posts contains an image, just a valid extension
The script will check the given download paths for images that 'have already been downloaded'. This is a simple check against the names of the files (titles of their respective posts) to see what's been downloaded. This can become an issue when a user wants to download to multiple paths. A sqlite db/csv file could be implemented to save details about downloads so that when checking a given path for already downloaded images, the image in question does not have to be inside of the given directory.
Had to save the images using the unique post.id rather then the post.title as sometimes it will throw an error if the title is too long. We can get the unique url which contains part of the title for a more detailed file name.
Todo
- Check to see if the subreddit exists before pulling images/Handle errors for invalid subreddit
- Add time filters, so rather then top:all we can do top:day,week,month etc.
-
After adding extra time filters, add the option to pull 'hot' posts with the same filters -
Add time filter of new posts
Only top and controversial posts supports choosing a time range for the download.
The goal is to get this script up to the state where it can be a simple command line utility you can run using rwpp
and then pass in args such as subreddit(s), how many posts, whether to be top or hot posts, the downloads path to use if not the default one
Currently doing a simple check against the list of the names ofs the images which have already been downloaded should be suffice, though I don't see it being an issue immediately, I do wonder how well it would scale and at what point does it really start to hinder performance. Maybe look at ways to do a more performant check.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rwpp-0.1.5.tar.gz
.
File metadata
- Download URL: rwpp-0.1.5.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/6.2.6-76060206-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bdf9af0511bb447c6280f8fb9632a296a295e8d3e2acbb72a8ea1837305bcc9 |
|
MD5 | 1750f106e697ede6dc85df841bfa40ac |
|
BLAKE2b-256 | 8317dfd6ff89581600ed3a536656914ea4a7ebc41219c9ccd19977e6402d908d |
File details
Details for the file rwpp-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: rwpp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/6.2.6-76060206-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc1b90bb56a18e7ba91385cb300ffe7e856c6555c2ca8aadd5f709cb51acc3dd |
|
MD5 | 3067ef261ccf6f9eeb6215af93ca6602 |
|
BLAKE2b-256 | cad3f97e4da58695318d146e14bf367fadc321a75f150ecb7e2ab9796faeb4d3 |