Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
f9b1e847
Commit
f9b1e847
authored
Dec 11, 2019
by
Michael Shavit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove backblaze leftovers
parent
55c0bb6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
42 deletions
+0
-42
.gitignore
.gitignore
+0
-1
kobo.py
cps/kobo.py
+0
-38
optional-requirements.txt
optional-requirements.txt
+0
-3
No files found.
.gitignore
View file @
f9b1e847
...
...
@@ -32,4 +32,3 @@ gdrive_credentials
vendor
client_secrets.json
b2_secrets.json
cps/kobo.py
View file @
f9b1e847
...
...
@@ -8,19 +8,14 @@ import os
from
datetime
import
datetime
,
tzinfo
,
timedelta
from
time
import
gmtime
,
strftime
from
b2sdk.account_info.in_memory
import
InMemoryAccountInfo
from
b2sdk.api
import
B2Api
from
jsonschema
import
validate
,
exceptions
from
flask
import
Blueprint
,
request
,
make_response
,
jsonify
,
json
,
send_file
from
flask_login
import
login_required
from
sqlalchemy
import
func
from
.
import
config
,
logger
,
kobo_auth
,
ub
,
db
,
helper
from
.constants
import
CONFIG_DIR
as
_CONFIG_DIR
from
.web
import
download_required
B2_SECRETS
=
os
.
path
.
join
(
_CONFIG_DIR
,
"b2_secrets.json"
)
kobo
=
Blueprint
(
"kobo"
,
__name__
)
kobo_auth
.
disable_failed_auth_redirect_for_blueprint
(
kobo
)
...
...
@@ -215,39 +210,6 @@ def get_download_url_for_book(book, book_format):
)
def
get_download_url_for_book_b2
(
book
,
book_format
):
if
not
data
:
log
.
info
(
u"Book
%
s does have a kepub format"
,
book_uuid
)
return
None
file_name
=
data
.
name
+
".kepub"
file_path
=
os
.
path
.
join
(
book
.
path
,
file_name
)
if
not
os
.
path
.
isfile
(
B2_SECRETS
):
log
.
error
(
u"b2 secret file not found"
)
return
None
with
open
(
B2_SECRETS
,
"r"
)
as
filedata
:
secrets
=
json
.
load
(
filedata
)
info
=
InMemoryAccountInfo
()
b2_api
=
B2Api
(
info
)
b2_api
.
authorize_account
(
"production"
,
secrets
[
"application_key_id"
],
secrets
[
"application_key"
]
)
bucket
=
b2_api
.
get_bucket_by_name
(
secrets
[
"bucket_name"
])
if
not
bucket
:
log
.
error
(
u"b2 bucket not found"
)
return
None
download_url
=
b2_api
.
get_download_url_for_file_name
(
secrets
[
"bucket_name"
],
file_path
)
download_authorization
=
bucket
.
get_download_authorization
(
file_path
,
valid_duration_in_seconds
=
600
)
return
download_url
+
"?Authorization="
+
download_authorization
def
create_book_entitlement
(
book
):
book_uuid
=
book
.
uuid
return
{
...
...
optional-requirements.txt
View file @
f9b1e847
...
...
@@ -32,6 +32,3 @@ rarfile>=2.7
# other
natsort
>=2.2.0
git+https://github.com/OzzieIsaacs/comicapi.git@5346716578b2843f54d522f44d01bc8d25001d24#egg=comicapi
# Unsupported/Experimental backblaze integration for Kobo endpoint.
b2sdk
>=1.0.2,<2.0.0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment