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
f89a6e3c
Commit
f89a6e3c
authored
9 years ago
by
labrys
Browse files
Options
Downloads
Patches
Plain Diff
Refactor internal variables
Standardize strings
parent
c6fd7956
No related branches found
No related tags found
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 @
f89a6e3c
...
...
@@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
unicode_literals
import
os
import
string
...
...
@@ -43,31 +45,31 @@ def getWinDrives():
def
getFileList
(
path
,
includeFiles
):
# 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
"
,
"
recycler
"
,
"
system volume information
"
,
"
temporary internet files
"
]
# windows specific
hide
L
ist
+=
[
"
.fseventd
"
,
"
.spotlight
"
,
"
.trashes
"
,
"
.vol
"
,
"
cachedmessages
"
,
"
caches
"
,
"
trash
"
]
# osx specific
hide
L
ist
+=
[
"
.git
"
]
hide
_l
ist
=
[
'
boot
'
,
'
bootmgr
'
,
'
cache
'
,
'
config.msi
'
,
'
msocache
'
,
'
recovery
'
,
'
$recycle.bin
'
,
'
recycler
'
,
'
system volume information
'
,
'
temporary internet files
'
]
# windows specific
hide
_l
ist
+=
[
'
.fseventd
'
,
'
.spotlight
'
,
'
.trashes
'
,
'
.vol
'
,
'
cachedmessages
'
,
'
caches
'
,
'
trash
'
]
# osx specific
hide
_l
ist
+=
[
'
.git
'
]
file
L
ist
=
[]
file
_l
ist
=
[]
for
filename
in
ek
(
os
.
listdir
,
path
):
if
filename
.
lower
()
in
hide
L
ist
:
if
filename
.
lower
()
in
hide
_l
ist
:
continue
full
F
ilename
=
ek
(
os
.
path
.
join
,
path
,
filename
)
is
D
ir
=
ek
(
os
.
path
.
isdir
,
full
F
ilename
)
full
_f
ilename
=
ek
(
os
.
path
.
join
,
path
,
filename
)
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
entry
=
{
'
name
'
:
filename
,
'
path
'
:
full
F
ilename
'
path
'
:
full
_f
ilename
}
if
not
is
D
ir
:
if
not
is
_d
ir
:
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
):
...
...
@@ -88,36 +90,36 @@ def foldersAtPath(path, includeParent=False, includeFiles=False):
else
:
path
=
ek
(
os
.
path
.
dirname
,
path
)
if
path
==
""
:
if
path
==
''
:
if
os
.
name
==
'
nt
'
:
entries
=
[{
'
currentPath
'
:
'
Root
'
}]
for
letter
in
getWinDrives
():
letter
P
ath
=
letter
+
'
:
\\
'
entries
.
append
({
'
name
'
:
letter
P
ath
,
'
path
'
:
letter
P
ath
})
letter
_p
ath
=
letter
+
'
:
\\
'
entries
.
append
({
'
name
'
:
letter
_p
ath
,
'
path
'
:
letter
_p
ath
})
return
entries
else
:
path
=
'
/
'
# fix up the path and find the parent
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
path
==
parent
P
ath
and
os
.
name
==
'
nt
'
:
parent
P
ath
=
""
if
path
==
parent
_p
ath
and
os
.
name
==
'
nt
'
:
parent
_p
ath
=
''
try
:
file
L
ist
=
getFileList
(
path
,
includeFiles
)
file
_l
ist
=
getFileList
(
path
,
includeFiles
)
except
OSError
as
e
:
logger
.
log
(
u
"
Unable to open
"
+
path
+
"
:
"
+
repr
(
e
)
+
"
/
"
+
str
(
e
),
logger
.
WARNING
)
file
L
ist
=
getFileList
(
parent
P
ath
,
includeFiles
)
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
=
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
()))
entries
=
[{
'
currentPath
'
:
path
}]
if
includeParent
and
parent
P
ath
!=
path
:
entries
.
append
({
'
name
'
:
"
..
"
,
'
path
'
:
parent
P
ath
})
entries
.
extend
(
file
L
ist
)
if
includeParent
and
parent
_p
ath
!=
path
:
entries
.
append
({
'
name
'
:
'
..
'
,
'
path
'
:
parent
_p
ath
})
entries
.
extend
(
file
_l
ist
)
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