Bump v2.9.0.

This commit is contained in:
Lovi 2025-02-28 13:54:49 +01:00
parent dd1e8364d3
commit 9c84eb665c
9 changed files with 47 additions and 40 deletions

View File

@ -55,10 +55,8 @@ def download_film(select_title: MediaItem) -> str:
output_path=os.path.join(mp4_path, title_name) output_path=os.path.join(mp4_path, title_name)
).start() ).start()
if "error" in r_proc.keys(): if r_proc['error'] is not None:
try: try: os.remove(r_proc['path'])
os.remove(r_proc['path']) except: pass
except:
pass
return r_proc['path'] return r_proc['path']

View File

@ -73,12 +73,9 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
output_path=os.path.join(mp4_path, mp4_name) output_path=os.path.join(mp4_path, mp4_name)
).start() ).start()
if r_proc['error'] is not None:
if "error" in r_proc.keys(): try: os.remove(r_proc['path'])
try: except: pass
os.remove(r_proc['path'])
except:
pass
return r_proc['path'], r_proc['stopped'] return r_proc['path'], r_proc['stopped']

View File

@ -86,10 +86,8 @@ def download_film(movie_details: Json_film) -> str:
output_path=os.path.join(mp4_path, title_name) output_path=os.path.join(mp4_path, title_name)
).start() ).start()
if "error" in r_proc.keys(): if r_proc['error'] is not None:
try: try: os.remove(r_proc['path'])
os.remove(r_proc['path']) except: pass
except:
pass
return r_proc['path'] return r_proc['path']

View File

@ -80,10 +80,8 @@ def download_film(select_title: MediaItem) -> str:
if script_id != "unknown": if script_id != "unknown":
TelegramSession.deleteScriptId(script_id) TelegramSession.deleteScriptId(script_id)
if "error" in r_proc.keys(): if r_proc['error'] is not None:
try: try: os.remove(r_proc['path'])
os.remove(r_proc['path']) except: pass
except:
pass
return r_proc['path'] return r_proc['path']

View File

@ -86,11 +86,9 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
output_path=os.path.join(mp4_path, mp4_name) output_path=os.path.join(mp4_path, mp4_name)
).start() ).start()
if "error" in r_proc.keys(): if r_proc['error'] is not None:
try: try: os.remove(r_proc['path'])
os.remove(r_proc['path']) except: pass
except:
pass
return r_proc['path'], r_proc['stopped'] return r_proc['path'], r_proc['stopped']

View File

@ -429,7 +429,8 @@ class HLS_Downloader:
'path': self.path_manager.output_path, 'path': self.path_manager.output_path,
'url': self.m3u8_url, 'url': self.m3u8_url,
'is_master': False, 'is_master': False,
'error': 'File already exists', 'msg': 'File already exists',
'error': None,
'stopped': False 'stopped': False
} }
if TELEGRAM_BOT: if TELEGRAM_BOT:
@ -473,6 +474,8 @@ class HLS_Downloader:
'path': self.path_manager.output_path, 'path': self.path_manager.output_path,
'url': self.m3u8_url, 'url': self.m3u8_url,
'is_master': self.m3u8_manager.is_master, 'is_master': self.m3u8_manager.is_master,
'msg': None,
'error': None,
'stopped': download_stopped 'stopped': download_stopped
} }
@ -485,6 +488,7 @@ class HLS_Downloader:
'path': None, 'path': None,
'url': self.m3u8_url, 'url': self.m3u8_url,
'is_master': getattr(self.m3u8_manager, 'is_master', None), 'is_master': getattr(self.m3u8_manager, 'is_master', None),
'msg': None,
'error': error_msg, 'error': error_msg,
'stopped': False 'stopped': False
} }

View File

@ -503,25 +503,35 @@ class M3U8_Parser:
except Exception as e: except Exception as e:
logging.error(f"Error parsing video info: {e}") logging.error(f"Error parsing video info: {e}")
def __parse_encryption_keys__(self, m3u8_obj) -> None: def __parse_encryption_keys__(self, obj) -> None:
""" """
Extracts encryption keys from the M3U8 object. Extracts encryption keys either from the M3U8 object or from individual segments.
Parameters: Parameters:
- m3u8_obj: The M3U8 object containing encryption keys. - obj: Either the main M3U8 object or an individual segment.
""" """
try: try:
if m3u8_obj.key is not None: if hasattr(obj, 'key') and obj.key is not None:
if self.keys is None: key_info = {
self.keys = { 'method': obj.key.method,
'method': m3u8_obj.key.method, 'iv': obj.key.iv,
'iv': m3u8_obj.key.iv, 'uri': obj.key.uri
'uri': m3u8_obj.key.uri
} }
if self.keys is None:
self.keys = key_info
"""
elif obj.key.uri not in self.keys:
if isinstance(self.keys, dict):
self.keys[obj.key.uri] = key_info
else:
old_key = self.keys
self.keys = {'default': old_key, obj.key.uri: key_info}
"""
except Exception as e: except Exception as e:
logging.error(f"Error parsing encryption keys: {e}") logging.error(f"Error parsing encryption keys: {e}")
sys.exit(0)
pass pass
def __parse_subtitles_and_audio__(self, m3u8_obj) -> None: def __parse_subtitles_and_audio__(self, m3u8_obj) -> None:
@ -575,6 +585,10 @@ class M3U8_Parser:
else: else:
self.subtitle.append(segment.uri) self.subtitle.append(segment.uri)
# Second check if there is key in main m3u8 obj
if self.keys is None:
self.__parse_encryption_keys__(m3u8_obj)
except Exception as e: except Exception as e:
logging.error(f"Error parsing segments: {e}") logging.error(f"Error parsing segments: {e}")

View File

@ -1,5 +1,5 @@
__title__ = 'StreamingCommunity' __title__ = 'StreamingCommunity'
__version__ = '2.8.0' __version__ = '2.9.0'
__author__ = 'Arrowar' __author__ = 'Arrowar'
__description__ = 'A command-line program to download film' __description__ = 'A command-line program to download film'
__copyright__ = 'Copyright 2024' __copyright__ = 'Copyright 2024'

View File

@ -10,7 +10,7 @@ with open("requirements.txt", "r", encoding="utf-8-sig") as f:
setup( setup(
name="StreamingCommunity", name="StreamingCommunity",
version="2.8.0", version="2.9.0",
long_description=read_readme(), long_description=read_readme(),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
author="Lovi-0", author="Lovi-0",