Ejemplo n.º 1
0
    def register(self, mid):
        """
        register in database mid
        if mid is already registered, it marks unload

        mid: mylistid or movieid
        return: bool
        """
        db = Database(self.databasePath)
        if mid[0:2] == "sm":
            if db.extMovieidInTable(mid):
                db.setMovieState(mid, 0)
            else:
                apiMovie = NicovideoAPI(movie_id=mid)
                movieTitle = apiMovie.get_movie_title()
                db.addMovie(mid)
                db.setMovieTitle(mid, movieTitle)
        else:
            if db.extMylistInTable(mid):
                db.setMylistRss(mid, 1)
            else:
                api = NicovideoAPI(mylist_id=mid)
                mylistTitle = api.get_mylist_title().decode(self.sysenc)
                db.addMylist(mid)
                db.setMylistTitle(mylistTitle)
        db.close()
Ejemplo n.º 2
0
 def movieLoad(self, movieid):
     """
     動画を保存
     save videos
     """
     if not self.db.addMovie(movieid):  # DB登録
         # 登録済みの時
         self.db.setMovieState(movieid, 0)
     api = NicovideoAPI(movie_id=movieid)
     title = api.get_movie_title()
     # ext = api.get_movie_type()
     nicoid = self.db.getNicoid()
     nicopw = self.db.getNicopw()
     savedir = getSavedir()
     self.status.chLoadingMovie()
     self.db.setMovieTitle(movieid, title)
     self.db.setMovieDescription(movieid, api.get_movie_description())
     self.db.setMovieLength(movieid, api.get_movie_length())
     self.db.setMoviePath(movieid, moviePath)
     self.status.setLoadingMovieid(movieid)
     moviePath = api.save_movie(nicoid, nicopw, savedir)
     self.db.setMovieThumbnail(movieid, api.save_thumbnail(savedir))
     self.db.setMovieComment(movieid, api.save_comment(nicoid, nicopw, savedir, title))
     self.db.setMovieState(movieid, 1)
     self.movieLoadDone()
     return True
Ejemplo n.º 3
0
 def movieLoad(self, movieid):
     """
     動画を保存
     save videos
     """
     if self.db.extMovieidInTable(movieid):
         # already resists
         self.db.setMovieState(movieid, 0)
     else:
         self.db.addMovie(movieid)  # resists for database
     api = NicovideoAPI(movie_id=movieid)
     title = api.get_movie_title()
     # ext = api.get_movie_type()
     nicoid = self.db.getNicoid()
     nicopw = self.db.getNicopw()
     savedir = getSavedir()
     self.__loading = True
     self.status.chLoadingMovie(self.__loading)
     self.db.setMovieTitle(movieid, title)
     self.db.setMovieDescription(movieid, api.get_movie_description())
     self.db.setMovieLength(movieid, api.get_movie_length())
     self.status.setLoadingMovieid(movieid)
     moviePath = api.save_movie(nicoid, nicopw, savedir)
     self.db.setMoviePath(movieid, moviePath)
     self.db.setMovieThumbnail(movieid, api.save_thumbnail(savedir))
     self.db.setMovieComment(movieid, api.save_comment(nicoid, nicopw, savedir, title))
     self.db.setMovieState(movieid, 1)
     self.movieLoadDone()
     return True
Ejemplo n.º 4
0
    def updateQueueList(self):
        movieQueue = self.nicoMain.getQueueObj.getQueueList()
        print movieQueue
        # 辞書の値の更新
        for movieid in self.__queueDict.keys():
            if not(movieid in movieQueue):
                del self.__queueDict[movieid]
        for movieid in movieQueue:
            if self.__queueDict.has_key(movieid) == False:
                try:
                    api = NicovideoAPI(movie_id=movieid)
                    title = api.get_movie_title()
                except:
                    title = "unknown"
                self.__queueDict.update({movieid : title})

        for movieid, title in self.__queueDict.items():
            self.__queueList.append((movieid, title))
        self.lclQueueList.SetItemCount(len(self.__queueList))
Ejemplo n.º 5
0
 def load(self, movieid):
     """
     load movieid
     """
     movieid = movieid
     self.logging("load: %s" % movieid)
     # 各データの取得
     db = Database(self.databasePath)
     sdb = SystemDatabase(self.systemDatabasePath)
     nicoid = sdb.getNicoid()
     nicopw = sdb.getNicopw()
     savedir = sdb.getSavedir()
     sdb.close()
     api = NicovideoAPI(movie_id=movieid)
     title = api.get_movie_title()
     moviePath = api.save_movie(nicoid, nicopw, savedir)  # 保存専用のクラスを定義する。一時停止可能なもの
     # 登録
     db.setMoviePath(movieid, moviePath)
     db.setMovieState(movieid, 1)
     self.queue.done()
     db.close()
     return True