class MainFrame(wx.Frame):
	def __init__(self, parent, library, player=''):
		self.libraryPath = library
		self.VlcPlayer = player
		
		self.selectedMovie = None
		
		self.filterName = None
		self.filterValue = None
		
		self.rightClickedMovie = None
		
		f = open(os.path.join(resDir,'template.html'))
		self.detailHtmlTemplate = unicode(f.read())
		f.close()
		
		self.movieTitleSearch = ''
				
		self.Playing = False
		self.Fullscreen = False
		
		self._init_ctrls(parent)
		
		
	def _init_db(self):
		if self.libraryPath == '':
			print "No library path set"
			return False
			
		try:
			if os.path.isdir(self.libraryPath):
				self.metadataPath = os.path.join(self.libraryPath,'metadata')
				if not os.path.isdir(self.metadataPath):
					os.mkdir(self.metadataPath)
				
				self.postersPath = os.path.join(self.metadataPath, 'posters')
				if not os.path.isdir(self.postersPath):
					os.mkdir(self.postersPath)
					
				self.catchPath = os.path.join(self.metadataPath, 'catch')
				if not os.path.isdir(self.catchPath):
					os.mkdir(self.catchPath)
				
				self.db = DbInterface(os.path.join(self.metadataPath,'metadata.db'))
				
				if not self.db.isConnected():
					print "Cannot connect to the metadata database"
					return False

				print "Library Opened"
				return True
				
			else:
				print "Library path is invalid"
				return False
				
		except OSError, e:
			print "Cannot access the library"
			return False
예제 #2
0
class MainFrame(wx.Frame):
    def __init__(self, parent, library, player=''):
        self.libraryPath = library
        self.VlcPlayer = player

        self.selectedMovie = None

        self.filterName = None
        self.filterValue = None

        self.rightClickedMovie = None

        f = open(os.path.join(resDir, 'template.html'))
        self.detailHtmlTemplate = unicode(f.read())
        f.close()

        self.movieTitleSearch = ''

        self.Playing = False
        self.Fullscreen = False

        self._init_ctrls(parent)

    def _init_db(self):
        if self.libraryPath == '':
            print "No library path set"
            return False

        try:
            if os.path.isdir(self.libraryPath):
                self.metadataPath = os.path.join(self.libraryPath, 'metadata')
                if not os.path.isdir(self.metadataPath):
                    os.mkdir(self.metadataPath)

                self.postersPath = os.path.join(self.metadataPath, 'posters')
                if not os.path.isdir(self.postersPath):
                    os.mkdir(self.postersPath)

                self.catchPath = os.path.join(self.metadataPath, 'catch')
                if not os.path.isdir(self.catchPath):
                    os.mkdir(self.catchPath)

                self.db = DbInterface(
                    os.path.join(self.metadataPath, 'metadata.db'))

                if not self.db.isConnected():
                    print "Cannot connect to the metadata database"
                    return False

                print "Library Opened"
                return True

            else:
                print "Library path is invalid"
                return False

        except OSError, e:
            print "Cannot access the library"
            return False