Fix issue where books weren't correctly ordered by Date added on the

Kobo device.
pull/1228/head
Michael Shavit 5 years ago
parent 7d795771d3
commit cba3e62e71

@ -21,6 +21,7 @@ import sys
import base64 import base64
import os import os
import uuid import uuid
from datetime import datetime
from time import gmtime, strftime from time import gmtime, strftime
try: try:
from urllib import unquote from urllib import unquote
@ -234,14 +235,14 @@ def create_book_entitlement(book):
return { return {
"Accessibility": "Full", "Accessibility": "Full",
"ActivePeriod": {"From": current_time(),}, "ActivePeriod": {"From": current_time(),},
"Created": book.timestamp, "Created": book.timestamp.strftime("%Y-%m-%dT%H:%M:%SZ"),
"CrossRevisionId": book_uuid, "CrossRevisionId": book_uuid,
"Id": book_uuid, "Id": book_uuid,
"IsHiddenFromArchive": False, "IsHiddenFromArchive": False,
"IsLocked": False, "IsLocked": False,
# Setting this to true removes from the device. # Setting this to true removes from the device.
"IsRemoved": False, "IsRemoved": False,
"LastModified": book.last_modified, "LastModified": book.last_modified.strftime("%Y-%m-%dT%H:%M:%SZ"),
"OriginCategory": "Imported", "OriginCategory": "Imported",
"RevisionId": book_uuid, "RevisionId": book_uuid,
"Status": "Active", "Status": "Active",
@ -397,6 +398,7 @@ def HandleUserRequest(dummy=None):
@kobo.route("/v1/products/<dummy>/reviews", methods=["GET", "POST"]) @kobo.route("/v1/products/<dummy>/reviews", methods=["GET", "POST"])
@kobo.route("/v1/products/books/<dummy>", methods=["GET", "POST"]) @kobo.route("/v1/products/books/<dummy>", methods=["GET", "POST"])
@kobo.route("/v1/products/dailydeal", methods=["GET", "POST"]) @kobo.route("/v1/products/dailydeal", methods=["GET", "POST"])
@kobo.route("/v1/products", methods=["GET", "POST"])
def HandleProductsRequest(dummy=None): def HandleProductsRequest(dummy=None):
log.debug("Unimplemented Products Request received: %s", request.base_url) log.debug("Unimplemented Products Request received: %s", request.base_url)
return redirect_or_proxy_request() return redirect_or_proxy_request()

Loading…
Cancel
Save