Added show() to photos_repl.py
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
# If you run this using python from command line, do so with -i flag:
|
# If you run this using python from command line, do so with -i flag:
|
||||||
# python3 -i examples/photos_repl.py
|
# python3 -i examples/photos_repl.py
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -17,6 +18,23 @@ import osxphotos
|
|||||||
from osxphotos.__main__ import get_photos_db, _list_libraries
|
from osxphotos.__main__ import get_photos_db, _list_libraries
|
||||||
|
|
||||||
|
|
||||||
|
def show(photo):
|
||||||
|
""" open image with default image viewer
|
||||||
|
|
||||||
|
Note: This is for debugging only -- it will actually open any filetype which could
|
||||||
|
be very, very bad.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
photo: PhotoInfo object or a path to a photo on disk
|
||||||
|
"""
|
||||||
|
photopath = photo.path if isinstance(photo, osxphotos.PhotoInfo) else photo
|
||||||
|
|
||||||
|
if not os.path.isfile(photopath):
|
||||||
|
return f"'{photopath}' does not appear to be a valid photo path"
|
||||||
|
|
||||||
|
os.system(f"open '{photopath}'")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
db = None
|
db = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user