X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/605ad52612d47d3ff18a4b045bc1ade29277722e..c69bb079fef352b7b34eac8739b0dc051629cb7b:/lib/python/Components/Scanner.py diff --git a/lib/python/Components/Scanner.py b/lib/python/Components/Scanner.py index 94c9cc2f..5a26a7d4 100644 --- a/lib/python/Components/Scanner.py +++ b/lib/python/Components/Scanner.py @@ -16,6 +16,7 @@ def getExtension(file): def getType(file): (type, _) = guess_type(file) + print "guessed type:", type if type is None: # Detect some mimetypes unknown to dm7025 # TODO: do mimetypes.add_type once should be better @@ -24,8 +25,18 @@ def getType(file): return "application/x-debian-package" elif ext == "ogg": return "application/ogg" + elif ext == "flac": + return "audio/x-flac" elif ext == "dmpkg": return "application/x-dream-package" + elif ext == "ts": + return "video/MP2T" + elif ext == "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: @@ -120,6 +131,10 @@ def scanDevice(mountpoint): # convert to list paths_to_scan = list(paths_to_scan) + + from Components.Harddisk import harddiskmanager + blockdev = mountpoint.split('/')[2] + error, blacklisted, removable, is_cdrom, partitions = harddiskmanager.getBlockDevInfo(blockdev) # now scan the paths for p in paths_to_scan: @@ -127,7 +142,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)