Code cosmetics
This commit is contained in:
parent
395c6679b7
commit
78067b87bc
|
@ -293,7 +293,7 @@ def setup_db():
|
||||||
engine = create_engine('sqlite:///'+ dbpath, echo=False, isolation_level="SERIALIZABLE")
|
engine = create_engine('sqlite:///'+ dbpath, echo=False, isolation_level="SERIALIZABLE")
|
||||||
try:
|
try:
|
||||||
conn = engine.connect()
|
conn = engine.connect()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
content = ub.session.query(ub.Settings).first()
|
content = ub.session.query(ub.Settings).first()
|
||||||
content.config_calibre_dir = None
|
content.config_calibre_dir = None
|
||||||
content.db_configured = False
|
content.db_configured = False
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
import os
|
|
||||||
import uploader
|
import uploader
|
||||||
try:
|
#try:
|
||||||
from io import StringIO
|
# from io import StringIO
|
||||||
except ImportError as e:
|
#except ImportError:
|
||||||
import StringIO
|
# import StringIO
|
||||||
|
|
||||||
def get_fb2_info(tmp_file_path, original_file_extension):
|
def get_fb2_info(tmp_file_path, original_file_extension):
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,11 @@ try:
|
||||||
from apiclient import errors
|
from apiclient import errors
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
import os, time
|
import os
|
||||||
|
|
||||||
from ub import config
|
from ub import config
|
||||||
|
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy import exc
|
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import *
|
from sqlalchemy.orm import *
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ def getFileFromEbooksFolder(drive, path, fileName):
|
||||||
if drive.auth.access_token_expired:
|
if drive.auth.access_token_expired:
|
||||||
drive.auth.Refresh()
|
drive.auth.Refresh()
|
||||||
if path:
|
if path:
|
||||||
sqlCheckPath=path if path[-1] =='/' else path + '/'
|
# sqlCheckPath=path if path[-1] =='/' else path + '/'
|
||||||
folderId=getFolderId(path, drive)
|
folderId=getFolderId(path, drive)
|
||||||
else:
|
else:
|
||||||
folderId=getEbooksFolderId(drive)
|
folderId=getEbooksFolderId(drive)
|
||||||
|
@ -273,20 +272,19 @@ def watchChange(drive, channel_id, channel_type, channel_address,
|
||||||
drive=getDrive()
|
drive=getDrive()
|
||||||
if drive.auth.access_token_expired:
|
if drive.auth.access_token_expired:
|
||||||
drive.auth.Refresh()
|
drive.auth.Refresh()
|
||||||
"""Watch for all changes to a user's Drive.
|
# Watch for all changes to a user's Drive.
|
||||||
Args:
|
# Args:
|
||||||
service: Drive API service instance.
|
# service: Drive API service instance.
|
||||||
channel_id: Unique string that identifies this channel.
|
# channel_id: Unique string that identifies this channel.
|
||||||
channel_type: Type of delivery mechanism used for this channel.
|
# channel_type: Type of delivery mechanism used for this channel.
|
||||||
channel_address: Address where notifications are delivered.
|
# channel_address: Address where notifications are delivered.
|
||||||
channel_token: An arbitrary string delivered to the target address with
|
# channel_token: An arbitrary string delivered to the target address with
|
||||||
each notification delivered over this channel. Optional.
|
# each notification delivered over this channel. Optional.
|
||||||
channel_address: Address where notifications are delivered. Optional.
|
# channel_address: Address where notifications are delivered. Optional.
|
||||||
Returns:
|
# Returns:
|
||||||
The created channel if successful
|
# The created channel if successful
|
||||||
Raises:
|
# Raises:
|
||||||
apiclient.errors.HttpError: if http request to create channel fails.
|
# apiclient.errors.HttpError: if http request to create channel fails.
|
||||||
"""
|
|
||||||
body = {
|
body = {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'type': channel_type,
|
'type': channel_type,
|
||||||
|
@ -344,7 +342,7 @@ def stopChannel(drive, channel_id, resource_id):
|
||||||
drive=getDrive()
|
drive=getDrive()
|
||||||
if drive.auth.access_token_expired:
|
if drive.auth.access_token_expired:
|
||||||
drive.auth.Refresh()
|
drive.auth.Refresh()
|
||||||
service=drive.auth.service
|
# service=drive.auth.service
|
||||||
body = {
|
body = {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'resourceId': resource_id
|
'resourceId': resource_id
|
||||||
|
|
|
@ -464,7 +464,7 @@ class Updater(threading.Thread):
|
||||||
logging.getLogger('cps.web').debug("Delete file " + item_path)
|
logging.getLogger('cps.web').debug("Delete file " + item_path)
|
||||||
log_from_thread("Delete file " + item_path)
|
log_from_thread("Delete file " + item_path)
|
||||||
os.remove(item_path)
|
os.remove(item_path)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.getLogger('cps.web').debug("Could not remove:" + item_path)
|
logging.getLogger('cps.web').debug("Could not remove:" + item_path)
|
||||||
shutil.rmtree(source, ignore_errors=True)
|
shutil.rmtree(source, ignore_errors=True)
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
Takes a prefix, query typeahead callback, Bloodhound typeahead adapter
|
Takes a prefix, query typeahead callback, Bloodhound typeahead adapter
|
||||||
and returns the completions it gets from the bloodhound engine prefixed.
|
and returns the completions it gets from the bloodhound engine prefixed.
|
||||||
*/
|
*/
|
||||||
function prefixed_source(prefix, query, cb, bh_adapter) {
|
function prefixed_source(prefix, query, cb, bhAdapter) {
|
||||||
bh_adapter(query, function(retArray){
|
bhAdapter(query, function(retArray){
|
||||||
var matches = [];
|
var matches = [];
|
||||||
for (var i = 0; i < retArray.length; i++) {
|
for (var i = 0; i < retArray.length; i++) {
|
||||||
var obj = {name : prefix + retArray[i].name};
|
var obj = {name : prefix + retArray[i].name};
|
||||||
|
@ -23,7 +23,7 @@ function get_path(){
|
||||||
}
|
}
|
||||||
|
|
||||||
var authors = new Bloodhound({
|
var authors = new Bloodhound({
|
||||||
name: 'authors',
|
name: "authors",
|
||||||
datumTokenizer: function(datum) {
|
datumTokenizer: function(datum) {
|
||||||
return [datum.name];
|
return [datum.name];
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@ var authors = new Bloodhound({
|
||||||
});
|
});
|
||||||
|
|
||||||
function authors_source(query, cb) {
|
function authors_source(query, cb) {
|
||||||
var bh_adapter = authors.ttAdapter();
|
var bhAdapter = authors.ttAdapter();
|
||||||
|
|
||||||
var tokens = query.split("&");
|
var tokens = query.split("&");
|
||||||
var current_author = tokens[tokens.length-1].trim();
|
var current_author = tokens[tokens.length-1].trim();
|
||||||
|
@ -46,7 +46,7 @@ function authors_source(query, cb) {
|
||||||
prefix += author + " & ";
|
prefix += author + " & ";
|
||||||
}
|
}
|
||||||
|
|
||||||
prefixed_source(prefix, current_author, cb, bh_adapter);
|
prefixed_source(prefix, current_author, cb, bhAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ var promise = authors.initialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
var series = new Bloodhound({
|
var series = new Bloodhound({
|
||||||
name: 'series',
|
name: "series",
|
||||||
datumTokenizer: function(datum) {
|
datumTokenizer: function(datum) {
|
||||||
return [datum.name];
|
return [datum.name];
|
||||||
},
|
},
|
||||||
|
@ -94,7 +94,7 @@ var promise = series.initialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
var tags = new Bloodhound({
|
var tags = new Bloodhound({
|
||||||
name: 'tags',
|
name: "tags",
|
||||||
datumTokenizer: function(datum) {
|
datumTokenizer: function(datum) {
|
||||||
return [datum.name];
|
return [datum.name];
|
||||||
},
|
},
|
||||||
|
@ -104,12 +104,12 @@ var tags = new Bloodhound({
|
||||||
return tokens
|
return tokens
|
||||||
},
|
},
|
||||||
remote: {
|
remote: {
|
||||||
url: get_path()+'/get_tags_json?q=%QUERY'
|
url: get_path()+"/get_tags_json?q=%QUERY"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function tag_source(query, cb) {
|
function tag_source(query, cb) {
|
||||||
var bh_adapter = tags.ttAdapter();
|
var bhAdapter = tags.ttAdapter();
|
||||||
|
|
||||||
var tokens = query.split(",");
|
var tokens = query.split(",");
|
||||||
var current_tag = tokens[tokens.length-1].trim();
|
var current_tag = tokens[tokens.length-1].trim();
|
||||||
|
@ -121,7 +121,7 @@ function tag_source(query, cb) {
|
||||||
prefix += tag + ", ";
|
prefix += tag + ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
prefixed_source(prefix, current_tag, cb, bh_adapter);
|
prefixed_source(prefix, current_tag, cb, bhAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise = tags.initialize();
|
var promise = tags.initialize();
|
||||||
|
@ -138,7 +138,7 @@ var promise = tags.initialize();
|
||||||
});
|
});
|
||||||
|
|
||||||
var languages = new Bloodhound({
|
var languages = new Bloodhound({
|
||||||
name: 'languages',
|
name: "languages",
|
||||||
datumTokenizer: function(datum) {
|
datumTokenizer: function(datum) {
|
||||||
return [datum.name];
|
return [datum.name];
|
||||||
},
|
},
|
||||||
|
@ -155,10 +155,10 @@ var languages = new Bloodhound({
|
||||||
});
|
});
|
||||||
|
|
||||||
function language_source(query, cb) {
|
function language_source(query, cb) {
|
||||||
var bh_adapter = languages.ttAdapter();
|
var bhAdapter = languages.ttAdapter();
|
||||||
|
|
||||||
var tokens = query.split(",");
|
var tokens = query.split(",");
|
||||||
var current_language = tokens[tokens.length-1].trim();
|
var currentLanguage = tokens[tokens.length-1].trim();
|
||||||
|
|
||||||
tokens.splice(tokens.length-1, 1); // remove last element
|
tokens.splice(tokens.length-1, 1); // remove last element
|
||||||
var prefix = "";
|
var prefix = "";
|
||||||
|
@ -167,7 +167,7 @@ function language_source(query, cb) {
|
||||||
prefix += tag + ", ";
|
prefix += tag + ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
prefixed_source(prefix, current_language, cb, bh_adapter);
|
prefixed_source(prefix, currentLanguage, cb, bhAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise = languages.initialize();
|
var promise = languages.initialize();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var msg = i18n_msg;
|
var msg = i18n_msg;
|
||||||
var douban = 'https://api.douban.com';
|
var douban = "https://api.douban.com";
|
||||||
var db_search = '/v2/book/search';
|
var db_search = '/v2/book/search';
|
||||||
var db_get_info = '/v2/book/';
|
var db_get_info = '/v2/book/';
|
||||||
var db_get_info_by_isbn = '/v2/book/isbn/ ';
|
var db_get_info_by_isbn = '/v2/book/isbn/ ';
|
||||||
|
@ -23,7 +23,7 @@ $(document).ready(function () {
|
||||||
var show_flag = 0;
|
var show_flag = 0;
|
||||||
String.prototype.replaceAll = function (s1, s2) {
|
String.prototype.replaceAll = function (s1, s2) {
|
||||||
return this.replace(new RegExp(s1, "gm"), s2);
|
return this.replace(new RegExp(s1, "gm"), s2);
|
||||||
}
|
};
|
||||||
|
|
||||||
gg_search_book = function (title) {
|
gg_search_book = function (title) {
|
||||||
title = title.replaceAll(/\s+/, '+');
|
title = title.replaceAll(/\s+/, '+');
|
||||||
|
@ -45,38 +45,38 @@ $(document).ready(function () {
|
||||||
|
|
||||||
get_meta = function (source, id) {
|
get_meta = function (source, id) {
|
||||||
var meta;
|
var meta;
|
||||||
if (source == 'google') {;
|
if (source == "google") {
|
||||||
meta = gg_results[id];
|
meta = gg_results[id];
|
||||||
$('#description').val(meta.volumeInfo.description);
|
$("#description").val(meta.volumeInfo.description);
|
||||||
$('#bookAuthor').val(meta.volumeInfo.authors.join(' & '));
|
$("#bookAuthor").val(meta.volumeInfo.authors.join(' & '));
|
||||||
$('#book_title').val(meta.volumeInfo.title);
|
$("#book_title").val(meta.volumeInfo.title);
|
||||||
if (meta.volumeInfo.categories) {
|
if (meta.volumeInfo.categories) {
|
||||||
var tags = meta.volumeInfo.categories.join(',');
|
var tags = meta.volumeInfo.categories.join(',');
|
||||||
$('#tags').val(tags);
|
$("#tags").val(tags);
|
||||||
}
|
}
|
||||||
if (meta.volumeInfo.averageRating) {
|
if (meta.volumeInfo.averageRating) {
|
||||||
$('#rating').val(Math.round(meta.volumeInfo.averageRating));
|
$("#rating").val(Math.round(meta.volumeInfo.averageRating));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (source == 'douban') {
|
if (source == "douban") {
|
||||||
meta = db_results[id];
|
meta = db_results[id];
|
||||||
$('#description').val(meta.summary);
|
$("#description").val(meta.summary);
|
||||||
$('#bookAuthor').val(meta.author.join(' & '));
|
$("#bookAuthor").val(meta.author.join(' & '));
|
||||||
$('#book_title').val(meta.title);
|
$("#book_title").val(meta.title);
|
||||||
var tags = '';
|
var tags = '';
|
||||||
for (var i = 0; i < meta.tags.length; i++) {
|
for (var i = 0; i < meta.tags.length; i++) {
|
||||||
tags = tags + meta.tags[i].title + ',';
|
tags = tags + meta.tags[i].title + ',';
|
||||||
}
|
}
|
||||||
$('#tags').val(tags);
|
$("#tags").val(tags);
|
||||||
$('#rating').val(Math.round(meta.rating.average / 2));
|
$("#rating").val(Math.round(meta.rating.average / 2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_search = function (keyword) {
|
do_search = function (keyword) {
|
||||||
show_flag = 0;
|
show_flag = 0;
|
||||||
$('#meta-info').text(msg.loading);
|
$("#meta-info").text(msg.loading);
|
||||||
var keyword = $('#keyword').val();
|
var keyword = $("#keyword").val();
|
||||||
if (keyword) {
|
if (keyword) {
|
||||||
db_search_book(keyword);
|
db_search_book(keyword);
|
||||||
gg_search_book(keyword);
|
gg_search_book(keyword);
|
||||||
|
|
|
@ -5,11 +5,11 @@ var updateText;
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.discover .row').isotope({
|
$('.discover .row').isotope({
|
||||||
// options
|
// options
|
||||||
itemSelector : '.book',
|
itemSelector : ".book",
|
||||||
layoutMode : 'fitRows'
|
layoutMode : "fitRows"
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.load-more .row').infinitescroll({
|
$(".load-more .row").infinitescroll({
|
||||||
debug: false,
|
debug: false,
|
||||||
navSelector : ".pagination",
|
navSelector : ".pagination",
|
||||||
// selector for the paged navigation (it will be hidden)
|
// selector for the paged navigation (it will be hidden)
|
||||||
|
@ -20,13 +20,13 @@ $(function() {
|
||||||
extraScrollPx: 300,
|
extraScrollPx: 300,
|
||||||
// selector for all items you'll retrieve
|
// selector for all items you'll retrieve
|
||||||
}, function(data){
|
}, function(data){
|
||||||
$('.load-more .row').isotope( 'appended', $(data), null );
|
$(".load-more .row").isotope( 'appended', $(data), null );
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#sendbtn').click(function(){
|
$('#sendbtn').click(function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$this.text('Please wait...');
|
$this.text("Please wait...");
|
||||||
$this.addClass('disabled');
|
$this.addClass("disabled");
|
||||||
});
|
});
|
||||||
$("#restart").click(function() {
|
$("#restart").click(function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -57,10 +57,10 @@ $(function() {
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#check_for_update").html(button_text);
|
$("#check_for_update").html(button_text);
|
||||||
if (data.status == true) {
|
if (data.status == true) {
|
||||||
$("#check_for_update").addClass('hidden');
|
$("#check_for_update").addClass("hidden");
|
||||||
$("#perform_update").removeClass('hidden');
|
$("#perform_update").removeClass("hidden");
|
||||||
$("#update_info").removeClass('hidden');
|
$("#update_info").removeClass("hidden");
|
||||||
$("#update_info").find('span').html(data.commit);
|
$("#update_info").find("span").html(data.commit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -73,14 +73,14 @@ $(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$("#perform_update").click(function() {
|
$("#perform_update").click(function() {
|
||||||
$('#spinner2').show();
|
$("#spinner2").show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { start: "True"},
|
data: { start: "True"},
|
||||||
url: window.location.pathname+"/../../get_updater_status",
|
url: window.location.pathname+"/../../get_updater_status",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
updateText=data.text
|
updateText=data.text;
|
||||||
$("#UpdateprogressDialog #Updatecontent").html(updateText[data.status]);
|
$("#UpdateprogressDialog #Updatecontent").html(updateText[data.status]);
|
||||||
console.log(data.status);
|
console.log(data.status);
|
||||||
updateTimerID=setInterval(updateTimer, 2000);}
|
updateTimerID=setInterval(updateTimer, 2000);}
|
||||||
|
@ -90,8 +90,8 @@ $(function() {
|
||||||
|
|
||||||
|
|
||||||
function restartTimer() {
|
function restartTimer() {
|
||||||
$('#spinner').hide();
|
$("#spinner").hide();
|
||||||
$('#RestartDialog').modal('hide');
|
$("#RestartDialog").modal("hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTimer() {
|
function updateTimer() {
|
||||||
|
@ -110,13 +110,13 @@ function updateTimer() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
console.log('Done');
|
// console.log('Done');
|
||||||
clearInterval(updateTimerID);
|
clearInterval(updateTimerID);
|
||||||
$('#spinner2').hide();
|
$("#spinner2").hide();
|
||||||
$("#UpdateprogressDialog #Updatecontent").html(updateText[7]);
|
$("#UpdateprogressDialog #Updatecontent").html(updateText[7]);
|
||||||
$('#UpdateprogressDialog #updateFinished').removeClass('hidden');
|
$("#UpdateprogressDialog #updateFinished").removeClass("hidden");
|
||||||
$("#check_for_update").removeClass('hidden');
|
$("#check_for_update").removeClass("hidden");
|
||||||
$("#perform_update").addClass('hidden');
|
$("#perform_update").addClass("hidden");
|
||||||
},
|
},
|
||||||
timeout:2000
|
timeout:2000
|
||||||
});
|
});
|
||||||
|
@ -124,5 +124,5 @@ function updateTimer() {
|
||||||
|
|
||||||
|
|
||||||
$(window).resize(function(event) {
|
$(window).resize(function(event) {
|
||||||
$('.discover .row').isotope('reLayout');
|
$(".discover .row").isotope("reLayout");
|
||||||
});
|
});
|
||||||
|
|
|
@ -506,7 +506,7 @@ def create_anonymous_user():
|
||||||
session.add(user)
|
session.add(user)
|
||||||
try:
|
try:
|
||||||
session.commit()
|
session.commit()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
13
cps/web.py
13
cps/web.py
|
@ -385,7 +385,7 @@ def shortentitle_filter(s):
|
||||||
def mimetype_filter(val):
|
def mimetype_filter(val):
|
||||||
try:
|
try:
|
||||||
s = mimetypes.types_map['.' + val]
|
s = mimetypes.types_map['.' + val]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
s = 'application/octet-stream'
|
s = 'application/octet-stream'
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
@ -558,10 +558,6 @@ def before_request():
|
||||||
@app.route("/opds")
|
@app.route("/opds")
|
||||||
@requires_basic_auth_if_no_ano
|
@requires_basic_auth_if_no_ano
|
||||||
def feed_index():
|
def feed_index():
|
||||||
if current_user.filter_language() != "all":
|
|
||||||
filter = db.Books.languages.any(db.Languages.lang_code == current_user.filter_language())
|
|
||||||
else:
|
|
||||||
filter = True
|
|
||||||
xml = render_title_template('index.xml')
|
xml = render_title_template('index.xml')
|
||||||
response = make_response(xml)
|
response = make_response(xml)
|
||||||
response.headers["Content-Type"] = "application/xml"
|
response.headers["Content-Type"] = "application/xml"
|
||||||
|
@ -792,7 +788,6 @@ def partial(total_byte_len, part_size_limit):
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def do_gdrive_download(df, headers):
|
def do_gdrive_download(df, headers):
|
||||||
startTime=time.time()
|
|
||||||
total_size = int(df.metadata.get('fileSize'))
|
total_size = int(df.metadata.get('fileSize'))
|
||||||
download_url = df.metadata.get('downloadUrl')
|
download_url = df.metadata.get('downloadUrl')
|
||||||
s = partial(total_size, 1024 * 1024) # I'm downloading BIG files, so 100M chunk size is fine for me
|
s = partial(total_size, 1024 * 1024) # I'm downloading BIG files, so 100M chunk size is fine for me
|
||||||
|
@ -911,7 +906,7 @@ def get_updater_status():
|
||||||
elif request.method == "GET":
|
elif request.method == "GET":
|
||||||
try:
|
try:
|
||||||
status['status']=helper.updater_thread.get_update_status()
|
status['status']=helper.updater_thread.get_update_status()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
status['status'] = 7
|
status['status'] = 7
|
||||||
return json.dumps(status)
|
return json.dumps(status)
|
||||||
|
|
||||||
|
@ -1304,7 +1299,7 @@ def revoke_watch_gdrive():
|
||||||
last_watch_response=config.config_google_drive_watch_changes_response
|
last_watch_response=config.config_google_drive_watch_changes_response
|
||||||
if last_watch_response:
|
if last_watch_response:
|
||||||
try:
|
try:
|
||||||
response=gdriveutils.stopChannel(Gdrive.Instance().drive, last_watch_response['id'], last_watch_response['resourceId'])
|
gdriveutils.stopChannel(Gdrive.Instance().drive, last_watch_response['id'], last_watch_response['resourceId'])
|
||||||
except HttpError:
|
except HttpError:
|
||||||
pass
|
pass
|
||||||
settings = ub.session.query(ub.Settings).first()
|
settings = ub.session.query(ub.Settings).first()
|
||||||
|
@ -1481,7 +1476,7 @@ def advanced_search():
|
||||||
def get_cover_via_gdrive(cover_path):
|
def get_cover_via_gdrive(cover_path):
|
||||||
df=gdriveutils.getFileFromEbooksFolder(Gdrive.Instance().drive, cover_path, 'cover.jpg')
|
df=gdriveutils.getFileFromEbooksFolder(Gdrive.Instance().drive, cover_path, 'cover.jpg')
|
||||||
if not gdriveutils.session.query(gdriveutils.PermissionAdded).filter(gdriveutils.PermissionAdded.gdrive_id == df['id']).first():
|
if not gdriveutils.session.query(gdriveutils.PermissionAdded).filter(gdriveutils.PermissionAdded.gdrive_id == df['id']).first():
|
||||||
permissions=df.GetPermissions()
|
df.GetPermissions()
|
||||||
df.InsertPermission({
|
df.InsertPermission({
|
||||||
'type': 'anyone',
|
'type': 'anyone',
|
||||||
'value': 'anyone',
|
'value': 'anyone',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user