def readbookmark(filename,readpath=BOOKMARK_PATH): logger.info("[favoritos.py] readbookmark") if usingsamba(readpath): bookmarkfile = samba.get_file_handle_for_reading(filename, readpath) else: filepath = os.path.join( readpath , filename ) # Lee el fichero de configuracion logger.info("[favoritos.py] filepath="+filepath) bookmarkfile = open(filepath) lines = bookmarkfile.readlines() try: titulo = urllib.unquote_plus(lines[0].strip()) except: titulo = lines[0].strip() try: url = urllib.unquote_plus(lines[1].strip()) except: url = lines[1].strip() try: thumbnail = urllib.unquote_plus(lines[2].strip()) except: thumbnail = lines[2].strip() try: server = urllib.unquote_plus(lines[3].strip()) except: server = lines[3].strip() try: plot = urllib.unquote_plus(lines[4].strip()) except: plot = lines[4].strip() ## Campos fulltitle y canal añadidos if len(lines)>=6: try: fulltitle = urllib.unquote_plus(lines[5].strip()) except: fulltitle = lines[5].strip() else: fulltitle=titulo if len(lines)>=7: try: canal = urllib.unquote_plus(lines[6].strip()) except: canal = lines[6].strip() else: canal="" bookmarkfile.close(); return canal,titulo,thumbnail,plot,server,url,fulltitle
def readbookmark(filename, readpath=BOOKMARK_PATH): logger.info("[favoritos.py] readbookmark") if usingsamba(readpath): bookmarkfile = samba.get_file_handle_for_reading(filename, readpath) else: filepath = os.path.join(readpath, filename) # Lee el fichero de configuracion logger.info("[favoritos.py] filepath=" + filepath) bookmarkfile = open(filepath) lines = bookmarkfile.readlines() try: titulo = urllib.unquote_plus(lines[0].strip()) except: titulo = lines[0].strip() try: url = urllib.unquote_plus(lines[1].strip()) except: url = lines[1].strip() try: thumbnail = urllib.unquote_plus(lines[2].strip()) except: thumbnail = lines[2].strip() try: server = urllib.unquote_plus(lines[3].strip()) except: server = lines[3].strip() try: plot = urllib.unquote_plus(lines[4].strip()) except: plot = lines[4].strip() ## Campos fulltitle y canal añadidos if len(lines) >= 6: try: fulltitle = urllib.unquote_plus(lines[5].strip()) except: fulltitle = lines[5].strip() else: fulltitle = titulo if len(lines) >= 7: try: canal = urllib.unquote_plus(lines[6].strip()) except: canal = lines[6].strip() else: canal = "" bookmarkfile.close() return canal, titulo, thumbnail, plot, server, url, fulltitle
def LeerFavorito(Nombre,Ruta=BOOKMARK_PATH): logger.info("[favoritos.py] LeerFavorito") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: Archivo = open(os.path.join(Ruta, Nombre)) lines = Archivo.readlines() Archivo.close(); item = Item() item.deserialize(lines[0]) return item
def LeerFavorito(Nombre, Ruta=BOOKMARK_PATH): logger.info("[favoritos.py] LeerFavorito") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: Archivo = open(os.path.join(Ruta, Nombre)) lines = Archivo.readlines() Archivo.close() item = Item() item.deserialize(lines[0]) return item
def LeerFavorito(Nombre,Ruta=BOOKMARK_PATH): logger.info("[favoritos.py] LeerFavorito") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: Archivo = open(os.path.join(Ruta, Nombre)) JSONItem = Archivo.read() Archivo.close(); item = Item() item.fromjson(JSONItem) if item.context: item.context +="|Eliminar,remove_from_favorites" else: item.context = "Eliminar,remove_from_favorites" return item
def LeerFavorito(Nombre, Ruta=BOOKMARK_PATH): logger.info("[favoritos.py] LeerFavorito") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: Archivo = open(os.path.join(Ruta, Nombre)) JSONItem = Archivo.read() Archivo.close() item = Item() item.fromjson(JSONItem) if item.context: item.context += "|Eliminar,remove_from_favorites" else: item.context = "Eliminar,remove_from_favorites" return item
def readbookmark(filename): logger.info("[favoritos.py] readbookmark") if usingsamba: bookmarkfile = samba.get_file_handle_for_reading( filename, BOOKMARK_PATH) else: filepath = os.path.join(BOOKMARK_PATH, filename) # Lee el fichero de configuracion logger.info("[favoritos.py] filepath=" + filepath) bookmarkfile = open(filepath) lines = bookmarkfile.readlines() try: titulo = urllib.unquote_plus(lines[0].strip()) except: titulo = lines[0].strip() try: url = urllib.unquote_plus(lines[1].strip()) except: url = lines[1].strip() try: thumbnail = urllib.unquote_plus(lines[2].strip()) except: thumbnail = lines[2].strip() try: server = urllib.unquote_plus(lines[3].strip()) except: server = lines[3].strip() try: plot = urllib.unquote_plus(lines[4].strip()) except: plot = lines[4].strip() bookmarkfile.close() return titulo, thumbnail, plot, server, url
def readbookmark(filename): logger.info("[favoritos.py] readbookmark") if usingsamba: bookmarkfile = samba.get_file_handle_for_reading(filename, BOOKMARK_PATH) else: filepath = os.path.join( BOOKMARK_PATH , filename ) # Lee el fichero de configuracion logger.info("[favoritos.py] filepath="+filepath) bookmarkfile = open(filepath) lines = bookmarkfile.readlines() try: titulo = urllib.unquote_plus(lines[0].strip()) except: titulo = lines[0].strip() try: url = urllib.unquote_plus(lines[1].strip()) except: url = lines[1].strip() try: thumbnail = urllib.unquote_plus(lines[2].strip()) except: thumbnail = lines[2].strip() try: server = urllib.unquote_plus(lines[3].strip()) except: server = lines[3].strip() try: plot = urllib.unquote_plus(lines[4].strip()) except: plot = lines[4].strip() bookmarkfile.close(); return titulo,thumbnail,plot,server,url