Update watch.py

master
Arjix 2022-02-12 06:00:16 -08:00 committed by GitHub
parent 4b86991945
commit 9583a4979d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -68,16 +68,9 @@ def command(anime_name, new, update_all, _list, quality, remove,
watcher = _watch.Watcher()
if not os.path.exists(watcher.WATCH_FILE):
with open(watcer.WATCH_FILE, "w") as f:
with open(watcher.WATCH_FILE, "w") as f:
f.write("[]")
with open(watcher.WATCH_FILE, "r") as f:
contents = f.read()
# print(contents)
if "[]" in contents or "[{}]" in contents:
logger.error("Add something to the watch list using `anime watch --new`")
sys.exit(1)
if new:
if anime_name:
query = anime_name
@ -89,6 +82,13 @@ def command(anime_name, new, update_all, _list, quality, remove,
watcher.new(url)
sys.exit(0)
with open(watcher.WATCH_FILE, "r") as f:
contents = f.read()
# print(contents)
if "[]" in contents:
logger.error("Add something to the watch list using `anime watch --new`")
sys.exit(1)
if remove:
anime = watcher.get(anime_name)
if anime and click.confirm(