Ticket #1661: symlinks.patch
File symlinks.patch, 2.9 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/jobqueue.cpp
1755 1755 QString statusText = StatusText(GetJobStatus(jobID)); 1756 1756 QString fileprefix = gContext->GetFilePrefix(); 1757 1757 QString filename = program_info->GetRecordFilename(fileprefix); 1758 QString theLink; 1758 1759 1759 1760 origfilesize = 0; 1760 1761 filesize = 0; … … 1798 1799 1799 1800 int status = GetJobStatus(jobID); 1800 1801 1802 QFileInfo inf(filename); 1803 if( inf.isSymLink() ) { 1804 theLink = filename; 1805 filename = inf.readLink(); 1806 } 1807 1801 1808 if (status == JOB_STOPPING) 1802 1809 { 1803 1810 QString tmpfile = filename; … … 1808 1815 // To save the original file... 1809 1816 QString oldfile = filename; 1810 1817 QString newfile = filename; 1818 QString newlink = theLink; 1811 1819 QString jobArgs = GetJobArgs(jobID); 1812 1820 oldfile += ".old"; 1813 1821 … … 1818 1826 1819 1827 newfile.replace(QRegExp("mpg$"), "nuv"); 1820 1828 newbase.replace(QRegExp("mpg$"), "nuv"); 1829 if( !theLink.isEmpty() ) 1830 newlink.replace(QRegExp("mpg$"), "nuv"); 1821 1831 program_info->SetRecordBasename(newbase); 1822 1832 } 1823 1833 … … 1831 1841 "JobQueue::DoTranscodeThread: Error Renaming '%1' to '%2'") 1832 1842 .arg(tmpfile).arg(newfile).ascii()); 1833 1843 1844 if (!theLink.isEmpty() && 1845 (unlink(theLink) == -1 || symlink(newfile, newlink) == -1)) 1846 perror(QString( 1847 "JobQueue::DoTranscodeThread: Error resetting symink '%1' to '%2'") 1848 .arg(theLink).arg(newlink).ascii()); 1849 1834 1850 if (!gContext->GetNumSetting("SaveTranscoding", 0)) 1835 1851 { 1836 1852 if (unlink(oldfile) == -1) … … 64 65 bool build_index = false, fifosync = false, showprogress = false, mpeg2 = false; 65 66 QMap<long long, int> deleteMap; 66 67 QMap<long long, long long> posMap; 68 int fd; 67 69 srand(time(NULL)); 68 70 71 /* Let this process migrate on openMosix */ 72 if( ( fd = open( "/proc/self/lock", O_WRONLY ) ) >= 0 ) { 73 write( fd, "0\n", 2 ); 74 close( fd ); 75 } 76 69 77 QApplication a(argc, argv, false); 70 78 71 79 print_verbose_messages = VB_IMPORTANT; -
programs/mythtranscode/main.cpp
1 1 #include <qapplication.h> 2 2 #include <qsqldatabase.h> 3 3 #include <qfile.h> 4 #include <qfileinfo.h> 4 5 #include <qmap.h> 5 6 #include <qfileinfo.h> 6 7 #include <qregexp.h> … … 368 376 return TRANSCODE_EXIT_REMOTE_FILE; 369 377 } 370 378 379 QFileInfo inf(infile); 380 if( inf.isSymLink() ) 381 infile = inf.readLink(); 382 371 383 if (outfile.isNull()) 372 384 outfile = infile + ".tmp"; 373 385