Ticket #2708: preferMythProto.patch
File preferMythProto.patch, 6.4 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/jobqueue.cpp
1776 1776 ChangeJobStatus(jobID, JOB_STARTING); 1777 1777 program_info->SetTranscoded(TRANSCODING_RUNNING); 1778 1778 1779 QString filename = program_info->GetPlaybackURL(); 1779 // I need to get the filesize, 1780 // // so we need to use the file (RW=true) 1781 QString filename = program_info->GetPlaybackURL(true); 1780 1782 1781 1783 origfilesize = 0; 1782 1784 filesize = 0; … … 1839 1841 // Clear the pathname to force rechecking the DB in case 1840 1842 // mythtranscode renamed the file. 1841 1843 program_info->pathname = ""; 1842 filename = program_info->GetPlaybackURL(); 1844 // I need to get the filesize, 1845 // so we need to use the file (RW=true) 1846 filename = program_info->GetPlaybackURL(true); 1843 1847 1844 1848 if (stat(filename.ascii(), &st) == 0) 1845 1849 { -
libs/libmythtv/previewgenerator.cpp
69 69 if (!QFileInfo(localFN).exists()) 70 70 { 71 71 // GetPlaybackURL tries to return a local filename if one exists 72 localFN = programInfo.GetPlaybackURL( );72 localFN = programInfo.GetPlaybackURL(true); 73 73 if (!(localFN.left(1) == "/" && QFileInfo(localFN).exists())) 74 74 return; // didn't find file locally, must use remote backend 75 75 } -
libs/libmythtv/RingBuffer.cpp
168 168 if ((filename.left(7) == "myth://") && 169 169 (filename.length() > 7 )) 170 170 { 171 QString local_pathname = gContext->GetSetting("RecordFilePrefix"); 172 int hostlen = filename.find(QRegExp("/"), 7); 173 174 if (hostlen != -1) 171 //If we don't prefer the myth proto, check to see if the file is 172 //availible locally 173 if (!gContext->GetSetting("PreferMythProto") ) 175 174 { 176 local_pathname += filename.right(filename.length() - hostlen); 175 QString local_pathname = gContext->GetSetting("RecordFilePrefix"); 176 int hostlen = filename.find(QRegExp("/"), 7); 177 177 178 QFile checkFile(local_pathname); 179 if (checkFile.exists()) 178 if (hostlen != -1) 180 179 { 181 is_local = true; 182 filename = local_pathname; 180 local_pathname += filename.right(filename.length() - hostlen); 181 182 QFile checkFile(local_pathname); 183 if (checkFile.exists()) 184 { 185 is_local = true; 186 filename = local_pathname; 187 } 183 188 } 184 189 } 190 185 191 } 186 192 #ifdef USING_FRONTEND 187 193 else if (filename.left(4) == "dvd:") -
libs/libmythtv/programinfo.h
160 160 bool SetRecordBasename(QString basename); 161 161 QString GetRecordBasename(bool fromDB = false) const; 162 162 QString GetRecordFilename(const QString &prefix, bool fromDB = false) const; 163 QString GetPlaybackURL( QString playbackHost = "") const;163 QString GetPlaybackURL(bool needRW = false) const; 164 164 QString MakeUniqueKey(void) const; 165 165 int CalculateLength(void) const; 166 166 int SecsTillStart() const; -
libs/libmythtv/programinfo.cpp
1467 1467 return QString("%1/%2").arg(prefix).arg(GetRecordBasename(fromDB)); 1468 1468 } 1469 1469 1470 /** \fn ProgramInfo::GetPlaybackURL( QString) const1470 /** \fn ProgramInfo::GetPlaybackURL(bool) const 1471 1471 * \brief Returns URL to where %MythTV would stream the 1472 1472 * this program from, were it to be streamed. 1473 * \param needRW boolean to request that file needs to be 1474 * writeable or otherwise not a mythstream (default = 1475 * false) 1473 1476 */ 1474 QString ProgramInfo::GetPlaybackURL( QString playbackHost) const1477 QString ProgramInfo::GetPlaybackURL(bool needRW) const 1475 1478 { 1476 1479 QString tmpURL; 1477 1480 QString m_hostname = gContext->GetHostName(); 1478 1481 1479 if (playbackHost == "")1480 playbackHost = m_hostname;1481 1482 1482 tmpURL = GetRecordFilename(gContext->GetSettingOnHost("RecordFilePrefix", 1483 1483 hostname)); 1484 bool preferMythProto = gContext->GetSettingOnHost("PreferMythProtocol", 1485 m_hostname); 1484 1486 1485 if (playbackHost == hostname) 1487 //If this is local, use the file path 1488 if (m_hostname == hostname) 1486 1489 return tmpURL; 1487 1490 1488 if (playbackHost == m_hostname) 1491 // I'd rather not use the mythproto, or I need to Read & Write 1492 // Check my local recording dir, see if this recording is there 1493 if (!preferMythProto || needRW) 1489 1494 { 1490 1495 QFile checkFile(tmpURL); 1491 1496 … … 1500 1505 return tmpURL; 1501 1506 } 1502 1507 1508 //Otherwise I prefer the myth protocol, or the file is not avail locally 1509 //so stream the file 1503 1510 tmpURL = QString("myth://") + 1504 1511 gContext->GetSettingOnHost("BackendServerIP", hostname) + ":" + 1505 1512 gContext->GetSettingOnHost("BackendServerPort", hostname) + "/" + -
programs/mythtranscode/main.cpp
395 395 return TRANSCODE_EXIT_NO_RECORDING_DATA; 396 396 } 397 397 398 infile = pginfo->GetPlaybackURL(); 398 // We can't transcode if we can't write 399 infile = pginfo->GetPlaybackURL(true); 399 400 } 400 401 else 401 402 { … … 584 585 return; 585 586 } 586 587 587 QString filename = pginfo->GetPlaybackURL(); 588 // We need to write the new file, so we need RW 589 QString filename = pginfo->GetPlaybackURL(true); 588 590 589 591 if (status == JOB_STOPPING) 590 592 {