Workaround for winrt not importing in debug
This commit is contained in:
		
							parent
							
								
									d5b1d50105
								
							
						
					
					
						commit
						3faeb5d6aa
					
				| @ -1,5 +1,10 @@ | |||||||
| import asyncio | import asyncio | ||||||
|  | DEBUG=False | ||||||
|  | try: | ||||||
| from  winrt.windows.media.control import GlobalSystemMediaTransportControlsSessionManager as MediaManager | from  winrt.windows.media.control import GlobalSystemMediaTransportControlsSessionManager as MediaManager | ||||||
|  | except: | ||||||
|  |     print("DEBUG; winrt disabled") | ||||||
|  |     DEBUG = True | ||||||
| import win32com.client | import win32com.client | ||||||
| import pythoncom | import pythoncom | ||||||
| import time | import time | ||||||
| @ -50,6 +55,7 @@ class PhoneLineEventHandler(): | |||||||
| 
 | 
 | ||||||
| async def try_play(): | async def try_play(): | ||||||
|     print("try_play") |     print("try_play") | ||||||
|  |     if not DEBUG: | ||||||
|     sessions = await MediaManager.request_async() |     sessions = await MediaManager.request_async() | ||||||
|     current_session = sessions.get_current_session() |     current_session = sessions.get_current_session() | ||||||
|     if current_session: |     if current_session: | ||||||
| @ -57,6 +63,7 @@ async def try_play(): | |||||||
| 
 | 
 | ||||||
| async def try_pause(): | async def try_pause(): | ||||||
|     print("try_pause") |     print("try_pause") | ||||||
|  |     if not DEBUG: | ||||||
|     sessions = await MediaManager.request_async() |     sessions = await MediaManager.request_async() | ||||||
|     current_session = sessions.get_current_session() |     current_session = sessions.get_current_session() | ||||||
|     if current_session: |     if current_session: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user