-
Notifications
You must be signed in to change notification settings - Fork 221
Fix bugs, security issues and performance problems #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KAMI911
wants to merge
18
commits into
linuxmint:master
Choose a base branch
from
KAMI911:fix/bugs-and-security
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c65cd06
common: Replace os.system() mkdir with os.makedirs()
KAMI911 8074bee
common: Validate provider info field count before unpacking
KAMI911 899992d
common: Fix downloaded_bytes counter to track actual received bytes
KAMI911 d4e6206
common: Fix favorites file handling for first-run and missing directory
KAMI911 d758994
hypnotix: Remove credential-exposing data from log output
KAMI911 70770e6
hypnotix: Replace bare except clauses with except Exception
KAMI911 d5132e7
hypnotix: Fix update_ytdlp to use absolute paths instead of os.chdir()
KAMI911 5bdf013
hypnotix: Fix search debounce timer truncating float to zero
KAMI911 cf05cf8
hypnotix: Prevent crash in on_search when no provider is selected
KAMI911 f3f48e5
hypnotix: Escape provider name before inserting into Pango markup
KAMI911 2db42d2
hypnotix: Use context manager and read() for GPL license file
KAMI911 ddeee4b
hypnotix: Replace type() == dict with isinstance() checks
KAMI911 fdd4c14
xtream: Fix cache_path fallback never triggering (== vs =)
KAMI911 2da41aa
xtream: Fix always-true condition in Group stream type check
KAMI911 06bb03d
xtream: Move mutable class attributes to instance __init__
KAMI911 5e433b0
xtream: Fix UnboundLocalError when processing series streams
KAMI911 22845bd
xtream: Remove duplicate catch_all_group insertion in load_iptv
KAMI911 e732ce9
xtream: Use compiled regex.match() directly in search_stream
KAMI911 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,7 +145,7 @@ def __init__(self, group_info: dict, stream_type: str): | |
| self.group_type = MOVIES_GROUP | ||
| elif "Series" == stream_type: | ||
| self.group_type = SERIES_GROUP | ||
| elif "Live": | ||
| elif stream_type == "Live": | ||
| self.group_type = TV_GROUP | ||
| else: | ||
| print("Unrecognized stream type `{}` for `{}`".format( | ||
|
|
@@ -262,26 +262,8 @@ class XTream: | |
| vod_type = "VOD" | ||
| series_type = "Series" | ||
|
|
||
| auth_data = {} | ||
| authorization = {} | ||
|
|
||
| groups = [] | ||
| channels = [] | ||
| series = [] | ||
| movies = [] | ||
|
|
||
| state = {"authenticated": False, "loaded": False} | ||
|
|
||
| hide_adult_content = False | ||
|
|
||
| catch_all_group = Group( | ||
| { | ||
| "category_id": "9999", | ||
| "category_name":"xEverythingElse", | ||
| "parent_id":0 | ||
| }, | ||
| "" | ||
| ) | ||
| # If the cached JSON file is older than threshold_time_sec then load a new | ||
| # JSON dictionary from the provider | ||
| threshold_time_sec = 60 * 60 * 8 | ||
|
|
@@ -321,12 +303,24 @@ def __init__( | |
| self.hide_adult_content = hide_adult_content | ||
| self.user_agent = user_agent | ||
|
|
||
| self.auth_data = {} | ||
| self.authorization = {} | ||
| self.groups = [] | ||
| self.channels = [] | ||
| self.series = [] | ||
| self.movies = [] | ||
| self.state = {"authenticated": False, "loaded": False} | ||
| self.catch_all_group = Group( | ||
| {"category_id": "9999", "category_name": "xEverythingElse", "parent_id": 0}, | ||
| "Live" | ||
| ) | ||
|
|
||
| # if the cache_path is specified, test that it is a directory | ||
| if self.cache_path != "": | ||
| # If the cache_path is not a directory, clear it | ||
| if not osp.isdir(self.cache_path): | ||
| print(" - Cache Path is not a directory, using default '~/.xtream-cache/'") | ||
| self.cache_path == "" | ||
| self.cache_path = "" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
|
|
||
| # If the cache_path is still empty, use default | ||
| if self.cache_path == "": | ||
|
|
@@ -357,23 +351,22 @@ def search_stream(self, keyword: str, ignore_case: bool = True, return_type: str | |
|
|
||
| print("Checking {} movies".format(len(self.movies))) | ||
| for stream in self.movies: | ||
| if re.match(regex, stream.name) is not None: | ||
| if regex.match(stream.name) is not None: | ||
| search_result.append(stream.export_json()) | ||
|
|
||
| print("Checking {} channels".format(len(self.channels))) | ||
| for stream in self.channels: | ||
| if re.match(regex, stream.name) is not None: | ||
| if regex.match(stream.name) is not None: | ||
| search_result.append(stream.export_json()) | ||
|
|
||
| print("Checking {} series".format(len(self.series))) | ||
| for stream in self.series: | ||
| if re.match(regex, stream.name) is not None: | ||
| if regex.match(stream.name) is not None: | ||
| search_result.append(stream.export_json()) | ||
|
|
||
| if return_type == "JSON": | ||
| if search_result is not None: | ||
| print("Found {} results `{}`".format(len(search_result), keyword)) | ||
| return json.dumps(search_result, ensure_ascii=False) | ||
| print("Found {} results `{}`".format(len(search_result), keyword)) | ||
| return json.dumps(search_result, ensure_ascii=False) | ||
| else: | ||
| return search_result | ||
|
|
||
|
|
@@ -562,9 +555,6 @@ def load_iptv(self): | |
| )) | ||
| ## Add GROUPS to dictionaries | ||
|
|
||
| # Add the catch-all-errors group | ||
| self.groups.append(self.catch_all_group) | ||
|
|
||
| for cat_obj in all_cat: | ||
| # Create Group (Category) | ||
| new_group = Group(cat_obj, loading_stream_type) | ||
|
|
@@ -661,13 +651,14 @@ def load_iptv(self): | |
| self, group_title, stream_channel | ||
| ) | ||
|
|
||
| if new_channel.group_id == "9999": | ||
| print(" - xEverythingElse Channel -> {} - {}".format(new_channel.name,new_channel.stream_type)) | ||
|
|
||
| # Save the new channel to the local list of channels | ||
| if loading_stream_type == self.live_type: | ||
| if new_channel.group_id == "9999": | ||
| print(" - xEverythingElse Channel -> {} - {}".format(new_channel.name, new_channel.stream_type)) | ||
| self.channels.append(new_channel) | ||
| elif loading_stream_type == self.vod_type: | ||
| if new_channel.group_id == "9999": | ||
| print(" - xEverythingElse Channel -> {} - {}".format(new_channel.name, new_channel.stream_type)) | ||
| self.movies.append(new_channel) | ||
| else: | ||
| self.series.append(new_series) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!