<commit_before>'''
Created on 14 nov. 2017

@author: roland
'''

class PlaylistGenerator(object):
    '''
    classdocs
    '''


    def __init__(self, show):
        '''
        Constructor
        '''
        self.show = show
        
    def generate(self):
        pass<commit_msg>added rest request to db<commit_after>import lxml
import requests

'''
Created on 14 nov. 2017

@author: roland
'''

class PlaylistGenerator(object):
    '''
    classdocs
    '''


    def __init__(self, show):
        '''
        Constructor
        '''
        self.show = show
        
    def generate(self):
        
        episodes = self.collect_episodes()
        for episode in episodes:
            pass
    
    def collect_episodes(self):
        
        payload = {
            'where': '{"title":"%s"}' % self.show
        }
        return requests.get('http://localhost:5001/episodes', params=payload).json()['_items']
        
{'fraction_non_alphanumeric': 0.12567132116004295, 'fraction_numerical': 0.017185821697099892, 'mean_word_length': 1.8328267477203648, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6061850', 'n_tokens_mistral': 288, 'n_tokens_neox': 269, 'n_words': 61}