Skip to content

Commit

Permalink
fix tqdm on macos #668 #700 (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Dec 4, 2023
1 parent 86f7838 commit e68ae9b
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 106 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fix: macos binary failing [#668](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/668) [#700](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/700)

## 1.16.3 (2023-12-04)

- fix: file date attribute [#714](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/714)
Expand Down
216 changes: 110 additions & 106 deletions src/starters/icloudpd_ex.py
Original file line number Diff line number Diff line change
@@ -1,106 +1,110 @@
""" Experimental code """
import sys
from icloudpd.base import main as icloudpd_main
from pyicloud_ipd.cmdline import main as icloud_main

import click

# goal0 -- allow experimental flow from cli
# goal1 -- compose auth flow for icloud auth apis that supports 2fa, fido,
# and works from China

# print("Experimenting with authentication")

# def make_requestor():
# """ make_requestor :: IO (Request -> Response) """

# def make_request_builder():
# """ make_request_builder :: State (a -> Request) """

# def make_response_parser():
# """ make_response_parser :: State (Response -> a) """


@click.group()
def commands():
pass


@commands.command()
@click.option(
"--username",
default="",
help="Apple ID to Use"
)
@click.option(
"--password",
default="",
help=(
"Apple ID Password to Use; if unspecified, password will be "
"fetched from the system keyring."
)
)
@click.option(
"-n", "--non-interactive",
default=True,
help="Disable interactive prompts."
)
@click.option(
"--delete-from-keyring",
default=False,
help="Delete stored password in system keyring for this username.",
)
@click.option(
"--domain",
default="com",
help="Root Domain for requests to iCloud. com or cn",
)
def icloud(username, password, non_interactive, delete_from_keyring, domain):
"""Legacy iCloud utils (keyring)"""
# raise Exception("blah")
icloud_main(sys.argv[2:])


@commands.command()
@click.argument('appleid') # , help="AppleID of the account to use")
@click.argument('target') # , help="Target path template")
def copy(appleid, target):
"""Copy assets from iCloud to local storage"""


@commands.command()
def move():
"""Move assets from iCloud to local storage"""


@commands.group()
def auth():
"""Manages persistant credentials"""


@auth.command()
@click.argument('appleid') # , help="AppleID of the account to use")
def add(appleid):
"""Add credentials to keyring"""


@auth.command()
@click.argument('appleid') # , help="AppleID of the account to use")
def delete(appleid):
"""Delete credentials from keyring"""


@commands.group()
def watch():
"""Watch for iCloud changes"""


def main():
commands.add_command(icloudpd_main, name="icloudpd")
watch.add_command(copy)
watch.add_command(move)
commands()


if __name__ == "__main__":
main()
""" Experimental code """

from multiprocessing import freeze_support
freeze_support() # fixing tqdm on macos

import sys
from icloudpd.base import main as icloudpd_main
from pyicloud_ipd.cmdline import main as icloud_main

import click

# goal0 -- allow experimental flow from cli
# goal1 -- compose auth flow for icloud auth apis that supports 2fa, fido,
# and works from China

# print("Experimenting with authentication")

# def make_requestor():
# """ make_requestor :: IO (Request -> Response) """

# def make_request_builder():
# """ make_request_builder :: State (a -> Request) """

# def make_response_parser():
# """ make_response_parser :: State (Response -> a) """


@click.group()
def commands():
pass


@commands.command()
@click.option(
"--username",
default="",
help="Apple ID to Use"
)
@click.option(
"--password",
default="",
help=(
"Apple ID Password to Use; if unspecified, password will be "
"fetched from the system keyring."
)
)
@click.option(
"-n", "--non-interactive",
default=True,
help="Disable interactive prompts."
)
@click.option(
"--delete-from-keyring",
default=False,
help="Delete stored password in system keyring for this username.",
)
@click.option(
"--domain",
default="com",
help="Root Domain for requests to iCloud. com or cn",
)
def icloud(username, password, non_interactive, delete_from_keyring, domain):
"""Legacy iCloud utils (keyring)"""
# raise Exception("blah")
icloud_main(sys.argv[2:])


@commands.command()
@click.argument('appleid') # , help="AppleID of the account to use")
@click.argument('target') # , help="Target path template")
def copy(appleid, target):
"""Copy assets from iCloud to local storage"""


@commands.command()
def move():
"""Move assets from iCloud to local storage"""


@commands.group()
def auth():
"""Manages persistant credentials"""


@auth.command()
@click.argument('appleid') # , help="AppleID of the account to use")
def add(appleid):
"""Add credentials to keyring"""


@auth.command()
@click.argument('appleid') # , help="AppleID of the account to use")
def delete(appleid):
"""Delete credentials from keyring"""


@commands.group()
def watch():
"""Watch for iCloud changes"""


def main():
commands.add_command(icloudpd_main, name="icloudpd")
watch.add_command(copy)
watch.add_command(move)
commands()


if __name__ == "__main__":
main()

0 comments on commit e68ae9b

Please sign in to comment.