def save_session(self):
        items = []

        def add_items(model, path, iter, item_list):
            url = model.get_value(iter, 0)
            thread_id = self.get_thread_id(url)
            thread = self.get_video_thread(thread_id)
            if thread and (
                thread.status == thread.PAUSED
                or thread.status == thread.DONE
                or thread.status == thread.CANCELLED
                or thread.status == thread.WAITING
            ):
                item_list.append(SessionItem(thread.video, thread.status))

        self.tree_model.foreach(add_items, items)

        #        print items
        new_session = SessionInfo()
        if items:
            for item in items:
                new_session.addItem(item)
            new_session.save()
        else:
            new_session.delete()
示例#2
0
    def save_session (self):
        items = []

        def add_items (model, path, iter, item_list):
            url = model.get_value (iter, 0)
            thread_id = self.get_thread_id (url)
            thread = self.get_video_thread (thread_id)
            if thread and (
                thread.status == thread.PAUSED or thread.status == thread.DONE
                or thread.status == thread.CANCELLED
                or thread.status == thread.WAITING):
                item_list.append (SessionItem (thread.video, thread.status))

        self.tree_model.foreach (add_items, items)

#        print items
        new_session = SessionInfo ()
        if items:
            for item in items:
                new_session.addItem (item)
            new_session.save ()
        else:
            new_session.delete ()
示例#3
0
    def restore_session (self):
        restore_session = SessionInfo ()
        items = restore_session.read ()

        for item in items:
            self.create_video_thread (item.video, item.status)
    def restore_session(self):
        restore_session = SessionInfo()
        items = restore_session.read()

        for item in items:
            self.create_video_thread(item.video, item.status)