View Full Version : i need a script
can anyone make a script of this site to me http://gmc.globo.com/ please
THANKSSSSSSSSSSSSSSSSSSS:grin: :nod:
import string
from string import *
import time
from time import strftime, gmtime
import urllib, re, random, xml.dom.minidom
import httplib, Cookie
import xbmc, xbmcgui
import threading
import copy
import base64
try: Emulating = xbmcgui.Emulating
except: Emulating = False
conversion= { "á": "a", "é": "e", "í": "i", "ó": "o", "ú": "u",
"à": "a", "è": "e", "ì": "i", "ò": "o", "ù": "u",
"â": "a", "ê": "e", "î": "i", "ô": "o", "û": "u",
"ã": "a", "õ": "o", "ñ": "n", "ç":"c",
"Á": "A", "É": "E", "Í": "I", "Ó": "O", "Ú": "U",
"À": "A", "È": "E", "Ì": "I", "Ò": "O", "Ù": "U",
"Â": "A", "Ê": "E", "Î": "I", "Ô": "O", "Û": "U",
u"\xc2\xb4": "'", u"\xc3\xbc": "u", "Ñ": "N", "Ç": "C",
"Ü": "U", u"\xc3\x89":"E", u"\xc3\x80":"A", "ä":"a", "Ë":"E", "ë":"e",
u"\xc3\xa5":"a", u"\xc3\x81":"A", u"\xc3\xa2":"a", "ö":"o", "ð":"?", "ß":"ss",
u"\xc3\xa1":"a","å":"a", "ø":"o", "Ø":"O", "Þ":"?" , "æ":"ae",
u"\xc3\xa7":"c", u"\xc3\xa3":"a", u"\xc3\xba":"u", u"\xc3\xb3":"o",
u"\xc3\xad":"i", u"\xc3\xaa":"e", u"\xc3\xb4":"o", u"\xc3\xa9":"e",
u"\xc3\xb5":"o", u"\xc2\xaa":"a",
}
GloboSite = 'http://gmc.globo.com'
global user
global passw
global usuario
global passw2
global password
global user2
HTTP_TIMEOUT = 10.0 # Max. segundos de espera por resposta
DEFAULT_SIZE = 2 # 2=Large, 1=Medium, 0=Small, -1=Show dialog
ACTION_MOVE_LEFT = 1
ACTION_MOVE_RIGHT = 2
ACTION_MOVE_UP = 3
ACTION_MOVE_DOWN = 4
ACTION_PAGE_UP = 5
ACTION_PAGE_DOWN = 6
ACTION_SELECT_ITEM = 7
ACTION_HIGHLIGHT_ITEM = 8
ACTION_PARENT_DIR = 9
ACTION_PREVIOUS_MENU = 10
ACTION_SHOW_INFO = 11
ACTION_PAUSE = 12
ACTION_STOP = 13
ACTION_NEXT_ITEM = 14
ACTION_PREV_ITEM = 15
DOWNLOAD_AND_PLAY = 1
# defines
STATE_HOJE = 1
STATE_ESPECIAL = 2
STATE_ESPECIAL_FILMES = 3
STATE_DIVERSAO = 4
STATE_DIVERSAO_FILMES = 5
STATE_JORNALISMO = 6
STATE_JORNALISMO_FILMES = 7
STATE_ESPORTE = 8
STATE_ESPORTE_FILMES = 9
STATE_ADICIONAL = 10
STATE_ADICIONAL_FILMES = 11
STATE_CONFIG = 12
links_hoje = {}
links_especial = {}
links_diversao = {}
links_esporte = {}
links_jornalismo = {}
links_adicional = {}
ids_hoje = {}
ids_especial = {}
ids_diversao = {}
ids_esporte = {}
ids_jornalismo = {}
ids_adicional = {}
links_integra = {}
links_filme = {}
links_filme_user = {}
tempo_filme = {}
links_exibicao = {}
links_integra = {}
alphanum_ops_CHECK=0
alphanum_ops_FIX=1
def recupparam():
global user
global passw
global passw2
global password
global user2
global usuario
try:
f=open('Q:\\SCRIPTS\senha.cfg',"r")
parametros=f.read()
f.close()
parametros=base64.decodestring(parametros)
user = extrai(parametros,'<login>','</login>',7)
passw = extrai(parametros,'<mdp>','</mdp>',5)
except:
user='user'
passw='pass'
user2 = user
usuario = user
passw2 = passw
password = passw
return
def extrai(parametros, ini, fim, nb):
try:
parametrosIni = string.index(parametros, ini, 0) + nb
parametrosFim = string.index(parametros, fim, parametrosIni)
return parametros[parametrosIni:parametrosFim]
except:
return none
return none
def _alphanum_util (string, operation):
"""check if all characters are in printable range
and valid in roman alphabet languages"""
global alphanum_ops_CHECK, alphanum_ops_FIX
global conversion
ok=1
out_string=""
skip=0
aux=len(string)
for i in xrange(aux):
if skip:
skip-=1
continue
char=string[i]
num=ord(char)
if num>=32 and num<=127:
out_string+=char
else:
if num> 127 and i<aux-1 and conversion.has_key (string[i]+string[i+1]):
out_string+=conversion[string[i]+string[i+1]]
skip=1
else:
out_string+="?"
ok=0
if operation==alphanum_ops_CHECK:
return ok
if num >= 0xf0:
skip=3
elif num >= 0xe0:
skip-2
elif num>= 0xc0:
skip=1
else:
skip=0
if operation==alphanum_ops_CHECK:
return ok
else:
return out_string
def check_alphanum (string):
"""check if all characters are in printable range and
valid in romam alphabet languages"""
global alphanum_ops_CHECK, alphanum_ops_FIX
return _alphanum_util (string, alphanum_ops_CHECK)
def strip_diacriticals (string):
"""replace non ASCII characters for '?' ' or equiv.
letter if it is an western european accented letter."""
global alphanum_ops_CHECK, alphanum_ops_FIX
return _alphanum_util (string, alphanum_ops_FIX)
def addToDictionary( dictionary, key, value):
if key not in dictionary:
dictionary[key] = value
else:
current = dictionary[key]
if type( current ) is types.DictType:
dictionary[key] = [current, value]
elif type( current[0] ) is types.DictType:
current.append( value )
elif type( current[0] ) is types.ListType:
current.append( value )
else:
dictionary[key] = [current, value]
def GetParse0(url):
file = urllib.urlopen(url)
data = file.read()
data = string.replace(data, chr(9), '')
data = string.replace(data, '&', '')
data = string.replace(data, '\n', '',6)
data = string.replace(data, ' ' , '',1)
data = string.replace(data, '\n', '',2)
data = string.replace(data, '\n\n', '\n')
data = string.replace(data, '\n\n', '\n')
data = string.replace(data, '><', '>\n<')
return data
def GetParse1(url):
file = urllib.urlopen(url)
data = file.read()
data = string.replace(data, chr(9), '')
data = string.replace(data, '&', '')
data = string.replace(data, '\n', '',22)
data = string.replace(data, '\n\n', '\n')
data = string.replace(data, '\n\n', '\n')
data = string.replace(data, ' <', '<')
data = string.replace(data, ' <grupomc', '<grupomc')
data = string.replace(data, ' </grupo>', '</grupo>')
data = string.replace(data, ' <descricao', '<descricao')
data = string.replace(data, ' <midiaid', '<midia id')
data = string.replace(data, ' <midiaid', '<midia id')
data = string.replace(data, 'grupo>\n<grupomc', 'grupo>\n\n<grupomc')
return data
def GetParse2(url):
file = urllib.urlopen(url)
data = file.read()
data = string.replace(data, '&', '')
data = string.replace(data, chr(9), '')
data = string.replace(data, '\n', '', 22)
data = string.replace(data, ' <' , '<')
data = string.replace(data, '><', '>\n<')
data = string.replace(data, 'item>\n<item', 'item>\n\n<item')
return data
def GetHeader(url):
data = GetParse0(url)
file = xml.dom.minidom.parseString(data)
boxs = file.getElementsByTagName("box")
boxes = {}
for node in boxs:
b = node.attributes["id"].value
items = node.getElementsByTagName("item")
idc = node.attributes["id"].value
litems = {}
count = 0
for nodeChild in items:
id = nodeChild.attributes["id"].value
litems[count] = [nodeChild.attributes["tit"].value, nodeChild.attributes["id"].value]
count = count + 1
addToDictionary(boxes, "box"+idc, litems)
return boxes
def GetMidias(url):
data = GetParse1(url)
file = xml.dom.minidom.parseString(data)
midias = file.getElementsByTagName("midia")
return midias
def GetMMSa(midia):
if user == 'user':
urllogin1= "gmc.globo.com:80"
params = midia
conn = httplib.HTTPConnection(urllogin1)
conn.request("GET", "/ServletsCDA/PopAutentica?ID="+midia)
response = conn.getresponse()
data = response.read()
conn.close()
m = re.search("Qstr='(.*)' ", data, re.IGNORECASE)
secure = m.group(1)
m = re.search("var vSRC = '(.*)' +", data, re.IGNORECASE)
url = m.group(1)
urlwmv = url+"&"+secure
file = urllib.urlopen(urlwmv)
data = file.read()
m = re.search('<REF HREF = "(.*)"/>', data, re.IGNORECASE)
mms = m.group(1)
return mms
urllogin1= "gmc.globo.com:80"
params = "username="+user+"&password="+passw+"&ID="+midia+"&forcebl=&autentica=&x=13&y=5"
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Cookie": "vgnvisitor=2wFO2000c7Q0003mgrnLI2t1y2; gmc_bprefer=1"}
conn = httplib.HTTPConnection(urllogin1)
conn.request("POST", "/ServletsCDA/PopAAA", params, headers)
response = conn.getresponse()
data = response.read()
conn.close()
m = re.search("Qstr='(.*)' ", data, re.IGNORECASE)
secure = m.group(1)
m = re.search("var vSRC = '(.*)' +", data, re.IGNORECASE)
url = m.group(1)
urlwmv = url+"&"+secure
file = urllib.urlopen(urlwmv)
data = file.read()
m = re.search('<REF HREF = "(.*)"/>', data, re.IGNORECASE)
mms = m.group(1)
return mms
def GetLinksFromPage(midias, page):
start = (page-1)*25
end = ((page-1)*25)+25
if len(midias) < start:
return None
return GetLink(midias[start:end])
def GetLink(midias):
url1 = "http://gmc.globo.com/Java/gmc/cda/xml/glb_gmc_xml_midia/0,,"
url = {}
url2 = ""
n = 0
b = 0
for midia in midias:
if midias[n].attributes["tipo"].value == 'I':
url2 = url2+"111111|"
links_integra[b] = midias[n].attributes["id"].value
links_exibicao[b] = midias[n].attributes["exibicao"].value
b = b + 1
if midias[n].attributes["tipo"].value == 'M':
url2 = url2+midias[n].attributes["id"].value+"|"
n = n + 1
url = url1+url2+"||,00.html"
return url
def Parse():
url = 'http://gmc.globo.com/Java/gmc/cda/xml/glb_gmc_xml_menu/0,,,00.html'
boxes = GetHeader(url)
for b in boxes:
for i in boxes[b]:
if b == "box0":
links_especial[i] = boxes[b][i][0]
ids_especial[i] = boxes[b][i][1]
elif b == "box1":
links_diversao[i] = boxes[b][i][0]
ids_diversao[i] = boxes[b][i][1]
elif b == "box2":
links_jornalismo[i] = boxes[b][i][0]
ids_jornalismo[i] = boxes[b][i][1]
elif b == "box3":
links_esporte[i] = boxes[b][i][0]
ids_esporte[i] = boxes[b][i][1]
elif b == "box4":
links_adicional[i] = boxes[b][i][0]
ids_adicional[i] = boxes[b][i][1]
return
def GetURL(id):
site = 'http://gmc.globo.com/Java/gmc/cda/xml/glb_gmc_xml_catalogo/0,,'+id+',00.html'
midias = GetMidias(site)
return midias
def GetTitulo(midias, page):
if user == 'user':
url = GetLinksFromPage(midias, page)
if url == None:
return None
data = GetParse2(url)
file = xml.dom.minidom.parseString(data)
itens = file.getElementsByTagName("item")
titulos ={}
n = 0
c = 0
cod = itens
for item in itens:
if itens[n].attributes['aberto'].value == '1':
titulo = file.getElementsByTagName("titulo")
titulo[n] = string.replace(titulo[n].toxml(), '<titulo>', '')
titulos[n] = string.replace(titulo[n], '</titulo>', '')
links_filme[(page-1)*25+n] = itens[n].attributes['id'].value
tempo_filme[(page-1)*25+n] = itens[n].attributes['duracao'].value
titulos[n] = titulos[n]+' '+time.strftime("%H:%M:%S", gmtime(int(tempo_filme[(page-1)*25+n])/1000))
if itens[n].attributes['id'].value == '111111':
titulos[n] = 'Integra dia '+links_exibicao[c]
links_filme[(page-1)*25+n] = links_integra[c]
tempo_filme[(page-1)*25+n] = ''
c = c + 1
n = n + 1
return titulos
url = GetLinksFromPage(midias, page)
if url == None:
return None
data = GetParse2(url)
file = xml.dom.minidom.parseString(data)
itens = file.getElementsByTagName("item")
titulos ={}
n = 0
c = 0
cod = itens
for item in itens:
titulo = file.getElementsByTagName("titulo")
titulo[n] = string.replace(titulo[n].toxml(), '<titulo>', '')
titulos[n] = string.replace(titulo[n], '</titulo>', '')
links_filme[(page-1)*25+n] = itens[n].attributes['id'].value
tempo_filme[(page-1)*25+n] = itens[n].attributes['duracao'].value
titulos[n] = titulos[n]+' '+time.strftime("%M:%S", gmtime(int(tempo_filme[(page-1)*25+n])/1000))+' '
if itens[n].attributes['id'].value == '111111':
titulos[n] = 'Integra dia '+links_exibicao[c]
links_filme[(page-1)*25+n] = links_integra[c]
tempo_filme[(page-1)*25+n] = ''
c = c + 1
n = n + 1
return titulos
def GetURLIntegra(id):
site = 'http://gmc.globo.com/Java/gmc/cda/xml/glb_gmc_xml_integra/0,,'+id+',00.html'
midias = GetMidias(site)
return midias
class MyClass(xbmcgui.Window):
def __init__(self):
self.scaleX = ( float(self.getWidth()) / float(720) )
self.scaleY = ( float(self.getHeight()) / float(480) )
self.state = 0
self.currentState = None
progress = xbmcgui.DialogProgress()
progress.create("Globo Media Center", "Abrindo pagina...")
webfile = Parse()
progress.close()
w = recupparam()
checalogin=user2
checapass=passw2
xbmcgui.lock()
self.addControl(xbmcgui.ControlImage(0,0, int(720*self.scaleX),int(480*self.scaleY), 'Q:\\SCRIPTS\\background4.png'))
self.list = xbmcgui.ControlList(int(211*self.scaleX), int(135*self.scaleY), int(450*self.scaleX), int(280*self.scaleY))
self.linklist = xbmcgui.ControlList(int(211*self.scaleX), int(135*self.scaleY), int(450*self.scaleX), int(280*self.scaleY))
self.lablogin = xbmcgui.ControlLabel(int(211*self.scaleX), int(135*self.scaleY), int(10*self.scaleX), int(10*self.scaleY),'','font13','0xFFFFFFFF')
self.addControl(self.lablogin)
self.lablogin.setLabel('User =')
self.btnlogin = xbmcgui.ControlButton(int(261*self.scaleX), int(135*self.scaleY), int(250*self.scaleX), int(20*self.scaleX),checalogin,'button-focus.png','button-nofocus.png')
self.addControl(self.btnlogin)
self.labpas = xbmcgui.ControlLabel(int(211*self.scaleX),int(175* self.scaleY),int(10*self.scaleX),int(10*self.scale Y),'','font13','0xFFFFFFFF')
self.addControl(self.labpas)
self.labpas.setLabel('Pass =')
self.btnpas = xbmcgui.ControlButton(int(261*self.scaleX),int(175 *self.scaleY), int(250*self.scaleX),int(20*self.scaleY),checapass ,'button-focus.png','button-nofocus.png')
self.addControl(self.btnpas)
self.btnsave = xbmcgui.ControlButton(int(511*self.scaleX),int(210 *self.scaleY), int(120*self.scaleX),int(30*self.scaleY),'Salvar', 'button-focus.png','button-nofocus.png')
self.addControl(self.btnsave)
self.btnHoje = xbmcgui.ControlButton(int(61*self.scaleX), int(160*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Hoje ")
self.btnEspecial = xbmcgui.ControlButton(int(61*self.scaleX), int(185*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Especiais ")
self.btnDiversao = xbmcgui.ControlButton(int(61*self.scaleX), int(210*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Diversao ")
self.btnJornalismo = xbmcgui.ControlButton(int(61*self.scaleX), int(235*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Jornalismo ")
self.btnEsporte = xbmcgui.ControlButton(int(61*self.scaleX), int(260*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Esporte ")
self.btnAdicional = xbmcgui.ControlButton(int(61*self.scaleX), int(285*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Adicionais ")
self.btnConfig = xbmcgui.ControlButton(int(61*self.scaleX), int(360*self.scaleY), int(136*self.scaleX), int(30*self.scaleY), "Config ")
self.addControl(self.list)
self.addControl(self.linklist)
self.addControl(self.btnHoje)
self.addControl(self.btnEspecial)
self.addControl(self.btnDiversao)
self.addControl(self.btnJornalismo)
self.addControl(self.btnEsporte)
self.addControl(self.btnAdicional)
self.addControl(self.btnConfig)
self.list.controlLeft(self.btnHoje)
self.linklist.controlLeft(self.btnHoje)
self.btnHoje.controlUp(self.btnConfig)
self.btnHoje.controlDown(self.btnEspecial)
self.btnHoje.controlRight(self.list)
self.btnHoje.controlRight(self.linklist)
self.btnEspecial.controlUp(self.btnHoje)
self.btnEspecial.controlDown(self.btnDiversao)
self.btnEspecial.controlRight(self.list)
self.btnEspecial.controlRight(self.linklist)
self.btnDiversao.controlUp(self.btnEspecial)
self.btnDiversao.controlDown(self.btnJornalismo)
self.btnDiversao.controlRight(self.list)
self.btnDiversao.controlRight(self.linklist)
self.btnJornalismo.controlUp(self.btnDiversao)
self.btnJornalismo.controlDown(self.btnEsporte)
self.btnJornalismo.controlRight(self.list)
self.btnJornalismo.controlRight(self.linklist)
self.btnEsporte.controlUp(self.btnJornalismo)
self.btnEsporte.controlDown(self.btnAdicional)
self.btnEsporte.controlRight(self.list)
self.btnEsporte.controlRight(self.linklist)
self.btnAdicional.controlUp(self.btnEsporte)
self.btnAdicional.controlDown(self.btnConfig)
self.btnAdicional.controlRight(self.list)
self.btnAdicional.controlRight(self.linklist)
self.btnConfig.controlUp(self.btnAdicional)
self.btnConfig.controlDown(self.btnHoje)
self.btnConfig.controlRight(self.btnlogin)
self.btnlogin.controlDown(self.btnpas)
self.btnlogin.controlUp(self.btnsave)
self.btnlogin.controlLeft(self.btnConfig)
self.btnlogin.controlRight(self.btnsave)
self.btnpas.controlDown(self.btnsave)
self.btnpas.controlUp(self.btnlogin)
self.btnpas.controlLeft(self.btnConfig)
self.btnpas.controlRight(self.btnsave)
self.btnsave.controlDown(self.btnlogin)
self.btnsave.controlUp(self.btnpas)
self.btnsave.controlLeft(self.btnConfig)
self.btnsave.controlRight(self.btnlogin)
self.lablogin.setVisible(0)
self.btnlogin.setVisible(0)
self.labpas.setVisible(0)
self.btnpas.setVisible(0)
self.btnsave.setVisible(0)
self.setFocus(self.btnHoje)
xbmcgui.unlock()
def show_link_list(self):
self.list.setVisible(0)
self.lablogin.setVisible(0)
self.btnlogin.setVisible(0)
self.labpas.setVisible(0)
self.btnpas.setVisible(0)
self.btnsave.setVisible(0)
self.linklist.setVisible(1)
self.setFocus(self.linklist)
self.state = 2
return
def hide_link_list(self):
self.linklist.setVisible(0)
self.lablogin.setVisible(0)
self.btnlogin.setVisible(0)
self.labpas.setVisible(0)
self.btnpas.setVisible(0)
self.btnsave.setVisible(0)
self.list.setVisible(1)
self.setFocus(self.list)
self.state = 1
return
def show_config(self):
self.list.setVisible(0)
self.linklist.setVisible(0)
self.lablogin.setVisible(1)
self.btnlogin.setVisible(1)
self.labpas.setVisible(1)
self.btnpas.setVisible(1)
self.btnsave.setVisible(1)
self.state = 1
return
def hide_config(self):
self.linklist.setVisible(0)
self.list.setVisible(0)
self.lablogin.setVisible(0)
self.btnlogin.setVisible(0)
self.labpas.setVisible(0)
self.btnpas.setVisible(0)
self.btnsave.setVisible(0)
self.setFocus(self.btnConfig)
return
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU and self.state == 0:
self.close()
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_HOJE:
self.setFocus(self.btnHoje)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_ESPECIAL:
self.setFocus(self.btnEspecial)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_DIVERSAO:
self.setFocus(self.btnDiversao)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_JORNALISMO:
self.setFocus(self.btnJornalismo)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_ESPORTE:
self.setFocus(self.btnEsporte)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_ADICIONAL:
self.setFocus(self.btnAdicional)
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 1 and self.currentState == STATE_CONFIG:
self.hide_config()
self.state = 0
return
if action == ACTION_PREVIOUS_MENU and self.state == 2 and self.currentState == STATE_ESPECIAL_FILMES:
self.currentState = STATE_ESPECIAL
self.hide_link_list()
return
if action == ACTION_PREVIOUS_MENU and self.state == 2 and self.currentState == STATE_DIVERSAO_FILMES:
self.currentState = STATE_DIVERSAO
self.hide_link_list()
return
if action == ACTION_PREVIOUS_MENU and self.state == 2 and self.currentState == STATE_JORNALISMO_FILMES:
self.currentState = STATE_JORNALISMO
self.hide_link_list()
return
if action == ACTION_PREVIOUS_MENU and self.state == 2 and self.currentState == STATE_ESPORTE_FILMES:
self.currentState = STATE_ESPORTE
self.hide_link_list()
return
if action == ACTION_PREVIOUS_MENU and self.state == 2 and self.currentState == STATE_ADICIONAL_FILMES:
self.currentState = STATE_ADICIONAL
self.hide_link_list()
return
def onControl(self, control):
if control == self.btnHoje:
self.hide_link_list()
self.currentState = STATE_HOJE
idhoje = '1'
progress = xbmcgui.DialogProgress()
progress.create("GMC", "Abrindo filmes de hoje...")
self.list.reset()
midias = GetURL(idhoje)
i = 1
titulos = GetTitulo(midias, i)
while titulos != None:
for n in titulos:
titulos[n] = string.replace(titulos[n], u'"', "")
self.list.addItem(strip_diacriticals(titulos[n]))
i = i + 1
titulos = GetTitulo(midias, i)
if user == 'user':
c = 0
for n in links_filme:
links_filme_user[c] = links_filme[n]
c = c + 1
progress.close()
elif control == self.btnEspecial:
self.hide_link_list()
self.currentState = STATE_ESPECIAL
self.list.reset()
for i in links_especial:
self.list.addItem(strip_diacriticals(links_especia l[i]))
elif control == self.btnDiversao:
self.hide_link_list()
self.currentState = STATE_DIVERSAO
self.list.reset()
for i in links_diversao:
self.list.addItem(strip_diacriticals(links_diversa o[i]))
elif control == self.btnJornalismo:
self.hide_link_list()
self.currentState = STATE_JORNALISMO
self.list.reset()
for i in links_jornalismo:
self.list.addItem(strip_diacriticals(links_jornali smo[i]))
elif control == self.btnEsporte:
self.hide_link_list()
self.currentState = STATE_ESPORTE
self.list.reset()
for i in links_esporte:
self.list.addItem(strip_diacriticals(links_esporte[i]))
elif control == self.btnAdicional:
self.hide_link_list()
self.currentState = STATE_ADICIONAL
self.list.reset()
for i in links_adicional:
self.list.addItem(strip_diacriticals(links_adicion al[i]))
elif control == self.btnConfig:
self.hide_link_list()
self.currentState = STATE_CONFIG
self.show_config()
self.setFocus(self.btnlogin)
elif control == self.btnlogin:
global user
global user2
global usuario
user2 = user
user2 = self.entratxt(user2)
self.btnlogin.setLabel(user2)
usuario = user2
elif control == self.btnpas:
global passw
global passw2
global password
passw2 = passw
passw2 = self.entratxt(passw2)
self.btnpas.setLabel(passw2)
password = passw2
elif control == self.btnsave:
mem = '<login>' + usuario + '</login>\n'
mem = mem + '<mdp>' + password + '</mdp>\n'
mem = mem + '\n'
mem = base64.encodestring(mem)
dialog = xbmcgui.Dialog()
try:
f=open('Q:\\SCRIPTS\\senha.cfg',"w")
f.writelines(mem)
f.close()
confirme=dialog.ok('GMC', 'Ola '+usuario+',','Seus dados foram salvos!')
except:
confirme=dialog.ok('GMC', 'Impossivel salvar seus dados', 'contate nos')
elif control == self.list:
if self.currentState == STATE_HOJE:
if user == 'user':
self.selectedhoje = self.list.getSelectedPosition()
linkshoje = self.GetMMS(links_filme_user[self.selectedhoje])
self.play_stream(linkshoje)
if user != 'user':
self.selectedhoje = self.list.getSelectedPosition()
linkshoje = self.GetMMS(links_filme[self.selectedhoje])
self.play_stream(linkshoje)
elif self.currentState == STATE_ESPECIAL:
self.show_link_list()
self.limpamatriz()
self.currentState = STATE_ESPECIAL_FILMES
self.selectedespecial = self.list.getSelectedPosition()
idespecial = ids_especial[self.selectedespecial]
progress = xbmcgui.DialogProgress()
progress.create("Globo Media Center", "Abrindo link de filmes...")
self.linklist.reset()
midias = GetURL(idespecial)
i = 1
titulos = GetTitulo(midias, i)
while titulos != None:
for n in titulos:
titulos[n] = string.replace(titulos[n], u'"', "")
self.linklist.addItem(strip_diacriticals(titulos[n]))
i = i + 1
titulos = GetTitulo(midias, i)
if user == 'user':
c = 0
for n in links_filme:
links_filme_user[c] = links_filme[n]
c = c + 1
progress.close()
elif self.currentState == STATE_DIVERSAO:
self.show_link_list()
self.limpamatriz()
self.currentState = STATE_DIVERSAO_FILMES
progress = xbmcgui.DialogProgress()
progress.create("Globo Media Center", "Abrindo link de filmes...")
self.selecteddiversao = self.list.getSelectedPosition()
iddiversao = ids_diversao[self.selecteddiversao]
self.linklist.reset()
midias = GetURL(iddiversao)
i = 1
titulos = GetTitulo(midias, i)
while titulos != None:
for n in titulos:
titulos[n] = string.replace(titulos[n], u'"', "")
self.linklist.addItem(strip_diacriticals(titulos[n]))
i = i + 1
titulos = GetTitulo(midias, i)
if user == 'user':
c = 0
for n in links_filme:
links_filme_user[c] = links_filme[n]
c = c + 1
progress.close()
elif self.currentState == STATE_JORNALISMO:
self.show_link_list()
self.limpamatriz()
self.currentState = STATE_JORNALISMO_FILMES
progress = xbmcgui.DialogProgress()
progress.create("Globo Media Center", "Abrindo link de filmes...")
self.selectedjornalismo = self.list.getSelectedPosition()
idjornalismo = ids_jornalismo[self.selectedjornalismo]
self.linklist.reset()
midias = GetURL(idjornalismo)
i = 1
titulos = GetTitulo(midias, i)
while titulos != None:
for n in titulos:
titulos[n] = string.replace(titulos[n], u'"', "")
self.linklist.addItem(strip_diacriticals(titulos[n]))
i = i + 1
titulos = GetTitulo(midias, i)
if user == 'user':
c = 0
for n in links_filme:
links_filme_user[c] = links_filme[n]
c = c + 1
progress.close()
elif self.currentState == STATE_ESPORTE_FILMES:
if user == 'user':
self.selectedesporte = self.linklist.getSelectedPosition()
linksesporte = self.GetMMS(links_filme_user[self.selectedesporte])
self.play_stream(linksesporte)
if user != 'user':
self.selectedesporte = self.linklist.getSelectedPosition()
linksesporte = self.GetMMS(links_filme[self.selectedesporte])
self.play_stream(linksesporte)
elif self.currentState == STATE_ADICIONAL_FILMES:
if user == 'user':
self.selectedadicional = self.linklist.getSelectedPosition()
linksadicional = self.GetMMS(links_filme_user[self.selectedadicional])
self.play_stream(linksadicional)
if user != 'user':
self.selectedadicional = self.linklist.getSelectedPosition()
linksadicional = self.GetMMS(links_filme[self.selectedadicional])
self.play_stream(linksadicional)
def entratxt(self,texto):
keyb=xbmc.Keyboard(texto)
keyb.doModal()
oldtxt=texto
if (keyb.isConfirmed()):
oldtxt=keyb.getText()
return oldtxt
def limpamatriz(self):
links_filme = {}
tempo_filme = {}
titulo = {}
titulos = {}
links_filme_user = {}
return
def message(self, messageText):
dialog = xbmcgui.Dialog()
dialog.ok(" My message title", messageText)
def GetMMS(self, midia):
if int(midia) < 10000:
progress = xbmcgui.DialogProgress()
progress.create("Globo Media Center", "Abrindo link de filmes...")
pls = xbmc.PlayList(2)
pls.clear()
midias = GetURLIntegra(midia)
n = 0
for midia in midias:
pls.add(GetMMSa(midias[n].attributes['id'].value))
n = n + 1
progress.close()
xbmc.Player().play(pls)
return
url = GetMMSa(midia)
return url
def play_stream(self, link):
xbmc.Player().play(link)
return
mydisplay = MyClass()
mydisplay.doModal()
del mydisplay
solexalex
2006-08-21, 01:09
wonderful...
Very usefull...
Do you think we can do anything with those lines...
Anyway, it seems you found what you need...
NB:
your post title is very interesting too...
no, you didnt understand, I have this script but i dont know why it doesnt work anymore and copy it here to anyone that understand fix it to me, thanks guys.
solexalex
2006-08-21, 18:39
ok
I didn't see the new title....
sorry
(your title still not very good one ! ;) )