Ticket #10500: videoscan.patch

File videoscan.patch, 2.3 KB (added by Jonatan Lindblad, 4 years ago)
  • mythtv/libs/libmythbase/remotefile.cpp

    diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp
    index eb591fb..dc75022 100644
    a b using namespace std; 
    3636
    3737#define MAX_FILE_CHECK 500  // in ms
    3838
     39static bool RemoteSendReceiveStringList(const QString &host, QStringList &strlist)
     40{
     41    bool ok = false;
     42
     43    if (gCoreContext->IsMasterBackend())
     44    {
     45        // since the master backend cannot connect back around to
     46        // itself, and the libraries do not have access to the list
     47        // of connected slave backends to query an existing connection
     48        // start up a new temporary connection directly to the slave
     49        // backend to query the file list
     50        QString ann = QString("ANN Playback %1 0")
     51                        .arg(gCoreContext->GetHostName());
     52        QString addr = gCoreContext->GetBackendServerIP(host);
     53        int port = gCoreContext->GetBackendServerPort(host);
     54        bool mismatch = false;
     55
     56        MythSocket *sock = gCoreContext->ConnectCommandSocket(
     57                                            addr, port, ann, &mismatch);
     58        if (sock)
     59        {
     60            ok = sock->SendReceiveStringList(strlist);
     61            sock->DecrRef();
     62        }
     63        else
     64            strlist.clear();
     65    }
     66    else
     67        ok = gCoreContext->SendReceiveStringList(strlist);
     68
     69    return ok;
     70}
     71
    3972RemoteFile::RemoteFile(const QString &_path, bool write, bool useRA,
    4073                       int _timeout_ms,
    4174                       const QStringList *possibleAuxiliaryFiles) :
    bool RemoteFile::Exists(const QString &url, struct stat *fileinfo) 
    498531    if (!sgroup.isEmpty())
    499532        strlist << sgroup;
    500533
    501     gCoreContext->SendReceiveStringList(strlist);
    502 
    503534    bool result = false;
    504     if (!strlist.isEmpty() && strlist[0] == "1")
     535    if (RemoteSendReceiveStringList(host, strlist) && strlist[0] == "1")
    505536    {
    506537        if ((strlist.size() >= 15) && fileinfo)
    507538        {
    QString RemoteFile::GetFileHash(const QString &url) 
    557588    strlist << sgroup;
    558589    strlist << hostname;
    559590
    560     gCoreContext->SendReceiveStringList(strlist);
    561     if (!strlist.isEmpty())
     591    if (RemoteSendReceiveStringList(hostname, strlist))
    562592    {
    563593        result = strlist[0];
    564594    }