- Jun 2, 2018
- 543
- 686
It's been a while... Still love you guys, and thanks in advance!
I need a way to log the length of video clips before they are played on a channel. These videos can vary wildly, as they originate from a mod folder where users can drop anything they want in it so long as it is compatible with RenPy...
The only way I know how to return the length of a clip is by using:
I have two issues with using that.
Firstly:
this, for example, will record the length as 0 (zero) seconds.
The only way I can get it to work is to put a short pause after playing the clip, then get the length. Like this:
For several reasons, this causes issues for me....
Secondly:
If I wanted to create an instance where playback halts after the sum of some randomly played clips reaches a preset amount of time, I think this is also the best way to do that.
What I'm looking for is something like this:
Of course what I'm looking for is to replace Some.Shit.That.Works with some shit that works...
Then we be like:
Can anyone help?
I need a way to log the length of video clips before they are played on a channel. These videos can vary wildly, as they originate from a mod folder where users can drop anything they want in it so long as it is compatible with RenPy...
The only way I know how to return the length of a clip is by using:
$ renpy.music.get_duration(channel="channel_name")
I have two issues with using that.
Firstly:
Python:
show expression getattr(store, some_clip) as sexy_clip
default timeout = renpy.music.get_duration(channel="CH_clip")
timer timeout action SetVariable("time_counter", timeout), Jump("To_A_Label")
The only way I can get it to work is to put a short pause after playing the clip, then get the length. Like this:
Python:
show expression getattr(store, some_clip) as sexy_clip
pause 0.3
default timeout = renpy.music.get_duration(channel="CH_clip")
timer timeout action SetVariable("time_counter", timeout), Jump("To_A_Label")
Secondly:
If I wanted to create an instance where playback halts after the sum of some randomly played clips reaches a preset amount of time, I think this is also the best way to do that.
What I'm looking for is something like this:
Python:
init python:
list_of_videos = []
length_of_videos = {}
for f in renpy.list_files():
if not f.startswith("Clips/"): continue
n, e = os.path.splitext(os.path.basename(f))
if not e.lower() in [".webm", ".ogv", ".avi"]: continue
setattr(store, f, Movie(size=(1280,720), play="{}".format(f), channel="channel_name"))
list_of_videos.append(f)
length_of_videos[f] = Some.Shit.That.Works(f)
Of course what I'm looking for is to replace Some.Shit.That.Works with some shit that works...
Then we be like:
Python:
$ sexy_clip = renpy.random.choice(list_of_vidoes)
default timeout = length_of_videos[sexy_clip]
timer timeout action SetVariable("time_counter", timeout), Jump("To_A_Label")
Can anyone help?