ver Jan5th

debugged
This commit is contained in:
David Chang
2024-01-05 15:20:47 +08:00
parent 5fedf5b891
commit eeb8a120d6
17 changed files with 158 additions and 86 deletions

View File

@@ -5,6 +5,9 @@ from xml.etree import ElementTree
import pygetwindow as gw
import pyautogui
import logging
logger = logging.getLogger("desktopenv.metrics.vlc")
def read_vlc_config(setting_name):
"""
Reads the VLC configuration file to check for a specific setting.
@@ -24,7 +27,7 @@ def read_vlc_config(setting_name):
config_path = paths.get(os_type)
if not config_path or not os.path.exists(config_path):
print("VLC config file not found for this operating system.")
logger.warning("VLC config file not found for this operating system.")
return None
try:
@@ -33,7 +36,7 @@ def read_vlc_config(setting_name):
if line.startswith(setting_name):
return line.strip()
except IOError as e:
print(f"Error reading config file: {e}")
logger.error(f"Error reading config file: {e}")
return None
@@ -53,7 +56,7 @@ def get_vlc_playing_info(host='localhost', port=8080, password='password'):
return status, file_info
return status, None
except Exception as e:
print(f"Error: {e}")
logger.error(f"Error: {e}")
return None, None
@@ -78,10 +81,10 @@ def is_vlc_fullscreen():
except IndexError:
# VLC window not found
print("VLC window not found.")
logger.error("VLC window not found.")
return False
except Exception as e:
print(f"An error occurred: {e}")
logger.error(f"An error occurred: {e}")
return False