Skip to content

Commit

Permalink
実際に実行する仮の関数を作成
Browse files Browse the repository at this point in the history
  • Loading branch information
ilim0t committed Dec 8, 2018
1 parent f9c4421 commit 87002e0
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ brew install imagesnap
Ubuntuは
```shell
sudo apt-get install fswebcam
```
```

## Usage
1. `npm install`
1. `npm start`
を実行
27 changes: 26 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
'use strict';
"use strict";

const photoapi = require("./photoAPI");
const {capture} = require("./caputure");
const slack = require("./slack");

const main = async () => {
const oAuth2Client = await photoapi.getOAuthToken();

const albumTitle = "bushitsuchan_album";
const albums = await photoapi.getAlbumList(oAuth2Client);
let album = albums.filter((album) => album.title === albumTitle);
if (!album.length) {
album = await photoapi.createAlbum(oAuth2Client, albumTitle);
await photoapi.shareAlbum(oAuth2Client, album.id);
}
setInterval(async () => {
const url = await capture(oAuth2Client, album);
slack.send(url); // ここをカスタマイズしてください
}, 5000);
};


if (require.main === module) {
main().catch(console.error);
}
41 changes: 41 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion slack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";


module.exports.send = (value, value2) => {
module.exports.send = value => {
console.log(`未実装ですが以下を投稿したことになりました ${value}`)
};

0 comments on commit 87002e0

Please sign in to comment.