Exemplo n.º 1
0
MetaGrabberScript MetaGrabberScript::FromInetref(const QString &inetref,
                                                 bool absolute)
{
    static QRegExp retagref("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3})_(.*)");
    static QRegExp retagref2("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3}):(.*)");
    static QMutex reLock;
    QMutexLocker lock(&reLock);
    QString tag;

    if (retagref.indexIn(inetref) > -1)
    {
        tag = retagref.cap(1);
    }
    else if (retagref2.indexIn(inetref) > -1)
    {
        tag = retagref2.cap(1);
    }
    if (!tag.isEmpty())
    {
        // match found, pull out the grabber
        MetaGrabberScript script = MetaGrabberScript::FromTag(tag, absolute);
        if (script.IsValid())
            return script;
    }

    // no working match, return a blank
    return MetaGrabberScript();
}
Exemplo n.º 2
0
LookupType GuessLookupType(const QString &inetref)
{
    if (inetref.isEmpty() || inetref == "00000000" ||
        inetref == MetaGrabberScript::CleanedInetref(inetref))
    {
        // can't determine subtype from inetref
        return kUnknownVideo;
    }

    // inetref is defined, see if we have a pre-defined grabber
    MetaGrabberScript grabber =
        MetaGrabberScript::FromInetref(inetref);

    if (!grabber.IsValid())
    {
        return kUnknownVideo;
    }

    switch (grabber.GetType())
    {
        case kGrabberMovie:
            return kProbableMovie;
        case kGrabberTelevision:
            return kProbableTelevision;
        default:
            return kUnknownVideo;
    }
}
Exemplo n.º 3
0
MetaGrabberScript MetaGrabberScript::GetGrabber(GrabberType defaultType,
                                                const MetadataLookup *lookup)
{
    if (!lookup)
    {
        return GetType(defaultType);
    }

    if (!lookup->GetInetref().isEmpty() &&
        lookup->GetInetref() != "00000000")
    {
        // inetref is defined, see if we have a pre-defined grabber
        MetaGrabberScript grabber = FromInetref(lookup->GetInetref());

        if (grabber.IsValid())
        {
            return grabber;
        }
        // matching grabber was not found, just use the default
        // fall through
    }

    return GetType(defaultType);
}