# Path: dj/main/titlecase.py
# def titlecase(text):
#     """
#     Titlecases input text
# 
#     This filter changes all words to Title Caps, and attempts to be clever
#     about *un*capitalizing SMALL words like a/an/the in the input.
# 
#     The list of "SMALL words" which are not capped comes from
#     the New York Times Manual of Style, plus 'vs' and 'v'.
# 
#     """
# 
#     words = re.split('\s', text)
#     line = []
#     for word in words:
#         if word.startswith('#') or \
#                 INLINE_PERIOD.search(word) or \
#                 UC_ELSEWHERE.match(word):
#             line.append(word)
#             continue
#         if SMALL_WORDS.match(word):
#             line.append(word.lower())
#             continue
#         line.append(CAPFIRST.sub(lambda m: m.group(0).upper(), word))
# 
#     line = " ".join(line)
# 
#     line = SMALL_FIRST.sub(lambda m: '%s%s' % (
#         m.group(1),
#         m.group(2).capitalize()
#     ), line)
# 
#     line = SMALL_LAST.sub(lambda m: m.group(0).capitalize(), line)
# 
#     line = SUBPHRASE.sub(lambda m: '%s%s' % (
#         m.group(1),
#         m.group(2).capitalize()
#     ), line)
# 
#     return line


import os
import socket
import datetime
import random
import re
from django import forms
from django import urls
from django.db import models
from django.db.models.signals import pre_save
from .unique_slugify import unique_slugify
from .titlecase import titlecase
from functools import reduce

    def get_minutes(self):
        ct = self.cuts_time()
        if ct is None:
            # if there are no cuts, use scheduled time
            delta = self.end - self.start
            minutes = delta.days*60*24 + delta.seconds/60.0
        else:
            # use amount of video time
            minutes = self.cuts_time()/60

        return int(minutes)

    def add_email(self, email):
        if self.emails is None: emails=[]
        else: emails = self.emails.split(',')
        if email not in emails:
            if self.emails:
                emails.append(email)
                self.emails = ','.join(emails)
            else:
                self.emails = email
            self.save()

    def get_authors(self):
        authors = self.authors.split(',') if self.authors else []
        return authors

    @property
    def titlecase(self):

# Path: dj/main/titlecase.py
# def titlecase(text):
#     """
#     Titlecases input text
# 
#     This filter changes all words to Title Caps, and attempts to be clever
#     about *un*capitalizing SMALL words like a/an/the in the input.
# 
#     The list of "SMALL words" which are not capped comes from
#     the New York Times Manual of Style, plus 'vs' and 'v'.
# 
#     """
# 
#     words = re.split('\s', text)
#     line = []
#     for word in words:
#         if word.startswith('#') or \
#                 INLINE_PERIOD.search(word) or \
#                 UC_ELSEWHERE.match(word):
#             line.append(word)
#             continue
#         if SMALL_WORDS.match(word):
#             line.append(word.lower())
#             continue
#         line.append(CAPFIRST.sub(lambda m: m.group(0).upper(), word))
# 
#     line = " ".join(line)
# 
#     line = SMALL_FIRST.sub(lambda m: '%s%s' % (
#         m.group(1),
#         m.group(2).capitalize()
#     ), line)
# 
#     line = SMALL_LAST.sub(lambda m: m.group(0).capitalize(), line)
# 
#     line = SUBPHRASE.sub(lambda m: '%s%s' % (
#         m.group(1),
#         m.group(2).capitalize()
#     ), line)
# 
#     return line


# Path: dj/main/models.py
import os
import socket
import datetime
import random
import re
from django import forms
from django import urls
from django.db import models
from django.db.models.signals import pre_save
from .unique_slugify import unique_slugify
from .titlecase import titlecase
from functools import reduce


    def get_minutes(self):
        ct = self.cuts_time()
        if ct is None:
            # if there are no cuts, use scheduled time
            delta = self.end - self.start
            minutes = delta.days*60*24 + delta.seconds/60.0
        else:
            # use amount of video time
            minutes = self.cuts_time()/60

        return int(minutes)

    def add_email(self, email):
        if self.emails is None: emails=[]
        else: emails = self.emails.split(',')
        if email not in emails:
            if self.emails:
                emails.append(email)
                self.emails = ','.join(emails)
            else:
                self.emails = email
            self.save()

    def get_authors(self):
        authors = self.authors.split(',') if self.authors else []
        return authors

    @property
    def titlecase(self):

        return titlecase(self.name)