
import mpd

SERVER = "localhost"
PORT = 6600


def connect(mpdclient):
    """
    Handle connection to the mpd server
    """
    mpdclient.connect(SERVER, PORT)


mpdclient = mpd.MPDClient()
connect(mpdclient)
bands = set(mpdclient.list("artist"))


import mpd

SERVER = "localhost"
PORT = 6600


def connect(mpdclient):
    """
    Handle connection to the mpd server
    """
    mpdclient.connect(SERVER, PORT)


mpdclient = mpd.MPDClient()
connect(mpdclient)
bands = set(str(artist).lower() for artist in mpdclient.list("artist")
            if artist != "")
print(bands)

Apply filters on artists to clean duplicates
Apply filters on artists to clean duplicates

  
  import mpd
  
  SERVER = "localhost"
  PORT = 6600
  
  
  def connect(mpdclient):
      """
      Handle connection to the mpd server
      """
      mpdclient.connect(SERVER, PORT)
  
  
  mpdclient = mpd.MPDClient()
  connect(mpdclient)
- bands = set(mpdclient.list("artist"))
+ bands = set(str(artist).lower() for artist in mpdclient.list("artist")
+             if artist != "")
+ print(bands)
  
Apply filters on artists to clean duplicates
## Code Before:

import mpd

SERVER = "localhost"
PORT = 6600


def connect(mpdclient):
    """
    Handle connection to the mpd server
    """
    mpdclient.connect(SERVER, PORT)


mpdclient = mpd.MPDClient()
connect(mpdclient)
bands = set(mpdclient.list("artist"))

## Instruction:
Apply filters on artists to clean duplicates
## Code After:

import mpd

SERVER = "localhost"
PORT = 6600


def connect(mpdclient):
    """
    Handle connection to the mpd server
    """
    mpdclient.connect(SERVER, PORT)


mpdclient = mpd.MPDClient()
connect(mpdclient)
bands = set(str(artist).lower() for artist in mpdclient.list("artist")
            if artist != "")
print(bands)
