Skip to content

Commit

Permalink
Fix MediaBrowser#15 : Hide Organize button when a task is running
Browse files Browse the repository at this point in the history
  • Loading branch information
PoppyPop committed Jul 27, 2018
1 parent 26c1566 commit 57ed195
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Emby.AutoOrganize/Configuration/autoorganizelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
<button is="emby-button" type="button" class="btnClearLog raised button-cancel">
<i class="md-icon">clear_all</i><span>${ButtonClear}</span>
</button>
<button is="emby-button" type="button" class="btnOrganize raised button-cancel"><i class="md-icon">check</i><span>Organize</span></button>
<button is="emby-button" type="button" class="btnOrganize raised button-cancel" id="btnOrganize"><i class="md-icon">check</i><span>Organize</span></button>
<progress max="100" min="0" style="width: 100px;" class="organizeProgress"></progress>
</div>

<div class="listTopPaging">
</div>

Expand Down
14 changes: 11 additions & 3 deletions Emby.AutoOrganize/Configuration/autoorganizelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@

html += '<td class="detailTableBodyCell">';
var hide = item.IsInProgress ? '' : ' hide';
html += '<img src="css/images/throbber.gif" alt="" class="syncSpinner' + hide + '" style="vertical-align: middle;" />';
html += '<img src="thirdparty/jstree/themes/default/throbber.gif" alt="" class="syncSpinner' + hide + '" style="vertical-align: middle;" />';
html += '</td>';

html += '<td class="detailTableBodyCell" data-title="Date">';
Expand Down Expand Up @@ -514,7 +514,15 @@
progressElem: view.querySelector('.organizeProgress'),
panel: view.querySelector('.organizeTaskPanel'),
taskKey: 'AutoOrganize',
button: view.querySelector('.btnOrganize')
button: view.querySelector('#btnOrganize')
});

view.querySelector('#btnOrganize').addEventListener('DOMSubtreeModified', function () {
if (view.querySelector('#btnOrganize').disabled) {
view.querySelector('#btnOrganize').classList.add('hide');
} else {
view.querySelector('#btnOrganize').classList.remove('hide');
}
});
});

Expand All @@ -531,7 +539,7 @@
// off here
taskButton({
mode: 'off',
button: view.querySelector('.btnOrganize')
button: view.querySelector('#btnOrganize')
});
});
};
Expand Down
4 changes: 2 additions & 2 deletions Emby.AutoOrganize/Core/OrganizerScheduledTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ public async Task Execute(CancellationToken cancellationToken, IProgress<double>

var options = GetAutoOrganizeOptions();

var fileOrganizationService = PluginEntryPoint.Current.FileOrganizationService;

if (options.TvOptions.IsEnabled)
{
queueTv = options.TvOptions.QueueLibraryScan;
var fileOrganizationService = PluginEntryPoint.Current.FileOrganizationService;

await new TvFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, fileOrganizationService, _config, _providerManager)
.Organize(options.TvOptions, cancellationToken, progress).ConfigureAwait(false);
Expand All @@ -70,7 +71,6 @@ public async Task Execute(CancellationToken cancellationToken, IProgress<double>
if (options.MovieOptions.IsEnabled)
{
queueMovie = options.MovieOptions.QueueLibraryScan;
var fileOrganizationService = PluginEntryPoint.Current.FileOrganizationService;

await new MovieFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, fileOrganizationService, _config, _providerManager)
.Organize(options.MovieOptions, cancellationToken, progress).ConfigureAwait(false);
Expand Down

0 comments on commit 57ed195

Please sign in to comment.