Author: tack
Date: Thu Feb 22 01:35:23 2007
New Revision: 2505
Modified:
trunk/metadata/src/factory.py
Log:
Make DVDs work again by using dvd:// instead of file:// for url scheme for
DVD ISOs or devices; handle unsupported url schemes more gracefully.
Modified: trunk/metadata/src/factory.py
==============================================================================
--- trunk/metadata/src/factory.py (original)
+++ trunk/metadata/src/factory.py Thu Feb 22 01:35:23 2007
@@ -146,6 +146,13 @@
import misc.directory
+ def get_scheme_from_info(self, info):
+ import disc.dvd
+ if isinstance(info, disc.dvd.DVDInfo):
+ return 'dvd'
+ else:
+ return 'file'
+
def create_from_file(self, file, force=True):
"""
@@ -227,7 +234,11 @@
else:
(scheme, location, path, query, fragment) = split
- uhandle = urllib.urlopen(url)
+ try:
+ uhandle = urllib.urlopen(url)
+ except IOError:
+ # Unsupported URL scheme
+ return
mime = uhandle.info().gettype()
log.debug("Trying %s" % mime)
if self.mimemap.has_key(mime):
@@ -258,7 +269,7 @@
r = self.create_from_file(f, force)
f.close()
if r:
- r.url = 'file://%s' % os.path.abspath(filename)
+ r.url = '%s://%s' % (self.get_scheme_from_info(r),
os.path.abspath(filename))
return r
return None
@@ -272,7 +283,7 @@
log.debug('Trying %s' % e[R_MIMETYPE])
try:
t = e[R_CLASS](devicename)
- t.url = 'file://%s' % os.path.abspath(devicename)
+ t.url = '%s://%s' % (self.get_scheme_from_info(t),
os.path.abspath(devicename))
return t
except core.ParseError:
pass
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog