<commit_before>#
# This file is part of my.gpodder.org.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# my.gpodder.org is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
#

import sys
from itertools import islice
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.views.decorators.cache import cache_page
from django.contrib.auth.models import User
from django.template import RequestContext
from mygpo.core import models
from mygpo.directory import tags
from mygpo.directory.toplist import PodcastToplist
from mygpo.users.models import Rating, Suggestions, History, HistoryEntry
from mygpo.api.models import Podcast, Episode, Device, EpisodeAction, UserProfile
from mygpo.users.models import PodcastUserState
from mygpo.decorators import manual_gc
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render_to_response
from datetime import datetime, timedelta
from django.contrib.sites.models import RequestSite
from mygpo.web import utils
from mygpo.api import backend
from mygpo.utils import flatten, parse_range
from mygpo import migrate
import os
import Image
import ImageDraw
import StringIO


def home(request):
    if request.user.is_authenticated():
        return dashboard(request)
    else:
        return welcome(request)


@manual_gc
def welcome(request, toplist_entries=10):
    current_site = RequestSite(request)
    podcasts = Podcast.objects.count()
    users = User.objects.filter(is_active=True).count()
    episodes = Episode.objects.count()

    try:
        lang = utils.process_lang_params(request, '/toplist/')
    except utils.UpdatedException, updated:
        lang = []<commit_msg>count episodes from CouchDB data in home view<commit_after>#
# This file is part of my.gpodder.org.
#
# my.gpodder.org is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# my.gpodder.org is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
#

import sys
from itertools import islice
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.views.decorators.cache import cache_page
from django.contrib.auth.models import User
from django.template import RequestContext
from mygpo.core import models
from mygpo.directory import tags
from mygpo.directory.toplist import PodcastToplist
from mygpo.users.models import Rating, Suggestions, History, HistoryEntry
from mygpo.api.models import Podcast, Episode, Device, EpisodeAction, UserProfile
from mygpo.users.models import PodcastUserState
from mygpo.decorators import manual_gc
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render_to_response
from datetime import datetime, timedelta
from django.contrib.sites.models import RequestSite
from mygpo.web import utils
from mygpo.api import backend
from mygpo.utils import flatten, parse_range
from mygpo import migrate
import os
import Image
import ImageDraw
import StringIO


def home(request):
    if request.user.is_authenticated():
        return dashboard(request)
    else:
        return welcome(request)


@manual_gc
def welcome(request, toplist_entries=10):
    current_site = RequestSite(request)
    podcasts = Podcast.objects.count()
    users = User.objects.filter(is_active=True).count()
    episodes = models.Episode.count()

    try:
        lang = utils.process_lang_params(request, '/toplist/')
    except utils.UpdatedException, updated:
        lang = []
{'fraction_non_alphanumeric': 0.06458557588805167, 'fraction_numerical': 0.0038751345532831, 'mean_word_length': 4.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '92929', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1270, 'n_words': 495}