Skip to content

Commit

Permalink
add support for edits #769 #350 #249 (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored May 30, 2024
1 parent f01f8ef commit 973b8da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- fix: Apple/Adobe raw photos are recognised as images [#662](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/662)
- feature: support multiple `--size` parameter specification in command line
- fix: file extensions for non-original version matching type of the asset in the version
- feature: support downloading adjusted files with `--size adjusted` parameter (portraits, edits, etc) [#769](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/769) [#704](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/704) [#350](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/350) [#249](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/249)

## 1.18.0 (2024-05-27)

Expand Down
4 changes: 2 additions & 2 deletions src/icloudpd/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def build_lp_filename_generator(_ctx: click.Context, _param: click.Parameter, lp
@click.option(
"--size",
help="Image size to download (default: original)",
type=click.Choice(["original", "medium", "thumb"]),
type=click.Choice(["original", "medium", "thumb", "adjusted"]),
default=["original"],
multiple=True,
)
Expand Down Expand Up @@ -508,7 +508,7 @@ def download_photo_(counter: Counter, photo: PhotoAsset) -> bool:
success = False

for download_size in size:
if download_size not in versions and size != "original":
if download_size not in versions and download_size != "original":
if force_size:
logger.error(
"%s size does not exist for %s. Skipping...",
Expand Down
13 changes: 13 additions & 0 deletions src/pyicloud_ipd/services/photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,19 @@ def versions(self) -> Dict[str, Dict[str, Any]]:
else:
typed_version_lookup = self.PHOTO_VERSION_LOOKUP

# handle adjustments
_adjusted = self._asset_record['fields'].get('resJPEGFullRes')
if _adjusted:
_f, _ = os.path.splitext(self.filename)
_t = self._asset_record['fields']['resJPEGFullFileType']['value']
_v: Dict[str, Any] = {
"type": _t,
"filename" : _f + "." + self.ITEM_TYPE_EXTENSIONS.get(_t, "JPG"),
"size": _adjusted["value"]["size"] ,
"url": _adjusted["value"]["downloadURL"],
}
self._versions["adjusted"] = _v

for key, prefix in typed_version_lookup.items():
if '%sRes' % prefix in self._master_record['fields']:
f = self._master_record['fields']
Expand Down

0 comments on commit 973b8da

Please sign in to comment.