Example #1
0
def get_file_type(filename):
    get = FileInfo(('pfileinfo','-v','0',
                    'type','--type-only',property_name,filename))
    result = get.run()
    if result != 0:
        return None
    result = get.get_stdout_msg()
    if len(result) and result[-1] == '\n':
        result = result[:-1]
    return result
Example #2
0
def get_file_type(filename):
    get = FileInfo(('pfileinfo', '-v', '0', 'type', '--type-only',
                    property_name, filename))
    result = get.run()
    if result != 0:
        return None
    result = get.get_stdout_msg()
    if len(result) and result[-1] == '\n':
        result = result[:-1]
    return result
Example #3
0
def get_file_property(filename, property_name):
    get = FileInfo(('pfileinfo','-v','0',
                    'get','--value-only',property_name,filename))
    try:
        result = get.run()
    except ECommand:
        return None
    if result != 0:
        return None
    result = get.get_stdout_msg()
    if len(result) and result[-1] == '\n':
        result = result[:-1]
    return result
Example #4
0
def get_file_property(filename, property_name):
    get = FileInfo(('pfileinfo', '-v', '0', 'get', '--value-only',
                    property_name, filename))
    try:
        result = get.run()
    except ECommand:
        return None
    if result != 0:
        return None
    result = get.get_stdout_msg()
    if len(result) and result[-1] == '\n':
        result = result[:-1]
    return result