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; }
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; }
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; }
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; }