Rawns / Reddit-Wallpaper-Changer

Reddit Wallpaper Changer
MIT License
121 stars 51 forks source link

Add ability to specify time at which subreddits can be used for wallpapers #61

Closed Apprehentice closed 7 years ago

Apprehentice commented 7 years ago

I had figured that this feature could be useful to some, including myself, and so I had a go at implementing it.

The feature is implemented through the subreddits field by appending an optional time range in the format "[H:mm-H:mm]" (24hr) to a subreddit's name. If the current time is outside of that range, the subreddit is excluded from the selection of subreddits from which wallpapers can be pulled. Entries with malformed time codes are skipped.

To facilitate this, a new parse function has been added. In addition, the changeWallpaper function now quietly returns if no subreddits are available.

An example use case for this might be choosing motivational subreddits in the morning and relaxing subreddits at night. A valid subreddit string could look like, "GetMotivated[5:00-11:30]+EarthPorn[11:30-17:00]+SpacePorn[17:00-5:00]+puppies+wallpapers"

Rawns commented 7 years ago

Nice addition, thanks! )

I'll run it through testing and get it merged. :)

Rawns commented 7 years ago

Merged to development branch. :)