mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-12-24 17:33:45 +03:00
Не большой баг фикс
This commit is contained in:
parent
bb54837cf7
commit
71f0114e31
2 changed files with 7 additions and 9 deletions
14
main.py
14
main.py
|
@ -1,7 +1,6 @@
|
|||
from bs4 import BeautifulSoup
|
||||
from pyqadmin import admin
|
||||
from elevate import elevate
|
||||
import requests
|
||||
|
||||
import ctypes
|
||||
import os
|
||||
import urllib
|
||||
|
@ -10,8 +9,6 @@ import winreg as reg
|
|||
import getpass
|
||||
|
||||
|
||||
|
||||
|
||||
class Nasa:
|
||||
|
||||
def __init__(self):
|
||||
|
@ -21,7 +18,6 @@ class Nasa:
|
|||
self.photoName = "everydayphotonasa.jpg"
|
||||
|
||||
@staticmethod
|
||||
@admin
|
||||
def autorun():
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
address = os.path.join(path, "main.py")
|
||||
|
@ -37,7 +33,6 @@ class Nasa:
|
|||
lnk = str
|
||||
for link in soup.select("img"):
|
||||
lnk = link["src"]
|
||||
print(f"Скачиваю картинку — {self.url + lnk}")
|
||||
|
||||
img = urllib.request.urlopen(self.url + lnk).read()
|
||||
out = open(self.photoName, "wb")
|
||||
|
@ -49,12 +44,15 @@ class Nasa:
|
|||
ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 0)
|
||||
|
||||
def start(self):
|
||||
self.autorun()
|
||||
if not ctypes.windll.shell32.IsUserAnAdmin() != 0:
|
||||
elevate(show_console=False, graphical=False)
|
||||
self.download_photo()
|
||||
self.set_wallpaper()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
schedule.every(1).days.do(Nasa().start)
|
||||
nasa = Nasa()
|
||||
nasa.start()
|
||||
schedule.every(3).seconds.do(nasa.start)
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
beautifulsoup4==4.11.1
|
||||
requests~=2.28.0
|
||||
schedule~=1.1.0
|
||||
pyqadmin~=1.0.0
|
||||
elevate~=0.1.3
|
Loading…
Add table
Reference in a new issue