Update of /cvsroot/openlibraries/openlibraries/test/openassetlib/python_bindings_unittest
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5042/test/openassetlib/python_bindings_unittest
Modified Files:
jahlogo.png python_binding_unittest.py
Added Files:
mvi_2827.avi
Log Message:
Add guid abstraction
Index: jahlogo.png
===================================================================
RCS file: /cvsroot/openlibraries/openlibraries/test/openassetlib/python_bindings_unittest/jahlogo.png,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
Binary files /tmp/cvsoLrWje and /tmp/cvsGAyFel differ
Index: python_binding_unittest.py
===================================================================
RCS file: /cvsroot/openlibraries/openlibraries/test/openassetlib/python_bindings_unittest/python_binding_unittest.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- python_binding_unittest.py 29 Aug 2006 17:18:01 -0000 1.1
+++ python_binding_unittest.py 28 Sep 2006 11:08:17 -0000 1.2
@@ -26,7 +26,7 @@
return uuid.uuid_time()
def print_asset_content( asset ):
- print "\n\tGUID: ", asset.guid()
+ print "\n\tGUID: ", asset.guid().string()
if asset.size() == 0:
print "\tContains no metadata"
else:
@@ -59,7 +59,7 @@
oal.init(uuid_generator())
guid = oal.generate_guid()
- print 'generate_guid: %s' % guid
+ print 'generate_guid: %s' % guid.string()
########################
print '\ncreating asset 1'
@@ -71,11 +71,11 @@
print_asset_content(asset1)
print 'Changing the GUID...'
- print 'get_guid\t->\t', asset1.guid()
- guid = str('GUID-1')
+ print 'get_guid\t->\t', asset1.guid().string()
+ guid = oal.create_guid(str('{11111111-1111-1111-1111-111111111111}'))
asset1.guid(guid)
- print 'set_guid\t<-\t', guid
- print 'get_guid\t->\t', asset1.guid()
+ print 'set_guid\t<-\t', guid.string()
+ print 'get_guid\t->\t', asset1.guid().string()
print "\tadding metadata..."
asset1.set("a_bool", True)
@@ -97,7 +97,7 @@
print_asset_content(asset2)
print "\tmodifiying metadata & guid..."
- asset2.guid(str('GUID-2'))
+ asset2.guid(oal.create_guid(str('{22222222-2222-2222-2222-222222222222}')))
asset2.set("a_bool", False)
asset2.set("a_string", "I'm a number 2!")
asset2.set("an_int", int(9876543210))
@@ -111,11 +111,13 @@
asset3 = oal.create_asset(os.path.join(os.getcwd(), "jahlogo.png"))
print 'dir = %s' % os.path.join(os.getcwd(), "jahlogo.png")
print asset3.get('location')
- print asset3.get('filename')
- asset3.set('location', 'c:\\sandbox\\openlibraries\\test\\openassetlib\\python_bindings_unittest')
- asset3.set('filename', 'jahlogo.png')
- print asset3.get('location')
- print asset3.get('filename')
+ #print asset3.get('filename')
+ #asset3.set('location', 'c:\\sandbox\\openlibraries\\test\\openassetlib\\python_bindings_unittest\\jahlogo.png')
+ #asset3.set('location', 'c:\\Media\\images\\jahlogo.png')
+ #asset3.set('location', 'c:\\sandbox\\openlibraries\\test\\openassetlib\\python_bindings_unittest')
+ #asset3.set('filename', 'jahlogo.png')
+ #print asset3.get('location')
+ #print asset3.get('filename')
if asset3 is None:
print '\tFailed'
@@ -124,7 +126,7 @@
print_asset_content(asset3)
print "\tadding extra metadata and modifiying guid..."
- asset3.guid(str('GUID-3'))
+ asset3.guid(oal.create_guid(str('{33333333-3333-3333-3333-333333333333}')))
asset3.set("a_string", "Three")
print_asset_content(asset3)
@@ -136,7 +138,7 @@
else:
print '\tSucceeded'
- asset4.guid(str('GUID-4'))
+ asset4.guid(oal.create_guid(str('{44444444-4444-4444-4444-444444444444}')))
asset4.set("a_string", "Four")
print_asset_content(asset4)
@@ -148,7 +150,7 @@
else:
print '\tSucceeded'
- asset5.guid(str('GUID-5'))
+ asset5.guid(oal.create_guid(str('{55555555-5555-5555-5555-555555555555}')))
asset5.set("a_string", "Five")
print_asset_content(asset5)
@@ -160,7 +162,7 @@
else:
print '\tSucceeded'
- asset6.guid(str('GUID-6'))
+ asset6.guid(oal.create_guid(str('{66666666-6666-6666-6666-666666666666}')))
asset6.set("a_string", "Six")
print_asset_content(asset6)
@@ -191,10 +193,10 @@
print 'List of assets:'
for a in set1:
- print "\t", a.guid()
+ print "\t", a.guid().string()
- print "Asset at offset 0: ", set1.at(0).guid()
- print "Asset at offset 3: ", set1.at(3).guid()
+ print "Asset at offset 0: ", set1.at(0).guid().string()
+ print "Asset at offset 3: ", set1.at(3).guid().string()
######################
print '\ncreating set2 with asset3'
@@ -213,7 +215,7 @@
print 'List of assets:'
for a in set2:
- print "\t", a.guid()
+ print "\t", a.guid().string()
######################
print '\ncreating set3 with set1'
@@ -221,42 +223,42 @@
print '\tset name = %s' % set3.name()
print 'List of assets:'
for a in set3:
- print "\t", a.guid()
+ print "\t", a.guid().string()
print 'popping the last asset off the back...'
set3.pop_back()
print 'List of assets:'
for a in set3:
- print "\t", a.guid()
+ print "\t", a.guid().string()
print 'Inserting asset6 at offset 1'
set3.insert(asset6, 1)
print 'List of assets:'
for a in set3:
- print "\t", a.guid()
+ print "\t", a.guid().string()
print 'Inserting set1 at offset 3'
set3.insert(set1, 3)
print 'List of assets:'
for a in set3:
- print "\t", a.guid()
+ print "\t", a.guid().string()
print '\nRemoving asset6'
set3.remove(asset6)
print 'List of assets:'
for a in set3:
- print "\t", a.guid()
+ print "\t", a.guid().string()
######################
print '\ncreating set4 with set1'
set4 = oal.create_set(set1)
print 'List of assets:'
for a in set4:
- print "\t", a.guid()
+ print "\t", a.guid().string()
print '\nClearing set'
set4.clear()
print 'List of assets:'
- if set4.empty() == 0:
+ if set4.empty():
print '\tEMPTY!'
else:
for a in set4:
- print "\t", a.guid()
+ print "\t", a.guid().string()
########################################################
print "\nIntersection of set1 and set2:"
@@ -317,8 +319,9 @@
print 'asset3 height = %s' % asset3.get("height")
###################################
- asset4.set("location", "C:/Media/")
- asset4.set("filename", "Donkey.mpeg")
+ #asset4.set("location", "C:/Media/")
+ #asset4.set("filename", "Donkey.mpeg")
+ asset4.set("location", os.path.join(os.getcwd(), "mvi_2827.avi"))
print_is_convertible(asset4)
media = oal.convert_to_media(asset4) # Note: Cos oml is not exported as yet, there is convert_to_media in the bindings returns void!
if media is None:
@@ -333,7 +336,7 @@
print 'asset4 fps = %s' % asset4.get("fps")
print 'asset4 sar = %s' % asset4.get("sar")
- search_root_dir = oal.generate_guid()
+ search_root_dir = oal.generate_guid().string()
os.mkdir(search_root_dir)
print search_root_dir
@@ -360,7 +363,7 @@
for y in x:
print y.libname(), ':', y.name(), y.merit()
fs_plugin = y.create_plugin("")
- print fs_plugin
+ #print fs_plugin
if fs_plugin is None:
print "Failed to create filesystem plugin"
else:
@@ -369,12 +372,12 @@
print "Searching for .png files in root of test folders (non-recursive)"
fs_search_set1 = oal.search(fs_plugin, ".*\.png", full_search_root_dir, False)
- print fs_search_set1
+ #print fs_search_set1
print_set_content(fs_search_set1)
print "Searching for .png files in root of test folders (recursive)"
fs_search_set2 = oal.search(fs_plugin, ".*\.png", full_search_root_dir, True)
- print fs_search_set2
+ #print fs_search_set2
print_set_content(fs_search_set2)
try:
@@ -416,17 +419,17 @@
else:
print 'The following assets failed to get stored in the db..'
for failed_asset in failed_to_store_set:
- print '\t%s' % failed_asset.guid()
+ print '\t%s' % failed_asset.guid().string()
print '\n'
restore_set = oal.create_set()
asset_to_restore1 = oal.create_asset()
- asset_to_restore1.guid("GUID-3")
+ asset_to_restore1.guid(oal.create_guid("{33333333-3333-3333-3333-333333333333}"))
restore_set.push_back(asset_to_restore1)
asset_to_restore2 = oal.create_asset()
- asset_to_restore2.guid("GUID-4")
+ asset_to_restore2.guid(oal.create_guid("{44444444-4444-4444-4444-444444444444}"))
restore_set.push_back(asset_to_restore2)
restored_set = oal.restore(db_plugin, restore_set)
@@ -435,6 +438,12 @@
else:
print 'Successfully restored assets...'
print_set_content(restored_set)
+ if restored_set.at(0).guid() == asset_to_restore1.guid():
+ print 'restored asset at set offset 0 was %s' % asset_to_restore1.guid().string()
+ if restored_set.at(1).guid() == asset_to_restore1.guid():
+ print 'restored asset at set offset 1 wasnt %s' % asset_to_restore1.guid().string()
+ print 'it was %s' % restored_set.at(1).guid().string()
+
image2 = oal.restore_image(restored_set.at(1), "jahlogo.png")
if image2 is None:
--- NEW FILE: mvi_2827.avi ---
(This appears to be a binary file; contents omitted.)
|