version 1.8, 2005/02/12 13:30:31
|
version 1.14, 2005/03/07 21:25:41
|
Line 4 import stat
|
Line 4 import stat
|
import OSAS_helpers |
import OSAS_helpers |
import xmlrpclib |
import xmlrpclib |
import bz2 |
import bz2 |
|
import base64 |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Globals import InitializeClass,package_home |
from Globals import InitializeClass,package_home |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
|
import zLOG |
|
|
|
def encodeRPC(string): |
|
return base64.encodestring(bz2.compress(string)) |
|
|
|
|
class OSAS_storeOnlineServer(SimpleItem): |
class OSAS_storeOnlineServer(SimpleItem): |
Line 17 class OSAS_storeOnlineServer(SimpleItem)
|
Line 20 class OSAS_storeOnlineServer(SimpleItem)
|
|
|
meta_type="OSAS_server" |
meta_type="OSAS_server" |
|
|
|
def getImages(self,path): |
|
"""hack""" |
|
imageEnding=['.gif','.jpg','.jpeg','.png','.tiff','.tif'] |
|
|
|
dirs=os.listdir(path) |
|
ret=[] |
|
|
|
for dir in dirs: |
|
|
|
if os.path.isdir(os.path.join(path,dir)): |
|
|
|
for subdir in os.listdir(os.path.join(path,dir)): |
|
if os.path.splitext(subdir)[1].lower() in imageEnding: |
|
ret.append(os.path.join(dir,subdir)) |
|
else: |
|
if os.path.splitext(dir)[1] in imageEnding: |
|
ret.append(os.path.join(dir)) |
|
return ret |
|
|
|
|
|
def getMovies(self,path): |
|
"""hack""" |
|
movieEnding=['.dv','.mov','.mp4'] |
|
dirs=os.listdir(path) |
|
ret=[] |
|
for dir in dirs: |
|
if os.path.isdir(os.path.join(path,dir)): |
|
for subdir in os.listdir(os.path.join(path,dir)): |
|
if os.path.splitext(subdir)[1].lower() in movieEnding: |
|
ret.append(os.path.join(dir,subdir)) |
|
else: |
|
if os.path.splitext(dir)[1] in movieEnding: |
|
ret.append(os.path.join(dir)) |
|
return ret |
|
|
|
|
def findIndexMeta(self,realPath=""): |
def findIndexMeta(self,realPath=""): |
"""finde Rueckwaerts im Baum von Pfad ausgehend, dass erste index.meta file |
"""finde Rueckwaerts im Baum von Pfad ausgehend, dass erste index.meta file |
Line 95 class OSAS_storeOnlineServer(SimpleItem)
|
Line 133 class OSAS_storeOnlineServer(SimpleItem)
|
"""get all index Metas""" |
"""get all index Metas""" |
ret={} |
ret={} |
if os.path.exists(path+"/index.meta"): |
if os.path.exists(path+"/index.meta"): |
compressed=file(path+"/index.meta","r").read() |
compressed=encodeRPC(file(path+"/index.meta","r").read()) |
ret["."]=('OSAS_dir',compressed) |
ret["."]=('OSAS_dir',compressed) |
for dir in os.listdir(path): |
for dir in os.listdir(path): |
fileType=OSAS_helpers.checkOSASFileType(os.path.join(path,dir)) |
fileType=OSAS_helpers.checkOSASFileType(os.path.join(path,dir)) |
if os.path.exists(os.path.join(path,dir,"index.meta")): |
if os.path.exists(os.path.join(path,dir,"index.meta")): |
compressed=file(os.path.join(path,dir,"index.meta"),"r").read() |
compressed=encodeRPC(file(os.path.join(path,dir,"index.meta"),"r").read()) |
ret[dir]=('OSAS_dir',compressed) |
ret[dir]=('OSAS_dir',compressed) |
else: |
else: |
ret[dir]=(fileType,None) |
ret[dir]=(fileType,None) |
return ret |
return ret |
|
|
|
def writeMetaDataFile(self,path,metadata): |
|
"""writefiletoserver""" |
|
try: |
|
fh=file(path,"w") |
|
fh.write(metadata) |
|
fh.close |
|
return True |
|
except: |
|
return False |
|
|
|
def generateMovieThumb(self,input,output): |
|
"""generate Movie""" |
|
zLOG.LOG("SERVER",zLOG.INFO,"/usr/local/bin/thumbbite.pl %s %s"%(input,output)) |
|
ret=os.popen("/usr/local/bin/thumbbite.pl %s %s"%(input,output)) |
|
zLOG.LOG("SERVER",zLOG.INFO,ret) |
|
return "ok" |
|
|
def manage_addOSAS_storeOnlineServerForm(self): |
def manage_addOSAS_storeOnlineServerForm(self): |
"""interface for adding the OSAS_storeOnline""" |
"""interface for adding the OSAS_storeOnline""" |