blob: 0dc747c4d8cf29f7078fd4ce39406fa3e2fc0970 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--- ./flowblade-0.10.0/Flowblade/sequence.py 2013-09-14 09:49:39.000000000 -0400
+++ sequence.py 2013-11-28 22:34:02.454226123 -0500
@@ -24,7 +24,7 @@
"""
import copy
-import gnomevfs
+import urllib, mimetypes
import mlt
import time #added when testing
import types
@@ -914,8 +914,13 @@
"""
Returns media type of file.
"""
+ # using urllib and mimetype for non gnome environments
try:
- mime_type = gnomevfs.get_mime_type(file_path)
+ url = urllib.pathname2url(file_path)
+ mime_guess = mimetypes.guess_type(url)
+ mime_string = mime_guess[0]
+ mime_type = str.split(mime_string, "/")
+
except Exception, err:
if not os.path.exists(file_path):
# We're doing a heuristic here to identify image sequence file_paths.
@@ -932,13 +937,13 @@
else:
return UNKNOWN
- if mime_type.startswith("video"):
+ if mime_type[0] == "video":
return VIDEO
- if mime_type.startswith("audio"):
+ if mime_type[0] == "audio":
return AUDIO
- if mime_type.startswith("image"):
+ if mime_type[0] == "image":
return IMAGE
return UNKNOWN
|