Esempio n. 1
0
    def run(self):
        L.d("running")
        self.stopvar = False
        rex = re.compile(".*\[(\d{7})\]$")
        imdb_db = imdb.IMDb()
        db = get_user_db()
        tp = QThreadPool.globalInstance()
        writer = IndexWriter()
        count = 0

        it = QDirIterator(self.media_path, QDirIterator.Subdirectories)
        while it.hasNext():
            dir = it.next()
            try:
                directory = unicode(dir)
                match = rex.match(directory)
                if match:
                    count += 1
                    imdb_id = match.group(1)
                    movie = db.get_doc(imdb_id)
                    if movie:
                        L.d("%s already in db - skipping" % imdb_id)
                    else:
                        j = Job(imdb_db, imdb_id, self)
                        j.obj.finished.connect(writer.index_movie,
                                               Qt.QueuedConnection)
                        tp.start(j)
            except:
                pass
        print count
        self.exec_()
Esempio n. 2
0
    def run(self):
        L.d("running")
        self.stopvar = False
        rex = re.compile(".*\[(\d{7})\]$")
        imdb_db = imdb.IMDb()
        db = get_user_db()
        tp = QThreadPool.globalInstance()
        writer = IndexWriter()
        count = 0

        it = QDirIterator(self.media_path, QDirIterator.Subdirectories)
        while it.hasNext():
            dir = it.next()
            try:
                directory = unicode(dir)
                match = rex.match(directory)
                if match:
                    count += 1
                    imdb_id = match.group(1)
                    movie = db.get_doc(imdb_id)
                    if movie:
                        L.d("%s already in db - skipping" % imdb_id)
                    else:
                        j = Job(imdb_db, imdb_id, self) 
                        j.obj.finished.connect(writer.index_movie,
                                Qt.QueuedConnection)
                        tp.start(j) 
            except:
                pass
        print count
        self.exec_()
Esempio n. 3
0
    def __init__(self, parent=None):
        QCoreApplication.setOrganizationName("Hamster Inc.")
        QCoreApplication.setApplicationName("Hamster")
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.index_thread = False
        self._shutdown_requested = False
        self.downloader = DownloadManager()
        self.downloader.dl_finished.connect(self.update_cover)
        header = ['Movie']

        #self.db = MovieDB("movies")
        tv = self.ui.tableView
        tv.setShowGrid(False)
        #model = MyTableModel(self.db, header, tv)
        #titles = self.db.get_movie_titles()
        self.index = get_user_index()
        self.db = get_user_db()
        results = self.index.list_all()
        self.model = ResultViewModel(results, header, tv)
        #model = QtGui.QStandardItemModel()
        #model.insertRow(0, [QtGui.QStandardItem("hallo")])
        #model.insertRow(0, [QtGui.QStandardItem("sadf")])
        #model.insertRow(0, [QtGui.QStandardItem("pfui")])
        #model.insertRow(0, [QtGui.QStandardItem("warum?")])
        #model.insertRow(0, [QtGui.QStandardItem("haeff")])
        tv.setModel(self.model)
        selectionModel = tv.selectionModel()
        # hide vertical header
        vh = tv.verticalHeader()
        vh.setVisible(False)

        # set horizontal header properties
        hh = tv.horizontalHeader()
        hh.setStretchLastSection(True)

        selectionModel.selectionChanged.connect(self.setCurrentSelection)
        self.ui.search_bar.textChanged.connect(self.update_model)
        self.ui.action_sync_now.triggered.connect(self.sync)
        self.settings = QSettings()
        global MOVIE_DIR
        MOVIE_DIR = self.settings.value("movie_dir", MOVIE_DIR)
        self.settings.setValue("movie_dir", MOVIE_DIR)
Esempio n. 4
0
    def __init__(self, parent=None):
        QCoreApplication.setOrganizationName("Hamster Inc.")
        QCoreApplication.setApplicationName("Hamster")
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.index_thread = False
        self._shutdown_requested = False
        self.downloader = DownloadManager()
        self.downloader.dl_finished.connect(self.update_cover)
        header = ['Movie']

        #self.db = MovieDB("movies")
        tv = self.ui.tableView
        tv.setShowGrid(False)
        #model = MyTableModel(self.db, header, tv)
        #titles = self.db.get_movie_titles()
        self.index = get_user_index()
        self.db = get_user_db()
        results = self.index.list_all()
        self.model = ResultViewModel(results, header, tv)
        #model = QtGui.QStandardItemModel()
        #model.insertRow(0, [QtGui.QStandardItem("hallo")])
        #model.insertRow(0, [QtGui.QStandardItem("sadf")])
        #model.insertRow(0, [QtGui.QStandardItem("pfui")])
        #model.insertRow(0, [QtGui.QStandardItem("warum?")])
        #model.insertRow(0, [QtGui.QStandardItem("haeff")])
        tv.setModel(self.model)
        selectionModel = tv.selectionModel()
        # hide vertical header
        vh = tv.verticalHeader()
        vh.setVisible(False)

        # set horizontal header properties
        hh = tv.horizontalHeader()
        hh.setStretchLastSection(True)

        selectionModel.selectionChanged.connect(self.setCurrentSelection)
        self.ui.search_bar.textChanged.connect(self.update_model)
        self.ui.action_sync_now.triggered.connect(self.sync)
        self.settings = QSettings()
        global MOVIE_DIR
        MOVIE_DIR = self.settings.value("movie_dir", MOVIE_DIR)
        self.settings.setValue("movie_dir", MOVIE_DIR)
Esempio n. 5
0
 def __init__(self):
     QObject.__init__(self)
     self.index = get_user_index()
     self.db = get_user_db()
Esempio n. 6
0
 def __init__(self):
     QObject.__init__(self)
     self.index = get_user_index()
     self.db = get_user_db()