Diff of /trunk/tubetutor/tubetutor.py [r6] .. [r7]  Maximize  Restore

Switch to unified view

a/trunk/tubetutor/tubetutor.py b/trunk/tubetutor/tubetutor.py
...
...
118
    def refresh_files(self):
118
    def refresh_files(self):
119
        self.files = []
119
        self.files = []
120
        for root, dirs, files in os.walk(os.path.join(self.path, "working")):
120
        for root, dirs, files in os.walk(os.path.join(self.path, "working")):
121
            for file in files:
121
            for file in files:
122
                if file.endswith(".mkv") or file.endswith(".txt"):
122
                if file.endswith(".mkv") or file.endswith(".txt"):
123
                    self.files.append(os.path.join(root, file))
123
                    self.files.append(os.path.join(root, file))
124
        self.files.sort()
124
125
125
    # Output the main window
126
    # Output the main window
126
    def refresh_display(self):
127
    def refresh_display(self):
127
        # remove all widgets
128
        # remove all widgets
128
        for w in self.buttons:
129
        for w in self.buttons:
...
...
148
149
149
        self.lastid=0
150
        self.lastid=0
150
151
151
152
152
        # re-add all widgets
153
        # re-add all widgets
153
        self.add_label("description", text="Press <Ctrl+Alt+R> to start or end recording.")
154
        if keyboard_loaded:
155
            self.add_label("description", text="Press <Ctrl+Alt+R> to start or end recording.")
156
        else:
157
            self.add_label("description", text="Hotkey <Ctrl+Alt+R> only works when started as root!!!")
158
                        
154
159
155
        # Title of the video
160
        # Title of the video
156
        self.start_frame()
161
        self.start_frame()
157
        self.add_label("title", "Title:", side=tkinter.LEFT)
162
        self.add_label("title", "Title:", side=tkinter.LEFT)
158
        self.add_text("title", "Video Tutorial", width=30, height=1, autosave=False, side=tkinter.LEFT)
163
        self.add_text("title", "Video Tutorial", width=30, height=1, autosave=False, side=tkinter.LEFT)
...
...
278
            r.mux(os.path.join(path, "tmp", "intro.mkv"), os.path.join("media", "intro.mp3"))
283
            r.mux(os.path.join(path, "tmp", "intro.mkv"), os.path.join("media", "intro.mp3"))
279
            videos.append(r.lastfilename)
284
            videos.append(r.lastfilename)
280
            r = ffmpeg.renderer()
285
            r = ffmpeg.renderer()
281
            r.resolution(resolution)
286
            r.resolution(resolution)
282
        else:
287
        else:
288
            params = " -scale %s!" % resolution.replace(":", "x")
289
            params += " -font %s -weight 500 -pointsize 100" % ffmpeg.font
290
            params += " -draw \"gravity northwest fill white text 100,775 '%s'\"" % self.get_title()
291
            params += " -scale %s!" % resolution.replace(":", "x")
292
            ffmpeg.convert_image(os.path.join("media", "intro.jpg"), os.path.join(path, "tmp", "intro.jpg"), params)
293
283
            r = ffmpeg.renderer()
294
            r = ffmpeg.renderer()
284
            r.resolution(resolution)
295
            r.resolution(resolution)
285
            r.add_image(os.path.join("media", "intro.png"))
296
            r.add_image(os.path.join("media", "intro.png"))
286
297
287
        # main
298
        # main
...
...
298
        r.speedup(os.path.join(path, "tmp", "speedup.mkv"), 0.7)
309
        r.speedup(os.path.join(path, "tmp", "speedup.mkv"), 0.7)
299
        r.mux(os.path.join(path, "tmp", "main.mkv"), os.path.join("media", "back.mp3"))
310
        r.mux(os.path.join(path, "tmp", "main.mkv"), os.path.join("media", "back.mp3"))
300
        videos.append(r.lastfilename)
311
        videos.append(r.lastfilename)
301
312
302
        # outro
313
        # outro
303
        r = ffmpeg.renderer()
314
        if os.path.exists(os.path.join("media", "outro.mkv")):
315
                r = ffmpeg.renderer()
304
        r.resolution(resolution)
316
                r.resolution(resolution)
305
        r.filename(os.path.join("media", "outro.mkv"))
317
                r.filename(os.path.join("media", "outro.mkv"))
306
        r.process(os.path.join(path, "tmp", "outro.mkv"), "-vf scale=" + resolution)
318
                r.process(os.path.join(path, "tmp", "outro.mkv"), "-vf scale=" + resolution)
307
        videos.append(r.lastfilename)
319
                videos.append(r.lastfilename)
308
320
309
        # mastering
321
        # mastering
310
        outputfilename=self.get_title().replace(" ", "-").replace(".", "_").replace("\n", "") + ".mkv"
322
        outputfilename=self.get_title().replace(" ", "-").replace(".", "_").replace("\n", "") + ".mkv"
311
        r = ffmpeg.renderer()
323
        r = ffmpeg.renderer()
312
        r.resolution(resolution)
324
        r.resolution(resolution)