mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-22 08:36:22 +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 bs4 import BeautifulSoup
|
||||||
from pyqadmin import admin
|
from elevate import elevate
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -10,8 +9,6 @@ import winreg as reg
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Nasa:
|
class Nasa:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -21,7 +18,6 @@ class Nasa:
|
||||||
self.photoName = "everydayphotonasa.jpg"
|
self.photoName = "everydayphotonasa.jpg"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@admin
|
|
||||||
def autorun():
|
def autorun():
|
||||||
path = os.path.dirname(os.path.realpath(__file__))
|
path = os.path.dirname(os.path.realpath(__file__))
|
||||||
address = os.path.join(path, "main.py")
|
address = os.path.join(path, "main.py")
|
||||||
|
@ -37,7 +33,6 @@ class Nasa:
|
||||||
lnk = str
|
lnk = str
|
||||||
for link in soup.select("img"):
|
for link in soup.select("img"):
|
||||||
lnk = link["src"]
|
lnk = link["src"]
|
||||||
print(f"Скачиваю картинку — {self.url + lnk}")
|
|
||||||
|
|
||||||
img = urllib.request.urlopen(self.url + lnk).read()
|
img = urllib.request.urlopen(self.url + lnk).read()
|
||||||
out = open(self.photoName, "wb")
|
out = open(self.photoName, "wb")
|
||||||
|
@ -49,12 +44,15 @@ class Nasa:
|
||||||
ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 0)
|
ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 0)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.autorun()
|
if not ctypes.windll.shell32.IsUserAnAdmin() != 0:
|
||||||
|
elevate(show_console=False, graphical=False)
|
||||||
self.download_photo()
|
self.download_photo()
|
||||||
self.set_wallpaper()
|
self.set_wallpaper()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
schedule.every(1).days.do(Nasa().start)
|
nasa = Nasa()
|
||||||
|
nasa.start()
|
||||||
|
schedule.every(3).seconds.do(nasa.start)
|
||||||
while True:
|
while True:
|
||||||
schedule.run_pending()
|
schedule.run_pending()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
requests~=2.28.0
|
requests~=2.28.0
|
||||||
schedule~=1.1.0
|
schedule~=1.1.0
|
||||||
pyqadmin~=1.0.0
|
elevate~=0.1.3
|
Loading…
Add table
Reference in a new issue