Opened 17 years ago
Closed 16 years ago
Last modified 16 years ago
#3779 closed patch (fixed)
Rename all PNG previews after transcode
Reported by: | Owned by: | cpinkham | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | mythtranscode | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
mythtranscode currently only renames the <basename>.png preview pixmap after a transcode from MPEG-2 to NUV. Since MythWeb uses the UPnP code to create customized (sized) preview pixmaps that are also cached by the backend and whose filenames include dimensions, users who transcode to NUV end up with "orphaned" previews, as described in Otto's post at http://www.gossamer-threads.com/lists/mythtv/dev/275384#275384 .
The attached patch, mythtv-mythtranscode_rename_png.patch, renames all preview pixmaps associated with the just-transcoded recording. The patch contains two regex's, either of which would work. The first (the one that's uncommented) will only match recordings of the format <basename>.100x0x155.png (i.e. with 3 dimensional numbers up to 4 digits for width and height and any number of digits for seconds in, all separated by "x"--I'm assuming the user will never create a preview whose size is greater than the recording's full resolution). The second (commented) regex will match files with anything between "mpg" and ".png" (and is really more similar to the behavior of the code that deletes the files, which uses the shell glob "<basename>*.png", but the regex is slightly more permissive). I'll let the reviewer decide which is more appropriate.
I surrounded all the rename code in a check for jobArgs == "RENAME_TO_NUV" as that is the only situation I know of where the filename is changed. If that assumption is not true, please let me know and I'll fix the patch. Also, by moving the preview renaming to the existing check for "RENAME_TO_NUV", the code could be slightly simpler, but I felt it was more appropriate to rename PNG's after renaming the recording.
Attachments (5)
Change History (13)
Changed 17 years ago by
Attachment: | mythtv-mythtranscode_rename_png.patch added |
---|
comment:1 Changed 17 years ago by
Changed 17 years ago by
Attachment: | mythtv-mythtranscode_rename_png-allows_spaces.patch added |
---|
Updated patch that allows for recordings whose filenames contains spaces/semicolons
comment:2 Changed 17 years ago by
The updated patch, mythtv-mythtranscode_rename_png-allows_spaces.patch, uses the same approach taken by the patch in #3522 to allow mythtranscode to find preview images whose filenames contain spaces or semicolons. Thanks to Nick Morrott for helping to track down the spaces issue for this ticket and #3522.
Changed 17 years ago by
Attachment: | mythtv-mythtranscode_rename_png-allows_spaces-with_local8Bit.patch added |
---|
Updated patch that uses local8Bit() to handle encoding issues
Changed 17 years ago by
Alternate patch that also deletes previews when a cutlist is applied
comment:3 Changed 17 years ago by
Two updated patches were attached.
The first, mythtv-mythtranscode_rename_png-allows_spaces-with_local8Bit.patch, is simply an updated version of mythtv-mythtranscode_rename_png-allows_spaces.patch that adds calls to local8Bit() for the QString values passed to rename() and unlink() calls, to handle encoding issues that could result if users rename recordings with mythrename.pl before transcoding.
The second, mythtv-mythtranscode_delete_or_rename_png-allows_spaces-with_local8Bit.patch, is an alternate patch that could be applied instead of mythtv-mythtranscode_rename_png-allows_spaces-with_local8Bit.patch. It has the same functionality, but also deletes previews if a cutlist was applied. This ensures that the preview image is not from a section that was removed during transcoding. It also ensures that the "dimensioned" previews (i.e. for MythWeb) will correspond to the new timeline (i.e. the seconds in dimension is no longer correct after cutting). Inspired by a comment from stuarta on IRC. If you'd prefer the delete code be added in a separate commit, I can do another patch once the rename code is committed.
comment:4 Changed 17 years ago by
I haven't tried the patch yet. I'm just wondering if this is the bug I am seeing. Since changing to lossless transcode I am seeing blank preview images, randomly, in MythWeb. It's about 40%/60% (blank/okay).
comment:5 Changed 17 years ago by
Owner: | changed from Isaac Richards to cpinkham |
---|
Changed 16 years ago by
Attachment: | mythtv-mythtranscode_delete_or_rename_png-20080108.patch added |
---|
Updates the delete or rename patch to account for [15328] (new preview image filename format) by using the "catch all" regexp (matches anything between mpg and .png)
comment:6 Changed 16 years ago by
The mythtv-mythtranscode_delete_or_rename_png-20080108.patch updates the delete or rename patch to account for the new preview image filename format in [15328] by using the regexp that matches anything between mpg and .png (as is done for the delete code). It supersedes all previous patches. Again, if you'd prefer separate patches for the delete (which simply deletes the preview, rather than rename it, if a cutlist is applied) and rename parts (which ensures all previews, including those for MythWeb/UPnP are renamed), please let me know.
comment:7 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 Changed 16 years ago by
(In [15397]) Allow MainServer::DoDeleteThread?() to find all .png files for a recording by replacing spaces and semicolons in the search spec with a question mark so that QDir can find them.
Closes #3522 using patch by Michael T. Dean. References #3779 and commit [15394] since that patch used the same logic in mythtranscode to rename png files.
I've tried the attached patch and both regex's with couple of transcodings. Both versions seem to work fine and there are no more orphaned thumbnails around.