]> kaliko git repositories - mpd-sima.git/commitdiff
Fixed double quote error, missing escape character (Closes #52)
authorkaliko <kaliko@azylum.org>
Fri, 18 Jun 2021 10:38:06 +0000 (12:38 +0200)
committerkaliko <kaliko@azylum.org>
Fri, 18 Jun 2021 10:38:06 +0000 (12:38 +0200)
sima/lib/meta.py
sima/mpdclient.py
tests/test_meta.py

index e6b9f46229554e008422017281de51db7d9be680..9e858a2bc972ffc1ef557bc27c41beb6f37cbf60 100644 (file)
@@ -61,8 +61,8 @@ def serialize(func):
     def wrapper(*args, **kwargs):
         ans = func(*args, **kwargs)
         if isinstance(ans, set):
-            return {s.replace("'", r"\'") for s in ans}
-        return ans.replace("'", r"\'")
+            return {s.replace("'", r"\'").replace('"', r'\"') for s in ans}
+        return ans.replace("'", r"\'").replace('"', r'\"')
     return wrapper
 
 
index 6b5b9767e95dd3eca58e3e1c6a16d7763da66c88..45d3dcdf767ab4bbc21c77a2629d45a0b60a3bbc 100644 (file)
@@ -365,15 +365,11 @@ class MPD(MPDClient):
 # #### Search Methods #####
     def _find_musicbrainz_artistid(self, artist):
         """Find MusicBrainzArtistID when possible.
-        For artist with aliases having a mbid but not the main name, no mbid is
-        fetched…
-        Searching for Artist('Russian Circls') do not reslove the MBID
         """
         if not self.use_mbid:
             return None
         mbids = None
         for name in artist.names_sz:
-            self.log.debug(name)
             filt = f'((artist == "{name}") AND (MUSICBRAINZ_ARTISTID != ""))'
             mbids = self.list('MUSICBRAINZ_ARTISTID', filt)
             if mbids:
index aefd339d83934bc08b414643fbcb02cc4445bbe2..b8a36b5717c1d40da7c8bf0ec18abceb7d980c94 100644 (file)
@@ -125,6 +125,13 @@ class TestMetaObject(unittest.TestCase):
         self.assertEqual(heavens_door.name_sz, target)
         heavens_door = Artist(name=name)
         self.assertEqual(heavens_door.name_sz, target)
+        # Same with double quote
+        name = 'Bonnie "Prince" Billy'
+        bonnie = Meta(name=name)
+        target = r"Bonnie \"Prince\" Billy"
+        self.assertEqual(bonnie.name_sz, target)
+        self.assertEqual(bonnie.name, name)
+
 
 
 class TestArtistObject(unittest.TestCase):