Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gregology committed Feb 26, 2019
0 parents commit 88e893a
Show file tree
Hide file tree
Showing 23 changed files with 3,777 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Silly Macs
*.DS_Store

# Scratch
scratch.*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Memair

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Memair Desktop App

## Development

Install Electron: `npm install --save-dev electron`

Install packager: `npm install electron-packager -g`

Build package

- Mac Example

`electron-packager ./ Memair --platform=darwin --arch=x64 --icon=assets/icons/mac/memair.icns --overwrite`
49 changes: 49 additions & 0 deletions app/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const sqlite3 = require('sqlite3');
const db_location = 'db/memair.db'

const fs = require('fs');
const path = require('path');
const json = require('big-json');


const google_location_history = 'tmp/Takeout/Location History/Location History.json'

function sleep(delay) {
var start = new Date().getTime();
while (new Date().getTime() < start + delay);
}

function build_locations_table() {
var db = new sqlite3.Database(db_location);
console.log('building locations table');
db.run(`
CREATE TABLE IF NOT EXISTS locations(
latitude FLOAT NOT NULL,
longitude FLOAT NOT NULL,
accuracy FLOAT,
timestamp DATETIME NOT NULL
);`
)
db.close()
}

function addLocation(db, raw_location) {
var moment = require('moment');
var timestamp = moment.unix(raw_location['timestampMs']/1000).format('YYYY-MM-DD hh:mm:ss.ss')
var latitude = raw_location['latitudeE7'] / 1e7
var longitude = raw_location['longitudeE7'] / 1e7
var accuracy = raw_location['accuracy']
db.run(`
INSERT INTO locations (
latitude,
longitude,
accuracy,
timestamp
) VALUES (
${latitude},
${longitude},
${(accuracy == undefined) ? 'NULL' : accuracy},
'${timestamp}'
);
`)
}
45 changes: 45 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset = "UTF-8">
<title>Memair Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="Greg Clarke">
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>

<body>
<div style="width:100%; height:100%">
<webview id="player" autosize="on" src="https://memair.com/player?desktop_app=true" style="min-width:100%; min-height:100%">
<div class="indicator"></div>
</webview>
</div>

<script type = "text/javascript">
// Event handlers for loading events.
// Use these to handle loading screens, transitions, etc
onload = () => {
const webview = document.getElementById('player')
const indicator = document.querySelector('.indicator')

const loadstart = () => {
indicator.innerText = 'loading...'
}

const loadstop = () => {
indicator.innerText = ''
}

webview.addEventListener('did-start-loading', loadstart)
webview.addEventListener('did-stop-loading', loadstop)
}
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions app/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

window.$ = window.jQuery = require('jquery')
window.Tether = require('tether')
window.Bootstrap = require('bootstrap')
22 changes: 22 additions & 0 deletions assets/icons/mac/memair.icns
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
How to use this icon:

Step 1: Copy the icon to the clipboard
a) Click on this file from the Finder
b) Choose 'Get Info' from the 'File' menu.
c) In the info window that pops up, click on the icon
d) Choose 'Copy' from the 'Edit' menu.
e) Close the info window

Step 2: Paste the icon to the desired item
a) Go to the item in the Finder that you want a custom icon
b) Click the item (file, folder, disk, etc)
b) Choose 'Get Info' from the 'File' menu.
c) In the info window that pops up, click on the icon
d) Choose 'Paste' from the 'Edit' menu.
e) Close the info window

Step 3:
Enjoy your newly customized icon!

For more thorough directions, see Apple's website at:
http://www.apple.com/support/mac101/customize/6/
Binary file added assets/icons/mac/memair.icns.zip
Binary file not shown.
Binary file added assets/icons/png/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/png/96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/win/Memair.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions db/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
16 changes: 16 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { app, BrowserWindow, Menu } = require('electron')
var path = require('path')

function createWindow () {
win = new BrowserWindow({
width: 1000,
height: 800,
icon: path.join(__dirname, 'assets/icons/png/64x64.png')
})

win.loadFile('app/index.html')

Menu.setApplicationMenu();
}

app.on('ready', createWindow)
Loading

0 comments on commit 88e893a

Please sign in to comment.