Skip to content

Commit

Permalink
drop bad wallpaper sources
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 15, 2024
1 parent 6a78e08 commit b6572a4
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ovos_workshop.decorators import intent_handler, resting_screen_handler
from ovos_workshop.intents import IntentBuilder
from ovos_workshop.skills import OVOSSkill
from wallpaper_changer.search import latest_reddit, latest_wpcraft, latest_unsplash
from wallpaper_changer.search import latest_reddit


class WallpapersSkill(OVOSSkill):
Expand All @@ -17,12 +17,6 @@ def initialize(self):
if "change_mins" not in self.settings:
self.settings["change_mins"] = 30

# image sources
if "unsplash" not in self.settings:
self.settings["unsplash"] = False
if "wpcraft" not in self.settings:
self.settings["wpcraft"] = True

subs = ['/r/EarthPorn', '/r/BotanicalPorn', '/r/WaterPorn',
'/r/SeaPorn',
'/r/SkyPorn', '/r/FirePorn', '/r/DesertPorn',
Expand Down Expand Up @@ -82,22 +76,9 @@ def initialize(self):
'/r/wallpapers',
"/r/InterstellarArt"]
self.subs = [s.split("/")[-1].strip() for s in subs]
self.wpcats = [
'3d', 'abstract', 'animals', 'anime', "art", "black", "cars",
'city',
'dark', 'fantasy', 'flowers', 'food', 'holidays', 'love',
'macro',
'minimalism', 'motorcycles', 'music', 'nature', 'other',
'smilies',
'space', 'sport', 'hi-tech', 'textures', 'vector', 'words',
'60_favorites'
]
for c in self.subs:
if c not in self.settings:
self.settings[c] = True
for c in self.wpcats:
if c not in self.settings:
self.settings[c] = True

# state trackers
self.pic_idx = 0
Expand Down Expand Up @@ -127,20 +108,6 @@ def update_picture(self, query=None):
self.pic_idx = 0
data = wps[0]
data["url"] = "https://www.reddit.com/r/{s}/".format(s=c)
if self.settings["unsplash"] and \
random.choice([True, False]) and not data:
self.picture_list = latest_unsplash(query, n=3)
data = self.picture_list[0]
data["url"] = "https://source.unsplash.com/1920x1080/?" + query
self.pic_idx = 0
elif self.settings["wpcraft"] and \
random.choice([True, False]) and not data:
wps = latest_wpcraft()
random.shuffle(wps)
data = wps[0]
self.picture_list = wps
self.pic_idx = 0
data["url"] = "https://wallpaperscraft.com"
else:
# fuzzy match voc_files
best_sub = query
Expand All @@ -163,19 +130,6 @@ def update_picture(self, query=None):
self.pic_idx = 0
data = wps[0]
data["url"] = "https://www.reddit.com/r/{s}/".format(s=query)
elif query in self.wpcats:
wps = latest_wpcraft(query)
random.shuffle(wps)
data = wps[0]
self.picture_list = wps
self.pic_idx = 0
data["url"] = "https://wallpaperscraft.com/catalog/" + query
else:
# no matching subreddit, search in unsplash
self.picture_list = latest_unsplash(query, n=3)
data = self.picture_list[0]
data["url"] = "https://source.unsplash.com/1920x1080/?" + query
self.pic_idx = 0

if not data:
# default source of wallpapers
Expand Down

0 comments on commit b6572a4

Please sign in to comment.