def __init__(self, fileSystemItem = None): CommonItem.__init__(self) if(fileSystemItem != None): if(fileSystemItem.extension.id.lower() != self.id.lower()): raise CommonMediaItemException() else: self.logger.debug("CommonMediaItem created for {0}".format(self.id)) self.fileSystemItem = fileSystemItem self.dateTime = self.fileSystemItem.dateTime pass
def __init__(self, fileSystemItem = None): CommonItem.__init__(self) if(fileSystemItem != None): self.fileSystemItem = fileSystemItem self.logger.debug("CommonHashedItem created for {0}".format(self.fileSystemItem.fullFileName)) try: fileSystemItemBuffer = open(self.fileSystemItem.fullFileName).read() self.hash = hashlib.md5(fileSystemItemBuffer).hexdigest() except Exception, ex: self.logger.error("Exception: {0}".format(str(ex))) raise CommonHashedItemException("Error while creating hash for: {0}".format(self.fileSystemItem.fullFileName))
def __init__(self, fileName = ""): CommonItem.__init__(self) if not os.path.isfile(fileName): raise CommonFileSystemException("Provide file not exists: {0}".format(fileName)) (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(fileName) self.dateTime = datetime.datetime.fromtimestamp(mtime) self.fullFileName = fileName self.logger.debug("FileSystemItem: {0}".format(self.fullFileName)) self.extension = FileComponent_Extension(os.path.splitext(fileName)[1][1:].strip().lower()) self.name = FileComponent_Name(os.path.split(fileName)[1]) self.path = FileComponent_Path(os.path.split(fileName)[0]) self.subFileSysytemItems = {}
def __init__(self): CommonItem.__init__(self) pass
def __init__(self, idStr=""): CommonItem.__init__(self) self.id = idStr pass