[addon] show filename at the end of moch url for external players

This commit is contained in:
TheBeastLT
2021-06-20 13:37:07 +02:00
parent f11bc8fbc8
commit 3e66db3717
3 changed files with 14 additions and 5 deletions

View File

@@ -6,4 +6,13 @@ function chunkArray(arr, size) {
: [arr];
}
module.exports = { chunkArray, BadTokenError }
function streamFilename(stream) {
const titleParts = stream.title.replace(/\n👤.*/s, '').split('\n');
const filePath = titleParts.pop();
const filename = titleParts.length
? filePath.split('/').pop()
: filePath;
return encodeURIComponent(filename)
}
module.exports = { chunkArray, BadTokenError, streamFilename }