diff --git a/meme-of-the-day-client.ps1 b/meme-of-the-day-client.ps1 index 4b4b5a7..0d0dcac 100644 --- a/meme-of-the-day-client.ps1 +++ b/meme-of-the-day-client.ps1 @@ -1,10 +1,8 @@ Function Set-WallPaper($Value){ - $url = "https://motd.ping-mee.de/wallpaper.png"; - $wc = New-Object System.Net.WebClient - $wc.DownloadFile($url, "C:\temp\wallpaper.png") - Invoke-WebRequest $url -OutFile C:\temp\wallpaper.png - Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value + Invoke-WebRequest "https://motd.ping-mee.de/wallpaper.png" -OutFile "$($value)wallpaper.png" + Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value "$($value)wallpaper.png" rundll32.exe user32.dll, UpdatePerUserSystemParameters + } -Set-WallPaper -value "C:\temp\wallpaper.png" \ No newline at end of file +Set-WallPaper -value "C:\temp\" \ No newline at end of file diff --git a/save-image.py b/save-image.py index 4641993..431f1e9 100644 --- a/save-image.py +++ b/save-image.py @@ -27,13 +27,14 @@ subreddit = reddit.subreddit(subreddit_name) posts = subreddit.top(time_filter="day", limit=5) for post in posts: try: - print(post.url) - if post.url.endswith(".png") or post.url.endswith(".jpg"): - debugging_message("Found a new post: "+post.title+" ("+post.id+")") + if post.over_18 == False: print(post.url) - debugging_message("Saving post to file") - with open(current_path+'/wallpaper.png', "wb") as file: - file.write(requests.get(post.url).content) - debugging_message("Saving post to file done") + if post.url.endswith(".png") or post.url.endswith(".jpg"): + debugging_message("Found a new post: "+post.title+" ("+post.id+")") + print(post.url) + debugging_message("Saving post to file") + with open(current_path+'/wallpaper.png', "wb") as file: + file.write(requests.get(post.url).content) + debugging_message("Saving post to file done") except: debugging_message("Error while getting post skipping and continuing") \ No newline at end of file