Remove deprecated utcfromtimestamp in kindle driver

The use for generate_annotation_html is safe since it is just used to
get a formatted date via strftime. No idea about its use in clippings,
this is also unmaintained code, so roll the dice :)
This commit is contained in:
Kovid Goyal 2023-11-17 08:15:14 +05:30
parent 70753ed389
commit d3965080da
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -8,9 +8,10 @@ from calibre.devices.kindle.apnx import APNXBuilder
Device driver for Amazon's Kindle
'''
import datetime, os, re, json, hashlib, errno
import os, re, json, hashlib, errno
from calibre.constants import DEBUG, filesystem_encoding
from calibre.utils.date import utcfromtimestamp
from calibre.devices.interface import OpenPopupMessage
from calibre.devices.kindle.bookmark import Bookmark
from calibre.devices.usbms.driver import USBMS
@ -218,9 +219,9 @@ class KINDLE(USBMS):
mc_path = get_my_clippings(storage, bookmarked_books)
if mc_path:
timestamp = datetime.datetime.utcfromtimestamp(os.path.getmtime(mc_path))
timestamp = utcfromtimestamp(os.path.getmtime(mc_path))
bookmarked_books['clippings'] = self.UserAnnotation(type='kindle_clippings',
value=dict(path=mc_path,timestamp=timestamp))
value=dict(path=mc_path, timestamp=timestamp))
# This returns as job.result in gui2.ui.annotations_fetched(self,job)
return bookmarked_books
@ -229,7 +230,7 @@ class KINDLE(USBMS):
from calibre.ebooks.BeautifulSoup import BeautifulSoup
# Returns <div class="user_annotations"> ... </div>
last_read_location = bookmark.last_read_location
timestamp = datetime.datetime.utcfromtimestamp(bookmark.timestamp)
timestamp = utcfromtimestamp(bookmark.timestamp)
percent_read = bookmark.percent_read
ka_soup = BeautifulSoup()