-
-
Save TRSGuy/aeed4690fd2db15e57d3cdf85342ebb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw, subprocess, pathlib | |
SUBREDDIT = "wallpapers" | |
pp = "{}/.prevwall".format(str(pathlib.Path.home())) # this is where the previously used wallpaper links are stored | |
previousImages = [] # This is where the urls of previously used images will be stored | |
r = praw.Reddit(client_id="", | |
client_secret="", | |
user_agent="WallpaperGrabber by /u/ParanoidBox") | |
allowedFormats = ['jpg', 'png'] | |
urls = [post.url for post in r.subreddit(SUBREDDIT).hot(limit=5) if post.url.split(".")[-1] in allowedFormats and !(in previousImages)post.url] | |
subprocess.call(['feh', "--bg-fill", urls[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment