Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Titles: Don't pollute temp dir with title previews #3520

Merged
merged 1 commit into from
May 28, 2020

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented May 27, 2020

Fixes #3518

@ferdnyc ferdnyc added closer This PR fixes one or more reported Issues media-handling Issues related to video/audio file processing & playback labels May 27, 2020
@jonoomph
Copy link
Member

LGTM. I really thought we were using our QtImageReader to rasterize the title previews, so it would use our rsvg library (if compiled). Hmmm, I guess that is for another day. 😉

@jonoomph jonoomph merged commit 62817dc into OpenShot:develop May 28, 2020
@ferdnyc
Copy link
Contributor Author

ferdnyc commented May 30, 2020

LGTM. I really thought we were using our QtImageReader to rasterize the title previews, so it would use our rsvg library (if compiled). Hmmm, I guess that is for another day.

Oh, no, we are. It uses reader.GetFrame().Thumbnail() to write the preview out to the tmp_filename, then reads it back in via QPixmap().load(). Then it adds it to the QGraphicsScene. (The variable name svg for the QPixmap is, arguably, slightly confusing perhaps.)

# Create a clip object and get the reader
clip = openshot.Clip(self.filename)
reader = clip.Reader()
# Open reader
reader.Open()
# Overwrite temp file with thumbnail image and close readers
reader.GetFrame(1).Thumbnail(
tmp_filename,
self.graphicsView.width(),
self.graphicsView.height(),
"", "", "#000", False, "png", 85, 0.0)
reader.Close()
clip.Close()
# Attempt to load saved thumbnail
svg = QtGui.QPixmap()
if not svg.load(tmp_filename):
log.error("Couldn't load title preview from {}".format(tmp_filename))
return

@ferdnyc ferdnyc deleted the title-tmp-pollution branch May 30, 2020 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closer This PR fixes one or more reported Issues media-handling Issues related to video/audio file processing & playback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

titles leave lot of tmp* files in /tmp
2 participants