class HarddiskManager:
def __init__(self):
self.hdd = [ ]
-
+ self.cd = ""
self.partitions = [ ]
self.on_partition_list_change = CList()
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
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()]
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 = """
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):
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
from Components.Task import Task, Job, job_manager, DiskspacePrecondition, Condition, ToolExistsPrecondition
+from Components.Harddisk import harddiskmanager
from Screens.MessageBox import MessageBox
class png2yuvTask(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):
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
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
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
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)