def __init__(self): AddonHelper.__init__(self,'plugin.image.picasa-desktop') if self.getSettingInt('db_location') == 0: # default local picasa db if os.name == 'nt': db_path = "file://" + os.path.join(os.getenv('USERPROFILE'), 'appdata', 'Local', 'Google', 'Picasa2Albums') elif os.name == 'posix': db_path = "file://" + os.path.join(os.getenv('HOME'), '.google', 'picasa', '3.0', 'drive_c', 'Documents and Settings', os.getenv('USER'), 'Local Settings', 'Application Data', 'Google', 'Picasa2Albums') protocol = PicasaKit().createProtocolFromString(db_path) m = re.match('\w+://(.*)', db_path) db_search = m.group(1) elif self.getSettingInt('db_location') == 1: # local folder db_path = "file://" + self.getSetting('db_path_local') protocol = PicasaKit().createProtocolFromString(db_path) m = re.match('\w+://(.*)', db_path) db_search = m.group(1) else: # network db_path = self.getSetting('db_path_network') m = re.match('\w+://(.+?)/', db_path) protocol = PicasaKit().createProtocolFromString(db_path) protocol.connect(username = self.getSetting('db_path_network_user'), password = self.getSetting('db_path_network_pass'), ip = m.group(1)) m = re.match('\w+://(.*)', db_path) db_search = '/' + m.group(1) # search for database files... print "search database..." location = PicasaKit().createLocation(protocol) if location.search_database(db_search) == False: print db_search xbmcgui.Dialog().ok('Picasa Desktop', 'Database not found at\n[%s]' % db_search) return None # init print "use path: " + location.cwd() self._picasa = PicasaKit().createDatabase(location) # what todo? try: if self.getParamString('album', None): self.listImages( album_id = self.getParamString('album', None) ) else: self.listAlbum() except Exception, e: # python 2.6 as xbmcgui.Dialog().ok('Picasa Error', e.__str__())
def setUp(self): """ set up data used in the tests. setUp is called before each test function execution. """ db_path = "file://" + os.path.join(os.getenv('HOME'), '.google', 'picasa', '3.0', 'drive_c', 'Documents and Settings', os.getenv('USER'), 'Local Settings', 'Application Data', 'Google', 'Picasa2Albums') protocol = PicasaKit().createProtocolFromString(db_path) location = PicasaKit().createLocation(protocol) # search for dbid... m = re.match('\w+://(.*)', db_path) location.search_database(m.group(1)) # init self.picasa = PicasaKit().createDatabase(location)
class testPicasaUnixNetwork(unittest.TestCase): """ A test class for the PicasaKit module. System: Windows 7 Picasa 3 Network Database """ def setUp(self): """ set up data used in the tests. setUp is called before each test function execution. """ db_path = "smb://10.0.0.11/tom/picasa/Local Settings/Application Data/Google/Picasa2Albums" protocol = PicasaKit().createProtocolFromString(db_path) protocol.connect(username = "******", password = "", ip = "10.0.0.11") location = PicasaKit().createLocation(protocol) # search for dbid... m = re.match('\w+://(.+)', db_path) location.search_database('/' + m.group(1)) # init self.picasa = PicasaKit().createDatabase(location) def test_ListAlbums(self): # self.assertNotEqual( len(self.picasa.albums()), 0 ) def test_ReadAlbum(self): # from picasa import Album self.assertNotEqual( self.picasa.album('84de3f2a5eb450e1aad57eaa7da06623'), Album)
class testPicasaLinuxDefault(unittest.TestCase): """ A test class for the PicasaKit module. System: Ubuntu 10.10 Picasa 3 Default Database """ def setUp(self): """ set up data used in the tests. setUp is called before each test function execution. """ db_path = "file://" + os.path.join(os.getenv('HOME'), '.google', 'picasa', '3.0', 'drive_c', 'Documents and Settings', os.getenv('USER'), 'Local Settings', 'Application Data', 'Google', 'Picasa2Albums') protocol = PicasaKit().createProtocolFromString(db_path) location = PicasaKit().createLocation(protocol) # search for dbid... m = re.match('\w+://(.*)', db_path) location.search_database(m.group(1)) # init self.picasa = PicasaKit().createDatabase(location) def test_ListAlbums(self): # self.assertNotEqual( len(self.picasa.albums()), 0 ) def test_ReadAlbum(self): # from picasa import Album self.assertNotEqual( self.picasa.album('21f2c0b53018628cbea72ad28503a41d'), Album)
def setUp(self): """ set up data used in the tests. setUp is called before each test function execution. """ db_path = "smb://10.0.0.11/tom/picasa/Local Settings/Application Data/Google/Picasa2Albums" protocol = PicasaKit().createProtocolFromString(db_path) protocol.connect(username="******", password="", ip="10.0.0.11") location = PicasaKit().createLocation(protocol) # search for dbid... m = re.match("\w+://(.+)", db_path) location.search_database("/" + m.group(1)) # init self.picasa = PicasaKit().createDatabase(location)