Rev 76 | Rev 2051 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
import mathdef getscore(struct) :score = 0.0if struct.has_key("features") :features = struct.get("features")if features.has_key("Resolution") :resolution = features.get("Resolution")if len(resolution) > 0 :resolution = float(resolution[0])print "resolution=" + `resolution`# Resolution : <=2 - 1, <=3 - 2, >3 - 3if resolution <= 2 :score = score + 1elif resolution <= 3 :score = score + 2elif resolution > 3 :score = score + 3if features.has_key("Flash") :flash = features.get("Flash")if len(flash) > 0 :flash = flash[0]print "flash=" + `flash`# Flash : LED - 0.5, Dual-LED - 1.0if flash == "LED" :print "Value is LED"score = score + 0.5elif flash == "Dual-LED" :score = score + 1if features.has_key("Still Image Formats") :siformats = features.get("Still Image Formats")print "siformats=" + `siformats`# Still Image Formats : count <=2 - 0.5, >2 - 1if len(siformats) <= 2 :score = score + 0.5elif len(siformats) > 2 :score = score + 1if features.has_key("Additional Camera features") :# Additional Camera features : 1, 0score = score + 1if struct.has_key("childrenslides") :childrenslides = struct.get("childrenslides")if childrenslides.has_key("Number of Cameras") :nfcs = childrenslides.get("Number of Cameras")if nfcs.has_key("features") :features = nfcs.get("features")# Number of Cameras > Primary camera : 1, 0if features.has_key("Primary camera") :score = score + 1# Number of Cameras > Secondary camera : 1, 0if features.has_key("Secondary camera") :score = score + 1return int(math.floor(score))