Commits

Anonymous committed 77a22d4

Allow open file as parameter (must be seekable) (Jack)

  • Participants
  • Parent commits 3350c73
  • Branches legacy-trunk

Comments (0)

Files changed (1)

 
 
 #-------------------------#
-# Recognize sound headers #
+# Recognize image headers #
 #-------------------------#
 
-def what(filename, h=None):
+def what(file, h=None):
 	if h is None:
-		f = open(filename, 'r')
-		h = f.read(32)
+		if type(file) == type(''):
+			f = open(file, 'rb')
+			h = f.read(32)
+		else:
+			location = file.tell()
+			h = file.read(32)
+			file.seek(location)
+			f = None	
 	else:
 		f = None
 	try: