mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -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
|
@ -35,6 +35,7 @@ from beets.plugins import BeetsPlugin
|
|||
from beets.ui import Subcommand, decargs
|
||||
from beets import util
|
||||
from beets.util.artresizer import ArtResizer, get_im_version, get_pil_version
|
||||
import six
|
||||
|
||||
|
||||
BASE_DIR = os.path.join(BaseDirectory.xdg_cache_home, "thumbnails")
|
||||
|
@ -162,15 +163,16 @@ class ThumbnailsPlugin(BeetsPlugin):
|
|||
See http://standards.freedesktop.org/thumbnail-spec/latest/x227.html
|
||||
"""
|
||||
uri = self.get_uri(path)
|
||||
hash = md5(uri).hexdigest()
|
||||
return b"{0}.png".format(hash)
|
||||
hash = md5(uri.encode('utf-8')).hexdigest()
|
||||
return util.bytestring_path("{0}.png".format(hash))
|
||||
|
||||
def add_tags(self, album, image_path):
|
||||
"""Write required metadata to the thumbnail
|
||||
See http://standards.freedesktop.org/thumbnail-spec/latest/x142.html
|
||||
"""
|
||||
mtime = os.stat(album.artpath).st_mtime
|
||||
metadata = {"Thumb::URI": self.get_uri(album.artpath),
|
||||
"Thumb::MTime": unicode(os.stat(album.artpath).st_mtime)}
|
||||
"Thumb::MTime": six.text_type(mtime)}
|
||||
try:
|
||||
self.write_metadata(image_path, metadata)
|
||||
except Exception:
|
||||
|
@ -183,7 +185,8 @@ class ThumbnailsPlugin(BeetsPlugin):
|
|||
return
|
||||
artfile = os.path.split(album.artpath)[1]
|
||||
with open(outfilename, 'w') as f:
|
||||
f.write(b"[Desktop Entry]\nIcon=./{0}".format(artfile))
|
||||
f.write('[Desktop Entry]\n')
|
||||
f.write('Icon=./{0}'.format(artfile.decode('utf-8')))
|
||||
f.close()
|
||||
self._log.debug(u"Wrote file {0}", util.displayable_path(outfilename))
|
||||
|
||||
|
@ -232,7 +235,7 @@ def copy_c_string(c_string):
|
|||
# work. A more surefire way would be to allocate a ctypes buffer and copy
|
||||
# the data with `memcpy` or somesuch.
|
||||
s = ctypes.cast(c_string, ctypes.c_char_p).value
|
||||
return '' + s
|
||||
return b'' + s
|
||||
|
||||
|
||||
class GioURI(URIGetter):
|
||||
|
@ -271,8 +274,6 @@ class GioURI(URIGetter):
|
|||
|
||||
try:
|
||||
uri_ptr = self.libgio.g_file_get_uri(g_file_ptr)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
self.libgio.g_object_unref(g_file_ptr)
|
||||
if not uri_ptr:
|
||||
|
@ -282,8 +283,12 @@ class GioURI(URIGetter):
|
|||
|
||||
try:
|
||||
uri = copy_c_string(uri_ptr)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
self.libgio.g_free(uri_ptr)
|
||||
return uri
|
||||
|
||||
try:
|
||||
return uri.decode(util._fsencoding())
|
||||
except UnicodeDecodeError:
|
||||
raise RuntimeError(
|
||||
"Could not decode filename from GIO: {!r}".format(uri)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue