From 9f237c71c8b073be27a1d68faee907892e967ee2 Mon Sep 17 00:00:00 2001 From: starnakin Date: Mon, 15 May 2023 13:41:32 +0200 Subject: [PATCH] fix: programs is reusable after stream --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index b4f4958..c643c13 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,8 @@ from tinydb import TinyDB, Query from bs4 import BeautifulSoup import requests -import os from simple_term_menu import TerminalMenu +import subprocess db = TinyDB("./database.json", indent=4) query = Query() @@ -43,7 +43,7 @@ while True: lst.append(element.text) terminal_menu = TerminalMenu(lst) file = soup.findAll("a")[terminal_menu.show()]["href"] - url = url + file if (not file.endswith("/")): - print(f"vlc '{url}'") - os.system(f"vlc '{url}'") + subprocess.run(f"vlc '{url + file}'", shell=True) + else: + url = url + file