コード例 #1
0
ファイル: metaioid3.cpp プロジェクト: tomhughes/mythtv
bool MetaIOID3::writeRating(TagLib::ID3v2::Tag *tag, int rating)
{
    if (!tag)
        return false;

    int popmrating = lroundf(static_cast<float>(rating) / 10.0f * 255.0f);

    // MythTV Specific Rating Tag
    PopularimeterFrame *popm = findPOPM(tag, email);

    if (!popm)
    {
        popm = new PopularimeterFrame();
        tag->addFrame(popm);
        popm->setEmail(email);
    }
    popm->setRating(popmrating);

    // Global Rating Tag
    PopularimeterFrame *gpopm = findPOPM(tag, "");
    if (!gpopm)
    {
        gpopm = new PopularimeterFrame();
        tag->addFrame(gpopm);
        gpopm->setEmail("");
    }
    gpopm->setRating(popmrating);

    return true;
}
コード例 #2
0
ファイル: metaioid3.cpp プロジェクト: tomhughes/mythtv
bool MetaIOID3::writePlayCount(TagLib::ID3v2::Tag *tag, int playcount)
{
    if (!tag)
        return false;

    // MythTV Specific playcount Tag
    PopularimeterFrame *popm = findPOPM(tag, email);

    if (!popm)
    {
        popm = new PopularimeterFrame();
        tag->addFrame(popm);
        popm->setEmail(email);
    }

    int prevCount = popm->counter();
    int countDiff = playcount - prevCount;
    // Allow for situations where the user has rolled back to an old DB backup
    if (countDiff > 0)
    {
        popm->setCounter(playcount);

        // Global playcount Tag - Updated by all apps/hardware that support it
        PopularimeterFrame *gpopm = findPOPM(tag, "");
        if (!gpopm)
        {
            gpopm = new PopularimeterFrame();
            tag->addFrame(gpopm);
            gpopm->setEmail("");
        }
        gpopm->setCounter((gpopm->counter() > 0) ? gpopm->counter() + countDiff : playcount);
    }

    return true;
}
コード例 #3
0
ファイル: metaioid3.cpp プロジェクト: pierrchen/mythtv
bool MetaIOID3::writePlayCount(TagLib::ID3v2::Tag *tag, int playcount)
{
    if (!tag)
        return false;

    PopularimeterFrame *popm = findPOPM(tag, email);

    if (!popm)
    {
        popm = new PopularimeterFrame();
        tag->addFrame(popm);
        popm->setEmail(email);
    }

    popm->setCounter(playcount);

    return true;
}
コード例 #4
0
ファイル: metaioid3.cpp プロジェクト: pierrchen/mythtv
bool MetaIOID3::writeRating(TagLib::ID3v2::Tag *tag, int rating)
{
    if (!tag)
        return false;

    PopularimeterFrame *popm = findPOPM(tag, email);

    if (!popm)
    {
        popm = new PopularimeterFrame();
        tag->addFrame(popm);
        popm->setEmail(email);
    }
    int popmrating = static_cast<int>(((static_cast<float>(rating) / 10.0)
                                                               * 255.0) + 0.5);
    popm->setRating(popmrating);

    return true;
}