0.0.2s
This commit is contained in:
+22
-1
@@ -2,6 +2,7 @@ from tinydb import TinyDB, Query
|
||||
import os
|
||||
import json
|
||||
from collections import Counter
|
||||
import gelbooru
|
||||
|
||||
class DB:
|
||||
def __init__(self):
|
||||
@@ -16,7 +17,27 @@ class DB:
|
||||
self.db.insert(data_add)
|
||||
|
||||
def add_raw(self, data_add):
|
||||
# self.db.insert(data_add)
|
||||
is_video = False
|
||||
is_gif = False
|
||||
if data_add["image"].split(".")[-1] in ["webm", "mp4", "avi"]:
|
||||
is_video = True
|
||||
if data_add["image"].split(".")[-1] == "gif":
|
||||
is_gif = True
|
||||
add_data = {
|
||||
"md5": data_add["md5"],
|
||||
"local_filename": data_add["image"],
|
||||
"is_video": is_video,
|
||||
"is_gif": is_gif,
|
||||
"tags": data_add["tags"].split(" "),
|
||||
"rating": data_add["rating"],
|
||||
"score": data_add["score"],
|
||||
"timestamp": data_add["created_at"],
|
||||
"display_date": gelbooru.gelbooru_date_parse(data_add["created_at"]),
|
||||
"source": data_add["source"],
|
||||
"width": data_add["width"],
|
||||
"height": data_add["height"]
|
||||
}
|
||||
self.db.insert(add_data)
|
||||
pass
|
||||
|
||||
def get_all(self):
|
||||
|
||||
Reference in New Issue
Block a user