mirror of
https://github.com/ClaytonWWilson/Scraper-for-theTVDB.com.git
synced 2025-12-18 10:18:48 +00:00
Did some work on update()
This commit is contained in:
parent
9507bcc26c
commit
9bcebbce48
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,3 @@
|
|||||||
login.json
|
login.json
|
||||||
api info.txt
|
api info.txt
|
||||||
__pycache__
|
__pycache__
|
||||||
menuLayout.txt
|
|
||||||
|
|||||||
27
actions.py
27
actions.py
@ -4,6 +4,7 @@ import json
|
|||||||
import datetime
|
import datetime
|
||||||
import dateutil
|
import dateutil
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
from checks import checkTimestamp
|
from checks import checkTimestamp
|
||||||
from checks import getToken
|
from checks import getToken
|
||||||
|
|
||||||
@ -127,3 +128,29 @@ def download(imageType, parsed_respObj):
|
|||||||
else:
|
else:
|
||||||
quit()
|
quit()
|
||||||
return saveNameList
|
return saveNameList
|
||||||
|
|
||||||
|
# The following code is from Red-DiscordBot
|
||||||
|
# https://github.com/Cog-Creators/Red-DiscordBot
|
||||||
|
def is_git_installed():
|
||||||
|
try:
|
||||||
|
subprocess.call(["git", "--version"], stdout=subprocess.DEVNULL,
|
||||||
|
stdin =subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def update():
|
||||||
|
try:
|
||||||
|
code = subprocess.call(("git", "pull", "--ff-only"))
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("\nError: Git not found. It's either not installed or you did "
|
||||||
|
"not clone this using git. Install instructions are on the GitHub: "
|
||||||
|
"https://github.com/ClaytonWWilson/Image-fetcher-for-theTVDB.com")
|
||||||
|
return
|
||||||
|
if code == 0:
|
||||||
|
print("\nProgram has been updated.")
|
||||||
|
else:
|
||||||
|
print("\nThere was an error while updating. This may be caused by edits "
|
||||||
|
"you have made to the code.")
|
||||||
|
|||||||
@ -45,7 +45,7 @@ while True:
|
|||||||
print("install requirements")
|
print("install requirements")
|
||||||
break
|
break
|
||||||
elif choice == "6":
|
elif choice == "6":
|
||||||
print("update")
|
update()
|
||||||
break
|
wait()
|
||||||
elif choice == "0":
|
elif choice == "0":
|
||||||
exit()
|
exit()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user