Browse Source

fixed other issues

shuvit 3 years ago
parent
commit
647a976f35
1 changed files with 5 additions and 7 deletions
  1. 5
    7
      music_player.py

+ 5
- 7
music_player.py View File

@@ -31,8 +31,8 @@ JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
31 31
 def initer(cont):
32 32
     own = cont.owner
33 33
     dict = bge.logic.globalDict
34
-    if 'playback' not in dict:
35
-        dict['playback'] = True
34
+    if 'mplayback' not in dict:
35
+        dict['mplayback'] = True
36 36
     if 'mp_inited' not in own:
37 37
         own['mp_inited'] = True
38 38
         print('Initializing music player')
@@ -72,14 +72,12 @@ def play_music():
72 72
     dict['change_track'] = 0
73 73
     dict['mu_track_time'] = 0 
74 74
     dict['music_player'] = 1  
75
-
76 75
     try:
77 76
         tag = TinyTag.get(full_path)
78 77
         print('Playing: ', 'Artist: %s' % tag.artist, 'Track: %s' % tag.title)
79 78
         dict['mu_artist'] = tag.artist
80 79
         dict['mu_title'] = tag.title
81 80
         info = ('Music > ', 'Artist: %s' % tag.artist, 'Track: %s' % tag.title)
82
-        print(info)
83 81
         dict['music_info'] = info
84 82
     except:
85 83
         print("Track has no tag.") 
@@ -144,8 +142,8 @@ def main(cont):
144 142
     sound.mode = 1
145 143
     initer(cont)
146 144
     if dict['music_player'] != 0:
147
-        if dict['mu_stopped'] == 0:        
148
-            sound.startSound()
145
+        if dict['mu_stopped'] == 1:        
146
+            play_music()
149 147
         if dict['change_track'] == 1:
150 148
             dict['change_track'] = 0
151 149
             next_track() 
@@ -159,7 +157,7 @@ def main(cont):
159 157
     if dict['npause']  == 1 or dict['playback'] == True:
160 158
         if dict['yBut'] == False and dict['last_yBut'] == True:
161 159
             if dict['mu_stopped'] == 1:
162
-                play_music()    
160
+                play_music() 
163 161
             else:
164 162
                 stop_music(sound)  
165 163
         if dict['lBump'] == False and dict['last_lBump'] == True:

Loading…
Cancel
Save