# Path: screenchop/urls.py
# def redirect_to_home():
# def error_page(e):
# def not_found(e):
# def registration_level():
# def google_analytics_account():
# def debug_enabled():
# ADMINS = config.EXCEPTION_EMAIL 
# 
# Path: scripts/add_invite_code.py
# def generate_invite():
#     # Generate UUID.hex to use as filename
#     uid = uuid.uuid4()
#     generate_unique = uid.hex
# 
#     code = Invite_code(code=generate_unique)
# 
#     code.save()
#     
#     print 'Invite code: %s' % generate_unique
# 
# Path: scripts/tag_freq.py
# def tag_frequencies():
#     ''' Finds frequently used tags in Posts and sorts them into tuples. '''
#     
#     tag_freqs = Post.objects.item_frequencies('tags', normalize=False)
#     top_tags = sorted(tag_freqs.items(), key=itemgetter(1), reverse=True)[:30]
#     
#     # Print output and save results into Tag_freq collection
#     for tag, freq in top_tags:
#         print tag, int(freq)
#         a, created = Tag_freq.objects.get_or_create(tag=tag)
#         Tag_freq.objects(tag=tag).update_one(set__freq=int(freq))


from flaskext.script import Manager
from screenchop import urls
from scripts.add_invite_code import generate_invite
from scripts.tag_freq import tag_frequencies
#!/usr/bin/env python



manager = Manager(urls.app)

@manager.command
def invite_code():
    "Generates an invitation code"
    generate_invite()

@manager.command
def tag_freq():

# Path: screenchop/urls.py
# def redirect_to_home():
# def error_page(e):
# def not_found(e):
# def registration_level():
# def google_analytics_account():
# def debug_enabled():
# ADMINS = config.EXCEPTION_EMAIL 
# 
# Path: scripts/add_invite_code.py
# def generate_invite():
#     # Generate UUID.hex to use as filename
#     uid = uuid.uuid4()
#     generate_unique = uid.hex
# 
#     code = Invite_code(code=generate_unique)
# 
#     code.save()
#     
#     print 'Invite code: %s' % generate_unique
# 
# Path: scripts/tag_freq.py
# def tag_frequencies():
#     ''' Finds frequently used tags in Posts and sorts them into tuples. '''
#     
#     tag_freqs = Post.objects.item_frequencies('tags', normalize=False)
#     top_tags = sorted(tag_freqs.items(), key=itemgetter(1), reverse=True)[:30]
#     
#     # Print output and save results into Tag_freq collection
#     for tag, freq in top_tags:
#         print tag, int(freq)
#         a, created = Tag_freq.objects.get_or_create(tag=tag)
#         Tag_freq.objects(tag=tag).update_one(set__freq=int(freq))


# Path: manage.py
from flaskext.script import Manager
from screenchop import urls
from scripts.add_invite_code import generate_invite
from scripts.tag_freq import tag_frequencies

#!/usr/bin/env python



manager = Manager(urls.app)

@manager.command
def invite_code():
    "Generates an invitation code"
    generate_invite()

@manager.command
def tag_freq():

    "Updates tag_freq collection with updated tag cloud"