Пример #1
0
def get_data_name_mirror(objDataDir, diskRoot, mapDict, itemName):
    if os.path.exists(objDataDir):
        updatadir = objDataDir
        logging.debug('get_data_name_mirror: found under objects: ' +
                      objDataDir)
    else:
        success,dirName,dataDir,auxiDir = ryw_philips.get_map_entry(
            diskRoot, mapDict, itemName)
        if not success:
            return None
        #ryw.give_news('get_data_name_mirror: found data: ' + dirName,
        #              logging.info)
        ryw.give_news3('found data: ' + dirName, logging.info)
        updatadir = dataDir

    try:    
        ll = os.listdir(updatadir)
    except:
        ryw.give_bad_news('get_data_name_mirror: failed to listdir: ' +
                          updatadir, logging.error)
        return None

    if len(ll) == 1 and os.path.isfile(os.path.join(updatadir, ll[0])):
        obdata = os.path.join(updatadir, ll[0])
    else:
        obdata = updatadir

    logging.debug('get_data_name_mirror: got data name: ' + obdata)
    return obdata
Пример #2
0
def get_aux_name_mirror(upauxdir, diskRoot, mapDict, itemName):
    if os.path.exists(upauxdir) and os.path.isdir(upauxdir):
        logging.debug('get_aux_name_mirror: found under objects: ' +
                      upauxdir)
        return upauxdir

    success,dirName,dataDir,auxiDir = ryw_philips.get_map_entry(
        diskRoot, mapDict, itemName)
    if not success:
        return None

    logging.debug('get_aux_name_mirror: got auxi name: ' + auxiDir)
    return auxiDir