aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-08 15:36:49 +0000
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-08 15:36:49 +0000
commit7416bb955a8eee1764a969116a54e3996fec429d (patch)
tree4b7a46276d9a748aa9fe2bd948f47098a302672f /lib
parentdb46f952f934ea8532527cbbdf21ef283cacda20 (diff)
downloadenigma2-7416bb955a8eee1764a969116a54e3996fec429d.tar.gz
enigma2-7416bb955a8eee1764a969116a54e3996fec429d.zip
get rid of hardcoded path to cdrom device
Diffstat (limited to 'lib')
-rw-r--r--lib/python/Components/Harddisk.py7
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py5
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/Process.py5
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/plugin.py9
4 files changed, 17 insertions, 9 deletions
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index dfc262d8..a5727cf7 100644
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -248,7 +248,7 @@ class Partition:
class HarddiskManager:
def __init__(self):
self.hdd = [ ]
-
+ self.cd = ""
self.partitions = [ ]
self.on_partition_list_change = CList()
@@ -301,6 +301,8 @@ class HarddiskManager:
if partition[0:len(blockdev)] != blockdev:
continue
partitions.append(partition)
+ else:
+ self.cd = "/dev/"+blockdev
except IOError:
error = True
return error, blacklisted, removable, is_cdrom, partitions
@@ -363,6 +365,9 @@ class HarddiskManager:
list.append((hdd, hd))
return list
+ def getCD(self):
+ return self.cd
+
def getMountedPartitions(self, onlyhotplug = False):
return [x for x in self.partitions if (x.is_hotplug or not onlyhotplug) and x.mounted()]
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
index c766ad52..30487b69 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
@@ -7,6 +7,7 @@ from Components.Sources.StaticText import StaticText
from Components.Sources.Progress import Progress
from Components.Task import Task, Job, job_manager, Condition
from Components.ScrollLabel import ScrollLabel
+from Components.Harddisk import harddiskmanager
class DVDToolbox(Screen):
skin = """
@@ -161,7 +162,7 @@ class DVDformatTask(Task):
self.toolbox = job.toolbox
self.postconditions.append(DVDformatTaskPostcondition())
self.setTool("/bin/dvd+rw-format")
- self.args += [ "/dev/cdroms/cdrom0" ]
+ self.args += [ harddiskmanager.getCD() ]
self.end = 1100
def prepare(self):
@@ -205,7 +206,7 @@ class DVDinfoTask(Task):
self.toolbox = job.toolbox
self.postconditions.append(DVDinfoTaskPostcondition())
self.setTool("/bin/dvd+rw-mediainfo")
- self.args += [ "/dev/cdroms/cdrom0" ]
+ self.args += [ harddiskmanager.getCD() ]
def prepare(self):
self.error = None
diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py
index 74f23f15..71f7c998 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/Process.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py
@@ -1,4 +1,5 @@
from Components.Task import Task, Job, job_manager, DiskspacePrecondition, Condition, ToolExistsPrecondition
+from Components.Harddisk import harddiskmanager
from Screens.MessageBox import MessageBox
class png2yuvTask(Task):
@@ -264,7 +265,7 @@ class BurnTask(Task):
self.postconditions.append(BurnTaskPostcondition())
self.setTool("/bin/growisofs")
volName = self.getASCIIname(job.project.settings.name.getValue())
- self.args += [ "-dvd-compat", "-Z", "/dev/cdroms/cdrom0", "-V", volName, "-publisher", "Dreambox", "-use-the-force-luke=dummy" ]
+ self.args += [ "-dvd-compat", "-Z", harddiskmanager.getCD(), "-V", volName, "-publisher", "Dreambox", "-use-the-force-luke=dummy" ]
self.args += extra_args
def getASCIIname(self, name):
@@ -302,7 +303,7 @@ class BurnTask(Task):
self.error = self.ERROR_SIZE
elif line.find("write failed") != -1:
self.error = self.ERROR_WRITE_FAILED
- elif line.find("unable to open64(\"/dev/cdroms/cdrom0\",O_RDONLY): No such file or directory") != -1: # fixme
+ elif line.find("unable to open64(") != -1 and line.find(",O_RDONLY): No such file or directory") != -1:
self.error = self.ERROR_DVDROM
elif line.find("media is not recognized as recordable DVD") != -1:
self.error = self.ERROR_NOTWRITEABLE
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
index b9d9ce79..b201d2c6 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
@@ -12,6 +12,7 @@ from Components.MenuList import MenuList
from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
from Components.config import config
from Tools.Directories import pathExists, fileExists
+from Components.Harddisk import harddiskmanager
import servicedvd # load c++ part of dvd player plugin
@@ -338,9 +339,9 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
self.dvd_device = dvd_device
self.physicalDVD = True
else:
- if fileExists("/dev/cdroms/cdrom0"):
- print "physical dvd found (/dev/cdroms/cdrom0)"
- self.dvd_device = "/dev/cdroms/cdrom0"
+ if fileExists(harddiskmanager.getCD()):
+ print "physical dvd found:", harddiskmanager.getCD()
+ self.dvd_device = harddiskmanager.getCD()
self.physicalDVD = True
else:
self.dvd_device = None
@@ -541,7 +542,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
def showFileBrowser(self):
if self.physicalDVD and len(self.dvd_filelist) == 0:
- if self.dvd_device == "/dev/cdroms/cdrom0":
+ if self.dvd_device == harddiskmanager.getCD():
self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 )
else:
self.DVDdriveCB(True)