示例#1
0
def id_to_rsync(htid, **kwargs):
    '''
    Take an HTRC id and convert it to an Rsync location for syncing Extracted
    Features
    '''
    if 'kind' in kwargs:
        logging.warn("The basic/advanced split with extracted features files "
                     "was removed in schema version 3.0. This function only "
                     "supports the current format for Rsync URLs, if you "
                     "would like to see the legacy 2.0 format, see Github: "
                     "https://github.com/htrc/htrc-feature-reader/blob/3e100ae"
                     "9ea45317443ae05f43a188b12afe2e69a/htrc_features/utils.py"
                     )
    libid, volid = htid.split('.', 1)
    volid_clean = id_encode(volid)
    filename = '.'.join([libid, volid_clean, 'json.bz2'])
    path = '/'.join([libid, 'pairtree_root', id2path(volid).replace('\\', '/'),
                     volid_clean, filename])
    return path
示例#2
0
文件: test.py 项目: edsu/pairtree
 def test_functions(self):
     self.assertEqual(id2path('http://example.org/1234/abcd'), 
                      'ht/tp/+=/=e/xa/mp/le/,o/rg/=1/23/4=/ab/cd')
     self.assertEqual(path2id('ht/tp/+=/=e/xa/mp/le/,o/rg/=1/23/4=/ab/cd'), 
                      'http://example.org/1234/abcd')