Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Touble with subprocess
#6
I'm not sure if this solution is suitable for you
or if you can work it into the way you want your program
to work, but here is an idea.
import os
import random
import time
import webbrowser as web
 
 
def make_url():
    """Append a random value to urls end."""
    rnd = str(random.randrange(1000000))
    url_with_rnd = "https://mediaserver3.afa.net:8443/talk.mp3" + "?" + rnd
    web.open(url_with_rnd)
    return url_with_rnd


while True:
    
    URL = make_url()
    time.sleep(30)
    os.system("taskkill /F /IM firefox.exe")
This will play the stream for 30 seconds, quit the browser and the stream, get a new url
and do it again for ever.
Reply


Messages In This Thread
Touble with subprocess - by jake9wi - Apr-12-2020, 11:47 PM
RE: Touble with subprocess - by Larz60+ - Apr-13-2020, 12:45 AM
RE: Touble with subprocess - by snippsat - Apr-13-2020, 11:15 AM
RE: Touble with subprocess - by jake9wi - Apr-13-2020, 07:15 PM
RE: Touble with subprocess - by snippsat - Apr-13-2020, 11:06 PM
RE: Touble with subprocess - by steve_shambles - Apr-14-2020, 03:36 AM
RE: Touble with subprocess - by snippsat - Apr-14-2020, 08:51 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020