Final Refactoring before alpha release
@@ -1,34 +0,0 @@
|
||||
# Generated by Django 2.2.7 on 2019-11-10 03:56
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="books",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("title", models.CharField(max_length=255)),
|
||||
("author", models.CharField(blank=True, max_length=255)),
|
||||
("categories", models.CharField(blank=True, max_length=255)),
|
||||
("cover", models.BinaryField(blank=True, editable=True)),
|
||||
("pages", models.IntegerField(blank=True)),
|
||||
("progress", models.IntegerField(blank=True)),
|
||||
("file_name", models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
]
|
||||
1
src/backend/data/shelf.json
Executable file
@@ -11,7 +11,7 @@ class Config:
|
||||
_fp = "config.json"
|
||||
print(os.path)
|
||||
|
||||
def __init__(self, root=os.path.abspath("../")):
|
||||
def __init__(self, root=os.path.abspath("../../")):
|
||||
_data = self.open_file(root)
|
||||
self.book_path = _data["BOOKPATH"]
|
||||
self.TITLE = _data["TITLE"]
|
||||
@@ -24,6 +24,7 @@ class Config:
|
||||
self.book_shelf,
|
||||
self.catalogue_db,
|
||||
]
|
||||
self.root = root
|
||||
self.auto_scan = True
|
||||
|
||||
def open_file(self, root):
|
||||
@@ -19,15 +19,14 @@ class Catalogue:
|
||||
|
||||
"""Step One: filter_books"""
|
||||
|
||||
def __init__(self, root):
|
||||
def __init__(self, config):
|
||||
self.file_list = []
|
||||
self.opf_regx = re.compile(r"\.opf")
|
||||
self.cover_regx = re.compile(r"\.jpg|\.jpeg|\.png|\.bmp|\.gif")
|
||||
self.html_regx = re.compile(r"\.html")
|
||||
self.root_dir = root
|
||||
_config = Config(root)
|
||||
self.book_folder = _config.book_path
|
||||
self.book_shelf = _config.book_shelf
|
||||
self.root_dir = config.root
|
||||
self.book_folder = config.book_path
|
||||
self.book_shelf = config.book_shelf
|
||||
self._book_list_expanded = None
|
||||
self.books = None
|
||||
|
||||
@@ -6,9 +6,9 @@ from lib.config import Config
|
||||
from lib.library import Catalogue
|
||||
from lib.pyShelf import InitFiles
|
||||
|
||||
ROOT_DIR = os.path.abspath("../")
|
||||
ROOT_DIR = os.path.abspath("../..")
|
||||
sys.path.append(ROOT_DIR)
|
||||
config = Config(ROOT_DIR) # Get configuration settings
|
||||
InitFiles(config.file_array) # Initialize file system
|
||||
Catalogue = Catalogue(ROOT_DIR) # Open the Catalogue
|
||||
Catalogue = Catalogue(config) # Open the Catalogue
|
||||
Catalogue.import_books() # Filter Your books
|
||||
0
frontend/frontend/__init__.py → src/data/shelf.json
Executable file → Normal file
0
frontend/interface/templatetags/__init__.py → src/interface/migrations/__init__.py
Normal file → Executable file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 581 B |
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |