0.0.3s
This commit is contained in:
+19
-2
@@ -3,6 +3,7 @@ import os
|
|||||||
import json
|
import json
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
import gelbooru
|
import gelbooru
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
class DB:
|
class DB:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -41,7 +42,15 @@ class DB:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_all(self):
|
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):
|
def get_search(self, ratings, tags):
|
||||||
ratings
|
ratings
|
||||||
@@ -49,7 +58,15 @@ class DB:
|
|||||||
self.File.rating.one_of(self.ratings) &
|
self.File.rating.one_of(self.ratings) &
|
||||||
self.File.tags.any(self.tags)
|
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):
|
def get_unknow(self):
|
||||||
results = self.db.search(self.File.tags == [])
|
results = self.db.search(self.File.tags == [])
|
||||||
|
|||||||
Reference in New Issue
Block a user