46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
import database as db
|
|
import Feed
|
|
|
|
userID = None
|
|
|
|
|
|
def login():
|
|
username = 'Dan'
|
|
password = 'password'
|
|
|
|
|
|
query = db.sql.text(""" select userID from Users where username = \'%s\'""" % username)
|
|
result = db.con.execute(query).fetchone()
|
|
|
|
print(result[0])
|
|
|
|
return result[0]
|
|
|
|
|
|
while True:
|
|
print("1. Login\n2. Upload\n3. Update feeds\n4. Add Feed\n9. Exit\n")
|
|
val = input(">>>")
|
|
if val == "1":
|
|
userID = login()
|
|
elif val == "2":
|
|
if userID is None or userID == '':
|
|
print("Please login first")
|
|
else:
|
|
Feed.feedImport(userID)
|
|
elif val == "3":
|
|
if userID is None or userID == '':
|
|
print("Please login first")
|
|
else:
|
|
Feed.updateFeeds(userID)
|
|
elif val == "4":
|
|
if userID is None or userID == '':
|
|
print("Please login first")
|
|
else:
|
|
Feed.addFeed(userID)
|
|
elif val == "5":
|
|
if userID is None or userID == '':
|
|
print("Please login first")
|
|
else:
|
|
Feed.deleteFeed(userID)
|
|
elif val == "9":
|
|
exit() |