Rev 78 | Rev 1915 | 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")# Screen Size : <=2 - 1, <=2.5 - 2, > 2.5 - 3if features.has_key("Screen Size") :ss = features.get("Screen Size")if len(ss) > 0 :ss = ss[0]ss = float(ss)print "ss=" + `ss`if ss <= 2 :score += 1elif ss <= 2.5 :score += 2elif ss > 2.5 :score += 3# Resolution : 320x240 px - 1, 480x360 px - 2if features.has_key("Resolution") :res = features.get("Resolution")if len(res) > 1 :width = int(res[0])height = int(res[1])print "width=" + `width`print "height=" + `height`if width <= 320 :score += 1elif width > 320 :score += 2# Number of Colors : 64 K - 0.5, 256 K - 1, 16 M - 1.5, 4 B - 2if features.has_key("Number of Colors") :nfcs = features.get("Number of Colors")if len(nfcs) > 0 :nfcs = nfcs[0]if nfcs == "64 K" :score += 0.5elif nfcs == "256 K" :score += 1elif nfcs == "16 M" :score += 1.5elif nfcs == "4 B" :score += 2# REVISIT# Type : TFT - 1, Others - 0.5if features.has_key("Type") :type = features.get("Type")if len(type) > 0 :type = type[0]if type == "TFT" :score += 1else :score += 0.5return int(math.floor(score))