sebsync 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -178,7 +178,7 @@ def sortable_author(author: str) -> str:
|
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
def books_are_different(local_ebook: LocalEbook, remote_ebook: RemoteEbook) -> bool:
|
|
181
|
-
"""Return if differences between local and remote ebooks
|
|
181
|
+
"""Return if differences are detected between local and remote ebooks."""
|
|
182
182
|
|
|
183
183
|
# if metadata has exact modification times, then local is considered current
|
|
184
184
|
if remote_ebook.updated == local_ebook.modified:
|
|
@@ -186,11 +186,16 @@ def books_are_different(local_ebook: LocalEbook, remote_ebook: RemoteEbook) -> b
|
|
|
186
186
|
|
|
187
187
|
stat = local_ebook.path.stat()
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
if remote_ebook.updated
|
|
191
|
-
return
|
|
189
|
+
file_modified = datetime.fromtimestamp(stat.st_mtime, timezone.utc)
|
|
190
|
+
if remote_ebook.updated > file_modified:
|
|
191
|
+
return True
|
|
192
|
+
|
|
193
|
+
response = requests.head(remote_ebook.href)
|
|
194
|
+
content_length = int(response.headers["Content-Length"])
|
|
195
|
+
if content_length != stat.st_size:
|
|
196
|
+
return True
|
|
192
197
|
|
|
193
|
-
return
|
|
198
|
+
return False
|
|
194
199
|
|
|
195
200
|
|
|
196
201
|
def ebook_filename(ebook: RemoteEbook) -> str:
|
|
@@ -219,11 +224,6 @@ def ebook_filename(ebook: RemoteEbook) -> str:
|
|
|
219
224
|
type=click.Path(exists=True, file_okay=False, dir_okay=True, writable=True, path_type=Path),
|
|
220
225
|
default=if_exists(Path.home() / "Downloads"),
|
|
221
226
|
)
|
|
222
|
-
@click.option(
|
|
223
|
-
"--force-update",
|
|
224
|
-
help="Force update of all local ebooks (implies --update).",
|
|
225
|
-
is_flag=True,
|
|
226
|
-
)
|
|
227
227
|
@click.option(
|
|
228
228
|
"--dry-run",
|
|
229
229
|
help="Perform a trial run with no changes made.",
|
|
@@ -234,6 +234,11 @@ def ebook_filename(ebook: RemoteEbook) -> str:
|
|
|
234
234
|
help="Email address to authenticate with Standard Ebooks.",
|
|
235
235
|
required=True,
|
|
236
236
|
)
|
|
237
|
+
@click.option(
|
|
238
|
+
"--force-update",
|
|
239
|
+
help="Force update of all local ebooks (implies --update).",
|
|
240
|
+
is_flag=True,
|
|
241
|
+
)
|
|
237
242
|
@click.help_option()
|
|
238
243
|
@click.option(
|
|
239
244
|
"--naming",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|