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)
).start()
if "error" in r_proc.keys():
try:
os.remove(r_proc['path'])
except:
pass
if r_proc['error'] is not None:
try: os.remove(r_proc['path'])
except: pass
return r_proc['path']

View File

@ -72,13 +72,10 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
m3u8_url=master_playlist,
output_path=os.path.join(mp4_path, mp4_name)
).start()
if "error" in r_proc.keys():
try:
os.remove(r_proc['path'])
except:
pass
if r_proc['error'] is not None:
try: os.remove(r_proc['path'])
except: pass
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)
).start()
if "error" in r_proc.keys():
try:
os.remove(r_proc['path'])
except:
pass
if r_proc['error'] is not None:
try: os.remove(r_proc['path'])
except: pass
return r_proc['path']

View File

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

View File

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

View File

@ -503,25 +503,35 @@ class M3U8_Parser:
except Exception as 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:
- m3u8_obj: The M3U8 object containing encryption keys.
- obj: Either the main M3U8 object or an individual segment.
"""
try:
if m3u8_obj.key is not None:
if hasattr(obj, 'key') and obj.key is not None:
key_info = {
'method': obj.key.method,
'iv': obj.key.iv,
'uri': obj.key.uri
}
if self.keys is None:
self.keys = {
'method': m3u8_obj.key.method,
'iv': m3u8_obj.key.iv,
'uri': m3u8_obj.key.uri
}
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:
logging.error(f"Error parsing encryption keys: {e}")
sys.exit(0)
pass
def __parse_subtitles_and_audio__(self, m3u8_obj) -> None:
@ -574,6 +584,10 @@ class M3U8_Parser:
self.segments.append(segment.uri)
else:
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:
logging.error(f"Error parsing segments: {e}")

View File

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

View File

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