Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 26ad2c4

Browse files
committed
Added additional filename template tags
1 parent 8a7be33 commit 26ad2c4

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

lamd.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,20 @@ function downloadFile() {
383383

384384
LiveMe.getVideoInfo(download_list[0]).then(video => {
385385

386-
var filename = config.downloadTemplate
387-
.replace(/%%broadcaster%%/g, video.uname)
388-
.replace(/%%longid%%/g, video.userid)
389-
.replace(/%%replayid%%/g, video.vid)
390-
.replace(/%%replayviews%%/g, video.playnumber)
391-
.replace(/%%replaylikes%%/g, video.likenum)
392-
.replace(/%%replayshares%%/g, video.sharenum)
393-
.replace(/%%replaytitle%%/g, video.title ? video.title : 'untitled')
394-
.replace(/%%replayduration%%/g, video.videolength);
386+
var dt = new Date(video.vtime * 1000), mm = dt.getMonth() + 1, dd = getDate(), filename = '';
387+
388+
filename = config.downloadTemplate
389+
.replace(/%%broadcaster%%/g, video.uname)
390+
.replace(/%%longid%%/g, video.userid)
391+
.replace(/%%replayid%%/g, video.vid)
392+
.replace(/%%replayviews%%/g, video.playnumber)
393+
.replace(/%%replaylikes%%/g, video.likenum)
394+
.replace(/%%replayshares%%/g, video.sharenum)
395+
.replace(/%%replaytitle%%/g, video.title ? video.title : 'untitled')
396+
.replace(/%%replayduration%%/g, video.videolength)
397+
.replace(/%%replaydatepacked%%/g, (dt.getFullYear() + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd))
398+
.replace(/%%replaydateus%%/g, ((mm < 10 ? '0' : '') + mm + '-' + (dd < 10 ? '0' : '') + dd + '-' + dt.getFullYear()))
399+
.replace(/%%replaydateeu%%/g, ((dd < 10 ? '0' : '') + dd + '-' + (mm < 10 ? '0' : '') + mm + '-' + dt.getFullYear()));
395400

396401
// Cleanup any illegal characters in the filename
397402
filename = filename.replace(/[/\\?%*:|"<>]/g, '-');

0 commit comments

Comments
 (0)