<commit_before># -*- coding: utf-8 -*-
__license__ = "GNU General Public License, Ver.3"
__author__ = "<NAME>"

import logging
from datetime import datetime

from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.template import RequestContext
from django.template.loader import render_to_string

from rstr.user import LoginForm
from rstr.config import Config
from rstr.common import ErrorClear
from rstr.models import video
from rstr.mainviewer import MainViewer

class StreamingView():
    def __init__(self, request):
        logging.basicConfig(filename='/var/log/rstreaming.log',level=logging.DEBUG)
        messages.set_level(request, messages.INFO)
        if request.session.get('isConfig', False) is False:
            request.session.set_expiry(600)
            data = Config(request.session).getSessionData()
            request.session.update(data)
            request.session['isConfig'] = True
        leftBlocks = []
        if not request.session['user'].is_authenticated():
            leftBlocks = [render_to_string('rstr/section.html', {'title' : 'login', 'content': render_to_string('rstr/form.html', {'form' : LoginForm(), 'action' : request.session['base_url'] + '/login'}, context_instance=RequestContext(request))})]
        self.render = MainViewer(request).render(leftBlocks, [], [])

    def getRender(self):
        return self.render

class VideosView():
    LIST = 0
    VIEW = 1
    DELETE = 2
    def __init__(self, request, action=0, key=None):
        logging.basicConfig(filename='/var/log/rstreaming.log',level=logging.DEBUG)
        messages.set_level(request, messages.INFO)
        if request.session.get('isConfig', False) is False:
            request.session.set_expiry(600)
            data = Config(request.session).getSessionData()
            request.session.update(data)
            request.session['isConfig'] = True
        leftBlocks = []
        if not request.session['user'].is_authenticated():
            leftBlocks = [render_to_string('rstr/section.html', {'title' : 'login', 'content': render_to_string('rstr/form.html', {'form' : LoginForm(), 'action' : request.session['base_url'] + '/login'}, context_instance=RequestContext(request))})]

        centerBlocks = []
        if action == self.LIST:
            try:
                videoList = video.objects.all()
                centerBlocks = [render_to_string('rstr/section.html', {'title' : 'Lista de videos', 'content': render_to_string('rstr/videoList.html', {'videos' : videoList, 'session' : request.session}).encode('utf-8')})]
            except video.DoesNotExist:
                pass
        elif action == self.VIEW:
            if key is not None:
                try:
                    v = video.objects.get(idVideo=key)
                    media = request.session['base_url'] + '/media/'
                    bfile = media + v.path[v.path.rfind('/')+1:v.path.rfind('.')]
                    src = {'ogv' : bfile + '.ogv', 'mp4' : bfile + '.mp4', 'webm' : bfile + '.webm', 'flash' : request.session['base_url'] + '/static/flowplayer/flowplayer-3.2.5.swf'}
                    centerBlocks = [render_to_string('rstr/section.html', {'title' : v.name, 'content': render_to_string('rstr/video.html', {'controls' : True, 'src' : src})})]
                except video.DoesNotExist:
                    pass
        elif action == self.DELETE:
            pass

        # Ultimos subidos, ultimos usuarios que han subido, usuarios que mas han subido, ...
        rightBlocks = []
<commit_msg>Se incluye la seccion Mis videos en la columna izquierda de videos cuando el usuario esta logueado<commit_after># -*- coding: utf-8 -*-
__license__ = "GNU General Public License, Ver.3"
__author__ = "<NAME>"

import logging
from datetime import datetime

from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.template import RequestContext
from django.template.loader import render_to_string

from rstr.user import LoginForm
from rstr.config import Config
from rstr.common import ErrorClear
from rstr.models import video
from rstr.mainviewer import MainViewer

class StreamingView():
    def __init__(self, request):
        logging.basicConfig(filename='/var/log/rstreaming.log',level=logging.DEBUG)
        messages.set_level(request, messages.INFO)
        if request.session.get('isConfig', False) is False:
            request.session.set_expiry(600)
            data = Config(request.session).getSessionData()
            request.session.update(data)
            request.session['isConfig'] = True
        leftBlocks = []
        if not request.session['user'].is_authenticated():
            leftBlocks = [render_to_string('rstr/section.html', {'title' : 'login', 'content': render_to_string('rstr/form.html', {'form' : LoginForm(), 'action' : request.session['base_url'] + '/login'}, context_instance=RequestContext(request))})]
        self.render = MainViewer(request).render(leftBlocks, [], [])

    def getRender(self):
        return self.render

class VideosView():
    LIST = 0
    VIEW = 1
    DELETE = 2
    def __init__(self, request, action=0, key=None):
        logging.basicConfig(filename='/var/log/rstreaming.log',level=logging.DEBUG)
        messages.set_level(request, messages.INFO)
        if request.session.get('isConfig', False) is False:
            request.session.set_expiry(600)
            data = Config(request.session).getSessionData()
            request.session.update(data)
            request.session['isConfig'] = True
        leftBlocks = []
        if not request.session['user'].is_authenticated():
            leftBlocks = [render_to_string('rstr/section.html', {'title' : 'login', 'content': render_to_string('rstr/form.html', {'form' : LoginForm(), 'action' : request.session['base_url'] + '/login'}, context_instance=RequestContext(request))})]
        else:
            try:
                myVideos = video.objects.filter(owner = request.session['user'])
                leftBlocks = [render_to_string('rstr/section.html', {'title' : 'Mis vídeos', 'content' : render_to_string('rstr/myVideo.html', {'videos' : myVideos, 'session' : request.session}).encode('utf-8')})]
            except video.DoesNotExist:
                pass

        centerBlocks = []
        if action == self.LIST:
            try:
                videoList = video.objects.all()
                centerBlocks = [render_to_string('rstr/section.html', {'title' : 'Lista de videos', 'content': render_to_string('rstr/videoList.html', {'videos' : videoList, 'session' : request.session}).encode('utf-8')})]
            except video.DoesNotExist:
                pass
        elif action == self.VIEW:
            if key is not None:
                try:
                    v = video.objects.get(idVideo=key)
                    media = request.session['base_url'] + '/media/'
                    bfile = media + v.path[v.path.rfind('/')+1:v.path.rfind('.')]
                    src = {'ogv' : bfile + '.ogv', 'mp4' : bfile + '.mp4', 'webm' : bfile + '.webm', 'flash' : request.session['base_url'] + '/static/flowplayer/flowplayer-3.2.5.swf'}
                    centerBlocks = [render_to_string('rstr/section.html', {'title' : v.name, 'content': render_to_string('rstr/video.html', {'controls' : True, 'src' : src})})]
                except video.DoesNotExist:
                    pass
        elif action == self.DELETE:
            pass

        # Ultimos subidos, ultimos usuarios que han subido, usuarios que mas han subido, ...
        rightBlocks = []

{'fraction_non_alphanumeric': 0.1366906474820144, 'fraction_numerical': 0.005101373446697188, 'mean_word_length': 2.7888999008919724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7226596', 'n_tokens_mistral': 2249, 'n_tokens_neox': 2180, 'n_words': 483}