Example #1
0
 def handle_items(self, data, playlist_id, meta):
     r = decode_response(data)
     listing = find_daap_tag("mlcl", r)
     deleted = find_daap_tag("mudl", r)
     meta_list = [m.strip() for m in meta.split(",")]
     itemdict = dict()
     deleted_list = []
     if listing is not None:
         for item in find_daap_listitems(listing):
             itemid = find_daap_tag("miid", item)
             itemdict[itemid] = dict()
             for m in meta_list:
                 try:
                     itemdict[itemid][m] = find_daap_tag(dmap_consts_rmap[m], item)
                 except KeyError:
                     continue
     if deleted is not None:
         for item_id in find_daap_listitems(deleted):
             deleted_list.append(item_id)
     self.daap_items = itemdict, deleted_list
Example #2
0
 def handle_items(self, data, playlist_id, meta):
     r = decode_response(data)
     listing = find_daap_tag('mlcl', r)
     deleted = find_daap_tag('mudl', r)
     meta_list = [m.strip() for m in meta.split(',')]
     itemdict = dict()
     deleted_list = []
     if listing is not None:
         for item in find_daap_listitems(listing):
             itemid = find_daap_tag('miid', item)
             itemdict[itemid] = dict()
             for m in meta_list:
                 try:
                     itemdict[itemid][m] = find_daap_tag(
                         dmap_consts_rmap[m], item)
                 except KeyError:
                     continue
     if deleted is not None:
         for item_id in find_daap_listitems(deleted):
             deleted_list.append(item_id)
     self.daap_items = itemdict, deleted_list
Example #3
0
    def handle_playlist(self, data, meta):
        r = decode_response(data)
        listing = find_daap_tag('mlcl', r)
        deleted = find_daap_tag('mudl', r)
        playlist_dict = dict()
        deleted_list = []
        meta_list = [m.strip() for m in meta.split(',')]
        if listing is not None:
            for item in find_daap_listitems(listing):
                playlist_id = find_daap_tag('miid', item)
                playlist_dict[playlist_id] = dict()
                for m in meta_list:
                    try:
                        playlist_dict[playlist_id][m] = find_daap_tag(
                            dmap_consts_rmap[m], item)
                    except KeyError:
                        continue
        if deleted is not None:
            for item_id in find_daap_listitems(deleted):
                deleted_list.append(item_id)

        self.daap_playlists = (playlist_dict, deleted_list)
Example #4
0
 def handle_playlist(self, data, meta):
     listing = find_daap_tag('mlcl', decode_response(data))
     playlist_dict = dict()
     meta_list = [m.strip() for m in meta.split(',')]
     for item in find_daap_listitems(listing):
         playlist_id = find_daap_tag('miid', item)
         playlist_dict[playlist_id] = dict()
         for m in meta_list:
             try:
                 playlist_dict[playlist_id][m] = find_daap_tag(
                                                 dmap_consts_rmap[m], item)
             except KeyError:
                 continue
     self.daap_playlists = playlist_dict
Example #5
0
 def handle_items(self, data, playlist_id, meta):
     listing = find_daap_tag('mlcl', decode_response(data))
     itemdict = dict()
     if not listing:
         self.daap_items = dict()    # dummy empty
         return
     meta_list = [m.strip() for m in meta.split(',')]
     for item in find_daap_listitems(listing):
         itemid = find_daap_tag('miid', item)
         itemdict[itemid] = dict()
         for m in meta_list:
             try:
                 itemdict[itemid][m] = find_daap_tag(
                                       dmap_consts_rmap[m], item)
             except KeyError:
                 continue
     self.daap_items = itemdict