Skip to content

Commit

Permalink
m3u loading should be correct now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ozankaraali committed Oct 18, 2024
1 parent 5b7c0eb commit 6894225
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 22 deletions.
40 changes: 24 additions & 16 deletions channel_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,16 +691,21 @@ def update_content(self):

def load_m3u_playlist(self, url):
try:
response = requests.get(url)
if response.status_code == 200:
content = self.parse_m3u(response.text)
self.display_content(content)
# Update the content in the config
self.config["data"][self.config["selected"]][
self.content_type
] = content
self.save_config()
except requests.RequestException as e:
if url.startswith(("http://", "https://")):
response = requests.get(url)
content = response.text
else:
with open(url, "r", encoding="utf-8") as file:
content = file.read()

parsed_content = self.parse_m3u(content)
self.display_content(parsed_content)
# Update the content in the config
self.config["data"][self.config["selected"]][
self.content_type
] = parsed_content
self.save_config()
except (requests.RequestException, IOError) as e:
print(f"Error loading M3U Playlist: {e}")

def load_stream(self, url):
Expand Down Expand Up @@ -1146,12 +1151,15 @@ def generate_headers(self):

@staticmethod
def verify_url(url):
try:
response = requests.head(url, timeout=5)
return True
except requests.RequestException as e:
print(f"Error verifying URL: {e}")
return False
if url.startswith(("http://", "https://")):
try:
response = requests.head(url, timeout=5)
return response.status_code == 200
except requests.RequestException as e:
print(f"Error verifying URL: {e}")
return False
else:
return os.path.isfile(url)

@staticmethod
def shorten_header(s):
Expand Down
2 changes: 1 addition & 1 deletion config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class ConfigManager:
CURRENT_VERSION = "1.5.6" # Set your current version here
CURRENT_VERSION = "1.5.7" # Set your current version here

def __init__(self):
self.config = {}
Expand Down
16 changes: 11 additions & 5 deletions options.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from PySide6.QtWidgets import (
QButtonGroup,
QComboBox,
Expand Down Expand Up @@ -182,14 +184,18 @@ def verify_provider(self):
self.verify_result.setText("Verifying...")
self.verify_result.repaint()
result = False
url = self.url_input.text()

if self.type_STB.isChecked():
result = self.parent().do_handshake(
self.url_input.text(), self.mac_input.text(), load=False
)
result = self.parent().do_handshake(url, self.mac_input.text(), load=False)
elif self.type_M3UPLAYLIST.isChecked() or self.type_M3USTREAM.isChecked():
result = self.parent().verify_url(self.url_input.text())
if url.startswith(("http://", "https://")):
result = self.parent().verify_url(url)
else:
result = os.path.isfile(url)
elif self.type_XTREAM.isChecked():
result = self.parent().verify_url(self.url_input.text())
result = self.parent().verify_url(url)

self.verify_result.setText(
"Provider verified successfully."
if result
Expand Down

0 comments on commit 6894225

Please sign in to comment.