Ajout du GUI

This commit is contained in:
thatscringebro
2022-08-08 16:31:52 -04:00
parent db362ccdca
commit abd15f28b6
851 changed files with 99957 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
from project import VideoApp
if __name__ == '__main__':
from kivy.core.video import Video
assert Video is not None
VideoApp().run()

View File

@@ -0,0 +1,50 @@
# -*- mode: python -*-
block_cipher = None
from kivy_deps import sdl2, glew
from kivy.tools.packaging.pyinstaller_hooks import runtime_hooks, hookspath
import os
deps = list(sdl2.dep_bins + glew.dep_bins)
try:
import ffpyplayer
deps.extend(ffpyplayer.dep_bins)
except ImportError:
pass
try:
from kivy_deps import gstreamer
deps.extend(gstreamer.dep_bins)
except ImportError:
pass
print('deps are: ', deps)
a = Analysis(['main.py'],
pathex=[os.environ['__KIVY_PYINSTALLER_DIR']],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[os.environ['__KIVY_PYINSTALLER_DIR']],
runtime_hooks=runtime_hooks(),
excludes=['numpy',],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='main',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in deps],
strip=False,
upx=True,
name='main')

View File

@@ -0,0 +1,38 @@
from kivy.app import App
from kivy.uix.videoplayer import VideoPlayer
from kivy.clock import Clock
import os
import time
class VideoApp(App):
player = None
start_t = None
def build(self):
self.player = player = VideoPlayer(
source=os.environ['__KIVY_VIDEO_TEST_FNAME'], volume=0)
self.player.fbind('position', self.check_position)
Clock.schedule_once(self.start_player, 0)
Clock.schedule_interval(self.stop_player, 1)
return player
def start_player(self, *args):
self.player.state = 'play'
self.start_t = time.perf_counter()
def check_position(self, *args):
if self.player.position > 0.1:
self.stop_player()
def stop_player(self, *args):
if time.perf_counter() - self.start_t > 10:
assert self.player.duration > 0
assert self.player.position > 0
self.stop()
else:
if self.player.position > 0 and self.player.duration > 0:
self.stop()