示例#1
0
    def __init__(self):
        super(VideoListPopular, self).__init__()

        self.get_style_context().add_class('video_list_popular')

        entries = search_youtube_by_keyword(
            popular=True,
            max_results=3,
            parent_control=self.ParentalControl,
            start_index=randint(1, 20))

        if entries:
            parsed_entries = parse_youtube_entries(entries)
            x_pos = 0

            for i, e in enumerate(parsed_entries):
                img = Gtk.Image()

                button = Button()
                if e['big_thumb']:
                    thumbnail = '{}/video_{}.jpg'.format(tmp_dir, time())
                    download_url(e['big_thumb'], thumbnail)
                    img.set_from_file(thumbnail)
                button.add(img)
                button.connect('clicked', self._play, e['video_url'])
                self._grid.attach(button, x_pos, 0, 1, 1)

                x_pos += 1
示例#2
0
    def __init__(self):
        super(VideoListPopular, self).__init__()

        self.get_style_context().add_class('video_list_popular')

        entries = search_youtube_by_keyword(popular=True, max_results=3,
                                            parent_control=self.ParentalControl,
                                            start_index=randint(1, 20))

        if entries:
            parsed_entries = parse_youtube_entries(entries)
            x_pos = 0

            for i, e in enumerate(parsed_entries):
                img = Gtk.Image()

                button = Button()
                if e['big_thumb']:
                    thumbnail = '{}/video_{}.jpg'.format(tmp_dir, time())
                    download_url(e['big_thumb'], thumbnail)
                    img.set_from_file(thumbnail)
                button.add(img)
                button.connect('clicked', self._play, e['video_url'])
                self._grid.attach(button, x_pos, 0, 1, 1)

                x_pos += 1
示例#3
0
    def __init__(self, keyword=None, username=None, playlist=None, page=1):
        super(VideoListYoutube, self).__init__()

        self.get_style_context().add_class('video_list_youtube')

        start_index = page_to_index(page)
        entries = None
        self._parsed_entries = None

        if keyword:
            entries = search_youtube_by_keyword(
                keyword,
                start_index=start_index,
                parent_control=self.ParentalControl)
            logger.info('searching by keyword: ' + keyword)
        elif username:
            entries = search_youtube_by_user(
                username, parent_control=self.ParentalControl)
            logger.info('listing by username: '******'listing playlist: ' + playlist)
        else:
            entries = search_youtube_by_user(
                'KanoComputing', parent_control=self.ParentalControl)
            logger.info('listing default videos by KanoComputing')

        if entries:
            self._parsed_entries = parse_youtube_entries(entries)
        else:
            self._grid.attach(self._no_results, 0, 0, 1, 1)

        self.refresh()
示例#4
0
    def __init__(self, keyword=None, username=None, playlist=None, page=1):
        super(VideoListYoutube, self).__init__()

        self.get_style_context().add_class('video_list_youtube')

        start_index = page_to_index(page)
        entries = None
        self._parsed_entries = None

        if keyword:
            entries = search_youtube_by_keyword(
                keyword, start_index=start_index,
                parent_control=self.ParentalControl)
            logger.info('searching by keyword: ' + keyword)
        elif username:
            entries = search_youtube_by_user(
                username, parent_control=self.ParentalControl)
            logger.info('listing by username: '******'listing playlist: ' + playlist)
        else:
            entries = search_youtube_by_user(
                'KanoComputing', parent_control=self.ParentalControl)
            logger.info('listing default videos by KanoComputing')

        if entries:
            self._parsed_entries = parse_youtube_entries(entries)
        else:
            self._grid.attach(self._no_results, 0, 0, 1, 1)

        self.refresh()