File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1- import feedparser
21import time
2+ import feedparser
33import vlc
44import warnings
55
@@ -25,10 +25,14 @@ def main():
2525
2626 try :
2727 while player .get_state () not in [vlc .State .Ended , vlc .State .Stopped , vlc .State .Error ]:
28+ loop_start_time = time .time ()
2829 current_time = player .get_time ()
2930 total_time = player .get_length ()
3031 print (f"Time: { format_time (current_time )} / { format_time (total_time )} " , end = '\r ' )
31- time .sleep (1 )
32+
33+ # Calculate the elapsed time and sleep for the remainder of 1 second
34+ elapsed_time = time .time () - loop_start_time
35+ time .sleep (max (1 - elapsed_time , 0 ))
3236 except KeyboardInterrupt :
3337 print ("\n Playback interrupted by user." )
3438
Original file line number Diff line number Diff line change 99 ],
1010 entry_points = {
1111 'console_scripts' : [
12- 'npr-news-now=npr-news-now-cli .listen:main' ,
12+ 'npr-news-now=npr_news_now_cli .listen:main' ,
1313 ],
1414 },
1515 author = "Alex P. Gates" ,
You can’t perform that action at this time.
0 commit comments