Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}