Skip to content

Commit

Permalink
Merge pull request #2 from TheOpenBooru/AlphaOxygen
Browse files Browse the repository at this point in the history
Alpha oxygen
  • Loading branch information
Ben-Brady authored Sep 13, 2022
2 parents 49a1f26 + 3b6d255 commit 681095b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/daemon/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

DB_PATH = Path("./data/tasks.json")
try:
db = pickledb.load(DB_PATH, False)
db = pickledb.load(DB_PATH, True)
except Exception:
DB_PATH.unlink()
db = pickledb.load(DB_PATH, False)
db = pickledb.load(DB_PATH, True)


def create_background_task(
Expand Down
3 changes: 3 additions & 0 deletions modules/importers/methods/e621/e621.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from itertools import islice
from tqdm import tqdm
from pathlib import Path
import logging
import requests


Expand All @@ -29,6 +30,8 @@ async def load(self, limit:Union[int, None] = None):
await load_post(data)
except ImportFailure:
pass
except Exception as e:
logging.exception(e)


async def load_post(data:dict):
Expand Down
4 changes: 3 additions & 1 deletion modules/importers/methods/rule34/rule34.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from modules import settings, schemas, database
from tqdm.asyncio import tqdm
from typing import Union
from itertools import islice
import logging


class Rule34(Importer):
Expand All @@ -23,6 +23,8 @@ async def load(self, limit:Union[int, None] = None):
await load_post(post)
except ImportFailure:
continue
except Exception as e:
logging.exception(e)



Expand Down
1 change: 1 addition & 0 deletions modules/posts/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def insert(post: schemas.Post, validate=True):
if validate:
_validate_post(post)

database.Post.insert(post)
if post.uploader:
database.User.create_post(post.uploader, post.id)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cachetools
pymongo
jinja2
boto3
pickledb

# Encoding
pillow
Expand Down

0 comments on commit 681095b

Please sign in to comment.