34 lines
786 B
Python
34 lines
786 B
Python
import sys
|
|
import os
|
|
import logging
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
import config
|
|
import fetcher
|
|
import wallpaper
|
|
|
|
|
|
def main():
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
)
|
|
logger = logging.getLogger("refresh")
|
|
|
|
try:
|
|
logger.info("Fetching wallpaper...")
|
|
image_path = fetcher.fetch_wallpaper()
|
|
fill_style = config.get("wallpaper.fill_style", "fill")
|
|
wallpaper.set_wallpaper(image_path, fill_style)
|
|
logger.info("Wallpaper updated successfully")
|
|
except Exception as e:
|
|
logger.error("Refresh failed: %s", e)
|
|
return 1
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|