Ticket #12277: mythtv-MetadataForManualRecordRules.patch

File mythtv-MetadataForManualRecordRules.patch, 1.5 KB (added by Steve Erlenborn <simon.sinister@…>, 7 years ago)

Strip (Manual Record) from titles before searching for metadata

  • mythtv/libs/libmythmetadata/metadatagrabber.cpp

    diff --git a/mythtv/libs/libmythmetadata/metadatagrabber.cpp b/mythtv/libs/libmythmetadata/metadatagrabber.cpp
    index 64050ea..ff5a05e 100644
    a b MetadataLookupList MetaGrabberScript::Search(const QString &title, 
    519519    QStringList args;
    520520    SetDefaultArgs(args);
    521521
     522    // Recordings made from Manual Record rules have a suffix
     523    // " (Manual Record)" appended to the title string. That
     524    // suffix will ruin the search for metadata, so we need
     525    // to strip it out, if it's there.
     526    QString baseTitle(title);
     527    QString manRecSuffix = QString(" (%1)").arg(QObject::tr("Manual Record"));
     528    baseTitle.replace(manRecSuffix,"");
     529
    522530    args << "-M"
    523          << title;
     531         << baseTitle;
    524532
    525533    return RunGrabber(args, lookup, passseas);
    526534}
    MetadataLookupList MetaGrabberScript::SearchSubtitle(const QString &title, 
    532540    QStringList args;
    533541    SetDefaultArgs(args);
    534542
     543    // Recordings made from Manual Record rules have a suffix
     544    // " (Manual Record)" appended to the title string. That
     545    // suffix will ruin the search for metadata, so we need
     546    // to strip it out, if it's there.
     547    QString baseTitle(title);
     548    QString manRecSuffix = QString(" (%1)").arg(QObject::tr("Manual Record"));
     549    baseTitle.replace(manRecSuffix,"");
     550
    535551    args << "-N"
    536          << title
     552         << baseTitle
    537553         << subtitle;
    538554
    539555    return RunGrabber(args, lookup, passseas);