Skip to content

Commit

Permalink
PLaylist imporvments, not perfect
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewiski committed May 15, 2023
1 parent 201d6e1 commit f9ef00f
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 23 deletions.
13 changes: 7 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,21 +897,22 @@ io.on('connection', function(socket) {
logUtilHelper.log(appLogName, "socketio", "debug", 'audio:' + ', message:' + message + ', client id:' + socket.id);
try {
switch (message.cmd) {
case "audioFilePlayFullSongPlaylist":

let fileStream = fs.createWriteStream(path.join(fullSongAudioDirectory,"playlist.txt"),{flags:"w", encoding:"utf-8", autoClose:true, start:0})
case "audioFileSaveFullSongPlaylist":
let fileStream = fs.createWriteStream(path.join(fullSongAudioDirectory, message.data.fileName),{flags:"w", encoding:"utf-8", autoClose:true, start:0})
for(var i=0; i<message.data.audioFiles.length; i++){
let data = "file '" + message.data.audioFiles[i] + "'\n";
fileStream.write(data);
}
fileStream.end();
fileStream.close();

break;
case "audioFilePlayFullSongPlaylist":

if(message.data.loop === true){
//-safe 0 -autoexit -hide_banner -nodisp -f concat -i data\audiofiles\fullsongs\playlist.txt
audioFilePlay(fullSongAudioDirectory, {fileName: "playlist.txt"}, ['-hide_banner', '-nodisp', "-f", "concat", "-safe", "0", "-loop", "0" ]);
audioFilePlay(fullSongAudioDirectory, {fileName: message.data.fileName}, ['-hide_banner', '-nodisp', "-f", "concat", "-safe", "0", "-loop", "0" ]);
}else{
audioFilePlay(fullSongAudioDirectory, {fileName: "playlist.txt"}, ['-hide_banner', '-nodisp', "-f", "concat", "-safe", "0", '-autoexit']);
audioFilePlay(fullSongAudioDirectory, {fileName: message.data.fileName}, ['-hide_banner', '-nodisp', "-f", "concat", "-safe", "0", '-autoexit']);
}
break;
case "audioFilePlayFullSong":
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "radargunmonitor",
"version": "0.0.18",
"version": "0.0.19",
"private": false,
"license": "Apache-2.0",
"keywords": [
Expand Down
68 changes: 54 additions & 14 deletions public/app/scoreboard/scoreboard.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@
<table class="table table-bordered table-striped">
<thead class="thead-light">
<tr>
<td><label class="control-label">Playlist</label></td>

<td><label class="control-label">Song</label></td>
<td><label class="control-label">Length</label></td>
<td><label class="control-label">Play</label></td>
Expand All @@ -1146,11 +1146,7 @@
</thead>
<tbody>
<tr ng-repeat="(index, fullSongFile) in (commonData.fullSongFiles)">
<td>
<div class="form-control-sm">
<input type="checkbox" value="{{fullSongFile.fileName}}" name="playlistFullSong">
</div>
</td>

<td>
<div class="form-control-sm">
<span ng-bind="fullSongFile.fileName"></span>
Expand Down Expand Up @@ -1178,18 +1174,62 @@
</tbody>
</table>
</div>
</uib-tab>

<uib-tab index="13" ng-show="commonData.isGameAdmin" ng-click="tabClick('playlists')">
<uib-tab-heading>
<i class="fa fa-music"></i> Playlists
</uib-tab-heading>

<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Playlist</div>
<div class="panel-body">
<div class="input-group-btn">
<button type="button" class="btn" ng-click="audioFilePlayFullSongPlaylist()" data-toggle="tooltip" data-placement="bottom" title="Play PLaylist"><i class="fa fa-play"></i></button>
<button type="button" class="btn" ng-click="audioFileStop()" data-toggle="tooltip" data-placement="bottom" title="Stop Audio"><i class="fa fa-stop"></i></button>
</div>
<div style="display: inline-block;"><input type="checkbox" value="true" name="playlistFullSongLoop" checked="checked"/> <span>Loop</span></div>

<div style="display: inline-block;">
<div class="input-group-btn">
<button type="button" class="btn" ng-click="refreshFullSongFiles()"><i class="fa fa-refresh"></i></button>
<button type="button" class="btn btn-success" ng-click="audioFilePlayFullSongPlaylist()" data-toggle="tooltip" data-placement="bottom" title="Play Playlist"><i class="fa fa-play"></i></button>
<button type="button" class="btn btn-danger" ng-click="audioFileStop()" data-toggle="tooltip" data-placement="bottom" title="Stop Audio"><i class="fa fa-stop"></i></button>
<button type="button" class="btn btn-info" ng-click="audioFileSaveFullSongPlaylist()" data-toggle="tooltip" data-placement="bottom" title="Save PlayList"><i class="fa-solid fa-floppy-disk"></i></button>
</div>
</div>
<div style="display: inline-block;"><input type="checkbox" value="true" id="playlistFullSongLoop" checked="checked"/> <span>Loop</span></div>
<table class="table table-bordered table-striped">
<thead class="thead-light">
<tr>
<td><label class="control-label">Playlist</label></td>
<td><label class="control-label">Song</label></td>
<td><label class="control-label">Length</label></td>
<td><label class="control-label">Preview</label></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="(index, fullSongFile) in (commonData.fullSongFiles)">
<td>
<div class="form-control-sm">
<input type="checkbox" value="{{fullSongFile.fileName}}" name="playlistFullSong">
</div>
</td>
<td>
<div class="form-control-sm">
<span ng-bind="fullSongFile.fileName"></span>
</div>
</td>
<td>
<div class="form-control-sm">
<span ng-bind="fullSongFile.length"></span>
</div>
</td>
<td>
<div class="form-control-sm">
<button type="button" class="btn" ng-click="audioFilePreviewFullSong($event, fullSongFile.fileName)" data-toggle="tooltip" data-placement="bottom" title="Preview FullSong"><i class="fa fa-play"></i></button>
<div class="previewControl">
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>

</uib-tab>

<uib-tab index="14" ng-show="commonData.isGameAdmin" ng-click="tabClick('PracticeMode')">
Expand Down
16 changes: 14 additions & 2 deletions public/app/scoreboard/scoreboardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@
refreshFullSongFiles();
}
break;
case "playlists":
console.log("tabPlaylistsClick");
if($scope.commonData.fullSongFiles === null){
refreshFullSongFiles();
}
break;
case "videoFiles":
console.log("tabVideoFilesClick");
//if($scope.commonData.videoFiles === null){
Expand Down Expand Up @@ -985,7 +991,8 @@
return array;
}

$scope.audioFilePlayFullSongPlaylist = function () {

$scope.audioFileSaveFullSongPlaylist = function () {
let audioFiles = [];
$("input[name=playlistFullSong]:checked").each(function () {
audioFiles.push($(this).val());
Expand All @@ -995,7 +1002,12 @@
shuffle(audioFiles);

}
radarMonitor.sendServerCommand("audio", { cmd: "audioFilePlayFullSongPlaylist", data: { audioFiles: audioFiles } });
radarMonitor.sendServerCommand("audio", { cmd: "audioFileSaveFullSongPlaylist", data: { fileName:"playlist.txt", audioFiles: audioFiles } });
}

$scope.audioFilePlayFullSongPlaylist = function () {
let shouldLoop = $("#playlistFullSongLoop").prop( "checked");
radarMonitor.sendServerCommand("audio", { cmd: "audioFilePlayFullSongPlaylist", data: { fileName:"playlist.txt", loop: shouldLoop } });
}


Expand Down

0 comments on commit f9ef00f

Please sign in to comment.