Update blink paths
This commit is contained in:
parent
db8fa77a4c
commit
1331316f6e
@ -11,7 +11,7 @@ def main() -> int:
|
|||||||
# Handle program arguments
|
# Handle program arguments
|
||||||
ap = argparse.ArgumentParser(prog='blink-check', description='Check on a running blink-fetch cron task')
|
ap = argparse.ArgumentParser(prog='blink-check', description='Check on a running blink-fetch cron task')
|
||||||
ap.add_argument("hostname", help="[user@]hostname[:port] for SSH")
|
ap.add_argument("hostname", help="[user@]hostname[:port] for SSH")
|
||||||
ap.add_argument("--image-dir", help="Remote directory containing fetched images", default="/tmp/blink")
|
ap.add_argument("--image-dir", help="Remote directory containing fetched images", default="/home/ewpratten/Pictures/blink")
|
||||||
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
||||||
ap.add_argument("--show-latest", "--show", "-s", help="Download and display the latest image (if possible)", action="store_true")
|
ap.add_argument("--show-latest", "--show", "-s", help="Download and display the latest image (if possible)", action="store_true")
|
||||||
ap.add_argument('-v', '--verbose', help='Enable verbose logging', action='store_true')
|
ap.add_argument('-v', '--verbose', help='Enable verbose logging', action='store_true')
|
||||||
|
@ -14,12 +14,14 @@ from pathlib import Path
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def decdeg2dms(dd):
|
def decdeg2dms(dd):
|
||||||
mult = -1 if dd < 0 else 1
|
mult = -1 if dd < 0 else 1
|
||||||
mnt, sec = divmod(abs(dd) * 3600, 60)
|
mnt, sec = divmod(abs(dd) * 3600, 60)
|
||||||
deg, mnt = divmod(mnt, 60)
|
deg, mnt = divmod(mnt, 60)
|
||||||
return mult * deg, mult * mnt, mult * sec
|
return mult * deg, mult * mnt, mult * sec
|
||||||
|
|
||||||
|
|
||||||
async def main() -> int:
|
async def main() -> int:
|
||||||
# Handle program arguments
|
# Handle program arguments
|
||||||
ap = argparse.ArgumentParser(
|
ap = argparse.ArgumentParser(
|
||||||
@ -28,12 +30,18 @@ async def main() -> int:
|
|||||||
ap.add_argument("--username", help="Blink username", required=True)
|
ap.add_argument("--username", help="Blink username", required=True)
|
||||||
ap.add_argument("--password", help="Blink password")
|
ap.add_argument("--password", help="Blink password")
|
||||||
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
||||||
ap.add_argument("--output-dir", help="Output directory", default="/tmp/blink")
|
ap.add_argument("--output-dir", help="Output directory", default="~/Pictures/blink")
|
||||||
ap.add_argument("--no-2fa", help="Don't try to get 2FA credentials", action="store_true")
|
ap.add_argument(
|
||||||
|
"--no-2fa", help="Don't try to get 2FA credentials", action="store_true"
|
||||||
|
)
|
||||||
ap.add_argument("--no-exif", help="Don't write EXIF data", action="store_true")
|
ap.add_argument("--no-exif", help="Don't write EXIF data", action="store_true")
|
||||||
ap.add_argument("--exif-camera", help="Camera name", default="Blink Mini")
|
ap.add_argument("--exif-camera", help="Camera name", default="Blink Mini")
|
||||||
ap.add_argument("--exif-latitude", "--exif-lat", help="Camera latitude (Decimal Degrees)")
|
ap.add_argument(
|
||||||
ap.add_argument("--exif-longitude", "--exif-lng", help="Camera longitude (Decimal Degrees)")
|
"--exif-latitude", "--exif-lat", help="Camera latitude (Decimal Degrees)"
|
||||||
|
)
|
||||||
|
ap.add_argument(
|
||||||
|
"--exif-longitude", "--exif-lng", help="Camera longitude (Decimal Degrees)"
|
||||||
|
)
|
||||||
ap.add_argument(
|
ap.add_argument(
|
||||||
"-v", "--verbose", help="Enable verbose logging", action="store_true"
|
"-v", "--verbose", help="Enable verbose logging", action="store_true"
|
||||||
)
|
)
|
||||||
@ -50,7 +58,9 @@ async def main() -> int:
|
|||||||
args.password = getpass.getpass(prompt="Blink Password: ")
|
args.password = getpass.getpass(prompt="Blink Password: ")
|
||||||
|
|
||||||
# Authenticate with Blink servers
|
# Authenticate with Blink servers
|
||||||
auth = Auth({"username": args.username, "password": args.password}, no_prompt=args.no_2fa)
|
auth = Auth(
|
||||||
|
{"username": args.username, "password": args.password}, no_prompt=args.no_2fa
|
||||||
|
)
|
||||||
blink = Blink()
|
blink = Blink()
|
||||||
blink.auth = auth
|
blink.auth = auth
|
||||||
await blink.start()
|
await blink.start()
|
||||||
@ -72,8 +82,9 @@ async def main() -> int:
|
|||||||
|
|
||||||
# Create the output directory if it doesn't exist
|
# Create the output directory if it doesn't exist
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
out_file = Path(
|
out_file = (
|
||||||
f"{args.output_dir}/camera_{args.camera_id}.{now.strftime('%Y%m%d_%H%M%S')}.jpg"
|
Path(args.output_dir).expanduser()
|
||||||
|
/ f"camera_{args.camera_id}.{now.strftime('%Y%m%d_%H%M%S')}.jpg"
|
||||||
)
|
)
|
||||||
out_file.parent.mkdir(parents=True, exist_ok=True)
|
out_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ def main() -> int:
|
|||||||
description="Generates timelapses from blink image captures",
|
description="Generates timelapses from blink image captures",
|
||||||
)
|
)
|
||||||
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
ap.add_argument("--camera-id", help="Camera ID", default="155295")
|
||||||
ap.add_argument("--image-dir", help="Image directory", default="/tmp/blink")
|
ap.add_argument("--image-dir", help="Image directory", default="~/Pictures/blink")
|
||||||
ap.add_argument(
|
ap.add_argument(
|
||||||
"--output-dir", help="Output directory", default="~/Videos/BlinkTimelapse"
|
"--output-dir", help="Output directory", default="~/Videos/BlinkTimelapse"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user