Skip to content

Commit be6422b

Browse files
committed
Correction bad path in pre-processing effects
1 parent e0dc88c commit be6422b

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/windows/process_effect.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def accept(self):
302302

303303
# Create protobuf data path
304304
protobufPath = os.path.join(info.PROTOBUF_DATA_PATH, ID + '.data')
305+
if os.name == 'nt' : protobufPath = protobufPath.replace("\\", "/")
305306

306307
# Load into JSON string info abou protobuf data path
307308
jsonString = self.generateJson(protobufPath)
@@ -395,4 +396,5 @@ def generateJson(self, protobufPath):
395396

396397
# Finish JSON string
397398
jsonString+='}'
398-
return jsonString
399+
if os.name == 'nt' : jsonString = jsonString.replace("\\", "/")
400+
return jsonString

src/windows/region.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ def __init__(self, file=None, clip=None):
8080
self.end_image = None
8181
self.current_frame = 1
8282

83-
self.clip = clip
83+
# Create region clip with Reader
84+
self.clip = openshot.Clip(clip.Reader())
85+
8486
self.clip.Open()
85-
self.clip_position = self.clip.Position()
86-
self.clip.Position(0)
87+
88+
# Set region clip start and end
89+
self.clip.Start(clip.Start())
90+
self.clip.End(clip.End())
91+
self.clip.Id( get_app().project.generate_id() )
92+
93+
print("IDS {} {}".format(clip.Id(), self.clip.Id()))
8794

8895
# Keep track of file object
8996
# self.file = file
@@ -100,6 +107,10 @@ def __init__(self, file=None, clip=None):
100107
self.channel_layout = c_info.channel_layout #int(file.data['channel_layout'])
101108
self.video_length = int(self.clip.Duration() * self.fps) + 1 #int(file.data['video_length'])
102109

110+
# Apply effects to region frames
111+
for effect in clip.Effects():
112+
self.clip.AddEffect(effect)
113+
103114
# Open video file with Reader
104115
log.info(self.clip.Reader())
105116

@@ -233,15 +244,11 @@ def sliderVideo_valueChanged(self, new_frame):
233244
def accept(self):
234245
""" Ok button clicked """
235246

236-
self.clip.Position(self.clip_position)
237-
238247
self.shutdownPlayer()
239248
super(SelectRegion, self).accept()
240249

241250
def shutdownPlayer(self):
242251

243-
self.clip.Position(self.clip_position)
244-
245252
log.info('shutdownPlayer')
246253

247254
# Stop playback
@@ -253,15 +260,14 @@ def shutdownPlayer(self):
253260
self.preview_parent.background.wait(5000)
254261

255262
# Close readers
256-
self.r.RemoveClip(self.clip)
263+
self.clip.Close()
264+
# self.r.RemoveClip(self.clip)
257265
self.r.Close()
258266
# self.clip.Close()
259267
self.r.ClearAllCache()
260268

261269
def reject(self):
262270

263-
self.clip.Position(self.clip_position)
264-
265271
# Cancel dialog
266272
self.shutdownPlayer()
267273
super(SelectRegion, self).reject()

0 commit comments

Comments
 (0)