-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
129 lines (95 loc) · 3.69 KB
/
main.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import pygame
import os
from os import listdir
from os.path import isfile, join
import time
import random
pygame.mixer.init()
initphrases = [f for f in listdir('0_start/') if isfile(join('0_start/', f))]
players = [f for f in listdir('1_player/') if isfile(join('1_player/', f))]
actions = [f for f in listdir('2_action/') if isfile(join('2_action/', f))]
facons = [f for f in listdir('3_facon/') if isfile(join('3_facon/', f))]
bodyparts = ['1.ogg','1.ogg','1.ogg','1.ogg','2.ogg','2.ogg','2.ogg','2.ogg','3.ogg','3.ogg','3.ogg','3.ogg','4.ogg','4.ogg','4.ogg','4.ogg','5.ogg','6.ogg','7.ogg']
sides = ["left", "right"]
colors = [f for f in listdir('8_color/') if isfile(join('8_color/', f))]
maleadj = [f for f in listdir('5_adj/m/') if isfile(join('5_adj/m/', f))]
femaleadj = [f for f in listdir('5_adj/f/') if isfile(join('5_adj/f/', f))]
malesides = ["droit.ogg", "droit.ogg", "gauche1.ogg", "gauche2.ogg"]
femalesides = ["droite.ogg", "droite.ogg", "gauche1.ogg", "gauche2.ogg"]
print "Runnung twister generator in ifinite loop, press Ctrl+C to exit"
turn = 1
start = pygame.mixer.Sound("0_start/"+random.choice(initphrases))
start.play()
while pygame.mixer.get_busy() == True:
continue
while (True):
side = random.choice(sides)
player = pygame.mixer.Sound("1_player/"+random.choice(players))
action = pygame.mixer.Sound("2_action/"+random.choice(actions))
facon = pygame.mixer.Sound("3_facon/"+random.choice(facons))
genderref = "6_bodypart/"+random.choice(bodyparts)
bodypart = pygame.mixer.Sound(genderref)
color = pygame.mixer.Sound("8_color/"+random.choice(colors))
if genderref == "6_bodypart/1.ogg" or genderref == "6_bodypart/2.ogg" or genderref == "6_bodypart/7.ogg":
gender = "male"
elif genderref == "6_bodypart/3.ogg" or genderref == "6_bodypart/4.ogg" or genderref == "6_bodypart/5.ogg":
gender = "female"
else:
gender = "plural"
if gender == "male":
taton = "4_taton/2.ogg"
adjective = pygame.mixer.Sound('5_adj/m/'+ random.choice(maleadj))
side = pygame.mixer.Sound('7_lr/'+ random.choice(malesides))
elif gender == "female":
taton = "4_taton/1.ogg"
adjective = pygame.mixer.Sound('5_adj/f/'+ random.choice(femaleadj))
side = pygame.mixer.Sound('7_lr/'+ random.choice(femalesides))
else:
taton = "4_taton/3.ogg"
adjective = pygame.mixer.Sound('5_adj/m/'+ random.choice(maleadj))
side = pygame.mixer.Sound('7_lr/'+ random.choice(malesides))
pronom = pygame.mixer.Sound(taton)
#
# print genderref
# print gender
# print side
# print adjective
if turn != 1:
player.play()
while pygame.mixer.get_busy() == True:
continue
action.play()
while pygame.mixer.get_busy() == True:
continue
facon.play()
while pygame.mixer.get_busy() == True:
continue
pronom.play()
while pygame.mixer.get_busy() == True:
continue
adjective.play()
while pygame.mixer.get_busy() == True:
continue
bodypart.play()
while pygame.mixer.get_busy() == True:
continue
if genderref != "6_bodypart/6.ogg" and genderref != "6_bodypart/5.ogg":
side.play()
while pygame.mixer.get_busy() == True:
continue
color.play()
while pygame.mixer.get_busy() == True:
continue
turn += 1
time.sleep(2)
pygame.mixer.quit()
# pygame.mixer.music.load("player/daniel.ogg")
# pygame.mixer.music.queue("mets ton.ogg")
# pygame.mixer.music.queue("body/pied.ogg")
# pygame.mixer.music.queue("sur le.ogg")
# pygame.mixer.music.queue("color/bleu.ogg")
#
#
# pygame.mixer.music.play()
# while pygame.mixer.music.get_busy() == True:
# continue