@@ -3197,34 +3197,20 @@ def get_volume(self, repeat=False):
3197
3197
self .get_volume (repeat = True )
3198
3198
self .actual_volume = self .volume
3199
3199
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('=======================')
3200
3204
3201
3205
def _no_mute_on_stop_playback (self ):
3202
3206
''' make sure vlc does not stop muted '''
3203
3207
if self .ctrl_c_pressed :
3204
3208
return
3205
3209
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' )
3228
3214
self .show_volume = True
3229
3215
3230
3216
''' WINDOWS PART '''
@@ -3257,6 +3243,7 @@ def _req(self, msg, ret_function=None, full=True):
3257
3243
sock .close ()
3258
3244
except :
3259
3245
pass
3246
+ # logger.info('response = "{}"'.format(response))
3260
3247
if msg == 'quit' :
3261
3248
self .process .terminate ()
3262
3249
self .process = None
@@ -3270,6 +3257,9 @@ def _thrededreq(self, msg, ret_function=None):
3270
3257
args = (msg ,ret_function )
3271
3258
)
3272
3259
self ._thrededreq_thread .start ()
3260
+ self ._thrededreq_thread .join ()
3261
+ while self ._thrededreq_thread .is_alive ():
3262
+ sleep (.01 )
3273
3263
3274
3264
def _win_show_vlc_volume (self ):
3275
3265
#if self.win_show_vlc_volume_function:
@@ -3286,7 +3276,9 @@ def _win_get_volume(self):
3286
3276
self ._thrededreq ('status' , self ._get_volume_response )
3287
3277
3288
3278
def _get_volume_response (self , msg ):
3279
+ # logger.debug('msg = "{}"'.format(msg))
3289
3280
parts = msg .split ('\r \n ' )
3281
+ # logger.debug('parts = {}'.format(parts))
3290
3282
for n in parts :
3291
3283
if 'volume' in n :
3292
3284
vol = n .split (': ' )[- 1 ].replace (' )' , '' )
@@ -3295,12 +3287,14 @@ def _get_volume_response(self, msg):
3295
3287
if ind > - 1 :
3296
3288
vol = vol [:ind ]
3297
3289
break
3290
+ # logger.debug('vol = "{}"'.format(vol))
3298
3291
try :
3299
3292
self .actual_volume = int (vol )
3300
3293
except ValueError :
3301
3294
# logger.error('DE ValueError: vol = {}'.format(vol))
3302
3295
return
3303
3296
break
3297
+ # logger.debug('self.actual_volume = {}'.format(self.actual_volume))
3304
3298
if self .actual_volume == 0 :
3305
3299
self .muted = True
3306
3300
self .volume = 0
0 commit comments