mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
[UTIL] Remove "call_stack.py"
This commit is contained in:
parent
658b6b0a01
commit
06a6865007
@ -11,10 +11,10 @@ from rich.console import Console
|
|||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
from StreamingCommunity.Util.os import os_manager
|
from StreamingCommunity.Util.os import os_manager, get_call_stack
|
||||||
from StreamingCommunity.Util.message import start_message
|
from StreamingCommunity.Util.message import start_message
|
||||||
from StreamingCommunity.Util.headers import get_userAgent
|
from StreamingCommunity.Util.headers import get_userAgent
|
||||||
from StreamingCommunity.Util.table import TVShowManager, get_call_stack
|
from StreamingCommunity.Util.table import TVShowManager
|
||||||
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
# 21.06.24
|
|
||||||
|
|
||||||
import os
|
|
||||||
import inspect
|
|
||||||
|
|
||||||
|
|
||||||
def get_call_stack():
|
|
||||||
"""
|
|
||||||
Retrieves the current call stack with details about each call.
|
|
||||||
|
|
||||||
This function inspects the current call stack and returns a list of dictionaries,
|
|
||||||
where each dictionary contains details about a function call in the stack.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
list: A list of dictionaries, each containing the following keys:
|
|
||||||
- function (str): The name of the function.
|
|
||||||
- folder (str): The directory path of the script containing the function.
|
|
||||||
- folder_base (str): The base name of the directory path.
|
|
||||||
- script (str): The name of the script file containing the function.
|
|
||||||
- line (int): The line number in the script where the function is defined.
|
|
||||||
"""
|
|
||||||
|
|
||||||
stack = inspect.stack()
|
|
||||||
call_stack = []
|
|
||||||
|
|
||||||
for frame_info in stack:
|
|
||||||
function_name = frame_info.function
|
|
||||||
filename = frame_info.filename
|
|
||||||
lineno = frame_info.lineno
|
|
||||||
folder_name = os.path.dirname(filename)
|
|
||||||
folder_base = os.path.basename(folder_name)
|
|
||||||
script_name = os.path.basename(filename)
|
|
||||||
|
|
||||||
call_stack.append({
|
|
||||||
"function": function_name,
|
|
||||||
"folder": folder_name,
|
|
||||||
"folder_base": folder_base,
|
|
||||||
"script": script_name,
|
|
||||||
"line": lineno
|
|
||||||
})
|
|
||||||
|
|
||||||
return call_stack
|
|
@ -9,6 +9,7 @@ import shutil
|
|||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import platform
|
import platform
|
||||||
|
import inspect
|
||||||
import subprocess
|
import subprocess
|
||||||
import contextlib
|
import contextlib
|
||||||
import importlib.metadata
|
import importlib.metadata
|
||||||
@ -493,20 +494,31 @@ def suppress_output():
|
|||||||
yield
|
yield
|
||||||
|
|
||||||
def compute_sha1_hash(input_string: str) -> str:
|
def compute_sha1_hash(input_string: str) -> str:
|
||||||
"""
|
"""Computes the SHA-1 hash of the input string."""
|
||||||
Computes the SHA-1 hash of the input string.
|
return hashlib.sha1(input_string.encode()).hexdigest()
|
||||||
|
|
||||||
Parameters:
|
def get_call_stack():
|
||||||
- input_string (str): The string to be hashed.
|
"""Retrieves the current call stack with details about each call."""
|
||||||
|
stack = inspect.stack()
|
||||||
|
call_stack = []
|
||||||
|
|
||||||
Returns:
|
for frame_info in stack:
|
||||||
str: The SHA-1 hash of the input string.
|
function_name = frame_info.function
|
||||||
"""
|
filename = frame_info.filename
|
||||||
# Compute the SHA-1 hash
|
lineno = frame_info.lineno
|
||||||
hashed_string = hashlib.sha1(input_string.encode()).hexdigest()
|
folder_name = os.path.dirname(filename)
|
||||||
|
folder_base = os.path.basename(folder_name)
|
||||||
|
script_name = os.path.basename(filename)
|
||||||
|
|
||||||
# Return the hashed string
|
call_stack.append({
|
||||||
return hashed_string
|
"function": function_name,
|
||||||
|
"folder": folder_name,
|
||||||
|
"folder_base": folder_base,
|
||||||
|
"script": script_name,
|
||||||
|
"line": lineno
|
||||||
|
})
|
||||||
|
|
||||||
|
return call_stack
|
||||||
|
|
||||||
def get_ffmpeg_path():
|
def get_ffmpeg_path():
|
||||||
"""Returns the path of FFmpeg."""
|
"""Returns the path of FFmpeg."""
|
||||||
|
@ -16,8 +16,8 @@ from rich.style import Style
|
|||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
|
from .os import get_call_stack
|
||||||
from .message import start_message
|
from .message import start_message
|
||||||
from .call_stack import get_call_stack
|
|
||||||
|
|
||||||
|
|
||||||
# Telegram bot instance
|
# Telegram bot instance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user