diff --git a/.DS_Store b/.DS_Store
index e2fb3cb..caf0f17 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/app/__init__.py b/app/__init__.py
index fa1b60b..de56f98 100755
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -36,4 +36,3 @@ socketio = SocketIO(app)
app.config.from_object(__name__)
from app import views
-
diff --git a/app/cover.py b/app/cover.py
index 1b0e04f..ef1bccc 100755
--- a/app/cover.py
+++ b/app/cover.py
@@ -40,7 +40,7 @@ def get_cover(file_path, filename):
big_filename = "app/uploads/cover/"+page["filename"] + "_cover.png"
small_filename = "app/uploads/cover/"+page["filename"] + "cover_small" + ".png"
- img = pdf_page_to_png(src_pdf, pagenum = page["pagenum"], resolution = 300)
+ img = pdf_page_to_png(src_pdf, pagenum = page["pagenum"], resolution = 200)
img.save(filename = big_filename)
# Ensmallen
diff --git a/app/extractText.py b/app/extractText.py
new file mode 100644
index 0000000..e3e435f
--- /dev/null
+++ b/app/extractText.py
@@ -0,0 +1,23 @@
+import PyPDF2
+
+
+def get_text(file_path, filename):
+ read_pdf =file_path
+
+ with open(read_pdf,'rb') as pdf_file, open("app/uploads/"+filename+'.txt', 'w') as text_file:
+ read_pdf = PyPDF2.PdfFileReader(pdf_file)
+ number_of_pages = read_pdf.getNumPages()
+ for page_number in range(number_of_pages): # use xrange in Py2
+ page = read_pdf.getPage(page_number)
+ page_content = page.extractText()
+ text_file.write(page_content)
+
+
+
+def extract_text(file_path, filename):
+ try:
+ get_text(file_path, filename)
+ except:
+ with open(filename+'.txt', 'w') as text_file:
+ page_content = ""
+ text_file.write(page_content)
diff --git a/app/models.py b/app/models.py
index 11d403a..68b7a23 100755
--- a/app/models.py
+++ b/app/models.py
@@ -15,6 +15,11 @@ stacks = db.Table('books_stacks',
db.Column('stack_id', db.Integer, db.ForeignKey('stacks.id'), primary_key=True)
)
+instances = db.Table('books_instances',
+ db.Column('book_id', db.Integer, db.ForeignKey('books.id'), primary_key=True),
+ db.Column('instance_id', db.Integer, db.ForeignKey('instances.id'), primary_key=True)
+)
+
class Book(db.Model):
__tablename__ = 'books'
@@ -26,10 +31,14 @@ class Book(db.Model):
category = db.Column(db.String(255))
year_published = db.Column(db.Numeric(4,0))
description = db.Column(db.String(2500))
+ html = db.Column(db.String(255))
+ downloads = db.Column(db.Numeric(100,0))
authors = db.relationship('Author', secondary=authors,cascade="delete", lazy='subquery',
backref=db.backref('books', lazy=True),passive_deletes=True)
stacks = db.relationship('Stack', secondary=stacks, lazy='subquery',
backref=db.backref('books', lazy=True))
+ instances = db.relationship('Instance', secondary=instances, lazy='subquery',
+ backref=db.backref('books', lazy=True))
scapeX = db.Column(db.Numeric(10,2))
scapeY = db.Column(db.Numeric(10,2))
message = db.Column(db.String(1000))
@@ -47,6 +56,7 @@ class Book(db.Model):
self.fileformat = fileformat
self.category = category
self.year_published = year_published
+ self.download = None
self.scapeX = 0
self.scapeY = 0
self.message = message
@@ -73,6 +83,19 @@ class Author(db.Model):
def __init__(self, author_name):
self.author_name = author_name
+class Instance(db.Model):
+ __tablename__ = 'instances'
+
+ id = db.Column(db.Integer(), primary_key=True)
+ name = db.Column(db.String(50))
+ ip = db.Column(db.String(50))
+ action = db.Column(db.String(50))
+
+ def __init__(self, ip, action):
+ self.name = ip
+ self.ip = ip
+ self.action = action
+
class UserIns(db.Model):
__tablename__ = 'userins'
diff --git a/app/static/css/style.css b/app/static/css/style.css
index e862ae3..6ae5dd1 100755
--- a/app/static/css/style.css
+++ b/app/static/css/style.css
@@ -199,6 +199,7 @@ font-size: 12px;
.ui-tabs-vertical { width: 100em; border-top: 0;}
<<<<<<< HEAD
+<<<<<<< HEAD
.ui-tabs-vertical .ui-tabs-nav { padding: .2em .2em .2em .2em; float: left; width: 15em; }
.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 0 !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
=======
@@ -206,6 +207,11 @@ font-size: 12px;
.ui-tabs-vertical .ui-tabs-nav { padding: .2em .2em .2em .2em; float: left; width: 15em; -webkit-appearance: none;}
.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 0 !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; list-style-type: none; }
>>>>>>> stack_stuff
+=======
+.ui-tabs-vertical a { text-decoration: none; color: black;}
+.ui-tabs-vertical .ui-tabs-nav { padding: .2em .2em .2em .2em; float: left; width: 15em; -webkit-appearance: none;}
+.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 0 !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; list-style-type: none; }
+>>>>>>> master
.ui-tabs-vertical .ui-tabs-nav li a { display:block; }
.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 0; background-color: yellow !important; list-style-type: none;}
.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: left; width: 50em; font-size: 12px; list-style-type: none;}
diff --git a/app/templates/base.html b/app/templates/base.html
index 9af5ed1..f407b49 100755
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -14,7 +14,6 @@
-
{% block css %} {% endblock%}
@@ -62,7 +61,7 @@ console.log(time)
return ('0'+time.getDate()).slice(-2) + '.' + ('0'+(time.getMonth()+1)).slice(-2) + '.' + time.getFullYear() +" " + ('0'+time.getHours()).slice(-2)+":"+ ('0'+time.getMinutes()).slice(-2);
}
//change addr when ONLINE::::::->
-var socket = io.connect('http://localhost:5000');
+var socket = io.connect('{{server}}');
var app = new Vue({
el: "#app",
delimiters: ['[[', ']]'],
@@ -112,6 +111,11 @@ socket.on('channel-' + app.channel, function(msg) {
scrollTop: $('.messages')[0].scrollHeight
});
});
+
+
+document.getElementById("file_import_csv").onchange = function() {
+ document.getElementById("form_import_csv").submit();
+};