Working electron app bundle

This commit is contained in:
Jaisen Mathai 2015-11-02 02:11:53 -08:00
parent 816a95d0bc
commit 4b5a736e6f
7 changed files with 76 additions and 13 deletions

1
.gitignore vendored
View File

@ -4,4 +4,3 @@
**/node_modules/** **/node_modules/**
dist/** dist/**
build/** build/**
elodie.spec

View File

@ -30,7 +30,8 @@ ipc.on('update-photos', function(event, args) {
} }
files = normalize(args['files']) 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') { if(typeof(args['location']) !== 'undefined') {
update_command += ' --location="' + args['location'] + '" "' + files.join('" "') + '"'; update_command += ' --location="' + args['location'] + '" "' + files.join('" "') + '"';
} else if(typeof(args['album']) !== 'undefined') { } else if(typeof(args['album']) !== 'undefined') {
@ -59,7 +60,7 @@ ipc.on('update-photos', function(event, args) {
var mb = menubar( var mb = menubar(
{ {
preloadWindow: true, preloadWindow: true,
dir: 'html', dir: __dirname + '/html',
index: 'location.html', index: 'location.html',
pages: { pages: {
'location': 'location.html' 'location': 'location.html'
@ -110,4 +111,3 @@ mb.on('hide', function hide () {
mb.on('after-hide', function afterHide () { mb.on('after-hide', function afterHide () {
console.log('after-hide') console.log('after-hide')
}) })

33
elodie.spec Normal file
View File

@ -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')

View File

@ -51,11 +51,28 @@ class Media(object):
return None return None
exiftool_attributes = self.get_exiftool_attributes() 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 None
return exiftool_attributes['album'] 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. Get the full path to the video.
@ -163,7 +180,7 @@ class Media(object):
if(self.exiftool_attributes is not None): if(self.exiftool_attributes is not None):
return self.exiftool_attributes return self.exiftool_attributes
exiftool = find_executable('exiftool') exiftool = self.get_exiftool()
if(exiftool is None): if(exiftool is None):
return False return False
@ -187,7 +204,6 @@ class Media(object):
title = title_return title = title_return
break; break;
self.exiftool_attributes = { self.exiftool_attributes = {
'album': album, 'album': album,
'title': title 'title': title
@ -263,7 +279,7 @@ class Media(object):
exiftool_attributes = self.get_exiftool_attributes() 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 None
return exiftool_attributes['title'] return exiftool_attributes['title']
@ -279,7 +295,7 @@ class Media(object):
if(name is None): if(name is None):
return False return False
exiftool = find_executable('exiftool') exiftool = self.get_exiftool()
if(exiftool is None): if(exiftool is None):
return False return False

View File

@ -5,7 +5,6 @@ Photo package that handles all photo operations
# load modules # load modules
from datetime import datetime from datetime import datetime
from distutils.spawn import find_executable
from sys import argv from sys import argv
import mimetypes import mimetypes

View File

@ -33,6 +33,22 @@ class Video(Media):
def __init__(self, source=None): def __init__(self, source=None):
super(Video, self).__init__(source) 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 Get latitude or longitude of photo from EXIF
@ -116,7 +132,7 @@ class Video(Media):
@returns, string or None if exiftool is not found @returns, string or None if exiftool is not found
""" """
def get_exif(self): def get_exif(self):
exiftool = find_executable('exiftool') exiftool = self.get_exiftool()
if(exiftool is None): if(exiftool is None):
return None return None
@ -191,7 +207,7 @@ class Video(Media):
print 'No lat/lon passed into __create_plist' print 'No lat/lon passed into __create_plist'
return False return False
avmetareadwrite = find_executable('avmetareadwrite') avmetareadwrite = self.get_avmetareadwrite()
if(avmetareadwrite is None): if(avmetareadwrite is None):
if(constants.debug == True): if(constants.debug == True):
print 'Could not find avmetareadwrite' print 'Could not find avmetareadwrite'

View File

@ -2,7 +2,7 @@
"name": "elodie", "name": "elodie",
"version": "1.0.0", "version": "1.0.0",
"description": "GUI for Elodie", "description": "GUI for Elodie",
"main": "app.js", "main": "app/index.js",
"dependencies": { "dependencies": {
"menubar": "^2.3.0" "menubar": "^2.3.0"
}, },