Better DB status

This commit is contained in:
IrosTheBeggar 2017-04-22 05:14:32 -04:00
parent e795ffbcad
commit 94f2163568
2 changed files with 81 additions and 31 deletions

View File

@ -44,6 +44,8 @@ $(document).ready(function(){
loadFileExplorer();
// MSTREAMGEN.getCurrentDirectoryContents();
callOnStart();
// Remove the overlay
$('.login-overlay').fadeOut( "slow" );
@ -66,7 +68,6 @@ $(document).ready(function(){
loginPanel.needToLogin = true;
// TODO: Move this transitionstuff to vue
$('.login-overlay').fadeIn( "slow" );
console.log(loginPanel);
// For electron we need to alert the user that user it failed and guide them to the login form
return;
@ -75,6 +76,8 @@ $(document).ready(function(){
MSTREAMAPI.currentServer.vPath = response.vPath;
// Setup the filebrowser
loadFileExplorer();
callOnStart();
});
}
@ -86,6 +89,44 @@ $(document).ready(function(){
var startInterval = false;
function callOnStart(){
console.log('CALL ON START')
MSTREAMAPI.dbStatus( function(response, error){
if(error){
$('.scan-status').html('');
$('.scan-status-files').html('');
clearInterval(startInterval);
startInterval = false;
return;
}
// if not scanning
if(!response.locked || response.locked === false){
clearInterval(startInterval);
startInterval = false;
$('.scan-status').html('');
$('.scan-status-files').html('');
return;
}
// Set Interval
if(startInterval === false){
startInterval = setInterval( function() {
callOnStart();
}, 2000);
}
// Update status
// $('#filelist').append('<p id="db_progress_report">Progress: '+ response.files_in_db +'/'+ response.file_count +'</p>');
$('.scan-status').html('Scan In Progress');
$('.scan-status-files').html(response.totalFileCount + ' files in DB');
});
}
////////////////////////////// Global Variables
// These vars track your position within the file explorer
var fileExplorerArray = [];
@ -444,7 +485,10 @@ $(document).ready(function(){
}
// if the DB is locked
if(response.locked){
$('#filelist').append('<p>The database is currently being built. Currently ' + response.totalFileCount + ' files are in the DB</p><input type="button" value="Check Progress" class="button secondary small" id="check_db_progress" >');
$('#filelist').append(' <p class="scan-status">Scan In Progress</p><p class="scan-status-files">'+response.totalFileCount+' files in DB</p>');
//$('#filelist').append('<p>The database is currently being built. Currently ' + response.totalFileCount + ' files are in the DB</p>');
return;
}
// If you got this far the db is made and working
@ -460,29 +504,32 @@ $(document).ready(function(){
if(error !== false){
return boilerplateFailure(response, error);
}
$('#filelist').append(' <p class="scan-status">Scan In Progress</p><p class="scan-status-files"></p>');
callOnStart();
// Append the check db button so the user can start checking right away
$('#filelist').append('<input type="button" value="Check Progress" id="check_db_progress" >');
// $('#filelist').append('<input type="button" value="Check Progress" id="check_db_progress" >');
});
});
// Check DB build progress
$('body').on('click', '#check_db_progress', function(){
MSTREAMAPI.dbStatus( function(response, error){
if(error !== false){
return boilerplateFailure(response, error);
}
$( "#db_progress_report" ).remove();
// if file_count is 0, report that the the build script is not done counting files
if(response.file_count == 0){
$('#filelist').append('<p id="db_progress_report">The create database script is still counting the files in the music collection. This operation can take some time. Try again in a bit</p>');
return;
}
// Append new <p> tag with id of "db_progress_report"
$('#filelist').append('<p id="db_progress_report">Progress: '+ response.files_in_db +'/'+ response.file_count +'</p>');
});
});
// // Check DB build progress
// $('body').on('click', '#check_db_progress', function(){
// MSTREAMAPI.dbStatus( function(response, error){
// if(error !== false){
// return boilerplateFailure(response, error);
// }
// $( "#db_progress_report" ).remove();
//
// // if file_count is 0, report that the the build script is not done counting files
// if(response.file_count == 0){
// $('#filelist').append('<p id="db_progress_report">The create database script is still counting the files in the music collection. This operation can take some time. Try again in a bit</p>');
// return;
// }
//
// // Append new <p> tag with id of "db_progress_report"
// $('#filelist').append('<p id="db_progress_report">Progress: '+ response.files_in_db +'/'+ response.file_count +'</p>');
// });
// });
//////////////////////////////////// Sort by Albums

View File

@ -193,21 +193,24 @@
<li class="left-off-canvas-toggle get_all_playlists show-for-small-only" id="all_playlists"><label>Playlists</label></li>
<li class="left-off-canvas-toggle get_all_albums show-for-small-only" id="all_albums"><label>Albums</label></li>
<li class="left-off-canvas-toggle get_all_artists show-for-small-only" id="all_artists"><label>Artists</label></li>
<li class="left-off-canvas-toggle" id="manage_database"><label>Database</label></li>
<li class="left-off-canvas-toggle" id="search_database"><label>Search</label></li>
<li class="left-off-canvas-toggle" id="jukebox_mode"><label>Jukebox</label></li>
</ul>
<div class="db-status-bar">
<p class="scan-status metadata-panel-text"></p><!-- DB Status -->
<p class="scan-status-files metadata-panel-text"></p><!-- Number of Files -->
</div>
<div id="metadata-panel">
<div class="metadata-text">
<p class="metadata-panel-text hide-for-small">Title: {{ (meta.title) ? meta.title : '' }}</p>
<p class="metadata-panel-text hide-for-small">Artist: {{ (meta.artist) ? meta.artist : '' }}</p>
<p class="metadata-panel-text hide-for-small">Album: {{ (meta.album) ? meta.album : '' }}</p>
<p class="metadata-panel-text hide-for-small">Year: {{ (meta.year) ? meta.year : '' }}</p>
<div class="metadata-text hide-for-small">
<p class="metadata-panel-text">Title: {{ (meta.title) ? meta.title : '' }}</p>
<p class="metadata-panel-text">Artist: {{ (meta.artist) ? meta.artist : '' }}</p>
<p class="metadata-panel-text">Album: {{ (meta.album) ? meta.album : '' }}</p>
<p class="metadata-panel-text">Year: {{ (meta.year) ? meta.year : '' }}</p>
</div>
<div class="album-art-container">
<img :src="albumArtPath" id="album-art" />
</div>
@ -235,10 +238,10 @@
<div class="columnHeader">
<div class="libraryHeaderContainer">
<div class="large-6 medium-6 small-12 columns noPaddingLeft">
<div class="large-10 medium-10 small-12 columns noPaddingLeft">
<h3 class="panel_one_name hide-for-small">Library</h3>
</div>
<div class="large-6 medium-6 small-12 columns">
<div class="large-2 medium-2 small-12 columns">
<div class="controls leftControls">
<a title="Add Directory to Playlist" class="add" id='addall'><img src="/public/img/glyphicons/png/glyphicons_131_inbox_plus.png" alt="" width="27" height="27"></a>
<!-- Add Directory to Playlist -->