-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhere.py
48 lines (39 loc) · 1.25 KB
/
where.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import argparse
import logging
import os
import google
import photos
name_to_level = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
'WARNING': logging.WARNING,
'INFO': logging.INFO,
'DEBUG': logging.DEBUG,
}
def enable_logging(level):
"""
Enable logging at the given level.
:param level:
"""
logging.basicConfig(level=name_to_level[level])
def parse_options():
"""
Parse command line options.
:return: parsed options
"""
parser = argparse.ArgumentParser()
parser.add_argument('--log', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], default='WARNING')
parser.add_argument('--google', default='Location History.json')
parser.add_argument('--photo', dest="photo", default=os.path.expanduser("~/Pictures/Photos Library.photoslibrary"),
help="Path to Apple Photos directory. The default is already set for Photos")
return parser.parse_args()
def main():
options = parse_options()
enable_logging(options.log)
logging.debug("Starting Script")
logging.debug("Starting google")
google.get_location_history(options.google)
logging.debug("Start Photos")
photos.get_locations(options.photo)
if __name__ == "__main__":
main()