mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
Update beets to 1.4.7
Also updates: - colorama-0.4.1 - jellyfish-0.6.1 - munkres-1.0.12 - musicbrainzngs-0.6 - mutagen-1.41.1 - pyyaml-3.13 - six-1.12.0 - unidecode-1.0.23
This commit is contained in:
parent
05b0fb498f
commit
e854005ae1
193 changed files with 15896 additions and 6384 deletions
|
@ -20,6 +20,7 @@ import os
|
|||
import stat
|
||||
import ctypes
|
||||
import sys
|
||||
import beets.util
|
||||
|
||||
|
||||
def _is_hidden_osx(path):
|
||||
|
@ -27,7 +28,7 @@ def _is_hidden_osx(path):
|
|||
|
||||
This uses os.lstat to work out if a file has the "hidden" flag.
|
||||
"""
|
||||
file_stat = os.lstat(path)
|
||||
file_stat = os.lstat(beets.util.syspath(path))
|
||||
|
||||
if hasattr(file_stat, 'st_flags') and hasattr(stat, 'UF_HIDDEN'):
|
||||
return bool(file_stat.st_flags & stat.UF_HIDDEN)
|
||||
|
@ -45,7 +46,7 @@ def _is_hidden_win(path):
|
|||
hidden_mask = 2
|
||||
|
||||
# Retrieve the attributes for the file.
|
||||
attrs = ctypes.windll.kernel32.GetFileAttributesW(path)
|
||||
attrs = ctypes.windll.kernel32.GetFileAttributesW(beets.util.syspath(path))
|
||||
|
||||
# Ensure we have valid attribues and compare them against the mask.
|
||||
return attrs >= 0 and attrs & hidden_mask
|
||||
|
@ -56,11 +57,12 @@ def _is_hidden_dot(path):
|
|||
|
||||
Files starting with a dot are seen as "hidden" files on Unix-based OSes.
|
||||
"""
|
||||
return os.path.basename(path).startswith('.')
|
||||
return os.path.basename(path).startswith(b'.')
|
||||
|
||||
|
||||
def is_hidden(path):
|
||||
"""Return whether or not a file is hidden.
|
||||
"""Return whether or not a file is hidden. `path` should be a
|
||||
bytestring filename.
|
||||
|
||||
This method works differently depending on the platform it is called on.
|
||||
|
||||
|
@ -73,10 +75,6 @@ def is_hidden(path):
|
|||
On any other operating systems (i.e. Linux), it uses `is_hidden_dot` to
|
||||
work out if a file is hidden.
|
||||
"""
|
||||
# Convert the path to unicode if it is not already.
|
||||
if not isinstance(path, unicode):
|
||||
path = path.decode('utf-8')
|
||||
|
||||
# Run platform specific functions depending on the platform
|
||||
if sys.platform == 'darwin':
|
||||
return _is_hidden_osx(path) or _is_hidden_dot(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue