-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspotlight.py
More file actions
39 lines (31 loc) · 1.19 KB
/
Copy pathspotlight.py
File metadata and controls
39 lines (31 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import shutil
from PIL import Image
def fetch_spotlight(dest_folder="./wallpapers"):
# The Windows Spotlight hidden assets path
src = os.path.expandvars(r"%LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets")
if not os.path.exists(src):
print(f"[!] cannot find spotlight folder. enable spotlight in windows settings.")
return
count = 1
if os.path.exists(dest_folder):
count = sum(1 for entry in os.scandir(dest_folder) if entry.is_file()) + 1
else:
os.makedirs(dest_folder)
files = os.listdir(src)
print(f"[*] Loading...")
for filename in files:
path = os.path.join(src, filename)
if os.path.getsize(path) > 150000:
try:
img = Image.open(path)
if img.width > img.height:
new_name = f"{count}.jpg"
shutil.copy(path, os.path.join(dest_folder, new_name))
print(f" [+] Exported: {new_name}")
count += 1
except:
continue
print("[*] Complete!")
if __name__ == "__main__":
fetch_spotlight()