Skip to content

Commit

Permalink
db update
Browse files Browse the repository at this point in the history
Bug fixes to stop None data getting into db

Added emails filter

Added /fix to fix old entries
  • Loading branch information
1337-server committed Apr 25, 2022
1 parent d5d1794 commit 2c04ca0
Show file tree
Hide file tree
Showing 8 changed files with 119,424 additions and 41 deletions.
Binary file removed arm-crc64.db
Binary file not shown.
21 changes: 6 additions & 15 deletions models/models.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import datetime

from ui import db
from prettytable import PrettyTable


class Job(db.Model):
job_id = db.Column(db.Integer, primary_key=True)
crc_id = db.Column(db.String(63), unique=True, nullable=False)
user_id = db.Column(db.String(63))
user_id = db.Column(db.String(63), nullable=False)
date_added = db.Column(db.DateTime)

no_of_titles = db.Column(db.Integer)
title = db.Column(db.String(256))
year = db.Column(db.String(4))
title = db.Column(db.String(256), nullable=False)
year = db.Column(db.String(4), nullable=False)
video_type = db.Column(db.String(20))

imdb_id = db.Column(db.String(15))
Expand All @@ -23,6 +22,7 @@ class Job(db.Model):
disctype = db.Column(db.String(20)) # dvd/bluray/data/music/unknown
label = db.Column(db.String(256))
validated = db.Column(db.Boolean)
poster_img = db.Column(db.String(256))

def __init__(self, crc, title, year):
"""Return a disc object"""
Expand All @@ -39,22 +39,13 @@ def __str__(self):
s = self.__class__.__name__ + ": "
for attr, value in self.__dict__.items():
s = s + "(" + str(attr) + "=" + str(value) + ") "

return s

def pretty_table(self):
"""Returns a string of the prettytable"""
x = PrettyTable()
x.field_names = ["Config", "Value"]
x._max_width = {"Config": 50, "Value": 60}
for attr, value in self.__dict__.items():
x.add_row([str(attr), str(value)])
return str(x.get_string())

def get_d(self):
r = {}
x = ("_sa_instance_state", "user_id", "job_id", "omdb_id")
for key, value in self.__dict__.items():
if '_sa_instance_state' not in key:
if key not in x:
r[str(key)] = str(value)
return r

Expand Down
Loading

0 comments on commit 2c04ca0

Please sign in to comment.