Allow playback of VCD (Video CD) and SVCD
[enigma2.git] / lib / python / Components / Scanner.py
index 6bd0e3bddc4b970c21ff7f8912580522439a8897..c217aa5c689d5eb0d77f19523cec1c2dcc0929b5 100644 (file)
@@ -26,10 +26,14 @@ def getType(file):
                        return "application/ogg"
                elif ext == "dmpkg":
                        return "application/x-dream-package"
+               elif ext == "ts":
+                       return "video/MP2T"
                elif ext == "iso":
-                       return "video/x-dvd-iso"        
+                       return "video/x-dvd-iso"
                elif file[-12:].lower() == "video_ts.ifo":
                        return "video/x-dvd"
+               elif ext == "dat" and file[-11:-6].lower() == "avseq":
+                       return "video/x-vcd"
        return type
 
 class Scanner:
@@ -124,6 +128,14 @@ def scanDevice(mountpoint):
 
        # convert to list
        paths_to_scan = list(paths_to_scan)
+       
+       from Components.Harddisk import HarddiskManager 
+       class CdromManager(HarddiskManager):
+               def __init__(self):
+                       pass
+       cdaman = CdromManager()
+       blockdev = mountpoint.split('/')[2]
+       error, blacklisted, removable, is_cdrom, partitions = cdaman.getBlockDevInfo(blockdev)
 
        # now scan the paths
        for p in paths_to_scan:
@@ -131,7 +143,11 @@ def scanDevice(mountpoint):
 
                for root, dirs, files in os_walk(path):
                        for f in files:
-                               sfile = ScanFile(os_path.join(root, f))
+                               path = os_path.join(root, f)
+                               if is_cdrom and path.endswith(".wav") and path[-13:-6] == ("/track-"):
+                                       sfile = ScanFile(path,"audio/x-cda")
+                               else:
+                                       sfile = ScanFile(path)
                                for s in scanner:
                                        s.handleFile(res, sfile)