Ticket #3639: trunkmp3fs.diff

File trunkmp3fs.diff, 2.5 KB (added by dbadia@…, 17 years ago)

patch

  • programs/mythbackend/mythxml.cpp

     
    13141314        // ------------------------------------------------------------------
    13151315
    13161316        MSqlQuery query(MSqlQuery::InitCon());
    1317 
     1317        QString filename = QString("");
    13181318        if (query.isConnected())
    13191319        {
    13201320            query.prepare("SELECT CONCAT_WS('/', music_directories.path, "
     
    13291329            if (query.isActive() && query.size() > 0)
    13301330            {
    13311331                query.first(); 
    1332                 pRequest->m_sFileName = QString( "%1/%2" )
    1333                                            .arg( sBasePath )
    1334                                            .arg( query.value(0).toString() );
    1335             }
     1332                filename = query.value(0).toString() ;
     1333            }        }
     1334
     1335        // ------------------------------------------------------------------
     1336        // Check for diff format required if not
     1337        // ------------------------------------------------------------------
     1338        QString peerIP = pRequest->GetPeerAddress();
     1339        QString altHosts = gContext->GetSetting("UpnpAltMusicHosts", "");
     1340        bool isAltHost = altHosts.contains(peerIP) > 0;
     1341        QString regExtension = gContext->GetSetting("UpnpNormalMusicExtension",
     1342             "none");
     1343        VERBOSE(VB_UPNP,QString("HttpStatus::GetMusic : peerIP %1, altHosts"
     1344         " %2, regExtension %3").arg(peerIP).arg(altHosts).arg(regExtension));
     1345        if(isAltHost && filename.endsWith(QString(".%1").arg(regExtension))) {
     1346            sBasePath = gContext->GetSetting("UpnpAltMusicLocation", sBasePath);
     1347            int index = filename.length() -5;
     1348            QString it = filename.replace(index, 4, QString(".mp3"));
     1349            it = it.left(filename.length() -1);
     1350            VERBOSE(VB_UPNP,QString("HttpStatus::GetMusic : m_sFileName ends"
     1351                " in .flac, replace with %1").arg(it));
     1352            filename = it;
     1353
    13361354        }
    13371355
     1356        pRequest->m_sFileName = QString ("%1/%2")
     1357                                .arg( sBasePath)
     1358                                .arg( filename) ;
     1359        VERBOSE(VB_UPNP,QString("HttpStatus::GetMusic : m_sFileName: %1")
     1360            .arg(pRequest->m_sFileName));
     1361
    13381362        // ------------------------------------------------------------------
    13391363        // Store information in WorkerThread Storage for next request (cache)
    13401364        // ------------------------------------------------------------------