Ejemplo n.º 1
0
 def clean_auxiliarry_files(self):
     if self.finished_encoding:
         video_dir = os.path.abspath(os.path.dirname(self.encoded_video.path))
         enc_logfile = get_setting('encoding_log_file')
         if enc_logfile:
             try:
                 os.remove(os.path.join(video_dir, enc_logfile))
             except:
                 pass
     if self.has_thumbnails():
         thumbnail_dir = os.path.join(video_dir, get_setting('thumbnail_dir'))
         thumbnail_logfile = get_setting('thumbnail_log_file')
         if thumbnail_logfile:
             try:
                 os.remove(os.path.join(thumbnail_dir, thumbnail_logfile))
             except:
                 pass
Ejemplo n.º 2
0
 def clean_auxiliarry_files(self):
     if self.finished_encoding:
         video_dir = os.path.abspath(
             os.path.dirname(self.encoded_video.path))
         enc_logfile = get_setting('encoding_log_file')
         if enc_logfile:
             try:
                 os.remove(os.path.join(video_dir, enc_logfile))
             except:
                 pass
     if self.has_thumbnails():
         thumbnail_dir = os.path.join(video_dir,
                                      get_setting('thumbnail_dir'))
         thumbnail_logfile = get_setting('thumbnail_log_file')
         if thumbnail_logfile:
             try:
                 os.remove(os.path.join(thumbnail_dir, thumbnail_logfile))
             except:
                 pass
Ejemplo n.º 3
0
import time
import django.conf
import re

from django.db import models
from datetime import timedelta
from video.timedeltafield import TimedeltaField
from video.config import get_setting, get_video_dir, get_thumbnail_setting
from video.fields import DynamicUploadFileField
from video.video_dispatcher import install_dispatcher
from video.signals import pre_upload, post_upload
from PIL import Image
from distutils.dir_util import remove_tree


TEMP_VIDEO_DIR = get_setting('temp_video_dir')

class ThumbnailManager(models.Manager):
    def ordered_by_time(self):
        return self.get_query_set().order_by('position')

class Thumbnail(models.Model):
    image = models.ImageField(null=False, upload_to=TEMP_VIDEO_DIR)
    video = models.ForeignKey('Video', related_name='thumbnails')
    position = TimedeltaField(null=False)
    _width = models.IntegerField(default=-1)
    _height = models.IntegerField(default=-1)

    objects = ThumbnailManager()

    def get_upload_to(self, attname):
Ejemplo n.º 4
0
import os
import time
import django.conf
import re

from django.db import models
from datetime import timedelta
from video.timedeltafield import TimedeltaField
from video.config import get_setting, get_video_dir, get_thumbnail_setting
from video.fields import DynamicUploadFileField
from video.video_dispatcher import install_dispatcher
from video.signals import pre_upload, post_upload
from PIL import Image
from distutils.dir_util import remove_tree

TEMP_VIDEO_DIR = get_setting('temp_video_dir')


class ThumbnailManager(models.Manager):
    def ordered_by_time(self):
        return self.get_query_set().order_by('position')


class Thumbnail(models.Model):
    image = models.ImageField(null=False, upload_to=TEMP_VIDEO_DIR)
    video = models.ForeignKey('Video', related_name='thumbnails')
    position = TimedeltaField(null=False)
    _width = models.IntegerField(default=-1)
    _height = models.IntegerField(default=-1)

    objects = ThumbnailManager()