757 | | oldfile = filename + ".png"; |
758 | | newfile += ".png"; |
| 758 | // Delete previews if cutlist was applied. They will be re-created as |
| 759 | // required. This prevents the user from being stuck with a preview |
| 760 | // from a cut area and ensures that the "dimensioned" previews |
| 761 | // correspond to the new timeline |
| 762 | if (useCutlist) |
| 763 | { |
| 764 | QFileInfo fInfo(filename); |
| 765 | QString nameFilter = fInfo.fileName() + "*.png"; |
| 766 | // QDir's nameFilter uses spaces or semicolons to separate globs, |
| 767 | // so replace them with the "match any character" wildcard |
| 768 | // since mythrename.pl may have included them in filenames |
| 769 | nameFilter.replace(QRegExp("( |;)"), "?"); |
| 770 | QDir dir (fInfo.dirPath(), nameFilter); |
760 | | QFile checkFile(oldfile); |
761 | | if ((oldfile != newfile) && (checkFile.exists())) |
762 | | rename(oldfile, newfile); |
| 772 | for (uint nIdx = 0; nIdx < dir.count(); nIdx++) |
| 773 | { |
| 774 | oldfile = QString("%1/%2").arg(fInfo.dirPath() ) |
| 775 | .arg(dir[nIdx]); |
| 776 | // If unlink fails, keeping the old preview is not a problem. |
| 777 | // The RENAME_TO_NUV check below will attempt to rename the |
| 778 | // file, if required. |
| 779 | unlink(oldfile.local8Bit()); |
| 780 | } |
| 781 | } |
| 783 | /* Rename all preview thumbnails. */ |
| 784 | if (jobArgs == "RENAME_TO_NUV") |
| 785 | { |
| 786 | QFileInfo fInfo(filename); |
| 787 | QString nameFilter = fInfo.fileName() + "*.png"; |
| 788 | // QDir's nameFilter uses spaces or semicolons to separate globs, |
| 789 | // so replace them with the "match any character" wildcard |
| 790 | // since mythrename.pl may have included them in filenames |
| 791 | nameFilter.replace(QRegExp("( |;)"), "?"); |
| 792 | |
| 793 | QDir dir (fInfo.dirPath(), nameFilter); |
| 794 | |
| 795 | for (uint nIdx = 0; nIdx < dir.count(); nIdx++) |
| 796 | { |
| 797 | oldfile = QString("%1/%2").arg(fInfo.dirPath() ) |
| 798 | .arg(dir[nIdx]); |
| 799 | newfile = oldfile; |
| 800 | QRegExp re("mpg(\\..*)?\\.png$"); |
| 801 | if (re.search(newfile)) |
| 802 | newfile.replace(re, QString("nuv%1.png").arg(re.cap(1))); |
| 803 | |
| 804 | QFile checkFile(oldfile); |
| 805 | if ((oldfile != newfile) && (checkFile.exists())) |
| 806 | rename(oldfile.local8Bit(), newfile.local8Bit()); |
| 807 | } |
| 808 | } |
| 809 | |