Removed applescript to close Photos

This commit is contained in:
Rhet Turnbull
2019-12-07 19:35:42 -08:00
parent 1ea83e6c8e
commit f21c7c8b08
2 changed files with 43 additions and 43 deletions

View File

@@ -18,7 +18,7 @@ import CoreFoundation
import objc
from Foundation import *
from . import _applescript
# from . import _applescript
from ._version import __version__
# TODO: find edited photos: see https://github.com/orangeturtle739/photos-export/blob/master/extract_photos.py
@@ -126,7 +126,7 @@ class PhotosDB:
)
# configure AppleScripts used to manipulate Photos
self._setup_applescript()
# self._setup_applescript()
# set up the data structures used to store all the Photo database info
@@ -164,7 +164,7 @@ class PhotosDB:
self._dbfile = dbfile
# force Photos to quit (TODO: this might not be needed since we copy the file)
self._scpt_quit.run()
# self._scpt_quit.run()
self._tmp_db = self._copy_db_file(self._dbfile)
self._db_version = self._get_db_version()
if int(self._db_version) >= int(_PHOTOS_5_VERSION):
@@ -261,45 +261,45 @@ class PhotosDB:
albums.add(self._dbalbum_details[album]["title"])
return list(albums)
def _setup_applescript(self):
""" setup various applescripts used internally (e.g. to close Photos) """
self._scpt_export = ""
self._scpt_launch = ""
self._scpt_quit = ""
# def _setup_applescript(self):
# """ setup various applescripts used internally (e.g. to close Photos) """
# self._scpt_export = ""
# self._scpt_launch = ""
# self._scpt_quit = ""
# Compile apple script that exports one image
# self._scpt_export = _applescript.AppleScript('''
# on run {arg}
# set thepath to "%s"
# tell application "Photos"
# set theitem to media item id arg
# set thelist to {theitem}
# export thelist to POSIX file thepath
# end tell
# end run
# ''' % (tmppath))
#
# Compile apple script that launches Photos.App
self._scpt_launch = _applescript.AppleScript(
"""
on run
tell application "Photos"
activate
end tell
end run
"""
)
# # Compile apple script that exports one image
# # self._scpt_export = _applescript.AppleScript('''
# # on run {arg}
# # set thepath to "%s"
# # tell application "Photos"
# # set theitem to media item id arg
# # set thelist to {theitem}
# # export thelist to POSIX file thepath
# # end tell
# # end run
# # ''' % (tmppath))
# #
# # Compile apple script that launches Photos.App
# self._scpt_launch = _applescript.AppleScript(
# """
# on run
# tell application "Photos"
# activate
# end tell
# end run
# """
# )
# Compile apple script that quits Photos.App
self._scpt_quit = _applescript.AppleScript(
"""
on run
tell application "Photos"
quit
end tell
end run
"""
)
# # Compile apple script that quits Photos.App
# self._scpt_quit = _applescript.AppleScript(
# """
# on run
# tell application "Photos"
# quit
# end tell
# end run
# """
# )
def get_db_version(self):
""" return the database version as stored in LiGlobals table """
@@ -431,7 +431,7 @@ class PhotosDB:
# Ensure Photos.App is not running
# TODO: Don't think we need this here
self._scpt_quit.run()
# self._scpt_quit.run()
(conn, c) = self._open_sql_file(self._tmp_db)
@@ -755,7 +755,7 @@ class PhotosDB:
# Ensure Photos.App is not running
# TODO: Don't think we need this here
self._scpt_quit.run()
# self._scpt_quit.run()
(conn, c) = self._open_sql_file(self._tmp_db)

View File

@@ -1,4 +1,4 @@
""" version info """
__version__ = "0.14.14"
__version__ = "0.14.15"