示例#1
0
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;
}
示例#2
0
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;
}