entity[ "price"] = '0' # there is no price information avialable inInfo = False print ":: Starting to parse entitySource" for i in range(len(entitySource)): entline = entitySource[i] #raw_input('now parsing entity source html') if start_info_section_identifier in entline: print ":: Found information HTML block" inInfo = True if inInfo: # look for ids in entline: for idkey, idval in ids.iteritems( ): # gather out the information as required if idval[0] in entitySource[i]: entity[idkey] = utils.get_info(entitySource[i + 2]) i = i + 2 #print entity[idkey] #raw_input("info above") if end_info_section_identifier in entline and inInfo is True: inInfo = False print ":: End of information HTML block" fiction[entity["id"]] = [] if None in entity.values(): none_keys = [] for k, v in entity.iteritems(): if v is None and k is not "type": none_keys.append(k) if k not in ["pricerange", "price"]: fiction[entity["id"]].append(k)
audioorder[val] = True if idkey == "hdmi": if idval[0] in entline: entity["hdmi"] += utils.get_info_hdmi(entline) if idkey == "accessories": for val in idval: if val in entline: entity["accessories"] += accessories_replacement[val] + ', ' else: if idval[0] in entline: # easier slots, with only 1 thing to look for if idkey == "usb": entity[idkey] = utils.get_usb_info(entline) if idkey == "cabinet": entity[idkey] = utils.get_info_cabinet(entline) elif idkey in ['screensize','eco','power', 'weight']: entity[idkey] = utils.get_info(entline) elif idkey == 'pixels': entity[idkey] = utils.get_info_pixels(entline) if end_info_section_identifier in entline: # FINALISE Audio if audioorder["Audyssey"]: entity["audio"] = "Audyssey" elif audioorder["CEVO"]: entity["audio"] = "CEVO" else: entity["audio"] = "NICAM" # On first run thru - add the screen size info: screensizeranges.append(float(entity["screensize"])) # Usinge above after running once already, determined the following for screensize binning: entity["screensizerange"] = utils.bin_screensize(entity["screensize"]) print ":: End of information HTML block"
entity["kind"] = "desktop" entity["name"] = utils.get_name(entity_page) entity["price"] = "0" # there is no price information avialable inInfo = False print ":: Starting to parse entitySource" for i in range(len(entitySource)): entline = entitySource[i] # raw_input('now parsing entity source html') if start_info_section_identifier in entline: print ":: Found information HTML block" inInfo = True if inInfo: # look for ids in entline: for idkey, idval in ids.iteritems(): # gather out the information as required if idval[0] in entitySource[i]: entity[idkey] = utils.get_info(entitySource[i + 2]) i = i + 2 # print entity[idkey] # raw_input("info above") if end_info_section_identifier in entline and inInfo is True: inInfo = False print ":: End of information HTML block" fiction[entity["id"]] = [] if None in entity.values(): none_keys = [] for k, v in entity.iteritems(): if v is None and k is not "type": none_keys.append(k) if k not in ["pricerange", "price"]: fiction[entity["id"]].append(k)
if val in entline: entity[ "accessories"] += accessories_replacement[ val] + ', ' else: if idval[ 0] in entline: # easier slots, with only 1 thing to look for if idkey == "usb": entity[idkey] = utils.get_usb_info(entline) if idkey == "cabinet": entity[idkey] = utils.get_info_cabinet( entline) elif idkey in [ 'screensize', 'eco', 'power', 'weight' ]: entity[idkey] = utils.get_info(entline) elif idkey == 'pixels': entity[idkey] = utils.get_info_pixels( entline) if end_info_section_identifier in entline: # FINALISE Audio if audioorder["Audyssey"]: entity["audio"] = "Audyssey" elif audioorder["CEVO"]: entity["audio"] = "CEVO" else: entity["audio"] = "NICAM" # On first run thru - add the screen size info: screensizeranges.append(float(entity["screensize"])) # Usinge above after running once already, determined the following for screensize binning: entity["screensizerange"] = utils.bin_screensize(