playlist_bot.py
def update_playlists(self, update_all=False):
        """ Checks all threads with playlists to see if their content should be updated """

        logging.info("Updating Playlists")

        for submission_name, playlist in self.playlists.iteritems():
            youtube_links = []
            # if the thread is still being watched
            submissions_with_name = [s for s in self.submissions if s.name == submission_name]
            if submissions_with_name or update_all:
                submission = submissions_with_name[0]
                all_comments = submission.comments
                flat_comments = flatten_tree(all_comments)

                # keep a record of yt_links in comments
                for comment in flat_comments:
                    if type(comment) != MoreComments and comment.score >= MINIMUM_COMMENT_UPVOTES:
                        links_in_comment = YOUTUBE_REGEX.findall(comment.body)
                        if links_in_comment:
                            youtube_links = youtube_links + links_in_comment

                # add new ones
                for video_id in youtube_links:
                    if video_id not in playlist.videos:
                        logging.info("Adding Video " + str(video_id) + " to Playlist - " + submission.title)
                        playlist.add_video(video_id)
 Checks all threads with playlists to see if their content should be updated 
Checks all threads with playlists to see if their content should be updated
Checks all threads with playlists to see if their content should be updated
def update_playlists(self, update_all=False):
        logging.info("Updating Playlists")
        for submission_name, playlist in self.playlists.iteritems():
            youtube_links = []
            submissions_with_name = [s for s in self.submissions if s.name == submission_name]
            if submissions_with_name or update_all:
                submission = submissions_with_name[0]
                all_comments = submission.comments
                flat_comments = flatten_tree(all_comments)
                for comment in flat_comments:
                    if type(comment) != MoreComments and comment.score >= MINIMUM_COMMENT_UPVOTES:
                        links_in_comment = YOUTUBE_REGEX.findall(comment.body)
                        if links_in_comment:
                            youtube_links = youtube_links + links_in_comment
                for video_id in youtube_links:
                    if video_id not in playlist.videos:
                        logging.info("Adding Video " + str(video_id) + " to Playlist - " + submission.title)
                        playlist.add_video(video_id)
def update_playlists ( self , update_all = False ) : logging . info ( "Updating Playlists" ) for submission_name , playlist in self . playlists . iteritems ( ) : youtube_links = [ ] submissions_with_name = [ s for s in self . submissions if s . name == submission_name ] if submissions_with_name or update_all : submission = submissions_with_name [ 0 ] all_comments = submission . comments flat_comments = flatten_tree ( all_comments ) for comment in flat_comments : if type ( comment ) != MoreComments and comment . score >= MINIMUM_COMMENT_UPVOTES : links_in_comment = YOUTUBE_REGEX . findall ( comment . body ) if links_in_comment : youtube_links = youtube_links + links_in_comment for video_id in youtube_links : if video_id not in playlist . videos : logging . info ( "Adding Video " + str ( video_id ) + " to Playlist - " + submission . title ) playlist . add_video ( video_id )
Checks all threads with playlists to see if their content should be updated
Checks all threads with playlists to see if their content should be updated
""" Checks all threads with playlists to see if their content should be updated """ # if the thread is still being watched # keep a record of yt_links in comments # add new ones
self
update_all