print "Content-Type: text/html; charset=UTF-8" print "" lookup = TemplateLookup(directories=['../webapp/templates'], input_encoding='utf-8', output_encoding='utf-8') template = lookup.get_template("fileInput.mako") model = {} dlna = Dlna() listMediaDir = dlna.getMediaDir() model["mediaFile"] = None model["file"] = '' model["mediaDir"] = None print "Revisando el post" form = cgi.FieldStorage() if(form.length > 0): model["file"] = form.getfirst("file").strip() mediaDir = form.getfirst("mediaDir") model["mediaDir"] = mediaDir archivo = form.getfirst("file").strip() path = mediaDir + "/" + archivo print path fileSvc = FileSvc() mimeVO = fileSvc.getMimeFile(path) print mimeVO model["mediaFile"] = path print template.render(model = model, listMediaDir = listMediaDir)
from model.vo import MimeVO from module.fileSvc import FileSvc import os from os.path import basename from module.dbConnect import DetailsSvc from model.entity import DETAILS #print parseFile.video fileSvc = FileSvc() file = "/home/esanchez/naruto.mp4" mimeVO = fileSvc.getMimeFile(file) print mimeVO print "====================================================" fileFullName = os.path.basename(file) print fileFullName print os.path.splitext(fileFullName)[0] print os.path.splitext(fileFullName)[-1] print "====================================================" #Se busca primero en DETAILS POR NOMBRE DE ARCHIVO, SI NO SE ENCUENTRA SE BUSCA LA CARPETA, SI NO SE ENCUENTRA SE EMPIESA A DESARMAR EL DIRECTORIO print file dirName = os.path.dirname(file) print dirName