asset.py 665 B

12345678910111213141516171819
  1. class Asset:
  2. def __init__(self, path, mimetype, start_location, end_location, flags):
  3. self.path = path
  4. self.mimetype = mimetype
  5. self.start_location = start_location
  6. self.end_location = end_location
  7. self.flags = flags
  8. @staticmethod
  9. def from_string(string):
  10. path, data = string.split(": ", 1)
  11. data = str.split(data.rstrip(), " ")
  12. asset = Asset(path, data[0], int(data[1]), int(data[2]), data[3:])
  13. return asset
  14. def __str__(self) -> str:
  15. return str.format("{}: {} {} {} {}", self.path, self.mimetype, self.start_location, self.end_location, str.join(" ", self.flags))