This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,622 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "video", | ||
"type": "category", | ||
"commands": [ | ||
"add", | ||
"help", | ||
"get-info", | ||
"push", | ||
"remove", | ||
"setup-obs", | ||
"setup", | ||
"start", | ||
"stop", | ||
"update" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
const fs = require('fs'); | ||
const serviceMetadata = JSON.parse(fs.readFileSync(`${__dirname}/../../provider-utils/supported-services.json`)); | ||
const subcommand = 'add'; | ||
const category = 'video'; | ||
|
||
let options; | ||
|
||
module.exports = { | ||
name: 'add', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.createLiveStream(); | ||
const {amplify} = context; | ||
return amplify.serviceSelectionPrompt(context, category, serviceMetadata).then((results) => { | ||
options = { | ||
service: category, | ||
serviceType: results.service, | ||
providerPlugin: results.providerName, | ||
}; | ||
const providerController = | ||
require(`../../provider-utils/${results.providerName}/index`); | ||
if (!providerController) { | ||
context.print.error('Provider not configured for this category'); | ||
return; | ||
} | ||
return providerController.addResource(context, results.service, options); | ||
}); | ||
}, | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,38 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'get-info'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'get-info', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.getInfo(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to get info for?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const infoController = | ||
require(`../../provider-utils/${options.providerPlugin}/utils/video-getinfo`); | ||
if (!infoController) { | ||
context.print.error('Info controller not configured for this category'); | ||
return; | ||
} | ||
|
||
return infoController.getVideoInfo(context, props.resourceName); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
const subcommand = 'remove'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'remove', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.removeLiveStream(context); | ||
await context.amplify.removeResource(context, category); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,38 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'setup-obs'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'setup-obs', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.setupOBS(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to get info for?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const obsController = | ||
require(`../../provider-utils/${options.providerPlugin}/utils/livestream-obs`); | ||
if (!obsController && obsController.serviceType != "livestream") { | ||
context.print.error('OBS controller not configured for this project.'); | ||
return; | ||
} | ||
|
||
return obsController.setupOBS(context, props.resourceName); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'setup'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'setup', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.pushStaticFiles(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to setup s3 for?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
|
||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const providerController = | ||
require(`../../provider-utils/${options.providerPlugin}/index`); | ||
if (!providerController) { | ||
context.print.error('Provider not configured for this category'); | ||
return; | ||
} | ||
return providerController.setupCloudFormation(context, options.serviceType, options, props.resourceName); | ||
|
||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'start'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'start', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.startStream(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to start?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
|
||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const providerController = | ||
require(`../../provider-utils/${options.providerPlugin}/index`); | ||
if (!providerController) { | ||
context.print.error('Provider not configured for this category'); | ||
return; | ||
} | ||
|
||
return providerController.livestreamStartStop(context, options.serviceType, options, props.resourceName, false); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'stop'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'stop', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.stopStream(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to stop?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
|
||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const providerController = | ||
require(`../../provider-utils/${options.providerPlugin}/index`); | ||
if (!providerController) { | ||
context.print.error('Provider not configured for this category'); | ||
return; | ||
} | ||
|
||
return providerController.livestreamStartStop(context, options.serviceType, options, props.resourceName, true); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,40 @@ | ||
const inquirer = require('inquirer'); | ||
const subcommand = 'update'; | ||
const category = 'video'; | ||
|
||
module.exports = { | ||
name: 'update', | ||
name: subcommand, | ||
run: async (context) => { | ||
context.updateLiveStream(); | ||
const {amplify} = context; | ||
const amplifyMeta = amplify.getProjectMeta(); | ||
|
||
if (!(category in amplifyMeta) || Object.keys(amplifyMeta[category]).length === 0) { | ||
context.print.error(`You have no ${category} projects.`); | ||
return | ||
} | ||
|
||
const chooseProject = [ | ||
{ | ||
type: 'list', | ||
name: 'resourceName', | ||
message: 'Choose what project you want to update?', | ||
choices: Object.keys(amplifyMeta[category]), | ||
default: Object.keys(amplifyMeta[category])[0], | ||
}, | ||
]; | ||
|
||
let props = await inquirer.prompt(chooseProject); | ||
|
||
let options = amplifyMeta.video[props.resourceName]; | ||
|
||
const providerController = | ||
require(`../../provider-utils/${options.providerPlugin}/index`); | ||
if (!providerController) { | ||
context.print.error('Provider not configured for this category'); | ||
return; | ||
} | ||
|
||
return providerController.updateResource(context, options.serviceType, options, props.resourceName); | ||
}, | ||
|
||
}; |
Oops, something went wrong.