#!/usr/bin/env python

# Mandatory for openpluginlib initialisation
import platform
import sys
import os.path

if platform.system( ) == "Linux":
	import dl
	sys.setdlopenflags( dl.RTLD_NOW | dl.RTLD_GLOBAL )

# Import the player lib
import openpluginlib as opl

iprop=opl.property( opl.create_key_from_string( "int_list_key" ) )
iprop.set( [ 1, 2, 3 ] )
print iprop.value_as_int_list()
iprop.set_from_string( "5:6:7" )
print iprop.value_as_int_list()

dprop=opl.property( opl.create_key_from_string( "double_list_key" ) )
dprop.set( [ 1.1, 2.2, 3.3 ] )
print dprop.value_as_double_list()
dprop.set_from_string( "5.5:6.6:7.7" )
print dprop.value_as_double_list()

sprop=opl.property( opl.create_key_from_string( "string_list_key" ) )
sprop.set( [ "foo", "bar", "zot" ] )
print sprop.value_as_wstring_list()
sprop.set_from_string( "oof:rab:toz" )
print sprop.value_as_wstring_list()

# check cloning
prop_a=opl.property( opl.create_key_from_string( "foo" ) )
prop_a.set( 10 )
print prop_a, prop_a.is_a_int(), prop_a.value_as_int()

prop_b=prop_a.clone()
print prop_b, prop_b.is_a_int(), prop_b.value_as_int()

prop_c=prop_a
print prop_c, prop_c.is_a_int(), prop_c.value_as_int()

prop_a.set( 20 )

print prop_a, prop_a.is_a_int(), prop_a.value_as_int()
print prop_b, prop_b.is_a_int(), prop_b.value_as_int()
print prop_c, prop_c.is_a_int(), prop_c.value_as_int()
print prop_a == prop_b
print prop_a == prop_c
