diff --git a/.travis.yml b/.travis.yml index 2b53c6d..6af1ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ os: osx +# https://docs.travis-ci.com/user/reference/osx/#macos-version osx_image: xcode9.4 language: node_js -node_js: "8" +node_js: "8" # one of node js travis pre installed versions sudo: required env: diff --git a/electron/index.html b/electron/index.html index 87499e0..987d338 100644 --- a/electron/index.html +++ b/electron/index.html @@ -105,6 +105,10 @@ window.BBCKeys = require('./bbc_keys.js').getBBCAPIkeys; window.setBBCAPIkeys = require('./bbc_keys.js').setBBCAPIkeys; window.areBBCAPIkeysSet = require('./bbc_keys.js').areBBCAPIkeysSet; + + window.TwitterAPIkeys = require('./twitter_keys.js').getTwitterAPIkeys; + window.setTwitterAPIkeys = require('./twitter_keys.js').setTwitterAPIkeys; + window.areTwitterAPIkeysSet = require('./twitter_keys.js').areTwitterAPIkeysSet; } if(window.ENV_CEP){ @@ -132,6 +136,9 @@ window.setBBCAPIkeys = require(`${envPath}/bbc_keys.js`).setBBCAPIkeys; window.areBBCAPIkeysSet = require(`${envPath}/bbc_keys.js`).areBBCAPIkeysSet; + window.TwitterAPIkeys = require(`${envPath}/twitter_keys.js`).getTwitterAPIkeys; + window.setTwitterAPIkeys = require(`${envPath}/twitter_keys.js`).setTwitterAPIkeys; + window.areTwitterAPIkeysSet = require(`${envPath}/twitter_keys.js`).areTwitterAPIkeysSet; } if(window.ENV_BROSWER){ @@ -178,9 +185,20 @@ console.info("placeholder funciton", keys); } - window.setBBCAPIkeys= function(keys){ + window.setBBCAPIkeys = function(keys){ + console.info("placeholder funciton", keys); + } + + window.TwitterAPIkeys = function(keys){ console.info("placeholder funciton", keys); } + window.setTwitterAPIkeys = function(keys){ + console.info("placeholder funciton", keys); + } + window.areTwitterAPIkeysSet = function(keys){ + console.info("placeholder funciton", keys); + } + } @@ -348,6 +366,7 @@ } /////////////////////// if(window.ENV_ELECTRON){ + const fs = require('fs'); ffmpegExentions = require("./ffmpeg_extentions.js"); // TODO: move code below so that it can work in chromium as well // file dialogue opener @@ -400,6 +419,44 @@ }) } + const electron = require('electron'); + const currentWindow = electron.remote.getCurrentWindow(); + const dataPath = currentWindow.dataPath; + window.dataPath = dataPath; + const tweetThatClip = require('tweet-that-clip'); + + window.tweetThatClip = function(infoToTweet){ + if(infoToTweet.captionsBool){ + fs.writeFileSync(infoToTweet.srtFilePath, infoToTweet.srtFileContent) + } + + return new Promise((resolve, reject)=>{ + // set credentials in process.env. + console.log('tweetThatClip - started in index.html'); + // adding path to electron + infoToTweet.ffmpegBin = require("ffmpeg-static-electron").path; + infoToTweet.credentials = window.TwitterAPIkeys(); + // TODO: tmpDir + infoToTweet.tmpDir = path.join(dataPath, 'tmp_media'); + // TODO: could add burn in captions, either before, or as option inside the twitter module, + // as optional submodule + // https://github.com/pietrop/captions_burner/blob/master/lib/burn_srt_on_video.js + // console.log('tweetThatClip',process.env.TWITTER_CONSUMER_KEY); + tweetThatClip(infoToTweet) + .then((res) => { + // TODO: add some kind of tweted message + console.log('tweeted - index.html'); + console.log(res); + // cb(null,res); + resolve(res); + }) + .catch((err)=>{ + // cb(err,null); + reject(err); + }); + }) + } + } diff --git a/lib/app/router.js b/lib/app/router.js index ec7bec2..d187226 100644 --- a/lib/app/router.js +++ b/lib/app/router.js @@ -86,7 +86,14 @@ module.exports = Backbone.Router.extend({ settingsPanel: function() { console.debug('Router: settings panel: '); - var tmpSettings = {credentials: {ibm: window.IBMWatsonKeys(), speechmatics: window.SpeechmaticsKeys(),rev: window.revKeys(), bbc: window.BBCKeys(), assemblyai: window.AssemblyaiAPIkeys() }} ; + var tmpSettings = {credentials: {ibm: window.IBMWatsonKeys(), + speechmatics: window.SpeechmaticsKeys(), + rev: window.revKeys(), + bbc: window.BBCKeys(), + assemblyai: window.AssemblyaiAPIkeys(), + twitter: window.TwitterAPIkeys() + } + } ; var settingsView = new SettingsView({settings: tmpSettings}); displayMain(settingsView); }, diff --git a/lib/app/templates/settings_template.html.ejs b/lib/app/templates/settings_template.html.ejs index e590f81..ca5649a 100644 --- a/lib/app/templates/settings_template.html.ejs +++ b/lib/app/templates/settings_template.html.ejs @@ -25,6 +25,7 @@
  • AssemblyAI
  • Rev
  • BBC
  • +
  • Twitter
  • @@ -199,6 +200,46 @@ + + +
    +
    +
    + × + Twitter Credentials +

    This service is for being able to tweet clips to your twitter account.

    +

    In order to use this service you need to get developer credentials, see user manual for more informations.

    +
    + + +
    +
    +
    +

    Twitter credentials

    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    + Save Twitter Credentials +
    +
    +
    +
    + + diff --git a/lib/app/templates/transcription_show.html.ejs b/lib/app/templates/transcription_show.html.ejs index 9ef0983..9f5c6c7 100644 --- a/lib/app/templates/transcription_show.html.ejs +++ b/lib/app/templates/transcription_show.html.ejs @@ -231,6 +231,125 @@

    Media preview not ready

    <% } %> + + + + +
    + + + + + + + + + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    + +

    Playback Speed

    + + +
    + + +
    + +
    + + +
    + + +
    + + + + + + + + + + +<% if(window.ENV_ELECTRON){ %> + + + + <% }%> + + +
    +
    +
    +
    Speech To Text System
    +
    <%= sttEngine %>
    +
    Language Model
    +
    <%= languageModel %>
    +
    File name
    +
    <%= metadata.fileName %>
    + +
    File Path Name
    +
    <%= metadata.filePathName %>
    + +
    Date
    +
    <%= metadata.date %>
    + +
    Reel Name
    +
    <%= metadata.reelName %>
    + +
    Timecode
    +
    <%= metadata.timecode %>
    + +
    fps
    +
    <%= metadata.fps %>
    + +
    Duration
    +
    <%= fromSeconds(metadata.duration) %>
    + +
    Description
    +
    <%= description %>
    +
    +
    +
    + + + +