CC-3561: Add button to automatically rescan watched folders.
-done
This commit is contained in:
parent
70bfe031ef
commit
d02607ed94
6 changed files with 32 additions and 11 deletions
|
@ -353,10 +353,12 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
public function rescanWatchDirectoryAction()
|
||||
{
|
||||
$dirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
foreach ($dirs as $dir) {
|
||||
$res = Application_Model_MusicDir::addWatchedDir($dir->getDirectory());
|
||||
}
|
||||
$dir = Application_Model_MusicDir::getDirByPath($this->getRequest()->getParam("dir"));
|
||||
$id = $dir->getId();
|
||||
$data = array();
|
||||
$data['directory'] = $dir->getDirectory();
|
||||
$data['id'] = $id;
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor('rescan_watch', $data);
|
||||
die();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<dt id="watchedFolder-label" class="block-display">
|
||||
<label class="required" for="watchedFolder"><?php echo $this->element->getElement('watchedFolder')->getLabel() ?></label>
|
||||
<a href="#" id="watchedFolder-rescan">Rescan</a>
|
||||
|
||||
</dt>
|
||||
<dd id="watchedFolder-element" class="block-display">
|
||||
<?php echo $this->element->getElement('watchedFolder') ?>
|
||||
|
@ -39,7 +39,10 @@
|
|||
<?php if (count($watched_dirs) > 0): ?>
|
||||
<?php foreach($watched_dirs as $watched_dir): ?>
|
||||
<dd class="block-display selected-item">
|
||||
<?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span><?php echo $watched_dir->getDirectory();?></span></span><span class="ui-icon ui-icon-close"></span>
|
||||
<?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span id="folderPath"><?php echo $watched_dir->getDirectory();?></span></span>
|
||||
<span title="Rescan watched directory (This is useful if it is network mount and may be out of sync with Airtime)" class="ui-icon ui-icon-refresh"></span>
|
||||
<span title="Remove watched directory" class="ui-icon ui-icon-close"></span>
|
||||
|
||||
</dd>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
|
|
|
@ -2027,12 +2027,23 @@ label span {
|
|||
-moz-border-radius: 4px;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
#watched-folder-section dd.block-display.selected-item .ui-icon {
|
||||
position:absolute;
|
||||
top:4px;
|
||||
right:5px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#watched-folder-section dd.block-display.selected-item .ui-icon.ui-icon-refresh {
|
||||
position:absolute;
|
||||
top:4px;
|
||||
right:20px;
|
||||
cursor:pointer;
|
||||
background-image:url(redmond/images/ui-icons_ffffff_256x240.png);
|
||||
background-position: -128px -63px;
|
||||
}
|
||||
|
||||
#watched-folder-section dd.block-display.selected-item .ui-icon:hover {
|
||||
background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png)
|
||||
}
|
||||
|
|
|
@ -78,14 +78,15 @@ function setWatchedDirEvents() {
|
|||
});
|
||||
});
|
||||
|
||||
$('#watchedFolder-rescan').click(function(){
|
||||
$.get("/Preference/rescan-watch-directory", {format: "json"});
|
||||
$('.selected-item').find('.ui-icon-refresh').click(function(){
|
||||
var folder = $(this).prev().text();
|
||||
$.get("/Preference/rescan-watch-directory", {format: "json", dir: folder});
|
||||
});
|
||||
|
||||
$('.selected-item').find('.ui-icon-close').click(function(){
|
||||
if(confirm("Are you sure you want to remove the watched folder?")){
|
||||
var row = $(this).parent();
|
||||
var folder = $(this).prev().text();
|
||||
var folder = row.find('#folderPath').text();
|
||||
|
||||
url = "/Preference/remove-watch-directory";
|
||||
|
||||
|
@ -124,4 +125,5 @@ $(document).ready(function() {
|
|||
show: 'mouseover',
|
||||
hide: 'mouseout'
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue