<commit_before>""" Models for the video application
keep track of uploaded videos and converted versions
"""
 
from django.db import models
from django.conf import settings
import sys, os, time, shutil

from convertvideo import extract_frame, convert_video, ffmpeg

from django.core.files.storage import FileSystemStorage


class VideoPosterMixin:
    """Base class for video models that adds a method
    for generating poster images
    
    Concrete class should have fields 'videofile' and 'poster'
    """
    
    def process(self):
        """The clean method will try to validate the video
        file format, optimise for streaming and generate
        the poster image"""
        
        print self.poster_path()
        self.ensure_mp4()
        

    def poster_path(self, create=True):
        """Return the path of the poster image for this
        video, if create=True, create the image if needed
        Return None if create=False and the file doesn't exist"""
        
        vidpath, ext = os.path.splitext(self.videofile.path)<commit_msg>don't convert videos in VideoPosterMixin<commit_after>""" Models for the video application
keep track of uploaded videos and converted versions
"""
 
from django.db import models
from django.conf import settings
import sys, os, time, shutil

from convertvideo import extract_frame, convert_video, ffmpeg

from django.core.files.storage import FileSystemStorage


class VideoPosterMixin:
    """Base class for video models that adds a method
    for generating poster images
    
    Concrete class should have fields 'videofile' and 'poster'
    """
    
    def process(self):
        """The clean method will try to validate the video
        file format, optimise for streaming and generate
        the poster image"""
        
        self.poster_path()
        #self.ensure_mp4()
        

    def poster_path(self, create=True):
        """Return the path of the poster image for this
        video, if create=True, create the image if needed
        Return None if create=False and the file doesn't exist"""
        
        vidpath, ext = os.path.splitext(self.videofile.path)
{'fraction_non_alphanumeric': 0.06616961789375582, 'fraction_numerical': 0.0009319664492078285, 'mean_word_length': 2.9612546125461257, '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': '2099045', 'n_tokens_mistral': 569, 'n_tokens_neox': 554, 'n_words': 234}