'''
Created on Sep 25, 2015

@author: wu_mzhou
'''
from setting.logrecord import LogRecord
import os

def screen_info(key):
    '''
    @param key: The value of key should be screensaver or resolution 
    '''
    screen_info_value = ""
    if os.path.exists("/etc/sysconfig/client/display.conf"):
        display=open("/etc/sysconfig/client/display.conf",'r') 
        try:
            content=display.read()
            for line in content.split('\n'):
 
                if key in line:
                    screen_info_value = line.split('=')[1]
        except Exception as e:
            print (e)
            LogRecord.instance().logger.exception(e)
            
    return screen_info_value

