mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Change file browser to permit manually entering a path.
This commit is contained in:
parent
ed4d165ee7
commit
a59fe898b5
8 changed files with 250 additions and 194 deletions
|
@ -108,7 +108,9 @@
|
|||
* Fix issue on Add Existing Shows page where shows were listed that should not have been
|
||||
* Change get_size helper to also handle files
|
||||
* Change improve handling of a bad email notify setting
|
||||
* Change give OMGWTFNZBS provider more time to respond
|
||||
* Fix provider MTV download URL
|
||||
* Change give provider OMGWTFNZBS more time to respond
|
||||
* Change file browser to permit manually entering a path
|
||||
|
||||
|
||||
### 0.10.0 (2015-08-06 11:05:00 UTC)
|
||||
|
|
|
@ -20,7 +20,7 @@ inc_top.tmpl
|
|||
}
|
||||
|
||||
.browserDialog.busy .ui-dialog-buttonpane{
|
||||
background:url("../images/loading.gif") 10px 50% no-repeat !important
|
||||
background:url("../images/loading32-dark.gif") 10px 50% no-repeat !important
|
||||
}
|
||||
|
||||
.ui-progressbar .ui-progressbar-overlay{
|
||||
|
@ -61,6 +61,8 @@ inc_top.tmpl
|
|||
.ui-state-default,
|
||||
.ui-widget-content .ui-state-default,
|
||||
.ui-widget-header .ui-state-default{
|
||||
background:#3d3d3d;
|
||||
color:#fff;
|
||||
border:1px solid #111
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -16,7 +16,7 @@ inc_top.tmpl
|
|||
}
|
||||
|
||||
.browserDialog.busy .ui-dialog-buttonpane{
|
||||
background:url("../images/loading.gif") 10px 50% no-repeat !important
|
||||
background:url("../images/loading32.gif") 10px 50% no-repeat !important
|
||||
}
|
||||
|
||||
.ui-progressbar .ui-progressbar-overlay{
|
||||
|
|
|
@ -175,7 +175,7 @@ inc_top.tmpl
|
|||
background:url("../css/lib/images/animated-overlay.gif")
|
||||
}
|
||||
|
||||
.ui-dialog,
|
||||
.ui-dialog,
|
||||
.ui-dialog-buttonpane{
|
||||
background:#eceadf url("../css/lib/images/ui-bg_fine-grain_10_eceadf_60x60.png") 50% 50% repeat !important
|
||||
}
|
||||
|
@ -3032,6 +3032,10 @@ fieldset[disabled] .navbar-default .btn-link:focus{
|
|||
display:inline
|
||||
}
|
||||
|
||||
#fileBrowserDialog .form-control{background-color:#f5f1e4}
|
||||
#fileBrowserDialog .form-control:active,
|
||||
#fileBrowserDialog .form-control:hover{background-color:#ffffca}
|
||||
|
||||
.btn{
|
||||
display:inline-block;
|
||||
*display:inline;
|
||||
|
@ -3942,7 +3946,7 @@ jquery.confirm.css
|
|||
box-shadow:inset 0 1px rgba(255, 255, 255, 0.1),inset 0 -1px 3px rgba(0, 0, 0, 0.3),inset 0 0 0 1px rgba(255, 255, 255, 0.08),0 1px 2px rgba(0, 0, 0, 0.15)
|
||||
}
|
||||
|
||||
#confirmBox .button:last-child{
|
||||
#confirmBox .button:last-child{
|
||||
margin-right:0
|
||||
}
|
||||
|
||||
|
|
|
@ -1,181 +1,208 @@
|
|||
;(function($) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
$.Browser = {
|
||||
defaults: {
|
||||
title: 'Choose Directory',
|
||||
url: sbRoot + '/browser/',
|
||||
autocompleteURL: sbRoot + '/browser/complete',
|
||||
includeFiles: 0
|
||||
}
|
||||
};
|
||||
$.Browser = {
|
||||
defaults: {
|
||||
title: 'Choose Directory (or enter manually)',
|
||||
url: sbRoot + '/browser/',
|
||||
autocompleteURL: sbRoot + '/browser/complete',
|
||||
includeFiles: 0,
|
||||
showBrowseButton: !0
|
||||
}
|
||||
};
|
||||
|
||||
var fileBrowserDialog, currentBrowserPath, currentRequest = null;
|
||||
var fileBrowserDialog, currentBrowserPath, currentRequest = null;
|
||||
|
||||
function browse(path, endpoint, includeFiles) {
|
||||
function browse(path, endpoint, includeFiles) {
|
||||
|
||||
if (currentBrowserPath == path) {
|
||||
return;
|
||||
}
|
||||
if (path === currentBrowserPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentBrowserPath = path;
|
||||
currentBrowserPath = path;
|
||||
|
||||
if (currentRequest) {
|
||||
currentRequest.abort();
|
||||
}
|
||||
if (currentRequest) {
|
||||
currentRequest.abort();
|
||||
}
|
||||
|
||||
fileBrowserDialog.dialog('option', 'dialogClass', 'browserDialog busy');
|
||||
fileBrowserDialog.dialog('option', 'dialogClass', 'browserDialog busy');
|
||||
|
||||
currentRequest = $.getJSON(endpoint, { path: path, includeFiles: includeFiles }, function (data) {
|
||||
fileBrowserDialog.empty();
|
||||
var first_val = data[0];
|
||||
var i = 0;
|
||||
var list, link = null;
|
||||
data = $.grep(data, function (value) {
|
||||
return i++ != 0;
|
||||
});
|
||||
$('<h2>').text(first_val.current_path).appendTo(fileBrowserDialog);
|
||||
list = $('<ul>').appendTo(fileBrowserDialog);
|
||||
$.each(data, function (i, entry) {
|
||||
link = $("<a href='javascript:void(0)' />").click(function () { browse(entry.path, endpoint, includeFiles); }).text(entry.name);
|
||||
$('<span class="ui-icon ui-icon-folder-collapsed"></span>').prependTo(link);
|
||||
link.hover(
|
||||
function () {$("span", this).addClass("ui-icon-folder-open"); },
|
||||
function () {$("span", this).removeClass("ui-icon-folder-open"); }
|
||||
);
|
||||
link.appendTo(list);
|
||||
});
|
||||
$("a", list).wrap('<li class="ui-state-default ui-corner-all">');
|
||||
fileBrowserDialog.dialog('option', 'dialogClass', 'browserDialog');
|
||||
});
|
||||
}
|
||||
currentRequest = $.getJSON(endpoint, {path: path, includeFiles: includeFiles}, function(data){
|
||||
fileBrowserDialog.empty();
|
||||
var firstVal = data[0], i = 0, list, link = null;
|
||||
data = $.grep(data, function(){
|
||||
return i++ != 0;
|
||||
});
|
||||
$('<input type="text" class="form-control input-sm">')
|
||||
.val(firstVal.currentPath)
|
||||
.on('keypress', function(e){
|
||||
if (13 === e.which) {
|
||||
browse(e.target.value, endpoint, includeFiles);
|
||||
}
|
||||
})
|
||||
.appendTo(fileBrowserDialog)
|
||||
.fileBrowser({showBrowseButton: !1})
|
||||
.on('autocompleteselect',
|
||||
function(e, ui){browse(ui.item.value, endpoint, includeFiles);
|
||||
});
|
||||
|
||||
$.fn.nFileBrowser = function (callback, options) {
|
||||
options = $.extend({}, $.Browser.defaults, options);
|
||||
list = $('<ul>').appendTo(fileBrowserDialog);
|
||||
$.each(data, function(i, entry){
|
||||
link = $('<a href="javascript:void(0)">').on('click',
|
||||
function(){
|
||||
if (entry.isFile) {
|
||||
currentBrowserPath = entry.path;
|
||||
$('.browserDialog .ui-button:contains("Ok")').click();
|
||||
} else {
|
||||
browse(entry.path, endpoint, includeFiles);
|
||||
}
|
||||
}).text(entry.name);
|
||||
|
||||
// make a fileBrowserDialog object if one doesn't exist already
|
||||
if (!fileBrowserDialog) {
|
||||
if (entry.isFile) {
|
||||
link.prepend('<span class="ui-icon ui-icon-blank"></span>');
|
||||
} else {
|
||||
link.prepend('<span class="ui-icon ui-icon-folder-collapsed"></span>')
|
||||
.on('mouseenter', function(){$('span', this).addClass('ui-icon-folder-open');})
|
||||
.on('mouseleave', function(){$('span', this).removeClass('ui-icon-folder-open');});
|
||||
}
|
||||
link.appendTo(list);
|
||||
});
|
||||
$('a', list).wrap('<li class="ui-state-default ui-corner-all">');
|
||||
fileBrowserDialog.dialog('option', 'dialogClass', 'browserDialog');
|
||||
});
|
||||
}
|
||||
|
||||
// set up the jquery dialog
|
||||
fileBrowserDialog = $('<div id="fileBrowserDialog" style="display:hidden"></div>').appendTo('body').dialog({
|
||||
dialogClass: 'browserDialog',
|
||||
title: options.title,
|
||||
position: ['center', 40],
|
||||
minWidth: Math.min($(document).width() - 80, 650),
|
||||
height: Math.min($(document).height() - 80, $(window).height() - 80),
|
||||
maxHeight: Math.min($(document).height() - 80, $(window).height() - 80),
|
||||
maxWidth: $(document).width() - 80,
|
||||
modal: true,
|
||||
autoOpen: false
|
||||
});
|
||||
}
|
||||
$.fn.nFileBrowser = function(callback, options){
|
||||
options = $.extend({}, $.Browser.defaults, options);
|
||||
|
||||
fileBrowserDialog.dialog('option', 'buttons', [
|
||||
{
|
||||
text: "Ok",
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
// store the browsed path to the associated text field
|
||||
callback(currentBrowserPath, options);
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Cancel",
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
]);
|
||||
// make a fileBrowserDialog object if one doesn't exist already
|
||||
if (fileBrowserDialog) {
|
||||
fileBrowserDialog.dialog('option', 'title', options.title);
|
||||
} else {
|
||||
// set up the jquery dialog
|
||||
var docWidth = $(document).width(), dlgWidth = Math.min(docWidth - 80, 650),
|
||||
docHeight = $(document).height() - 80, winHeight = $(window).height() - 80;
|
||||
fileBrowserDialog = $('<div id="fileBrowserDialog" style="display:none"></div>').appendTo('body').dialog({
|
||||
dialogClass: 'browserDialog',
|
||||
title: options.title,
|
||||
position: [(docWidth - dlgWidth)/2, 60],
|
||||
minWidth: dlgWidth,
|
||||
height: Math.min(docHeight, winHeight),
|
||||
maxHeight: Math.min(docHeight, winHeight),
|
||||
maxWidth: docWidth - 80,
|
||||
modal: true,
|
||||
autoOpen: false
|
||||
});
|
||||
}
|
||||
|
||||
// set up the browser and launch the dialog
|
||||
var initialDir = '';
|
||||
if (options.initialDir) {
|
||||
initialDir = options.initialDir;
|
||||
}
|
||||
fileBrowserDialog.dialog('option', 'buttons',
|
||||
[{
|
||||
text: 'Ok',
|
||||
'class': 'btn',
|
||||
click: function(){
|
||||
// store the browsed path to the associated text field
|
||||
callback(currentBrowserPath, options);
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
'class': 'btn',
|
||||
click: function(){
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}]);
|
||||
|
||||
browse(initialDir, options.url, options.includeFiles);
|
||||
fileBrowserDialog.dialog('open');
|
||||
// set up the browser and launch the dialog
|
||||
var initialDir = '';
|
||||
if (options.initialDir) {
|
||||
initialDir = options.initialDir;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
browse(initialDir, options.url, options.includeFiles);
|
||||
fileBrowserDialog.dialog('open');
|
||||
|
||||
$.fn.fileBrowser = function (options) {
|
||||
options = $.extend({}, $.Browser.defaults, options);
|
||||
// text field used for the result
|
||||
options.field = $(this);
|
||||
return false;
|
||||
};
|
||||
|
||||
if (options.field.autocomplete && options.autocompleteURL) {
|
||||
var query = '';
|
||||
options.field.autocomplete({
|
||||
position: { my : "top", at: "bottom", collision: "flipfit" },
|
||||
source: function (request, response) {
|
||||
//keep track of user submitted search term
|
||||
query = $.ui.autocomplete.escapeRegex(request.term, options.includeFiles);
|
||||
$.ajax({
|
||||
url: options.autocompleteURL,
|
||||
data: request,
|
||||
dataType: "json",
|
||||
success: function (data, item) {
|
||||
//implement a startsWith filter for the results
|
||||
var matcher = new RegExp("^" + query, "i");
|
||||
var a = $.grep(data, function (item, index) {
|
||||
return matcher.test(item);
|
||||
});
|
||||
response(a);
|
||||
}
|
||||
});
|
||||
},
|
||||
open: function (event, ui) {
|
||||
$(".ui-autocomplete li.ui-menu-item a").removeClass("ui-corner-all");
|
||||
$(".ui-autocomplete li.ui-menu-item:odd a").addClass("ui-menu-item-alternate");
|
||||
}
|
||||
})
|
||||
.data("ui-autocomplete")._renderItem = function (ul, item) {
|
||||
//highlight the matched search term from the item -- note that this is global and will match anywhere
|
||||
var result_item = item.label;
|
||||
var x = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "gi");
|
||||
result_item = result_item.replace(x, function (FullMatch, n) {
|
||||
return '<b>' + FullMatch + '</b>';
|
||||
});
|
||||
return $("<li></li>")
|
||||
.data("ui-autocomplete-item", item)
|
||||
.append("<a class='nowrap'>" + result_item + "</a>")
|
||||
.appendTo(ul);
|
||||
};
|
||||
}
|
||||
$.fn.fileBrowser = function(options){
|
||||
options = $.extend({}, $.Browser.defaults, options);
|
||||
// text field used for the result
|
||||
options.field = $(this);
|
||||
|
||||
var initialDir, path, callback, ls = false;
|
||||
// if the text field is empty and we're given a key then populate it with the last browsed value from localStorage
|
||||
try { ls = !!(localStorage.getItem); } catch (e) {}
|
||||
if (ls && options.key) {
|
||||
path = localStorage['fileBrowser-' + options.key];
|
||||
}
|
||||
if (options.key && options.field.val().length == 0 && (path)) {
|
||||
options.field.val(path);
|
||||
}
|
||||
if (options.field.autocomplete && options.autocompleteURL) {
|
||||
var query = '';
|
||||
options.field.autocomplete({
|
||||
position: {my: 'top', at: 'bottom', collision: 'flipfit'},
|
||||
source: function(request, response){
|
||||
//keep track of user submitted search term
|
||||
query = $.ui.autocomplete.escapeRegex(request.term, options.includeFiles);
|
||||
$.ajax({
|
||||
url: options.autocompleteURL,
|
||||
data: request,
|
||||
dataType: 'json',
|
||||
success: function(data){
|
||||
//implement a startsWith filter for the results
|
||||
var matcher = new RegExp('^' + query, 'i');
|
||||
var a = $.grep(data, function(item){
|
||||
return matcher.test(item);
|
||||
});
|
||||
response(a);
|
||||
}
|
||||
});
|
||||
},
|
||||
open: function(){
|
||||
$('.ui-autocomplete li.ui-menu-item a').removeClass('ui-corner-all');
|
||||
$('.ui-autocomplete li.ui-menu-item:odd a').addClass('ui-menu-item-alternate');
|
||||
}
|
||||
}).data('ui-autocomplete')._renderItem = function(ul, item){
|
||||
//highlight the matched search term from the item -- note that this is global and will match anywhere
|
||||
var resultItem = item.label;
|
||||
var x = new RegExp('(?![^&;]+;)(?!<[^<>]*)(' + query + ')(?![^<>]*>)(?![^&;]+;)', 'gi');
|
||||
resultItem = resultItem.replace(x, function(fullMatch){
|
||||
return '<b>' + fullMatch + '</b>';
|
||||
});
|
||||
return $('<li></li>')
|
||||
.data('ui-autocomplete-item', item)
|
||||
.append('<a class="nowrap">' + resultItem + '</a>')
|
||||
.appendTo(ul);
|
||||
};
|
||||
}
|
||||
|
||||
callback = function (path, options) {
|
||||
// store the browsed path to the associated text field
|
||||
options.field.val(path);
|
||||
var path, callback, ls = false;
|
||||
// if empty text field and given a key then populate it with the last browsed value from localStorage
|
||||
try { ls = !!(localStorage.getItem); } catch (e) {}
|
||||
if (ls && options.key) {
|
||||
path = localStorage['fileBrowser-' + options.key];
|
||||
}
|
||||
if (options.key && options.field.val().length == 0 && (path)) {
|
||||
options.field.val(path);
|
||||
}
|
||||
|
||||
// use a localStorage to remember for next time -- no ie6/7
|
||||
if (ls && options.key) {
|
||||
localStorage['fileBrowser-' + options.key] = path;
|
||||
}
|
||||
callback = function(path, options){
|
||||
// store the browsed path to the associated text field
|
||||
options.field.val(path);
|
||||
|
||||
};
|
||||
// use a localStorage to remember for next time -- no ie6/7
|
||||
if (ls && options.key) {
|
||||
localStorage['fileBrowser-' + options.key] = path;
|
||||
}
|
||||
};
|
||||
|
||||
initialDir = options.field.val() || (options.key && path) || '';
|
||||
|
||||
options = $.extend(options, {initialDir: initialDir});
|
||||
|
||||
// append the browse button and give it a click behaviour
|
||||
return options.field.addClass('fileBrowserField').after($('<input type="button" value="Browse…" class="btn btn-inline fileBrowser" />').click(function () {
|
||||
$(this).nFileBrowser(callback, options);
|
||||
return false;
|
||||
}));
|
||||
};
|
||||
options.field.addClass('fileBrowserField');
|
||||
if (options.showBrowseButton) {
|
||||
// append the browse button and give it a click behaviour
|
||||
options.field.after(
|
||||
$('<input type="button" value="Browse…" class="btn btn-inline fileBrowser">').on('click',
|
||||
function(){
|
||||
$(this).nFileBrowser(callback, $.extend(
|
||||
{}, options, {initialDir: options.field.val() || (options.key && path) || ''}
|
||||
));
|
||||
return false;
|
||||
}));
|
||||
}
|
||||
return options.field;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
@ -30,17 +30,18 @@ except ImportError:
|
|||
from lib import simplejson as json
|
||||
|
||||
# this is for the drive letter code, it only works on windows
|
||||
if os.name == 'nt':
|
||||
if 'nt' == os.name:
|
||||
from ctypes import windll
|
||||
|
||||
|
||||
# adapted from http://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python/827490
|
||||
# adapted from
|
||||
# http://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python/827490
|
||||
def getWinDrives():
|
||||
""" Return list of detected drives """
|
||||
assert os.name == 'nt'
|
||||
assert 'nt' == os.name
|
||||
|
||||
drives = []
|
||||
bitmask = windll.kernel32.GetLogicalDrives() #@UndefinedVariable
|
||||
bitmask = windll.kernel32.GetLogicalDrives()
|
||||
for letter in string.uppercase:
|
||||
if bitmask & 1:
|
||||
drives.append(letter)
|
||||
|
@ -56,54 +57,67 @@ def foldersAtPath(path, includeParent=False, includeFiles=False):
|
|||
"""
|
||||
|
||||
# walk up the tree until we find a valid path
|
||||
while path and not os.path.isdir(path):
|
||||
if path == os.path.dirname(path):
|
||||
while path and not ek.ek(os.path.isdir, path):
|
||||
if path == ek.ek(os.path.dirname, path):
|
||||
path = ''
|
||||
break
|
||||
else:
|
||||
path = os.path.dirname(path)
|
||||
path = ek.ek(os.path.dirname, path)
|
||||
|
||||
if path == '':
|
||||
if os.name == 'nt':
|
||||
entries = [{'current_path': 'Root'}]
|
||||
if '' == path:
|
||||
if 'nt' == os.name:
|
||||
entries = [{'currentPath': '\My Computer'}]
|
||||
for letter in getWinDrives():
|
||||
letterPath = '%s:\\' % letter
|
||||
entries.append({'name': letterPath, 'path': letterPath})
|
||||
letter_path = '%s:\\' % letter
|
||||
entries.append({'name': letter_path, 'path': letter_path})
|
||||
return entries
|
||||
else:
|
||||
path = '/'
|
||||
|
||||
# fix up the path and find the parent
|
||||
path = os.path.abspath(os.path.normpath(path))
|
||||
parentPath = os.path.dirname(path)
|
||||
path = ek.ek(os.path.abspath, ek.ek(os.path.normpath, path))
|
||||
parent_path = ek.ek(os.path.dirname, path)
|
||||
|
||||
# if we're at the root then the next step is the meta-node showing our drive letters
|
||||
if path == parentPath and os.name == 'nt':
|
||||
parentPath = ''
|
||||
if 'nt' == os.name and path == parent_path:
|
||||
parent_path = ''
|
||||
|
||||
try:
|
||||
fileList = [{'name': filename, 'path': ek.ek(os.path.join, path, filename)} for filename in
|
||||
ek.ek(os.listdir, path)]
|
||||
file_list = get_file_list(path, includeFiles)
|
||||
except OSError as e:
|
||||
logger.log(u'Unable to open %s: %r / %s' % (path, e, e), logger.WARNING)
|
||||
fileList = [{'name': filename, 'path': ek.ek(os.path.join, parentPath, filename)} for filename in
|
||||
ek.ek(os.listdir, parentPath)]
|
||||
file_list = get_file_list(parent_path, includeFiles)
|
||||
|
||||
if not includeFiles:
|
||||
fileList = filter(lambda entry: ek.ek(os.path.isdir, entry['path']), fileList)
|
||||
file_list = sorted(file_list, lambda x, y: cmp(ek.ek(os.path.basename, x['name']).lower(),
|
||||
ek.ek(os.path.basename, y['path']).lower()))
|
||||
|
||||
# prune out directories to proect the user from doing stupid things (already lower case the dir to reduce calls)
|
||||
hideList = ['boot', 'bootmgr', 'cache', 'msocache', 'recovery', '$recycle.bin', 'recycler',
|
||||
'system volume information', 'temporary internet files'] # windows specific
|
||||
hideList += ['.fseventd', '.spotlight', '.trashes', '.vol', 'cachedmessages', 'caches', 'trash'] # osx specific
|
||||
fileList = filter(lambda entry: entry['name'].lower() not in hideList, fileList)
|
||||
entries = [{'currentPath': path}]
|
||||
if includeParent and path != parent_path:
|
||||
entries.append({'name': '..', 'path': parent_path})
|
||||
entries.extend(file_list)
|
||||
|
||||
fileList = sorted(fileList,
|
||||
lambda x, y: cmp(os.path.basename(x['name']).lower(), os.path.basename(y['path']).lower()))
|
||||
return entries
|
||||
|
||||
entries = [{'current_path': path}]
|
||||
if includeParent and parentPath != path:
|
||||
entries.append({'name': '..', 'path': parentPath})
|
||||
entries.extend(fileList)
|
||||
|
||||
return entries
|
||||
def get_file_list(path, include_files):
|
||||
|
||||
result = []
|
||||
|
||||
hide_names = [
|
||||
# windows specific
|
||||
'boot', 'bootmgr', 'cache', 'config.msi', 'msocache', 'recovery', '$recycle.bin', 'recycler',
|
||||
'system volume information', 'temporary internet files',
|
||||
# osx specific
|
||||
'.fseventd', '.spotlight', '.trashes', '.vol', 'cachedmessages', 'caches', 'trash',
|
||||
# general
|
||||
'.git']
|
||||
|
||||
# filter directories to protect
|
||||
for name in ek.ek(os.listdir, path):
|
||||
if name.lower() not in hide_names:
|
||||
path_file = ek.ek(os.path.join, path, name)
|
||||
is_dir = ek.ek(os.path.isdir, path_file)
|
||||
if include_files or is_dir:
|
||||
result.append({'name': name, 'path': path_file, 'isFile': (1, 0)[is_dir]})
|
||||
|
||||
return result
|
||||
|
|
|
@ -3366,6 +3366,13 @@ class Manage(MainHandler):
|
|||
cur_show_dir = ek.ek(os.path.basename, showObj._location)
|
||||
if cur_root_dir in dir_map and cur_root_dir != dir_map[cur_root_dir]:
|
||||
new_show_dir = ek.ek(os.path.join, dir_map[cur_root_dir], cur_show_dir)
|
||||
if 'nt' != os.name and ':\\' in cur_show_dir:
|
||||
cur_show_dir = showObj._location.split('\\')[-1]
|
||||
try:
|
||||
base_dir = dir_map[cur_root_dir].rsplit(cur_show_dir)[0].rstrip('/')
|
||||
except IndexError:
|
||||
base_dir = dir_map[cur_root_dir]
|
||||
new_show_dir = ek.ek(os.path.join, base_dir, cur_show_dir)
|
||||
logger.log(
|
||||
u'For show ' + showObj.name + ' changing dir from ' + showObj._location + ' to ' + new_show_dir)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue