[mythtv] Ticket #3077: Default CD Device selection

Matthew Wire devel at mrwire.co.uk
Sun Mar 4 15:52:47 UTC 2007


> >> 1) I agree that having a default device selector is useful, and  
> >> having the
> >> burning functions seperate is also good. Having four defaults seems
> >> overkill, though? Maybe just one DefaultBurner setting?
> > This patch actually only creates two defaults - one for DVD and one  
> > for CD drives.
> 
> Well, you only added defaultCDDevice and defaultDVDDevice,
> but there are also CDWriterDevice, CDDevice,
> MythArchiveDVDLocation and DVDDeviceLocation?
> 
> 
> >   However, it may well make more sense to just have a single default?
> 
> We probably should just keep CDDevice and DVDDeviceLocation,
> and add DefaultWriter?
That's an interesting point that I'd not really thought of.  I wonder if
anyone can think of a reason why we would need more than those three
settings?
(CDDevice,DVDDeviceLocation,DefaultWriter).

Settings for CD devices in the plugins can then be removed entirely.
Any reason why anyone should want to configure plugins differently?

> Another alternative might be to pop up a device selector
> each time the user is going to burn something?
Hmm, this is perhaps the only time you might want two burners - one that
is good for cd's and another for dvd's.  Seems unlikely though..
I'll make a patch which removes plugin configurations and just has those
three defaults.  That should get some feedback anyway.

> >> 5) I am wondering if the user really needs the /dev name in the GUI
> >> selector? Ideally, we would present the device name (''e.g.''  
> >> "PIONEER
> >> DVD-RW DVR-108" or "LITE-ON DVDRW SOHW-832S") parsed from
> >> /proc/ide/hd?model
> > That would be nice, I did have some code which did that
> 
> Ooo. Do share (if you still have it?)
The code for this is quite simple. Passing a device (eg. /dev/hdb)
returns either the name (eg. LITE-ON DVDRW SOHW-832S) or the device
(/dev/hdb) if it cannot find a name.  It only retrieves a name for ide
drives.

QString MediaMonitor::GetCDDeviceModel(QString &dev)
{
#ifdef linux
    QString devname = dev.mid(5);
    if (devname.startsWith("hd"))
    {  // Is an IDE drive
        QFile file("/proc/ide/"+devname+"/model");
        if (file.open(IO_ReadOnly))
        {
            QTextStream stream(&file);
            dev = stream.read();
            file.close();
        }
    }
#endif
    return dev.stripWhiteSpace();
}

The only issue with displaying this to the user is that you have to make
the combobox read-only.  When read-only, you can specify two parameters
for the entry, the first is what is displayed, the second is what is
stored.  When the combobox is writeable only the first (displayed) value
is used.  Hence, the drive detection code needs to work 99% of the time
or the user has to edit the sql directly.

Matt



More information about the mythtv-dev mailing list