#### vuplus
#Normal, LShift(42), RAlt(100), LShift+RAlt(100+42)/LArt(56)
vukeymap_us_de = {
- "2":[u"1", u"!", None, None]
- , "3":[u"2", u"@", None, None]
- , "4":[u"3", u"#", None, '\xc2\xa3']
- , "5":[u"4", u"$", '\xc3\xa7', None]
- , "6":[u"5", u"%", '\xc3\xbc', '\xe2\x82\xac']
- , "7":[u"6", u"^", '\xc3\xb6', None]
- , "8":[u"7", u"&", '\xc3\xa4', None]
- , "9":[u"8", u"*", '\xc3\xa0', None]
- ,"10":[u"9", u"(", '\xc3\xa8', None]
- ,"11":[u"0", u")", '\xc3\xa9', None]
- ,"12":[u"-", u"_", None, None]
- ,"13":[u"=", u"+", "~", None]
- ,"16":[u"q", u"Q", None, None]
- ,"17":[u"w", u"W", None, None]
- ,"18":[u"e", u"E", '\xe2\x82\xac', None]
- ,"19":[u"r", u"R", None, None]
- ,"20":[u"t", u"T", None, None]
- ,"21":[u"y", u"Y", None, None]
- ,"22":[u"u", u"U", None, None]
- ,"23":[u"i", u"I", None, None]
- ,"24":[u"o", u"O", None, None]
- ,"25":[u"p", u"P", None, None]
- ,"26":[u"[", u"{", None, None]
- ,"27":[u"]", u"}", None, None]
- ,"30":[u"a", u"A", None, None]
- ,"31":[u"s", u"S", '\xc3\x9f', None]
- ,"32":[u"d", u"D", None, None]
- ,"33":[u"f", u"F", None, None]
- ,"34":[u"g", u"G", None, None]
- ,"35":[u"h", u"H", None, None]
- ,"36":[u"j", u"J", None, None]
- ,"37":[u"k", u"K", None, None]
- ,"38":[u"l", u"L", None, None]
- ,"39":[u";", u":", None, None]
- ,"40":[u"\'", u"\"", None, None]
- ,"41":['\xc2\xa7', '\xc2\xb0', '\xc2\xac', None]
- ,"43":[u"\\", u"|", None, None]
- ,"44":[u"z", u"Z", None, u"<"]
- ,"45":[u"x", u"X", None, u">"]
- ,"46":[u"c", u"C", '\xc2\xa2', None]
- ,"47":[u"v", u"V", None, None]
- ,"48":[u"b", u"B", None, None]
- ,"49":[u"n", u"N", None, None]
- ,"50":[u"m", u"M", '\xc2\xb5', None]
- ,"51":[u",", "<", None, None]
- ,"52":[u".", ">", None, None]
- ,"53":[u"/", u"?", None, None]
+ 2:[u"1", u"!", None, None]
+ , 3:[u"2", u"@", None, None]
+ , 4:[u"3", u"#", None, '\xc2\xa3']
+ , 5:[u"4", u"$", '\xc3\xa7', None]
+ , 6:[u"5", u"%", '\xc3\xbc', '\xe2\x82\xac']
+ , 7:[u"6", u"^", '\xc3\xb6', None]
+ , 8:[u"7", u"&", '\xc3\xa4', None]
+ , 9:[u"8", u"*", '\xc3\xa0', None]
+ ,10:[u"9", u"(", '\xc3\xa8', None]
+ ,11:[u"0", u")", '\xc3\xa9', None]
+ ,12:[u"-", u"_", None, None]
+ ,13:[u"=", u"+", "~", None]
+ ,16:[u"q", u"Q", None, None]
+ ,17:[u"w", u"W", None, None]
+ ,18:[u"e", u"E", '\xe2\x82\xac', None]
+ ,19:[u"r", u"R", None, None]
+ ,20:[u"t", u"T", None, None]
+ ,21:[u"y", u"Y", None, None]
+ ,22:[u"u", u"U", None, None]
+ ,23:[u"i", u"I", None, None]
+ ,24:[u"o", u"O", None, None]
+ ,25:[u"p", u"P", None, None]
+ ,26:[u"[", u"{", None, None]
+ ,27:[u"]", u"}", None, None]
+ ,30:[u"a", u"A", None, None]
+ ,31:[u"s", u"S", '\xc3\x9f', None]
+ ,32:[u"d", u"D", None, None]
+ ,33:[u"f", u"F", None, None]
+ ,34:[u"g", u"G", None, None]
+ ,35:[u"h", u"H", None, None]
+ ,36:[u"j", u"J", None, None]
+ ,37:[u"k", u"K", None, None]
+ ,38:[u"l", u"L", None, None]
+ ,39:[u";", u":", None, None]
+ ,40:[u"\'", u"\"", None, None]
+ ,41:['\xc2\xa7', '\xc2\xb0', '\xc2\xac', None]
+ ,43:[u"\\", u"|", None, None]
+ ,44:[u"z", u"Z", None, u"<"]
+ ,45:[u"x", u"X", None, u">"]
+ ,46:[u"c", u"C", '\xc2\xa2', None]
+ ,47:[u"v", u"V", None, None]
+ ,48:[u"b", u"B", None, None]
+ ,49:[u"n", u"N", None, None]
+ ,50:[u"m", u"M", '\xc2\xb5', None]
+ ,51:[u",", "<", None, None]
+ ,52:[u".", ">", None, None]
+ ,53:[u"/", u"?", None, None]
+ ,57:[u" ", None, None, None]
}
vumapidx = 0
vukeymap = vukeymap_us_de
global vumapidx
global vukeymap
global rckeyboard_enable
- #print "code : %d, mapidx : %d"%(code, vumapidx)
+ print "got ascii code : %d [%d]"%(code, vumapidx)
if rckeyboard_enable:
if code == 0:
vumapidx = 0
vumapidx += 2
return None
try:
- return vukeymap[str(code)][vumapidx]
+ return vukeymap[code][vumapidx]
except:
return None
else:
}
class VuPlayerLauncher:
+ QUALITY_CODE = {
+ '5': 'FLV 224p'
+ ,'6': 'FLV 270p'
+ ,'34':'FLV 360p'
+ ,'35':'FLV 480p'
+ ,'18':'MP4 360p'
+ ,'22':'MP4 720p'
+ ,'37':'MP4 1080p'
+ ,'38':'MP4 2304p'
+ ,'83':'MP4-3D 240p'
+ ,'82':'MP4-3D 360p'
+ ,'85':'MP4-3D 520p'
+ ,'84':'MP4-3D 720p'
+ ,'43':'WebM 360p'
+ ,'44':'WebM 480p'
+ ,'45':'WebM 720p'
+ ,'46':'WebM 1080p'
+ ,'100':'WebM-3D 360p'
+ ,'101':'WebM-3D 480p'
+ ,'102':'WebM-3D 720p'
+ ,'13':'3GP 0.5'
+ ,'17':'3GP 2.0'
+ }
def getVideoUrl(self, video_id):
video_url = None
if VIDEO_FMT_PRIORITY_MAP.has_key(fmtid):
video_fmt_map[VIDEO_FMT_PRIORITY_MAP[fmtid]] = { 'fmtid': fmtid, 'fmturl': unquote_plus(fmturl) }
fmt_infomap[int(fmtid)] = unquote_plus(fmturl)
- print "got",sorted(fmt_infomap.iterkeys())
- if video_fmt_map and len(video_fmt_map):
- video_url = video_fmt_map[sorted(video_fmt_map.iterkeys())[0]]['fmturl'].split(';')[0]
- #print "found best available video format:",video_fmt_map[sorted(video_fmt_map.iterkeys())[0]]['fmtid']
- #print "found best available video url:",video_url
- return video_url
+ print "fmtinfomap :",sorted(fmt_infomap.iterkeys())
+
+ video_url_list = []
+ if video_fmt_map:
+ idx = 0
+ sorted_fmt_keys = sorted(video_fmt_map.iterkeys())
+ for x in video_fmt_map:
+ try:
+ videofmt = video_fmt_map[sorted_fmt_keys[idx]]
+ video_url = videofmt['fmturl'].split(';')[0]
+ quality_str = self.qCode2String(videofmt['fmtid'])
+ #print "detected video : quality [%s], url [%s]" % (quality_str, video_url)
+ if video_url and quality_str:
+ video_url_list.append((quality_str, video_url))
+ print "added quality [%s], url [%s]" % (quality_str, video_url)
+ except Exception, msg: print "Error >>", msg
+ idx = idx + 1
+ return video_url_list
+
+ def qCode2String(self, qcode):
+ qstr = None
+ try:
+ qstr = self.QUALITY_CODE[qcode]
+ except: pass
+ #print "quality : code[%s], str[%s]" % (qcode, qstr)
+ return qstr
def run(self, tubeid, session, service):
+ self.session = session
+ self.service = service
try:
- myurl = self.getVideoUrl(tubeid)
- print "Playing URL", myurl
- if myurl is None:
+ self.url_list = self.getVideoUrl(tubeid)
+ if self.url_list is None or len(self.url_list) == 0:
session.open(MessageBox, _("Sorry, video is not available!"), MessageBox.TYPE_INFO)
+ wb_unlock()
return
- myreference = eServiceReference(4097, 0, myurl)
- session.open(VuPlayer, myreference, service)
+ titlemsg = "Please, choice video quality.\nFor smooth playback depends on network conditions."
+ self.session.openWithCallback(self.cbSelectedQuality, ChoiceBox, title=_(titlemsg), list = self.url_list)
+ except Exception, msg:
+ wb_unlock()
+ print "Error >>", msg
+
+ def cbSelectedQuality(self, choice):
+ try:
+ print "selected [%s] : [%s]" % (choice[0], choice[1])
+ myreference = eServiceReference(4097, 0, choice[1])
+ self.session.open(VuPlayer, myreference, self.service)
except Exception, msg:
wb_unlock()
print "Error >>", msg
tmp = data.split("?")
print tmp # ['http://www.youtube.com/watch', 'v=BpThu778qB4&feature=related']
service = self.session.nav.getCurrentlyPlayingServiceReference()
- if len(tmp) == 2 and tmp[0] == "http://www.youtube.com/watch":
+ if len(tmp) and tmp[0] == "http://www.youtube.com/watch":
tmp = tmp[1].split("&")
print tmp # ['v=BpThu778qB4', 'feature=related']
- if len(tmp) > 2:
+ if len(tmp):
tmp = tmp[0].split("=")
print tmp # ['v', 'BpThu778qB4']
if len(tmp) == 2 and tmp[0] == "v":