Commit cdb1b526 authored by OzzieIsaacs's avatar OzzieIsaacs

Bugfix Get gdrive instances (#554, #525)

Metadata.db download works again
removed DEVELOPMENT constant
removed db logging in debug mode (too, noisy, to less information)
code refactoring url_for_other_page
feed languge set to en-EN
update status shos local time instead of UTC
Error handling (back to index page) in case of gdrive authenticate aborted
Mistyping page register fixed
Mistyping bokk fixed
Added uploaded books to tasklist (#442)
Error handling for failed file update added
Code refactoring worker thread
Tasks now never show any decimal values
Converter function unified
removed shell from subprocess call
preparation for limiting domain for registering emails
Book series can now increased in 0.1 steps (#562)
Accordion panels in config are now usable on touch devices like iPad (#545)
Gdrive authenticate button only visible after logged in (#525)
Fixed misstyping in german translation
parent f8132f4d
......@@ -3,8 +3,9 @@ try:
from pydrive.drive import GoogleDrive
from pydrive.auth import RefreshError
from apiclient import errors
gdrive_support = True
except ImportError:
pass
gdrive_support = False
import os
from ub import config
......@@ -259,6 +260,13 @@ def copyDriveFileRemote(drive, origin_file_id, copy_title):
print ('An error occurred: %s' % error)
return None
# Download metadata.db from gdrive
def downloadFile(path, filename, output):
f = getFileFromEbooksFolder(path, filename)
f.GetContentFile(output)
def moveGdriveFolderRemote(origin_file, target_folder):
drive = getDrive(Gdrive.Instance().drive)
previous_parents = ",".join([parent["id"] for parent in origin_file.get('parents')])
......@@ -339,7 +347,7 @@ def uploadFileToEbooksFolder(destFile, f):
def watchChange(drive, channel_id, channel_type, channel_address,
channel_token=None, expiration=None):
drive = getDrive(drive)
# drive = getDrive(drive)
# Watch for all changes to a user's Drive.
# Args:
# service: Drive API service instance.
......@@ -382,7 +390,7 @@ def watchFile(drive, file_id, channel_id, channel_type, channel_address,
Raises:
apiclient.errors.HttpError: if http request to create channel fails.
"""
drive = getDrive(drive)
# drive = getDrive(drive)
body = {
'id': channel_id,
......@@ -405,7 +413,7 @@ def stopChannel(drive, channel_id, resource_id):
Raises:
apiclient.errors.HttpError: if http request to create channel fails.
"""
drive = getDrive(drive)
# drive = getDrive(drive)
# service=drive.auth.service
body = {
'id': channel_id,
......@@ -415,7 +423,7 @@ def stopChannel(drive, channel_id, resource_id):
def getChangeById (drive, change_id):
drive = getDrive(drive)
# drive = getDrive(drive)
# Print a single Change resource information.
#
# Args:
......
......@@ -53,6 +53,9 @@
</table>
<div class="btn btn-default" id="admin_edit_email"><a href="{{url_for('edit_mailsettings')}}">{{_('Change SMTP settings')}}</a></div>
{% if g.allow_registration %}
<div class="btn btn-default" id="admin_register_domain"><a href="{{url_for('edit_register_domains')}}">{{_('Edit allowed domains')}}</a></div>
{% endif %}
<h2>{{_('Configuration')}}</h2>
<table class="table table-striped" id="table_configuration">
......@@ -79,16 +82,14 @@
<div class="btn btn-default"><a href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div>
<div class="btn btn-default"><a href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div>
<h2>{{_('Administration')}}</h2>
{% if not development %}
<div>{{_('Current commit timestamp')}}: <span>{{commit}} </span></div>
<div class="hidden" id="update_info">{{_('Newest commit timestamp')}}: <span></span></div>
<p></p>
<div class="btn btn-default" id="restart_database">{{_('Reconnect to Calibre DB')}}</div>
<div class="btn btn-default" data-toggle="modal" data-target="#RestartDialog">{{_('Restart Calibre-web')}}</div>
<div class="btn btn-default" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-web')}}</div>
<div class="btn btn-default" id="check_for_update">{{_('Check for update')}}</div>
<div class="btn btn-default hidden" id="perform_update" data-toggle="modal" data-target="#UpdateprogressDialog">{{_('Perform Update')}}</div>
{% endif %}
<div>{{_('Current commit timestamp')}}: <span>{{commit}} </span></div>
<div class="hidden" id="update_info">{{_('Newest commit timestamp')}}: <span></span></div>
<p></p>
<div class="btn btn-default" id="restart_database">{{_('Reconnect to Calibre DB')}}</div>
<div class="btn btn-default" data-toggle="modal" data-target="#RestartDialog">{{_('Restart Calibre-web')}}</div>
<div class="btn btn-default" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-web')}}</div>
<div class="btn btn-default" id="check_for_update">{{_('Check for update')}}</div>
<div class="btn btn-default hidden" id="perform_update" data-toggle="modal" data-target="#UpdateprogressDialog">{{_('Perform Update')}}</div>
</div>
<!-- Modal -->
<div id="RestartDialog" class="modal fade" role="dialog">
......
......@@ -50,7 +50,7 @@
</div>
<div class="form-group">
<label for="series_index">{{_('Series id')}}</label>
<input type="number" step="1" min="0" class="form-control" name="series_index" id="series_index" value="{{book.series_index}}">
<input type="number" step="0.1" min="0" class="form-control" name="series_index" id="series_index" value="{{book.series_index}}">
</div>
<div class="form-group">
<label for="rating">{{_('Rating')}}</label>
......
......@@ -7,10 +7,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseOne">
<a class="accordion-toggle" data-toggle="collapse" href="#collapseOne" style="text-decoration:none;">
<span class="glyphicon glyphicon-minus"></span>
{{_('Library Configuration')}}
</div>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
......@@ -31,11 +31,15 @@
</label>
</div>
{% else %}
{% if show_authenticate_google_drive %}
{% if show_authenticate_google_drive and g.user.is_authenticated %}
<div class="form-group required">
<a href="{{ url_for('authenticate_google_drive') }}" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
</div>
{% else %}
{% if show_authenticate_google_drive and not g.user.is_authenticated %}
<div >{{_('Please finish Google Drive setup after login')}}</div>
{% endif %}
{% if not show_authenticate_google_drive %}
<div class="form-group required">
<label for="config_google_drive_folder">{{_('Google Drive Calibre folder')}}</label>
<select name="config_google_drive_folder" id="config_google_drive_folder" class="form-control">
......@@ -53,19 +57,21 @@
{% else %}
<a href="{{ url_for('watch_gdrive') }}" class="btn btn-primary">Enable watch of metadata.db</a>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsetwo">
<a class="accordion-toggle" data-toggle="collapse" href="#collapsetwo" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('Server Configuration')}}
</div>
</a>
</h4>
</div>
<div id="collapsetwo" class="panel-collapse collapse">
......@@ -88,10 +94,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsethree">
<a class="accordion-toggle" data-toggle="collapse" href="#collapsethree" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('Logfile Configuration')}}
</div>
</a>
</h4>
</div>
<div id="collapsethree" class="panel-collapse collapse">
......@@ -115,10 +121,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsefive">
<a class="accordion-toggle" data-toggle="collapse" href="#collapsefive">
<span class="glyphicon glyphicon-plus"></span>
{{_('Feature Configuration')}}
</div>
</a>
</h4>
</div>
<div id="collapsefive" class="panel-collapse collapse">
......@@ -162,10 +168,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseeight">
<a class="accordion-toggle" data-toggle="collapse" href="#collapseeight" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('E-Book converter')}}
</div>
</a>
</h4>
</div>
<div id="collapseeight" class="panel-collapse collapse">
......
......@@ -7,10 +7,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsefour">
<a class="accordion-toggle" data-toggle="collapse" href="#collapsefour" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('View Configuration')}}
</div>
</a>
</h4>
</div>
<div id="collapsefour" class="panel-collapse collapse">
......@@ -57,10 +57,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsesix">
<a class="accordion-toggle" data-toggle="collapse" href="#collapsesix" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('Default settings for new users')}}
</div>
</a>
</h4>
</div>
<div id="collapsesix" class="panel-collapse collapse">
......@@ -99,10 +99,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseseven">
<a class="accordion-toggle" data-toggle="collapse" href="#collapseseven" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span>
{{_('Default visibilities for new users')}}
</div>
</a>
</h4>
</div>
<div id="collapseseven" class="panel-collapse collapse">
......
......@@ -186,13 +186,13 @@
{% if pagination and (pagination.has_next or pagination.has_prev) %}
<div class="pagination">
{% if pagination.has_prev %}
<a class="previous" href="{{ url_for_other_page(pagination.page - 1)
<a class="previous" href="{{ (pagination.page - 1)|url_for_other_page
}}">&laquo; {{_('Previous')}}</a>
{% endif %}
{% for page in pagination.iter_pages() %}
{% if page %}
{% if page != pagination.page %}
<a href="{{ url_for_other_page(page) }}">{{ page }}</a>
<a href="{{ (page)|url_for_other_page }}">{{ page }}</a>
{% else %}
<strong>{{ page }}</strong>
{% endif %}
......@@ -201,7 +201,7 @@
{% endif %}
{% endfor %}
{% if pagination.has_next %}
<a class="next" href="{{ url_for_other_page(pagination.page + 1)
<a class="next" href="{{ (pagination.page + 1)|url_for_other_page
}}">{{_('Next')}} &raquo;</a>
{% endif %}
</div>
......
......@@ -1287,7 +1287,7 @@ msgstr "Über"
#: cps/templates/layout.html:187
msgid "Previous"
msgstr "Voerheriger"
msgstr "Vorheriger"
#: cps/templates/layout.html:214
msgid "Book Details"
......
......@@ -46,7 +46,6 @@ DEFAULT_PASS = "admin123"
DEFAULT_PORT = int(os.environ.get("CALIBRE_PORT", 8083))
DEVELOPMENT = False
class UserBase:
......@@ -291,10 +290,7 @@ class Settings(Base):
config_default_show = Column(SmallInteger, default=2047)
config_columns_to_ignore = Column(String)
config_use_google_drive = Column(Boolean)
# config_google_drive_client_id = Column(String)
# config_google_drive_client_secret = Column(String)
config_google_drive_folder = Column(String)
# config_google_drive_calibre_url_base = Column(String)
config_google_drive_watch_changes_response = Column(String)
config_remote_login = Column(Boolean)
config_use_goodreads = Column(Boolean)
......@@ -556,9 +552,6 @@ def migrate_Database():
except exc.OperationalError:
conn = engine.connect()
conn.execute("ALTER TABLE Settings ADD column `config_use_google_drive` INTEGER DEFAULT 0")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_client_id` String DEFAULT ''")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_client_secret` String DEFAULT ''")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_calibre_url_base` INTEGER DEFAULT 0")
conn.execute("ALTER TABLE Settings ADD column `config_google_drive_folder` String DEFAULT ''")
conn.execute("ALTER TABLE Settings ADD column `config_google_drive_watch_changes_response` String DEFAULT ''")
try:
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment