Example #1
0
class RpcTest(TestCase):
    def setUp(self):
        self.rpc = VideosApiClass()
        self.user = UserFactory(is_superuser=True)
        self.video = VideoFactory()

    def test_change_title_video(self):
        title = u'New title'
        rv = self.rpc.change_title_video(self.video.pk, title, self.user)
        if isinstance(rv, Error):
            raise AssertionError('RPC error: %s' % rv)

        video = Video.objects.get(pk=self.video.pk)
        self.assertEqual(video.title, title)
        try:
            Action.objects.get(video=self.video,
                               new_video_title=title,
                               action_type=Action.CHANGE_TITLE)
        except Action.DoesNotExist:
            self.fail()
Example #2
0
from utils.objectlist import object_list
from utils.rpc import RpcRouter
from utils.pagination import AmaraPaginator
from utils.text import fmt
from utils.translation import (get_user_languages_from_request,
                               get_language_label)

from teams.permissions import can_edit_video, can_add_version, can_resync
from . import video_size
import teams.permissions

VIDEO_IN_ROW = 6
ACTIVITY_PER_PAGE = 8

rpc_router = RpcRouter('videos:rpc_router', {
    'VideosApi': VideosApiClass()
})


# .e.g json, nor include aliases
AVAILABLE_SUBTITLE_FORMATS_FOR_DISPLAY = [
    'dfxp',  'sbv', 'srt', 'ssa', 'txt', 'vtt',
]

LanguageListItem = namedtuple("LanguageListItem", "name status tags url code")

class LanguageList(object):
    """List of languages for the video pages."""

    def __init__(self, video):
        original_languages = []
Example #3
0
from utils import send_templated_email
from django.contrib.auth import logout
from videos.share_utils import _add_share_panel_context_for_video, _add_share_panel_context_for_history
from gdata.service import RequestError
from django.db.models import Sum, Q, F
from django.utils.translation import ugettext
from statistic.models import EmailShareStatistic
import urllib, urllib2
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from videos.rpc import VideosApiClass
from utils.rpc import RpcRouter
from django.utils.http import urlquote_plus

rpc_router = RpcRouter('videos:rpc_router', {'VideosApi': VideosApiClass()})


def index(request):
    context = widget.add_onsite_js_files({})
    context['all_videos'] = Video.objects.count()
    return render_to_response('index.html',
                              context,
                              context_instance=RequestContext(request))


def bug(request):
    from widget.rpc import add_general_settings
    context = widget.add_config_based_js_files({}, settings.JS_API,
                                               'mirosubs-api.js')
    context['all_videos'] = Video.objects.count()
Example #4
0
 def setUp(self):
     self.rpc = VideosApiClass()
     self.user = UserFactory(is_superuser=True)
     self.video = VideoFactory()