-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v5' into v5-feat-steam-Short-Discription
- Loading branch information
Showing
13 changed files
with
275 additions
and
80 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
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
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,29 @@ | ||
"use strict"; | ||
|
||
const { OutputDataType, VariableCategory } = require("../../../shared/variable-constants"); | ||
|
||
const frontendCommunicator = require("../../common/frontend-communicator"); | ||
|
||
const model = { | ||
definition: { | ||
handle: "audioDuration", | ||
usage: "audioDuration[filePathOrUrl]", | ||
description: "Attempts to retrieve audio duration.", | ||
categories: [VariableCategory.ADVANCED], | ||
possibleDataOutput: [OutputDataType.NUMBER] | ||
}, | ||
evaluator: async (trigger, url) => { | ||
if (url == null) { | ||
return "[NO URL PROVIDED]"; | ||
} | ||
try { | ||
return await frontendCommunicator.fireEventAsync("getSoundDuration", { | ||
path: url | ||
}); | ||
} catch (err) { | ||
return "[ERROR FETCHING DURATION]"; | ||
} | ||
} | ||
}; | ||
|
||
module.exports = model; |
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,30 @@ | ||
"use strict"; | ||
|
||
const { OutputDataType, VariableCategory } = require("../../../shared/variable-constants"); | ||
|
||
const frontendCommunicator = require("../../common/frontend-communicator"); | ||
const logger = require("../../logwrapper"); | ||
|
||
const model = { | ||
definition: { | ||
handle: "videoDuration", | ||
usage: "videoDuration[filePathOrUrl]", | ||
description: "Attempts to retrieve video duration.", | ||
categories: [VariableCategory.ADVANCED], | ||
possibleDataOutput: [OutputDataType.TEXT] | ||
}, | ||
evaluator: async (trigger, url) => { | ||
if (url == null) { | ||
return "[NO URL PROVIDED]"; | ||
} | ||
const result = await frontendCommunicator.fireEventAsync("getVideoDuration", url); | ||
|
||
if (isNaN(result)) { | ||
logger.error("Error while retrieving video duration", result); | ||
return "[ERROR FETCHING DURATION]"; | ||
} | ||
return result; | ||
} | ||
}; | ||
|
||
module.exports = model; |
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,30 @@ | ||
"use strict"; | ||
|
||
const { OutputDataType, VariableCategory } = require("../../../shared/variable-constants"); | ||
const logger = require("../../logwrapper"); | ||
const frontendCommunicator = require("../../common/frontend-communicator"); | ||
const { parseYoutubeId } = require("../../../shared/youtube-url-parser"); | ||
|
||
const model = { | ||
definition: { | ||
handle: "youtubeVideoDuration", | ||
usage: "youtubeVideoDuration[urlOrId]", | ||
description: "Attempts to retrieve youtube video duration.", | ||
categories: [VariableCategory.ADVANCED], | ||
possibleDataOutput: [OutputDataType.TEXT] | ||
}, | ||
evaluator: async (trigger, id) => { | ||
if (id == null) { | ||
return "[NO VIDEO ID PROVIDED]"; | ||
} | ||
const result = await frontendCommunicator.fireEventAsync("getYoutubeVideoDuration", parseYoutubeId(id).id); | ||
|
||
if (isNaN(result)) { | ||
logger.error("Error while retrieving youtube video duration", result); | ||
return "[ERROR FETCHING DURATION]"; | ||
} | ||
return result; | ||
} | ||
}; | ||
|
||
module.exports = model; |
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
Oops, something went wrong.