[mythtv] Ticket #3077: Default CD Device selection

Matthew Wire devel at mrwire.co.uk
Thu Mar 8 12:37:06 UTC 2007


On Thu, 2007-03-08 at 14:27 +1100, Nigel Pearson wrote:
> > Seems I might as well support both then.
> 
> Hold off on coding this for a little while (1/2 days).
> I am working on a patch that adds m_DeviceModel
> and getDeviceModel() into the MythMedia class.
I already did some code to support both:

#ifdef linux
    QString devname = device.mid(5);
    QString model = "/sys/block/"+devname+"/device/model";
    if (!QFile::exists(model))
        model = "/proc/ide/"+devname+"/model";
    QFile file(model);
    if (file.open(IO_ReadOnly))
    {
        QTextStream stream(&file);
        device = stream.read();
        file.close();
    }
#endif
    return device.stripWhiteSpace();

>If we wanted to go this way, the plugin could call:
>MythMediaMonitor::GetDefaultCDBurner()
>and it could do all the magic
>
>(e.g. if a default is set, return it, otherwise
>       pop up a selector so the user could choose
>       from the current set of drives,
>       or the drives with valid blank
>       media in them, or whatever)
Even better, we could implement methods for GetDefaultCDDevice(),
GetDefaultDVDDevice() as well.
As a start they could just return the default drive, then if we get
complaints from users we could think about implementing a popup for the
default burner etc.  However, I do wonder how many people actually have
more than two drives (or even one) in their systems...



>I am not a MythUI expert, but couldn't we keep it read-write,
>but pre-populate it with stuff like:
>
>/dev/hdc  LITEON DVDR
>/dev/hdd  Pioneer A108
>/dev/sdb  Sony
>
>and then parse/validate the first part if/when the user changes it?
Well, I've been trying something like this:
    /*Needs to be editable for mac/windows since we don't (yet) detect
devices
    * automatically for those OS's. */
#ifdef linux
    bool editable=false;
#else
    bool editable=true;
#endif
    HostComboBox *gc = new HostComboBox("CDDevice", editable);

If we are properly detecting the drives there is really no need for it
to be read/write.  If Myth is still unable to detect the drive then it
suggests the users system is somehow misconfigured.

Cheers,
Matt




More information about the mythtv-dev mailing list