Skip to content

Commit

Permalink
add support cavetube
Browse files Browse the repository at this point in the history
  • Loading branch information
MOTOO11 committed Dec 6, 2016
1 parent 23d8887 commit 3f66de2
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 126 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## liveport - live broadcast support tool.
したらば掲示板の読み込み、ブラウザ上に表示・読み上げ(v0.0.1)
したらば掲示板・CaveTubeのコメントを、ブラウザ上に表示・読み上げ(v1.0.0)
### 使い方
* liveport.exeを起動
* OBS Studioの設定
Expand All @@ -17,10 +17,12 @@
* background-color: rgba(0, 0, 0, 0); 背景透過(必須)
* overflow: hidden; 長い文章を途中で省略する(必須)
* color:white; 文字の色(変更可能)
* URLを入力後**[]読み込み開始**ボタンを押す。
* タイトルバーにURLを入力後**[]読み込み開始**ボタンを押す。
* 詳細な設定は[resources/app/config.json]

* データは以下に保存される
* C:\Users\%USERNAME%\AppData\Roaming\liveport\
*


* ver 0.0.1
* ver 1.0.0
* 初版
148 changes: 74 additions & 74 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
{
"name": "liveport",
"version": "0.0.1",
"description": "livestream support tool",
"main": "build/main.js",
"scripts": {
"watch": "webpack-dashboard -- webpack -d --watch",
"start": "webpack-dashboard -- webpack-dev-server -d --hot --inline",
"build": "electron-packager . live_gen --platform=win32 --arch=x64 --version=1.4.6 --out ./release"
},
"author": "https://github.com/odangosan",
"license": "ISC",
"devDependencies": {
"@types/electron": "^1.4.25",
"@types/express": "^4.0.33",
"@types/iconv-lite": "0.0.1",
"@types/material-design-lite": "^1.1.14",
"@types/materialize-css": "^0.97.32",
"@types/node": "^6.0.46",
"@types/request": "0.0.33",
"@types/request-promise": "^4.1.33",
"@types/socket.io": "^1.4.27",
"@types/socket.io-client": "^1.4.28",
"@types/webspeechapi": "0.0.27",
"autoprefixer": "^6.5.3",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.25.0",
"electron": "^1.4.5",
"electron-connect": "^0.6.0",
"electron-packager": "^8.2.0",
"exports-loader": "^0.6.3",
"file-loader": "^0.9.0",
"font-awesome": "^4.7.0",
"github": "^7.0.0",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-typescript": "^3.1.2",
"gulp-useref": "^3.1.2",
"gulp-util": "^3.0.7",
"gulp-webpack": "^1.5.0",
"gulp-zip": "^3.2.0",
"iconv-lite": "^0.4.13",
"imports-loader": "^0.6.5",
"jquery": "^3.1.1",
"json-loader": "^0.5.4",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"material-design-icons": "^3.0.1",
"material-design-lite": "^1.2.1",
"open": "0.0.5",
"postcss-import": "^8.2.0",
"postcss-loader": "^1.1.1",
"request": "^2.78.0",
"request-promise": "^4.1.1",
"resolve-url-loader": "^1.6.0",
"run-sequence": "^1.2.2",
"script-loader": "^0.7.0",
"socket.io-client": "^1.5.1",
"style-loader": "^0.13.1",
"ts-loader": "^1.0.0",
"typescript": "^2.0.8",
"typings": "^1.5.0",
"url-loader": "^0.5.7",
"vue": "^2.0.5",
"vue-typed": "^2.0.1",
"webpack": "^1.13.3",
"webpack-dashboard": "^0.2.0",
"webpack-dev-server": "^1.16.2",
"webpack-merge": "^0.15.0"
},
"dependencies": {
"express": "^4.14.0",
"socket.io": "^1.5.1"
}
}
"name": "liveport",
"version": "1.0.0",
"description": "livestream support tool",
"main": "build/main.js",
"scripts": {
"watch": "webpack-dashboard -- webpack -d --watch",
"start": "webpack-dashboard -- webpack-dev-server -d --hot --inline",
"build": "electron-packager . live_gen --platform=win32 --arch=x64 --version=1.4.6 --out ./release"
},
"author": "https://github.com/odangosan",
"license": "ISC",
"devDependencies": {
"@types/electron": "^1.4.25",
"@types/express": "^4.0.33",
"@types/iconv-lite": "0.0.1",
"@types/material-design-lite": "^1.1.14",
"@types/materialize-css": "^0.97.32",
"@types/node": "^6.0.46",
"@types/request": "0.0.33",
"@types/request-promise": "^4.1.33",
"@types/socket.io": "^1.4.27",
"@types/socket.io-client": "^1.4.28",
"@types/webspeechapi": "0.0.27",
"autoprefixer": "^6.5.3",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.25.0",
"electron": "^1.4.5",
"electron-connect": "^0.6.0",
"electron-packager": "^8.2.0",
"exports-loader": "^0.6.3",
"file-loader": "^0.9.0",
"font-awesome": "^4.7.0",
"github": "^7.0.0",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-typescript": "^3.1.2",
"gulp-useref": "^3.1.2",
"gulp-util": "^3.0.7",
"gulp-webpack": "^1.5.0",
"gulp-zip": "^3.2.0",
"iconv-lite": "^0.4.13",
"imports-loader": "^0.6.5",
"jquery": "^3.1.1",
"json-loader": "^0.5.4",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"material-design-icons": "^3.0.1",
"material-design-lite": "^1.2.1",
"open": "0.0.5",
"postcss-import": "^8.2.0",
"postcss-loader": "^1.1.1",
"request": "^2.78.0",
"request-promise": "^4.1.1",
"resolve-url-loader": "^1.6.0",
"run-sequence": "^1.2.2",
"script-loader": "^0.7.0",
"socket.io-client": "^1.5.1",
"style-loader": "^0.13.1",
"ts-loader": "^1.0.0",
"typescript": "^2.0.8",
"typings": "^1.5.0",
"url-loader": "^0.5.7",
"vue": "^2.0.5",
"vue-typed": "^2.0.1",
"webpack": "^1.13.3",
"webpack-dashboard": "^0.2.0",
"webpack-dev-server": "^1.16.2",
"webpack-merge": "^0.15.0"
},
"dependencies": {
"express": "^4.14.0",
"socket.io": "^1.5.1"
}
}
88 changes: 61 additions & 27 deletions src/renderer/ts/Application.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use strict"
import * as Vue from "Vue";
import { Component, Watch } from "vue-typed"
import { Thread } from "./Thread";
import { DataSource } from "./DataSource";
import { Shitaraba } from "./Shitaraba";
import { CaveTube } from "./CaveTube";
import { VOICE, VoiceParameter } from "./Voice"
import StringUtil from "./StringUtil";
import Logger from "./Logger";
Expand All @@ -19,13 +21,13 @@ export default class Application extends Vue {
testMessage: string = 'このテキストはテストメッセージです';
url: string = "";
processing: boolean = false;
thread: Thread;
thread: DataSource;
constructor() {
super();
Logger.log("start", "hello application.");
this.pManager = new ProvideManager();
this.setTitle("");
this.thread = new Thread();
this.thread = new Shitaraba("dummy");
this.loadSettings();
}

Expand Down Expand Up @@ -127,50 +129,56 @@ export default class Application extends Vue {
}

start() {
if (!this.validate()) return;
this.processing = true;
this.loadUrl();
if (!this.validate()) {
this.processing = false;
return;
}
if (this.thread) {
if (this.url != this.thread.url) {
this.loadUrlSource();
}
} else {
this.loadUrlSource();
}
this.startThreadRequest();
this.startProvide();
}

validate(): boolean {
if (this.pManager.voice === VOICE.SOFTALK && this.path === "") {
if (this.pManager.voice === VOICE.SOFTALK && this.path === "" && this.pManager.reading && this.processing === true) {
let warn = {
message: "ERROR : pathが設定されていません。",
timeout: 3000
message: "ERROR : pathが設定されていません。"
}
this.snackbar(warn);
return false;
}
return true;
}

loadUrl() {
if (this.url != this.thread.url) {
this.initUrlSource();
Logger.log("change", "modified thread url.");
if (!this.isValidURL()) {
Logger.log("invalid url", "not supported url.");
return false;
}
return true;
}
initUrlSource() {
this.thread = new Thread(this.url);
}

// refresh
requestOnce() {
if (!this.url) {
Logger.log("invalid url", "no input.");
if (!this.validate()) {
return;
}
if (!Thread.isShitarabaURL(this.url)) {
Logger.log("invalid url", "not shitaraba url.");
return;
}
this.thread = new Thread(this.url);
this.loadUrlSource(false);

this.thread.request(
(newArrival: number) => {
Logger.log("request success", newArrival.toString());
},
(err: any) => {
Logger.log("request failed", err);
let warn = {
message: "ERROR : " + err,
timeout: 6000
}
this.snackbar(warn);
}
);
}
Expand Down Expand Up @@ -217,10 +225,10 @@ export default class Application extends Vue {

// computed
get validUrl() {
return Thread.isShitarabaURL(this.url);
return this.isValidURL();
}

snackbar(data: { message: string, timeout: number } = { message: "info", timeout: 3000 }) {
snackbar(data: { message: string, timeout?: number } = { message: "info", timeout: 3000 }) {
var snackbarContainer: any = document.querySelector('#demo-snackbar-example');
// var handler = function (event) {
// Logger.log("snackbar", "");
Expand Down Expand Up @@ -304,7 +312,8 @@ export default class Application extends Vue {
try {
this.url = settings.url;
if (this.url) {
this.initUrlSource();
if (this.isValidURL())
this.loadUrlSource();
this.setTitle(this.thread.title);
};
this.autoScroll = Boolean(settings.autoScroll);
Expand Down Expand Up @@ -354,4 +363,29 @@ export default class Application extends Vue {
var settings = JSON.parse(localStorage.getItem(SETTINGS));
}
version = VERSION;


isValidURL(): boolean {
if (!this.url) {
Logger.log("invalid url", "no input.");
return false;
}
return Shitaraba.isValidURL(this.url) || CaveTube.isValidURL(this.url);
}

// allocate
loadUrlSource(load: boolean = true) {
if (Shitaraba.isValidURL(this.url)) {
this.thread = new Shitaraba(this.url);
if (load) {
this.thread.load();
}
}
if (CaveTube.isValidURL(this.url)) {
this.thread = new CaveTube(this.url);
if (load) {
this.thread.load();
}
}
}
}
Loading

0 comments on commit 3f66de2

Please sign in to comment.