@@ -3197,34 +3197,20 @@ def get_volume(self, repeat=False):
31973197 self .get_volume (repeat = True )
31983198 self .actual_volume = self .volume
31993199 self .volume = int (100 * self .actual_volume / self .max_volume )
3200+ # logger.error('Final')
3201+ # logger.error('self.actual_volume = {}'.format(self.actual_volume))
3202+ # logger.error('self.volume = {}'.format(self.volume))
3203+ # logger.error('=======================')
32003204
32013205 def _no_mute_on_stop_playback (self ):
32023206 ''' make sure vlc does not stop muted '''
32033207 if self .ctrl_c_pressed :
32043208 return
32053209 if self .isPlaying ():
3206- if self .actual_volume == - 1 :
3207- self .get_volume ()
3208- if self .actual_volume == - 1 :
3209- self .actual_volume = 0
3210- if self .actual_volume == 0 :
3211- self .actual_volume = int (self .max_volume * 0.25 )
3212- if self .WIN :
3213- self ._win_set_volume (self .actual_volume )
3214- else :
3215- self ._sendCommand ('volume {}\n ' .format (self .actual_volume ))
3216- if logger .isEnabledFor (logging .DEBUG ):
3217- logger .debug ('Unmuting VLC on exit: {} (25%)' .format (self .actual_volume ))
3218- elif self .muted :
3219- if self .actual_volume > 0 :
3220- if self .WIN :
3221- self ._win_set_volume (self .actual_volume )
3222- else :
3223- self ._sendCommand ('volume {}\n ' .format (self .actual_volume ))
3224- self .volume = int (100 * self .actual_volume / self .max_volume )
3225- if logger .isEnabledFor (logging .DEBUG ):
3226- logger .debug ('VLC volume restored on exit: {0} ({1}%)' .format (self .actual_volume , self .volume ))
3227-
3210+ self .show_volume = False
3211+ self .set_volume (0 )
3212+ if logger .isEnabledFor (logging .DEBUG ):
3213+ logger .debug ('VLC volume set to 0 at exit' )
32283214 self .show_volume = True
32293215
32303216 ''' WINDOWS PART '''
@@ -3257,6 +3243,7 @@ def _req(self, msg, ret_function=None, full=True):
32573243 sock .close ()
32583244 except :
32593245 pass
3246+ # logger.info('response = "{}"'.format(response))
32603247 if msg == 'quit' :
32613248 self .process .terminate ()
32623249 self .process = None
@@ -3270,6 +3257,9 @@ def _thrededreq(self, msg, ret_function=None):
32703257 args = (msg ,ret_function )
32713258 )
32723259 self ._thrededreq_thread .start ()
3260+ self ._thrededreq_thread .join ()
3261+ while self ._thrededreq_thread .is_alive ():
3262+ sleep (.01 )
32733263
32743264 def _win_show_vlc_volume (self ):
32753265 #if self.win_show_vlc_volume_function:
@@ -3286,7 +3276,9 @@ def _win_get_volume(self):
32863276 self ._thrededreq ('status' , self ._get_volume_response )
32873277
32883278 def _get_volume_response (self , msg ):
3279+ # logger.debug('msg = "{}"'.format(msg))
32893280 parts = msg .split ('\r \n ' )
3281+ # logger.debug('parts = {}'.format(parts))
32903282 for n in parts :
32913283 if 'volume' in n :
32923284 vol = n .split (': ' )[- 1 ].replace (' )' , '' )
@@ -3295,12 +3287,14 @@ def _get_volume_response(self, msg):
32953287 if ind > - 1 :
32963288 vol = vol [:ind ]
32973289 break
3290+ # logger.debug('vol = "{}"'.format(vol))
32983291 try :
32993292 self .actual_volume = int (vol )
33003293 except ValueError :
33013294 # logger.error('DE ValueError: vol = {}'.format(vol))
33023295 return
33033296 break
3297+ # logger.debug('self.actual_volume = {}'.format(self.actual_volume))
33043298 if self .actual_volume == 0 :
33053299 self .muted = True
33063300 self .volume = 0
0 commit comments