Browse Source

fixed other issues

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

Loading…
Cancel
Save