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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sebsync
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Synchronize Standard Ebooks catalog with local EPUB collection.
5
5
  Home-page: https://github.com/pbryan/sebsync/
6
6
  License: MIT
@@ -8,7 +8,7 @@ target-version = ['py312']
8
8
 
9
9
  [tool.poetry]
10
10
  name = "sebsync"
11
- version = "1.0.3"
11
+ version = "1.0.4"
12
12
  description = "Synchronize Standard Ebooks catalog with local EPUB collection."
13
13
  readme = "README.md"
14
14
  authors = ["sebsync authors"]
@@ -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 are detected."""
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
- # if timestamp of remote is less than that of local file, assume local is current
190
- if remote_ebook.updated < datetime.fromtimestamp(stat.st_mtime, timezone.utc):
191
- return False
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 True
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