diff --git a/.gitignore b/.gitignore index ac687d3..2dcd055 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ **/node_modules/** dist/** build/** -elodie.spec diff --git a/app/app.js b/app/index.js similarity index 95% rename from app/app.js rename to app/index.js index 5c1b201..d77c892 100644 --- a/app/app.js +++ b/app/index.js @@ -30,7 +30,8 @@ ipc.on('update-photos', function(event, args) { } files = normalize(args['files']) - update_command = '/Users/jaisenmathai/dev/tools/elodie/update.py' + update_command = __dirname + '/../dist/elodie/elodie update' + //update_command = __dirname + '/../elodie.py update' if(typeof(args['location']) !== 'undefined') { update_command += ' --location="' + args['location'] + '" "' + files.join('" "') + '"'; } else if(typeof(args['album']) !== 'undefined') { @@ -59,7 +60,7 @@ ipc.on('update-photos', function(event, args) { var mb = menubar( { preloadWindow: true, - dir: 'html', + dir: __dirname + '/html', index: 'location.html', pages: { 'location': 'location.html' @@ -110,4 +111,3 @@ mb.on('hide', function hide () { mb.on('after-hide', function afterHide () { console.log('after-hide') }) - diff --git a/elodie.spec b/elodie.spec new file mode 100644 index 0000000..83daf12 --- /dev/null +++ b/elodie.spec @@ -0,0 +1,33 @@ +# -*- mode: python -*- + +block_cipher = None + + +a = Analysis(['elodie.py'], + pathex=['/Users/jaisenmathai/dev/tools/elodie'], + binaries=None, + datas=[('config.ini',''),('configs/ExifTool_config', 'configs')], + hiddenimports=[], + hookspath=None, + runtime_hooks=None, + excludes=None, + win_no_prefer_redirects=None, + win_private_assemblies=None, + cipher=block_cipher) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + exclude_binaries=True, + name='elodie', + debug=False, + strip=None, + upx=True, + console=True ) +coll = COLLECT(exe, + a.binaries, + a.zipfiles, + a.datas, + strip=None, + upx=True, + name='elodie') diff --git a/elodie/media/media.py b/elodie/media/media.py index 5e15f0f..b52e645 100644 --- a/elodie/media/media.py +++ b/elodie/media/media.py @@ -51,11 +51,28 @@ class Media(object): return None exiftool_attributes = self.get_exiftool_attributes() - if('album' not in exiftool_attributes): + if(exiftool_attributes is None or 'album' not in exiftool_attributes): return None return exiftool_attributes['album'] + """ + Get path to executable exiftool binary. + We wrap this since we call it in a few places and we do a fallback. + + @returns, None or string + """ + def get_exiftool(self): + exiftool = find_executable('exiftool') + # If exiftool wasn't found we try to brute force the homebrew location + if(exiftool is None): + exiftool = '/usr/local/bin/exiftool' + if(not os.path.isfile(exiftool) or not os.access(exiftool, os.X_OK)): + return None + + return exiftool + + """ Get the full path to the video. @@ -163,7 +180,7 @@ class Media(object): if(self.exiftool_attributes is not None): return self.exiftool_attributes - exiftool = find_executable('exiftool') + exiftool = self.get_exiftool() if(exiftool is None): return False @@ -187,7 +204,6 @@ class Media(object): title = title_return break; - self.exiftool_attributes = { 'album': album, 'title': title @@ -263,7 +279,7 @@ class Media(object): exiftool_attributes = self.get_exiftool_attributes() - if('title' not in exiftool_attributes): + if(exiftool_attributes is None or 'title' not in exiftool_attributes): return None return exiftool_attributes['title'] @@ -279,7 +295,7 @@ class Media(object): if(name is None): return False - exiftool = find_executable('exiftool') + exiftool = self.get_exiftool() if(exiftool is None): return False diff --git a/elodie/media/photo.py b/elodie/media/photo.py index c7cc5c1..f6f267b 100644 --- a/elodie/media/photo.py +++ b/elodie/media/photo.py @@ -5,7 +5,6 @@ Photo package that handles all photo operations # load modules from datetime import datetime -from distutils.spawn import find_executable from sys import argv import mimetypes diff --git a/elodie/media/video.py b/elodie/media/video.py index a81baab..d7e29e3 100644 --- a/elodie/media/video.py +++ b/elodie/media/video.py @@ -33,6 +33,22 @@ class Video(Media): def __init__(self, source=None): super(Video, self).__init__(source) + """ + Get path to executable avmetareadwrite binary. + We wrap this since we call it in a few places and we do a fallback. + + @returns, None or string + """ + def get_avmetareadwrite(self): + avmetareadwrite = find_executable('avmetareadwrite') + if(avmetareadwrite is None): + avmetareadwrite = '/usr/bin/avmetareadwrite' + if(not os.path.isfile(avmetareadwrite) or not os.access(avmetareadwrite, os.X_OK)): + return None + + return avmetareadwrite + + """ Get latitude or longitude of photo from EXIF @@ -116,7 +132,7 @@ class Video(Media): @returns, string or None if exiftool is not found """ def get_exif(self): - exiftool = find_executable('exiftool') + exiftool = self.get_exiftool() if(exiftool is None): return None @@ -191,7 +207,7 @@ class Video(Media): print 'No lat/lon passed into __create_plist' return False - avmetareadwrite = find_executable('avmetareadwrite') + avmetareadwrite = self.get_avmetareadwrite() if(avmetareadwrite is None): if(constants.debug == True): print 'Could not find avmetareadwrite' diff --git a/app/package.json b/package.json similarity index 94% rename from app/package.json rename to package.json index 1cc177f..bf98e20 100644 --- a/app/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "elodie", "version": "1.0.0", "description": "GUI for Elodie", - "main": "app.js", + "main": "app/index.js", "dependencies": { "menubar": "^2.3.0" },