def readbookmark(filename,readpath=BOOKMARK_PATH): logger.info("tvalacarta.core.favoritos 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("tvalacarta.core.favoritos 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?didos 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("tvalacarta.core.favoritos 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("tvalacarta.core.favoritos 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?didos 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 test_samba(): from core import samba #print samba.file_exists("00000005.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") #print samba.file_exists("00000004.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") print samba.get_files("smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") handle = samba.get_file_handle_for_reading("00000007.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") lines = handle.readlines() for line in lines: print line handle.close() samba.remove_file("00000007.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos")
def LeerDescarga(Nombre, Ruta=DOWNLOAD_LIST_PATH): logger.info("[descargas.py] LeerDescarga") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: filepath = os.path.join( Ruta , Nombre ) Archivo = open(filepath) lines = Archivo.readlines() Archivo.close(); item = Item() item.deserialize(lines[0]) return item
def LeerDescarga(Nombre, Ruta=DOWNLOAD_LIST_PATH): logger.info("[descargas.py] LeerDescarga") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: filepath = os.path.join(Ruta, Nombre) Archivo = open(filepath) lines = Archivo.readlines() Archivo.close() item = Item() item.deserialize(lines[0]) return item
def test_samba(): from core import samba #print samba.file_exists("00000005.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") #print samba.file_exists("00000004.txt","smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") print samba.get_files("smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") handle = samba.get_file_handle_for_reading( "00000007.txt", "smb://MEDIASERVER/DESCARGAS/XBMC/favoritos") lines = handle.readlines() for line in lines: print line handle.close() samba.remove_file("00000007.txt", "smb://MEDIASERVER/DESCARGAS/XBMC/favoritos")