Closed LawnGnome closed 9 years ago
Did some experimenting. I can turn one of these into a PR if you want.
Basically, GoogleMusicActions._sanitizePath
should return either a properly encoded UTF-8 string (which works great for me on Android, but might fail miserably on Windows — I don't really know anything about how Python and Windows interact on that front) or the lowest common denominator ASCII string. Both options are below.
def _sanitizePath(self, name):
name = "".join(i for i in name if i not in "\/:*?<>|,;$%\"\'.`")
if len(name) > 50: name = name[:50]
return name.decode("utf8", "ignore").encode("utf8").strip()
As I said, this works really nicely on Android (and should be fine on Linux), but I don't know how portable this will be.
def _sanitizePath(self, name):
name = "".join(i for i in name if i not in "\/:*?<>|,;$%\"\'.`")
if len(name) > 50: name = name[:50]
return name.decode("utf8", "ignore").encode("ascii", "backslashreplace").replace("\\x", "_x").replace("\\u", "_u").strip()
This results in ugly file names (for instance, Sigur Rós
becomes Sigur R_xf3s
) but should work everywhere.
Thank you, I'll add your fix for the next version.
Please test this version: https://app.box.com/s/d0h56sddqomwj46f8amipcebjikpf2w5
closing for inactivity
Using 1.4alpha1, I'm getting the following error when I try to export My Library:
Since I have a few artists and albums in my library that have non-ASCII characters in them (
Sigur Rós
andf♯a♯∞
being the obvious ones that come to mind), I'm guessing the Python script is choking on one of them.