Skip to content

Commit

Permalink
Merge pull request #18 from 360ls/sprint5/build
Browse files Browse the repository at this point in the history
Sprint5/build
  • Loading branch information
dongy7 authored Dec 2, 2016
2 parents 46323af + f1a0491 commit 320480d
Show file tree
Hide file tree
Showing 18 changed files with 442 additions and 450 deletions.
26 changes: 13 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_js:
- 6

cache:
yarn: true
directories:
- node_modules

Expand All @@ -28,27 +29,26 @@ addons:
- xz-utils
- xorriso

install:
- export CXX="g++-4.8"
- npm install -g npm@latest
- npm install
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
# install:
# - export CXX="g++-4.8"
# - npm install -g npm@latest
# - npm install
# - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"

# Enable when https://github.com/yarnpkg/yarn/issues/1233 and
# https://github.com/yarnpkg/yarn/issues/1059 are resolved and disable npm cache
#
# install:
# - export CXX="g++-4.8"
# - npm install -g yarnpkg
# - yarn
# - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
install:
- export CXX="g++-4.8"
- npm install -g yarn@latest
- yarn
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start &
- sleep 3

script:
- npm run test
- npm run build
- npm run package
- npm test
- npm run release
1 change: 0 additions & 1 deletion .yarnclean

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ $ npm test
Run the following commands. The executables will be output to the `release` directory.

```bash
$ npm run build
$ npm run package
```
10 changes: 5 additions & 5 deletions app/actions/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ const createVideo = (id, url) => {
const minutes = today.getMinutes();

if (dd < 10) {
dd = '0' + dd;
dd = `0${dd}`;
}

if (mm < 10) {
mm = '0' + mm;
mm = `0${mm}`;
}

const date = mm + '/' + dd + '/' + yyyy;
const timestamp = hour + ':' + minutes;
const name = 'Recording-' + timestamp;
const date = `${mm}/$${dd}/${yyyy}`;
const timestamp = `${hour}:${minutes}`;
const name = `Recording-${timestamp}`;

const video = {
id,
Expand Down
5 changes: 2 additions & 3 deletions app/actions/videos.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ export const setVisibilityFilter = filter => ({
export const switchVideoTo = (uri, id) =>
switchVideo(uri, id);

export const toggleVideo = (id) => (dispatch) =>
api.toggleVideo(id).then(response => {
console.log(response);
export const toggleVideo = (video) => (dispatch) =>
api.toggleVideo(video).then(response => {
dispatch({
type: TOGGLE_VIDEO_SUCCESS,
response: normalize(response, schema.video),
Expand Down
10 changes: 5 additions & 5 deletions app/api/firebase.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import firebase from 'firebase';

const config = {
apiKey: "AIzaSyAwrohrIqi9rd90SZZu-53P-ZQvuzqLK00",
authDomain: "ls-46057.firebaseapp.com",
databaseURL: "https://ls-46057.firebaseio.com",
storageBucket: "ls-46057.appspot.com",
messagingSenderId: "207802343853"
apiKey: 'AIzaSyAwrohrIqi9rd90SZZu-53P-ZQvuzqLK00',
authDomain: 'ls-46057.firebaseapp.com',
databaseURL: 'https://ls-46057.firebaseio.com',
storageBucket: 'ls-46057.appspot.com',
messagingSenderId: '207802343853'
};
const firebaseApp = firebase.initializeApp(config);
const database = firebaseApp.database();
Expand Down
30 changes: 8 additions & 22 deletions app/api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { v4 } from 'node-uuid';
import DropBox from 'dropbox';
import database from './firebase';

Expand All @@ -16,7 +15,7 @@ const flatten = (object) => {
});

return arr;
}
};

export const fetchVideos = (filter) =>
database.ref(endpoint).once('value').then((snapshot) => {
Expand All @@ -26,29 +25,16 @@ export const fetchVideos = (filter) =>
throw new Error(err);
});

const videoRef = (id) => Promise.resolve(database.ref(endpoint + id));

export const toggleVideo = (id) =>
videoRef(id).then((ref) => ref).then((ref) => { return ref.transaction((video) => {
if (video) {
video.flagged = !video.flagged;
}
return video;
});
}).then(video => video);

export const addVideo = (video) => {
const key = endpoint + video.id;
const entry = {};
entry[key] = video;

database.ref.update(entry).then(() => {
return video;
}, (err) => {
throw new Error(err);
const getToggledVideo = (video) => {
const toggledVideo = Object.assign({}, video, {
flagged: !video.flagged,
});
return toggledVideo;
};

export const toggleVideo = (video) =>
addVideoEntry(getToggledVideo(video));

const filterVideos = (videos, filter) => {
switch (filter) {
case 'All':
Expand Down
2 changes: 1 addition & 1 deletion app/components/VideoInfoList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const VideoInfoList = ({ video, toggleVideo }) => (
/>
<ListItem
primaryText="Flagged"
rightToggle={<Toggle toggled={video.flagged} onToggle={() => toggleVideo(video.id)} />}
rightToggle={<Toggle toggled={video.flagged} onToggle={() => toggleVideo(video)} />}
/>
</List>
);
Expand Down
12 changes: 8 additions & 4 deletions app/components/VideoTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ const closeIcon = <Close color={red500} />;

const sortVideos = (videos) => {
return videos.concat().sort((a, b) => {
return new Date(a.date).getTime() - new Date(b.date).getTime() ;
return new Date(a.date).getTime() - new Date(b.date).getTime();
});
};

const getSortedVideos = (videos) =>
sortVideos(videos);

const VideoTable = ({ videos, onClick, router, path }) => (
<Table
onRowSelection={rows => {
onClick(sortVideos(videos)[rows[0]].uri, videos[rows[0]].id);
router.push(`${path}/${videos[rows[0]].id}`);
const index = rows[0];
onClick(getSortedVideos(videos)[index].uri, getSortedVideos(videos)[index].id);
router.push(`${path}/${videos[index].id}`);
}}
>
<TableHeader>
Expand All @@ -46,7 +50,7 @@ const VideoTable = ({ videos, onClick, router, path }) => (
</TableRow>
</TableHeader>
<TableBody>
{sortVideos(videos).map(video =>
{getSortedVideos(videos).map(video =>
<TableRow
key={video.id}
>
Expand Down
20 changes: 11 additions & 9 deletions app/main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
STOP_PREVIEW,
START_STREAM,
STOP_STREAM,
} from './services/ipcDispatcher';
} from './services/signals';
import {
spawnProc,
killProc,
Expand All @@ -21,11 +21,12 @@ import {
getStitcherArgsForPreview,
getStitcherArgsForStream,
getStitcherArgsForRecording,
getStitcherCmd,
getFFmpegCmd,
getConversionCmd,
getTargetPath,
getConvertedTargetPath,
changeToDir,
spawnPythonProc,
} from './utils/proc';
import {
getRecordingLocation,
Expand Down Expand Up @@ -127,9 +128,8 @@ ipcMain.on(RECORD, (event, arg) => {
const width = 640;
const height = 480;

streamProc = spawnProc(
getStitcherCmd(stitcherLocation),
getStitcherArgsForRecording(width, height, index, outPath));
changeToDir(stitcherLocation);
streamProc = spawnPythonProc(getStitcherArgsForRecording(width, height, index, outPath));
ffmpegProc = spawnProc(getFFmpegCmd(), getStreamArgs(streamUrl));

connect(streamProc, ffmpegProc);
Expand Down Expand Up @@ -167,8 +167,9 @@ ipcMain.on(START_PREVIEW, (event, arg) => {
const stitcherLocation = getStitcherLocation(arg);
const index = getIndex(arg);

previewProc = spawnProc(
getStitcherCmd(stitcherLocation), getStitcherArgsForPreview(index));
changeToDir(stitcherLocation);

previewProc = spawnPythonProc(getStitcherArgsForPreview(index));
});

ipcMain.on(STOP_PREVIEW, () => {
Expand All @@ -180,8 +181,9 @@ ipcMain.on(START_STREAM, (event, arg) => {
const index = getIndex(arg);
const streamUrl = getStreamUrl(arg);

stitcherProc = spawnProc(
getStitcherCmd(stitcherLocation), getStitcherArgsForStream(index));
changeToDir(stitcherLocation);

stitcherProc = spawnPythonProc(getStitcherArgsForStream(index));
ffmpegProc = spawnProc(getFFmpegCmd(), getStreamArgs(streamUrl));

connect(stitcherProc, ffmpegProc);
Expand Down
2 changes: 1 addition & 1 deletion app/reducers/preference.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { combineReducers } from 'redux';
import { PREFERENCE_SAVED } from '../actions/preference';

const baseDir = '.360ls/';
const baseDir = '.360ls/stitcher/';
const recordDir = '.360ls/recordings/';
const url = 'rtmp://54.227.214.22:1935/live/myStream';

Expand Down
24 changes: 11 additions & 13 deletions app/services/ipcDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ import {
getPreviewIndex,
getStreamUrl,
} from '../reducers/preference';

export const RECORD = 'RECORD';
export const STOP = 'STOP';
export const REQUEST_FILE = 'REQUEST_FILE';
export const RECEIVE_FILE = 'RECEIVE_FILE';
export const STOPPED_PROC = 'STOPPED_PROC';
export const UPLOADED = 'UPLOADED';
export const START_PREVIEW = 'START_PREVIEW';
export const STOP_PREVIEW = 'STOP_PREVIEW';
export const STOPPED_PREVIEW = 'STOPPED_PREVIEW';
export const START_STREAM = 'START_STREAM';
export const STOP_STREAM = 'STOP_STREAM';
import {
RECORD,
STOP,
REQUEST_FILE,
RECEIVE_FILE,
STOPPED_PROC,
START_PREVIEW,
STOP_PREVIEW,
START_STREAM,
STOP_STREAM,
} from '../services/signals';

let currState = false;
export const handleChange = (store) => () => {
Expand Down Expand Up @@ -97,7 +96,6 @@ export const setupIPCHandler = (store) => {

ipcRenderer.on(STOPPED_PROC, (event, arg) => {
const videoPath = arg.outPath;
const videoId = arg.id;
store.dispatch(requestVideo(videoPath));
});
};
11 changes: 11 additions & 0 deletions app/services/signals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const RECORD = 'RECORD';
export const STOP = 'STOP';
export const REQUEST_FILE = 'REQUEST_FILE';
export const RECEIVE_FILE = 'RECEIVE_FILE';
export const STOPPED_PROC = 'STOPPED_PROC';
export const UPLOADED = 'UPLOADED';
export const START_PREVIEW = 'START_PREVIEW';
export const STOP_PREVIEW = 'STOP_PREVIEW';
export const STOPPED_PREVIEW = 'STOPPED_PREVIEW';
export const START_STREAM = 'START_STREAM';
export const STOP_STREAM = 'STOP_STREAM';
Loading

0 comments on commit 320480d

Please sign in to comment.