mopidy / mopidy-local-sqlite

DEPRECATED (Mopidy SQLite local library extension)
https://mopidy.com
Apache License 2.0
30 stars 10 forks source link

Empty albums via browsing if albumartist is missing #53

Closed tkem closed 9 years ago

tkem commented 9 years ago

If an album does not contain an albumartist, it may be reported as empty when browsed via Artists/<artist>/<album>, due to a malformed artist URI.

INFO     2015-03-05 10:06:39,151 [9591:MpdSession-24] mopidy.mpd.session
  New MPD connection from [::ffff:127.0.0.1]:57313
DEBUG    2015-03-05 10:06:39,152 [9591:MpdSession-24] mopidy.mpd.session
  Request from [::ffff:127.0.0.1]:57313: lsinfo "Local media/Artists/Vampire Weekend/Modern Vampires of the City"
DEBUG    2015-03-05 10:06:39,154 [9591:LocalBackend-4] mopidy_local_sqlite.schema
  SQLite browse query []: 
    SELECT 'artist' AS type, uri AS uri, name AS name
      FROM artist
     WHERE EXISTS (
                SELECT * FROM track WHERE track.artists = artist.uri
            ) OR EXISTS (
                SELECT * FROM album WHERE album.artists = artist.uri
            )
     ORDER BY type, name

DEBUG    2015-03-05 10:06:39,155 [9591:LocalBackend-4] mopidy_local_sqlite.schema
  SQLite browse query [u'local:artist:md5:5cb761c4aaf2977354756b081b66374f']: 
    SELECT 'album' AS type, uri AS uri, name AS name
      FROM album
     WHERE artists = ?
     ORDER BY type, name

DEBUG    2015-03-05 10:06:39,155 [9591:LocalBackend-4] mopidy_local_sqlite.schema
  SQLite browse query [u'local:artist:md5:5cb761c4aaf2977354756b081b66374f']: 
    SELECT CASE WHEN album.uri IS NULL THEN 'track' ELSE 'album' END AS type,
           coalesce(album.uri, track.uri) AS uri,
           coalesce(album.name, track.name) AS name
      FROM track LEFT OUTER JOIN album ON track.album = album.uri
     WHERE track.artists = ?
     GROUP BY coalesce(album.uri, track.uri)
     ORDER BY type, name

DEBUG    2015-03-05 10:06:39,156 [9591:LocalBackend-4] mopidy_local_sqlite.schema
  SQLite browse query [u'local:album:md5:b31168f3158e1a7c87c357ec45166138', u'local:directory?album=local:album:md5:cb66bdd94f5a29ffcecfb3501e8a76b1&type=track&artist=local:artist:md5:5cb761c4aaf2977354756b081b66374f']: 
    SELECT 'track' AS type, uri AS uri, name AS name
      FROM track
     WHERE album = ? AND artists = ?
     ORDER BY disc_no, track_no, name

DEBUG    2015-03-05 10:06:39,157 [9591:MpdSession-24] mopidy.mpd.session
  Response to [::ffff:127.0.0.1]:57313: OK
DEBUG    2015-03-05 10:06:39,162 [9591:MpdSession-24] mopidy.utils.network
  Client most likely disconnected.
DEBUG    2015-03-05 10:06:39,163 [9591:MpdSession-24] mopidy.utils.network
  Already stopping: Actor is shutting down.

Apparently, this does not always occur, but can reproduced if two or more albums without albumartist tags exist for a single artist.