Esempio n. 1
0
/// Sets metadata from a DB row
void VideoMetadataImp::fromDBRow(MSqlQuery &query)
{
    m_title = query.value(0).toString();
    m_director = query.value(1).toString();
    m_studio = query.value(2).toString();
    m_plot = query.value(3).toString();
    m_rating = query.value(4).toString();
    m_year = query.value(5).toInt();
    m_releasedate = query.value(6).toDate();
    m_userrating = (float)query.value(7).toDouble();
    if (isnan(m_userrating) || m_userrating < 0)
        m_userrating = 0.0;
    if (m_userrating > 10.0)
        m_userrating = 10.0;
    m_length = query.value(8).toInt();
    m_filename = query.value(9).toString();
    m_hash = query.value(10).toString();
    m_showlevel = ParentalLevel(query.value(11).toInt()).GetLevel();
    m_coverfile = query.value(12).toString();
    m_inetref = query.value(13).toString();
    m_homepage = query.value(14).toString();
    m_childID = query.value(15).toUInt();
    m_browse = query.value(16).toBool();
    m_watched = query.value(17).toBool();
    m_playcommand = query.value(18).toString();
    m_categoryID = query.value(19).toInt();
    m_id = query.value(20).toInt();
    m_trailer = query.value(21).toString();
    m_screenshot = query.value(22).toString();
    m_banner = query.value(23).toString();
    m_fanart = query.value(24).toString();
    m_subtitle = query.value(25).toString();
    m_tagline = query.value(26).toString();
    m_season = query.value(27).toInt();
    m_episode = query.value(28).toInt();
    m_host = query.value(29).toString();
    m_insertdate = query.value(30).toDate();
    m_processed = query.value(31).toBool();

    VideoCategory::GetCategory().get(m_categoryID, m_category);

    // Genres
    fillGenres();

    //Countries
    fillCountries();

    // Cast
    fillCast();
}
Esempio n. 2
0
void EditMetadataDialog::SetLevel(MythUIButtonListItem *item)
{
    m_workingMetadata->
            SetShowLevel(ParentalLevel(item->GetData().toInt()).GetLevel());
}
Esempio n. 3
0
 void SetShowLevel(ParentalLevel::Level showLevel)
 {
     m_showlevel = ParentalLevel(showLevel).GetLevel();
 }
Esempio n. 4
0
    // returns true if no completion is required
    bool DoCheck()
    {
        ParentalLevel which_level(m_toLevel);

        // No password for level 1 and you can always switch down from your
        // current level.
        if (which_level == ParentalLevel::plLowest ||
            which_level <= ParentalLevel(m_fromLevel))
            return true;

        // If there isn't a password at the current level, and
        // none of the levels below, we are done.
        // The assumption is that if you password protected lower levels,
        // and a higher level does not have a password it is something
        // you've overlooked (rather than intended).
        if (!m_pm.FirstAtOrBelow(which_level.GetLevel()).length())
            return true;

        // See if we recently (and successfully) asked for a password
        QString last_time_stamp = gCoreContext->GetSetting("VideoPasswordTime");
        int last_parent_lvl = gCoreContext->GetNumSetting("VideoPasswordLevel", -1);

        if (!last_time_stamp.length() || last_parent_lvl == -1)
        {
            VERBOSE(VB_IMPORTANT,
                    QString("%1: Could not read password/pin time "
                            "stamp. This is only an issue if it "
                            "happens repeatedly.").arg(__FILE__));
        }
        else
        {
            QDateTime curr_time = QDateTime::currentDateTime();
            QDateTime last_time =
                    QDateTime::fromString(last_time_stamp, Qt::ISODate);

            if (ParentalLevel(last_parent_lvl) >= which_level &&
                last_time.secsTo(curr_time) < 120)
            {
                // Two minute window
                last_time_stamp = curr_time.toString(Qt::ISODate);
                gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
                gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
                return true;
            }
        }

        m_validPasswords = m_pm.AtOrAbove(which_level.GetLevel());

        // If there isn't a password for this level or higher levels, treat
        // the next lower password as valid. This is only done so people
        // cannot lock themselves out of the setup.
        if (!m_validPasswords.size())
        {
            QString pw = m_pm.FirstAtOrBelow(which_level.GetLevel());
            if (pw.length())
                m_validPasswords.push_back(pw);
        }

        // There are no suitable passwords.
        if (!m_validPasswords.size())
            return true;

        // If we got here, there is a password, and there's no backing down.
        MythScreenStack *popupStack =
                GetMythMainWindow()->GetStack("popup stack");

        MythTextInputDialog *pwd =
                new MythTextInputDialog(popupStack,
                        QObject::tr("Parental PIN:"), FilterNone, true);

        connect(pwd, SIGNAL(haveResult(QString)),
                SLOT(OnPasswordEntered(QString)));
        connect(pwd, SIGNAL(Exiting()), SLOT(OnPasswordExit()));

        if (pwd->Create())
            popupStack->AddScreen(pwd, false);

        return false;
    }