Skip to content

Instantly share code, notes, and snippets.

@Naville
Created February 19, 2017 22:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Naville/b7b635d82ba520044be031a297efa008 to your computer and use it in GitHub Desktop.
Save Naville/b7b635d82ba520044be031a297efa008 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import plistlib
from os.path import expanduser
import os
BASEPATH=os.path.join(expanduser("~"),"WallpaperKit","WallpaperKit.plist")
def absoluteFilePaths(directory):
for dirpath,_,filenames in os.walk(directory):
for f in filenames:
yield os.path.abspath(os.path.join(dirpath, f))
def recursiveSearch(directory):
return [os.path.join(root, name)
for root, dirs, files in os.walk(directory)
for name in files
if name.endswith(".DS_Store")==False]
Base=dict()
Base["WKImagePlugin"]=list()
Base["WKVideoPlugin"]=list()
Base["WKWebpagePlugin"]=list()
Base["WKImageSlideshow"]=list()
Base["WEWorkshopPath"]="/Volumes/Maets/SteamLibrary/steamapps/workshop/content/431960"
for Path in absoluteFilePaths(os.path.join(expanduser("~"),"Desktop","ActiveWallpapers")):
if Path.endswith("DS_Store")==False:
Base["WKImagePlugin"].append({"Path":Path})
for Path in absoluteFilePaths(os.path.join(expanduser("~"),"Desktop","BackGroundVideos")):
if Path.endswith("DS_Store")==False:
Base["WKVideoPlugin"].append({"Path":Path})
IMGS=os.path.join("/Volumes","Tardis","Images")
for Path in [os.path.join(IMGS, d) for d in os.listdir(IMGS) if os.path.isdir(os.path.join(IMGS, d))]:
if Path.endswith("DS_Store")==False:
Base["WKImageSlideshow"].append({"ImagePath":Path,"Interval":5})
plistlib.writePlist(Base,BASEPATH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment