Example #1
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 #2
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
Example #3
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 #4
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 #5
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 #6
0
 def handle_update(self, data):
     revision = find_daap_tag('musr', decode_response(data))
     self.old_revision = self.revision
     self.revision = revision
Example #7
0
 def handle_db(self, data):
     db_list = find_daap_tag('mlcl', decode_response(data))
     # Just get the first one.
     db = find_daap_tag('mlit', db_list)
     self.db_id = find_daap_tag('miid', db)
     self.db_name = find_daap_tag('minm', db)
Example #8
0
 def handle_login(self, data):
     self.session = find_daap_tag('mlid', decode_response(data))
Example #9
0
 def handle_server_info(self, data):
     update = find_daap_tag('msup', decode_response(data))
     self.supports_update = True if update else False
Example #10
0
 def handle_db(self, data):
     db_list = find_daap_tag('mlcl', decode_response(data))
     # Just get the first one.
     db = find_daap_tag('mlit', db_list)
     self.db_id = find_daap_tag('miid', db)
     self.db_name = find_daap_tag('minm', db)
Example #11
0
 def handle_login(self, data):
     self.session = find_daap_tag('mlid', decode_response(data))
Example #12
0
 def handle_update(self, data):
     revision = find_daap_tag('musr', decode_response(data))
     self.old_revision = self.revision
     self.revision = revision
Example #13
0
 def handle_server_info(self, data):
     update = find_daap_tag('msup', decode_response(data))
     self.supports_update = True if update else False