forked from buba447/simpsonstv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.py
More file actions
32 lines (24 loc) · 683 Bytes
/
Copy pathplayer.py
File metadata and controls
32 lines (24 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import random
import time
from subprocess import PIPE, Popen, STDOUT
directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'videos')
videos = []
def getVideos():
global videos
videos = []
for file in os.listdir(directory):
if file.lower().endswith('.mp4'):
videos.append(os.path.join(directory, file))
def playVideos():
global videos
if len(videos) == 0:
getVideos()
time.sleep(5)
return
random.shuffle(videos)
for video in videos:
playProcess = Popen(['omxplayer', '--no-osd', '--aspect-mode', 'fill', video])
playProcess.wait()
while (True):
playVideos()