<commit_before>'''
Created on May 31, 2013

@author: teddydestodes
'''

from rfk.database.base import Permission, Setting, User
import rfk.database


def setup_settings():
    settings = []
    settings.append(Setting.add_setting('use_icy', 'Use ICY-Tags for unplanned Shows', Setting.TYPES.INT))
    settings.append(Setting.add_setting('show_def_name', 'Default Name for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_desc', 'Default Description for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_tags', 'Default Tags for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_logo', 'Default Logo for Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('locale', 'Locale', Setting.TYPES.STR))
    settings.append(Setting.add_setting('timezone', 'Timezone', Setting.TYPES.STR))
    for setting in settings:
        rfk.database.session.add(setting)
    rfk.database.session.commit() 

def setup_permissions():
    permissions = []
    permissions.append(Permission.add_permission('manage-liquidsoap', 'Manage Liquidsoap'))
    permissions.append(Permission.add_permission('manage-relays', 'Manage Relays'))
    permissions.append(Permission.add_permission('admin', 'Admin'))
    for permission in permissions:
        rfk.database.session.add(permission)
    rfk.database.session.commit()
    
def setup_default_user(username, password):
    users = []
    users.append(User.add_user(username, password))
    for user in users:
        rfk.database.session.add(user)
        user.add_permission(code='manage-liquidsoap')
        user.add_permission(code='manage-relays')
        user.add_permission(code='admin')
        print "[users] Added %s" % user.username
    rfk.database.session.commit()<commit_msg>added overall listeners to install<commit_after>'''
Created on May 31, 2013

@author: teddydestodes
'''

from rfk.database.base import Permission, Setting, User
import rfk.database


def setup_settings():
    settings = []
    settings.append(Setting.add_setting('use_icy', 'Use ICY-Tags for unplanned Shows', Setting.TYPES.INT))
    settings.append(Setting.add_setting('show_def_name', 'Default Name for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_desc', 'Default Description for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_tags', 'Default Tags for new Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('show_def_logo', 'Default Logo for Shows', Setting.TYPES.STR))
    settings.append(Setting.add_setting('locale', 'Locale', Setting.TYPES.STR))
    settings.append(Setting.add_setting('timezone', 'Timezone', Setting.TYPES.STR))
    for setting in settings:
        rfk.database.session.add(setting)
    rfk.database.session.commit() 

def setup_permissions():
    permissions = []
    permissions.append(Permission.add_permission('manage-liquidsoap', 'Manage Liquidsoap'))
    permissions.append(Permission.add_permission('manage-relays', 'Manage Relays'))
    permissions.append(Permission.add_permission('admin', 'Admin'))
    for permission in permissions:
        rfk.database.session.add(permission)
    rfk.database.session.commit()
    
def setup_default_user(username, password):
    users = []
    users.append(User.add_user(username, password))
    for user in users:
        rfk.database.session.add(user)
        user.add_permission(code='manage-liquidsoap')
        user.add_permission(code='manage-relays')
        user.add_permission(code='admin')
        print "[users] Added %s" % user.username
    rfk.database.session.commit()
    
def setup_statistics():
    stat = rfk.database.stats.Statistic(name="Overall Listener", identifier="lst-total")
    rfk.database.session.add(stat)
    rfk.database.session.commit()
{'fraction_non_alphanumeric': 0.13012987012987012, 'fraction_numerical': 0.003116883116883117, 'mean_word_length': 4.621897810218978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1310917', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1166, 'n_words': 215}