cms.plugins.video.models: 37 total statements, 0.0% covered

Generated: Wed 2013-03-13 10:33 CET

Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/cms/plugins/video/models.py

Stats: 0 executed, 26 missed, 11 excluded, 13 ignored

  1. from django.db import models
  2. from django.utils.translation import ugettext_lazy as _
  3. from cms.models import CMSPlugin
  4. from cms.plugins.video import settings
  5. from os.path import basename
  6. class Video(CMSPlugin):
  7. # player settings
  8. movie = models.FileField(_('movie file'), upload_to=CMSPlugin.get_media_path, help_text=_('use .flv file or h264 encoded video file'), blank=True, null=True)
  9. movie_url = models.CharField(_('movie url'), max_length=255, help_text=_('vimeo or youtube video url. Example: http://www.youtube.com/watch?v=-iJ7bs4mTUY'), blank=True, null=True)
  10. image = models.ImageField(_('image'), upload_to=CMSPlugin.get_media_path, help_text=_('preview image file'), null=True, blank=True)
  11. width = models.PositiveSmallIntegerField(_('width'))
  12. height = models.PositiveSmallIntegerField(_('height'))
  13. auto_play = models.BooleanField(_('auto play'), default=settings.VIDEO_AUTOPLAY)
  14. auto_hide = models.BooleanField(_('auto hide'), default=settings.VIDEO_AUTOHIDE)
  15. fullscreen = models.BooleanField(_('fullscreen'), default=settings.VIDEO_FULLSCREEN)
  16. loop = models.BooleanField(_('loop'), default=settings.VIDEO_LOOP)
  17. # plugin settings
  18. bgcolor = models.CharField(_('background color'), max_length=6, default=settings.VIDEO_BG_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  19. textcolor = models.CharField(_('text color'), max_length=6, default=settings.VIDEO_TEXT_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  20. seekbarcolor = models.CharField(_('seekbar color'), max_length=6, default=settings.VIDEO_SEEKBAR_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  21. seekbarbgcolor = models.CharField(_('seekbar bg color'), max_length=6, default=settings.VIDEO_SEEKBARBG_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  22. loadingbarcolor = models.CharField(_('loadingbar color'), max_length=6, default=settings.VIDEO_LOADINGBAR_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  23. buttonoutcolor = models.CharField(_('button out color'), max_length=6, default=settings.VIDEO_BUTTON_OUT_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  24. buttonovercolor = models.CharField(_('button over color'), max_length=6, default=settings.VIDEO_BUTTON_OVER_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  25. buttonhighlightcolor = models.CharField(_('button highlight color'), max_length=6, default=settings.VIDEO_BUTTON_HIGHLIGHT_COLOR, help_text=_('Hexadecimal, eg ff00cc'))
  26. def __unicode__(self):
  27. if self.movie:
  28. name = self.movie.path
  29. else:
  30. name = self.movie_url
  31. return u"%s" % basename(name)
  32. def get_height(self):
  33. return "%s" % (self.height)
  34. def get_width(self):
  35. return "%s" % (self.width)
  36. def get_movie(self):
  37. if self.movie:
  38. return self.movie.url
  39. else:
  40. return self.movie_url