@@ -83,6 +83,7 @@ class DLNAHandler(BaseHTTPRequestHandler):
8383 server_instance = None # Reference to the ZeroConfigDLNA server instance
8484 verbose = False # Verbose logging flag
8585 server_name = None # Server name, set by the server instance
86+ fast = False # Fast mode flag to disable subprocess calls
8687
8788 def __init__ (self , * args , ** kwargs ):
8889 # Set default timeout for socket operations (5 minutes)
@@ -101,6 +102,9 @@ def __init__(self, *args, **kwargs):
101102 # Just log it and return gracefully
102103 print (f"Client disconnected during handler initialization: { e } " )
103104
105+ if self .fast :
106+ print ("Fast mode enabled - subprocess calls will be disabled" )
107+
104108 def setup (self ):
105109 """Set up the connection with timeout"""
106110 super ().setup ()
@@ -2030,8 +2034,8 @@ def _get_media_duration(self, file_path, mime_type):
20302034 "audio/aiff" : "00:05:00" ,
20312035 }
20322036
2033- # Try to get duration using ffprobe if available
2034- if mime_type and (
2037+ # Try to get duration using ffprobe if available (skip if fast mode is enabled)
2038+ if not self . fast and mime_type and (
20352039 mime_type .startswith ("video/" ) or mime_type .startswith ("audio/" )
20362040 ):
20372041 try :
@@ -2086,17 +2090,17 @@ def _get_media_duration(self, file_path, mime_type):
20862090 ):
20872091 pass
20882092
2089- # Try basic MP4 parsing for MP4 files
2090- if mime_type == "video/mp4" :
2091- mp4_duration = self ._parse_mp4_duration (file_path )
2092- if mp4_duration :
2093- return mp4_duration
2094-
2095- # Try basic AVI parsing for AVI files
2096- if mime_type == "video/x-msvideo" :
2097- avi_duration = self ._parse_avi_duration (file_path )
2098- if avi_duration :
2099- return avi_duration
2093+ # Try basic MP4 parsing for MP4 files (works even in fast mode)
2094+ if mime_type == "video/mp4" :
2095+ mp4_duration = self ._parse_mp4_duration (file_path )
2096+ if mp4_duration :
2097+ return mp4_duration
2098+
2099+ # Try basic AVI parsing for AVI files (works even in fast mode)
2100+ if mime_type == "video/x-msvideo" :
2101+ avi_duration = self ._parse_avi_duration (file_path )
2102+ if avi_duration :
2103+ return avi_duration
21002104
21012105 # Return default duration for the mime type
21022106 return default_durations .get (mime_type , "01:00:00" )
0 commit comments