Ticket #12549: savestars.patch

File savestars.patch, 2.2 KB (added by anonymous, 4 years ago)
  • mythtv/libs/libmyth/programinfo.cpp

    diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
    index 5d43f57..efeb1bd 100644
    a b void ProgramInfo::SaveSeasonEpisode(uint seas, uint ep) 
    43184318    SendUpdateEvent();
    43194319}
    43204320
     4321void ProgramInfo::SaveStars(float stars)
     4322{
     4323    MSqlQuery query(MSqlQuery::InitCon());
     4324
     4325    query.prepare(
     4326        "UPDATE recorded "
     4327        "SET stars = :STARS "
     4328        "WHERE chanid = :CHANID AND starttime = :STARTTIME "
     4329        "AND recordid = :RECORDID");
     4330
     4331    query.bindValue(":STARS",      stars);
     4332    query.bindValue(":CHANID",     chanid);
     4333    query.bindValue(":STARTTIME",  recstartts);
     4334    query.bindValue(":RECORDID",   recordid);
     4335    if (!query.exec())
     4336    {
     4337        MythDB::DBError("SaveStars", query);
     4338        return;
     4339    }
     4340
     4341    SendUpdateEvent();
     4342}
     4343
    43214344void ProgramInfo::SaveInetRef(const QString &inet)
    43224345{
    43234346    MSqlQuery query(MSqlQuery::InitCon());
  • mythtv/libs/libmyth/programinfo.h

    diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h
    index a9b5a13..50231f6 100644
    a b class MPUBLIC ProgramInfo 
    576576    void MarkAsInUse(bool inuse, QString usedFor = "");
    577577    void UpdateInUseMark(bool force = false);
    578578    void SaveSeasonEpisode(uint seas, uint ep);
     579    void SaveStars(float stars);
    579580    void SaveInetRef(const QString &inet);
    580581
    581582    // Extremely slow functions that cannot be called from the UI thread.
  • mythtv/programs/mythmetadatalookup/lookup.cpp

    diff --git a/mythtv/programs/mythmetadatalookup/lookup.cpp b/mythtv/programs/mythmetadatalookup/lookup.cpp
    index cd18d02..49c5a99 100644
    a b void LookerUpper::customEvent(QEvent *levent) 
    341341
    342342        if (lookup->GetSubtype() != kProbableGenericTelevision)
    343343            pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode());
     344        // Need to normalize rating from being out of ten to being between 0 and 1.
     345        if (lookup->GetUserRating() > 0.0)
     346            pginfo->SaveStars(lookup->GetUserRating() / 10.0);
    344347        pginfo->SaveInetRef(lookup->GetInetref());
    345348
    346349        if (m_updaterules)