import os import time import ctypes import tempfile import requests # ===== CONFIG - EDIT THESE ===== # Choose your category: "feet", "rubber", "sneakers", or "bondage" ACTIVE_CATEGORY = "feet" POLL_INTERVAL_MINUTES = 30 # How often to change the wallpaper (in minutes) # ================================ API_ENDPOINTS = { "feet": "https://footfetish.blakesfeet1992.com/random", "rubber": "https://rubber.blakesfeet1992.com/random", "sneakers": "https://sneakers.blakesfeet1992.com/random", "bondage": "https://bft4evr.blakesfeet1992.com/random" } # Windows SystemParametersInfo constants for setting wallpapers SPI_SETDESKWALLPAPER = 20 SPIF_UPDATEINIFILE = 0x01 SPIF_SENDWININICHANGE = 0x02 def fetch_image_url(api_url): """Fetches a random image URL from the API.""" try: response = requests.get(api_url, timeout=10) response.raise_for_status() data = response.json() if "url" in data: return data["url"] else: print("[Error] No 'url' key found in API response.") return None except Exception as e: print(f"[Error] Failed to fetch from API: {e}") return None def download_image_to_temp(img_url): """Downloads the image to the OS temp directory and returns the file path.""" try: response = requests.get(img_url, timeout=15) response.raise_for_status() # Determine file extension from URL, fallback to .jpg ext = os.path.splitext(img_url)[1] if not ext: ext = ".jpg" # Get Windows temp directory temp_dir = tempfile.gettempdir() temp_file_path = os.path.join(temp_dir, f"kinkwall_bg{ext}") # Write image data to the temp file with open(temp_file_path, 'wb') as f: f.write(response.content) return temp_file_path except Exception as e: print(f"[Error] Failed to download image: {e}") return None def set_windows_wallpaper(image_path): """Uses ctypes to call the Windows API and update the desktop background.""" try: result = ctypes.windll.user32.SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, image_path, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE ) if result: print(f"[Success] Wallpaper updated to: {image_path}") else: print("[Error] Windows API failed to set the wallpaper.") except Exception as e: print(f"[Error] Failed to set wallpaper: {e}") def main(): api_url = API_ENDPOINTS.get(ACTIVE_CATEGORY, API_ENDPOINTS["feet"]) print("========================================") print(" KinkWall Desktop Wallpaper Changer ") print(f" Category: {ACTIVE_CATEGORY}") print(f" Polling API every {POLL_INTERVAL_MINUTES} minutes.") print("========================================\n") while True: print("Fetching new wallpaper...") img_url = fetch_image_url(api_url) if img_url: print(f"Target URL: {img_url}") local_path = download_image_to_temp(img_url) if local_path: set_windows_wallpaper(local_path) print(f"Sleeping for {POLL_INTERVAL_MINUTES} minutes...\n") time.sleep(POLL_INTERVAL_MINUTES * 60) if __name__ == "__main__": main()