Skip to content

Commit

Permalink
Fixed flickr images not being set as wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
NullSense committed Dec 7, 2015
1 parent a622caf commit 86104c5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ Run.lnk
*.gif

setup.py

dist
cacert.pem
build
praw.ini
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# WallDit
A very lightweight python program that sets your wallpaper, taken from Reddit, based on your set parameters (GUI version)
A very lightweight python program that sets your wallpaper, of images taken from Reddit, based on your set parameters (GUI version)

# GIF (.pyw no CMD version):
## GIF ([Binary .exe is finally released!](https://github.com/MrCappuccino/WallDit-QT/releases)):
![How it works](http://i.imgur.com/jfVSYvC.gif)

# Plans (Ascending priority):
* Make app standalone (no need for python and module downloads)
## Plans (Descending priority):
* Saving wallpaper to another dir
* Minimize and run in background
* Timer to automatically change wallpaper
* Launch on startup
* Linux support

# Setup:
## [Binary released, just extract the compressed files and double click the .exe](https://github.com/MrCappuccino/WallDit-QT/releases)

### If you want to contribute, feel free to do so, any help is appreciated!

## Setup (If you wanna run it yourself):
* download the modules
```
pip install praw
pip install pyside
```

# Launch:
## Launch:

* Version with CMD for debugging purposes

Expand Down
11 changes: 1 addition & 10 deletions WallDit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ def get_post_type(window):
# Checks if the submission fits the specified parameters
def is_ok_submission_url(window, submission, link_search_limit):
suffixes = ['.gif', '.gifv', '.com']
dont_include = {'/a/', '/gallery/', 'gfy', 'deviantart', 'reddit', 'artstation'}
dont_include = {'/a/', '/gallery/', 'gfy', 'deviantart', 'reddit', 'artstation', 'flickr'}
url = submission.url
global counter
if any(term in url for term in dont_include) or url.endswith(tuple(suffixes)) or not url:
print("\n\nSubmission ERROR: image a(n) album/gif, from deviantart or empty.")
counter = counter +1
print("counter:" + str(counter))
return False
if submission.over_18 and window.handle_nsfw_checkbox() == False:
print("Submission is over 18 and NSFW is unchecked.")
counter = counter +1
print("counter:" + str(counter))
return False
if counter == link_search_limit:
window.handle_status_label("Error: Submission are all invalid, up the counter or try again")
Expand All @@ -59,11 +55,8 @@ def get_link(window):
post_types = ['get_hot', 'get_top_from_hour', 'get_top_from_day', 'get_top_from_week', 'get_top_from_month', 'get_top_from_year', 'get_top_from_all']

for submission in getattr(subreddit, post_types[p_type])(limit = link_search_limit):
if "." not in submission.title:
print("\nKarma: {submission}\nNSFW: {submission.over_18}".format(submission=submission))
if is_ok_submission_url(window, submission, link_search_limit):
window.handle_progress_bar(25)
window.handle_status_label("\nKarma: {submission}\nNSFW: {submission.over_18}".format(submission=submission))
return submission.url

# Downloads image
Expand Down Expand Up @@ -100,11 +93,9 @@ def set_wallpaper(window):
path = os.path.join(cwd, "DownloadedImage.png")
url = get_image_download(window)
window.handle_progress_bar(30)
print("Setting image as desktop background...")
window.handle_status_label("Setting image as desktop background...")
if ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 0): # Runs on magical pony farts, do not touch
window.handle_progress_bar(30)
print("Desktop background set successfully.")
window.handle_status_label("Desktop background set successfully.")
else:
print("\n\nUh uh... Something went wrong.\nSend an email to [email protected] or message me on reddit /u/FilthyPeasantt")
Expand Down

0 comments on commit 86104c5

Please sign in to comment.