improved pdf viewer

This commit is contained in:
vabene1111
2020-06-10 15:40:24 +02:00
parent f44ebe0d05
commit ec8a879efa
201 changed files with 27517 additions and 415 deletions

View File

@ -1,4 +1,5 @@
import base64
import io
import os
import tempfile
from datetime import datetime
@ -85,18 +86,17 @@ class Nextcloud(Provider):
return Nextcloud.create_share_link(recipe)
@staticmethod
def get_base64_file(recipe):
def get_file(recipe):
client = Nextcloud.get_client(recipe.storage)
tmp_file_path = tempfile.gettempdir() + '/' + recipe.name + '.pdf'
client.download_file(remote_path=recipe.file_path, local_path=tmp_file_path)
val = base64.b64encode(open(tmp_file_path, 'rb').read())
file = io.BytesIO(open(tmp_file_path, 'rb').read())
os.remove(tmp_file_path)
return val
return file
@staticmethod
def rename_file(recipe, new_name):