0.0.3s
This commit is contained in:
+19
-2
@@ -3,6 +3,7 @@ import os
|
||||
import json
|
||||
from collections import Counter
|
||||
import gelbooru
|
||||
from datetime import datetime
|
||||
|
||||
class DB:
|
||||
def __init__(self):
|
||||
@@ -41,7 +42,15 @@ class DB:
|
||||
pass
|
||||
|
||||
def get_all(self):
|
||||
return self.db.all()
|
||||
sorted_records = sorted(
|
||||
self.db.all(),
|
||||
key=lambda x: datetime.strptime(
|
||||
x["timestamp"],
|
||||
"%a %b %d %H:%M:%S %z %Y"
|
||||
),
|
||||
reverse=True
|
||||
)
|
||||
return sorted_records
|
||||
|
||||
def get_search(self, ratings, tags):
|
||||
ratings
|
||||
@@ -49,7 +58,15 @@ class DB:
|
||||
self.File.rating.one_of(self.ratings) &
|
||||
self.File.tags.any(self.tags)
|
||||
)
|
||||
return results
|
||||
sorted_records = sorted(
|
||||
results,
|
||||
key=lambda x: datetime.strptime(
|
||||
x["timestamp"],
|
||||
"%a %b %d %H:%M:%S %z %Y"
|
||||
),
|
||||
reverse=True
|
||||
)
|
||||
return sorted_records
|
||||
|
||||
def get_unknow(self):
|
||||
results = self.db.search(self.File.tags == [])
|
||||
|
||||
Reference in New Issue
Block a user