(new small feature) 0.1.2 - get an anime entry
This commit is contained in:
@@ -3,3 +3,5 @@
|
|||||||
First release
|
First release
|
||||||
** 0.1.1 <2022-07-08>
|
** 0.1.1 <2022-07-08>
|
||||||
New small feature: update anime status
|
New small feature: update anime status
|
||||||
|
** 0.1.2 <2022-07-08>
|
||||||
|
New small feature: get an anime entry
|
||||||
|
|||||||
@@ -72,3 +72,13 @@ class DataBase:
|
|||||||
connect.commit()
|
connect.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connect.close()
|
connect.close()
|
||||||
|
|
||||||
|
def get_entry(self, url):
|
||||||
|
"""Returns the entry if exists. Otherwise, return []."""
|
||||||
|
connect = sqlite3.connect(self.PATH)
|
||||||
|
cursor = connect.cursor()
|
||||||
|
cursor.execute(f"SELECT * FROM {self.TABLE} WHERE Url = '{url}';")
|
||||||
|
data = cursor.fetchall()
|
||||||
|
cursor.close()
|
||||||
|
connect.close()
|
||||||
|
return data
|
||||||
|
|||||||
+4
-2
@@ -22,8 +22,10 @@ from db import DataBase
|
|||||||
def main():
|
def main():
|
||||||
db = DataBase()
|
db = DataBase()
|
||||||
# Test data
|
# Test data
|
||||||
db.add_anime("test.url", "The anime", "1")
|
#db.add_anime("test.url", "The anime", "1")
|
||||||
db.update_anime_status("test.url", "2")
|
#db.update_anime_status("test.url", "2")
|
||||||
|
data = db.get_entry("test.url")
|
||||||
|
print(f"{data=}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user