Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1.  def get(cls, filename, tags=True, duration=True, image=False):
  2.         parser_class = None
  3.         size = os.path.getsize(filename)
  4.         if not size > 0:
  5.             return TinyTag(None, 0)
  6.         if cls == TinyTag:  # if `get` is invoked on TinyTag, find parser by ext
  7.             parser_class = cls._get_parser_for_filename(filename, exception=True)
  8.         else:  # otherwise use the class on which `get` was invoked
  9.             parser_class = cls
  10.         with io.open(filename, 'rb') as af:
  11.             tag = parser_class(af, size)
  12.             tag.load(tags=tags, duration=duration, image=image)
  13.             return tag
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement