[CI] fix a few lint errors
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									d7a483f386
								
							
						
					
					
						commit
						e197117c0e
					
				
					 1 changed files with 15 additions and 10 deletions
				
			
		
							
								
								
									
										23
									
								
								timer.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								timer.py
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,5 +1,9 @@
 | 
			
		|||
#!/usr/bin/python
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
OBS countdown timer for OBS
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import argparse
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
| 
						 | 
				
			
			@ -13,15 +17,16 @@ args = parser.parse_args()
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def write_countdown(filename, stimer):
 | 
			
		||||
    t = stimer
 | 
			
		||||
    with open(filename, 'w') as f:
 | 
			
		||||
        while t > 0:
 | 
			
		||||
            t -= 1
 | 
			
		||||
            min, sec = divmod(t, 60)
 | 
			
		||||
            print(f'{min:02d}:{sec:02d}')
 | 
			
		||||
            f.seek(0)
 | 
			
		||||
            f.write(f'{min:02d}:{sec:02d}')
 | 
			
		||||
            os.fsync(f)
 | 
			
		||||
    """ decrease counter anf write synchronously to dest file """
 | 
			
		||||
    tsec = stimer
 | 
			
		||||
    with open(filename, 'w') as destfile:
 | 
			
		||||
        while tsec > 0:
 | 
			
		||||
            tsec -= 1
 | 
			
		||||
            minutes, sec = divmod(tsec, 60)
 | 
			
		||||
            print(f'{minutes:02d}:{sec:02d}')
 | 
			
		||||
            destfile.seek(0)
 | 
			
		||||
            destfile.write(f'{minutes:02d}:{sec:02d}')
 | 
			
		||||
            os.fsync(destfile)
 | 
			
		||||
            time.sleep(1)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue