Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- class File:
- def __init__(self, path):
- self.path = path
- self.contents = []
- def add_content(self, *content):
- for item in content:
- self.contents.append(item)
- def show(self):
- for item in self.contents:
- print(item)
- def rename(self, new_path):
- self.path = new_path
- def remove(self):
- self.content = []
- self.path = ""
- def size(self):
- size = sum([sys.getsizeof(item) for item in self.contents])
- return size,sys.getsizeof(self.contents),sys.getsizeof(self)
- def info(self):
- return self.path, self.contents
- class MediaFile(File):
- def __init__(self,path,codec,geoloc,duration):
- super().__init__(path)
- self.codec = codec
- self.geoloc = geoloc
- self.duration = duration
- def info(self):
- return super().info(),self.codec,self.geoloc,self.duration
- class VideoFile(MediaFile):
- def __init__(self,path,codec,geoloc,duration,dimensions):
- super().__init__(path,codec,geoloc,duration)
- self.dimensions = dimensions
- def info(self):
- return vars(self)
- Video1 = VideoFile("/home/python/vanrossum.mp4","h264",(23.21325,35.34534),487,(1920,1080))
- Video1.add_content('Hello','world')
- print(Video1.info())
- print(Video1.size())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement