Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
91d1af7e
Commit
91d1af7e
authored
Jan 10, 2016
by
Labrys of Knossos
Browse files
Options
Downloads
Plain Diff
Merge pull request #718 from SickRage/browser
Refactor internal variables
parents
c6fd7956
f89a6e3c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sickbeard/browser.py
+29
-27
29 additions, 27 deletions
sickbeard/browser.py
with
29 additions
and
27 deletions
sickbeard/browser.py
+
29
−
27
View file @
91d1af7e
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
unicode_literals
import
os
import
os
import
string
import
string
...
@@ -43,31 +45,31 @@ def getWinDrives():
...
@@ -43,31 +45,31 @@ def getWinDrives():
def
getFileList
(
path
,
includeFiles
):
def
getFileList
(
path
,
includeFiles
):
# prune out directories to protect the user from doing stupid things (already lower case the dir to reduce calls)
# prune out directories to protect the user from doing stupid things (already lower case the dir to reduce calls)
hide
L
ist
=
[
"
boot
"
,
"
bootmgr
"
,
"
cache
"
,
"
config.msi
"
,
"
msocache
"
,
"
recovery
"
,
"
$recycle.bin
"
,
hide
_l
ist
=
[
'
boot
'
,
'
bootmgr
'
,
'
cache
'
,
'
config.msi
'
,
'
msocache
'
,
'
recovery
'
,
'
$recycle.bin
'
,
"
recycler
"
,
"
system volume information
"
,
"
temporary internet files
"
]
# windows specific
'
recycler
'
,
'
system volume information
'
,
'
temporary internet files
'
]
# windows specific
hide
L
ist
+=
[
"
.fseventd
"
,
"
.spotlight
"
,
"
.trashes
"
,
"
.vol
"
,
"
cachedmessages
"
,
"
caches
"
,
"
trash
"
]
# osx specific
hide
_l
ist
+=
[
'
.fseventd
'
,
'
.spotlight
'
,
'
.trashes
'
,
'
.vol
'
,
'
cachedmessages
'
,
'
caches
'
,
'
trash
'
]
# osx specific
hide
L
ist
+=
[
"
.git
"
]
hide
_l
ist
+=
[
'
.git
'
]
file
L
ist
=
[]
file
_l
ist
=
[]
for
filename
in
ek
(
os
.
listdir
,
path
):
for
filename
in
ek
(
os
.
listdir
,
path
):
if
filename
.
lower
()
in
hide
L
ist
:
if
filename
.
lower
()
in
hide
_l
ist
:
continue
continue
full
F
ilename
=
ek
(
os
.
path
.
join
,
path
,
filename
)
full
_f
ilename
=
ek
(
os
.
path
.
join
,
path
,
filename
)
is
D
ir
=
ek
(
os
.
path
.
isdir
,
full
F
ilename
)
is
_d
ir
=
ek
(
os
.
path
.
isdir
,
full
_f
ilename
)
if
not
includeFiles
and
not
is
D
ir
:
if
not
includeFiles
and
not
is
_d
ir
:
continue
continue
entry
=
{
entry
=
{
'
name
'
:
filename
,
'
name
'
:
filename
,
'
path
'
:
full
F
ilename
'
path
'
:
full
_f
ilename
}
}
if
not
is
D
ir
:
if
not
is
_d
ir
:
entry
[
'
isFile
'
]
=
True
entry
[
'
isFile
'
]
=
True
file
L
ist
.
append
(
entry
)
file
_l
ist
.
append
(
entry
)
return
file
L
ist
return
file
_l
ist
def
foldersAtPath
(
path
,
includeParent
=
False
,
includeFiles
=
False
):
def
foldersAtPath
(
path
,
includeParent
=
False
,
includeFiles
=
False
):
...
@@ -88,36 +90,36 @@ def foldersAtPath(path, includeParent=False, includeFiles=False):
...
@@ -88,36 +90,36 @@ def foldersAtPath(path, includeParent=False, includeFiles=False):
else
:
else
:
path
=
ek
(
os
.
path
.
dirname
,
path
)
path
=
ek
(
os
.
path
.
dirname
,
path
)
if
path
==
""
:
if
path
==
''
:
if
os
.
name
==
'
nt
'
:
if
os
.
name
==
'
nt
'
:
entries
=
[{
'
currentPath
'
:
'
Root
'
}]
entries
=
[{
'
currentPath
'
:
'
Root
'
}]
for
letter
in
getWinDrives
():
for
letter
in
getWinDrives
():
letter
P
ath
=
letter
+
'
:
\\
'
letter
_p
ath
=
letter
+
'
:
\\
'
entries
.
append
({
'
name
'
:
letter
P
ath
,
'
path
'
:
letter
P
ath
})
entries
.
append
({
'
name
'
:
letter
_p
ath
,
'
path
'
:
letter
_p
ath
})
return
entries
return
entries
else
:
else
:
path
=
'
/
'
path
=
'
/
'
# fix up the path and find the parent
# fix up the path and find the parent
path
=
ek
(
os
.
path
.
abspath
,
ek
(
os
.
path
.
normpath
,
path
))
path
=
ek
(
os
.
path
.
abspath
,
ek
(
os
.
path
.
normpath
,
path
))
parent
P
ath
=
ek
(
os
.
path
.
dirname
,
path
)
parent
_p
ath
=
ek
(
os
.
path
.
dirname
,
path
)
# if we're at the root then the next step is the meta-node showing our drive letters
# if we're at the root then the next step is the meta-node showing our drive letters
if
path
==
parent
P
ath
and
os
.
name
==
'
nt
'
:
if
path
==
parent
_p
ath
and
os
.
name
==
'
nt
'
:
parent
P
ath
=
""
parent
_p
ath
=
''
try
:
try
:
file
L
ist
=
getFileList
(
path
,
includeFiles
)
file
_l
ist
=
getFileList
(
path
,
includeFiles
)
except
OSError
as
e
:
except
OSError
as
e
:
logger
.
log
(
u
"
Unable to open
"
+
path
+
"
:
"
+
repr
(
e
)
+
"
/
"
+
str
(
e
),
logger
.
WARNING
)
logger
.
log
(
'
Unable to open
%s: %s / %s
'
%
(
path
,
repr
(
e
),
str
(
e
)
)
,
logger
.
WARNING
)
file
L
ist
=
getFileList
(
parent
P
ath
,
includeFiles
)
file
_l
ist
=
getFileList
(
parent
_p
ath
,
includeFiles
)
file
L
ist
=
sorted
(
file
L
ist
,
file
_l
ist
=
sorted
(
file
_l
ist
,
lambda
x
,
y
:
cmp
(
ek
(
os
.
path
.
basename
,
x
[
'
name
'
]).
lower
(),
ek
(
os
.
path
.
basename
,
y
[
'
path
'
]).
lower
()))
lambda
x
,
y
:
cmp
(
ek
(
os
.
path
.
basename
,
x
[
'
name
'
]).
lower
(),
ek
(
os
.
path
.
basename
,
y
[
'
path
'
]).
lower
()))
entries
=
[{
'
currentPath
'
:
path
}]
entries
=
[{
'
currentPath
'
:
path
}]
if
includeParent
and
parent
P
ath
!=
path
:
if
includeParent
and
parent
_p
ath
!=
path
:
entries
.
append
({
'
name
'
:
"
..
"
,
'
path
'
:
parent
P
ath
})
entries
.
append
({
'
name
'
:
'
..
'
,
'
path
'
:
parent
_p
ath
})
entries
.
extend
(
file
L
ist
)
entries
.
extend
(
file
_l
ist
)
return
entries
return
entries
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment