Changeset 691fe38


Ignore:
Timestamp:
26/10/2011 17:18:43 (3 years ago)
Author:
yomguy <yomguy@…>
Branches:
master, crem, crem2, dev, dev2, diadems, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, forma, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, production, release/1.4.4, sabiod, security, server, social, storage, telecaster, test, video
Children:
f315124
Parents:
149505a
git-author:
yomguy <yomguy@…> (26/10/2011 17:18:43)
git-committer:
yomguy <yomguy@…> (26/10/2011 17:18:43)
Message:

add sound() filter to item queries, add 2 iframe musical sound selections on index.html, cleanup bad prints

Location:
telemeta
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • telemeta/htdocs/js/playerLoader.js

    r2a5709c r691fe38  
    464464                        var player_url = urlNormalized(); //defined in application.js 
    465465                        var size= player.getImageSize(); 
    466                         player_url += "/player/"+size.width+"x"+size.height; 
     466                        player_url += "/player/"+size.width+2+"x"+size.height; 
    467467                        var iframeSpanW = 15; 
    468468                        var iframeSpanH = 85; 
  • telemeta/models/query.py

    r785d13a r691fe38  
    193193        return self.filter(self.by_fuzzy_collector_q(pattern)) 
    194194     
     195    def sound(self): 
     196        return self.filter(file__contains='/') 
    195197         
    196198class MediaItemManager(CoreManager): 
     
    233235    by_location.__doc__ = MediaItemQuerySet.by_location.__doc__     
    234236 
     237    def sound(self, *args, **kwargs): 
     238        return self.get_query_set().sound(*args, **kwargs) 
     239    sound.__doc__ = MediaItemQuerySet.sound.__doc__     
    235240 
    236241class MediaCollectionQuerySet(CoreQuerySet): 
  • telemeta/templates/telemeta_default/index.html

    rf9d66b0 r691fe38  
    3232 
    3333{% endblock %} 
     34 
    3435</div> 
    3536 
     
    3940</div> 
    4041 
     42<div style="margin-top: 1ex;"> 
     43<h1><img src="{% url telemeta-images "playlist_title.png" %}" alt="playlists" style="vertical-align:middle" /> 
     44    {% trans "Musical selection" %}</h1> 
     45<table><tr> 
     46{% for item in sound_items %} 
     47<td><iframe width='375' height='215' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='/items/{{item.public_id }}/player/362x130/'></iframe></td> 
     48{% endfor %} 
     49</tr> 
     50</table> 
     51</div> 
     52 
    4153</div> 
    4254{% endblock %} 
  • telemeta/web/base.py

    r86d17e9 r691fe38  
    4040import csv 
    4141import time 
     42import random 
    4243import datetime 
    4344import timeside 
     
    177178            ids = [id for id in MediaItem.objects.all().values_list('id', flat=True).order_by('?')[0:3]] 
    178179            items = MediaItem.objects.enriched().filter(pk__in=ids) 
     180             
     181            sound_items = MediaItem.objects.sound() 
     182            sound_pub_items = [] 
     183            for item in sound_items: 
     184                if get_public_access(item.public_access,  str(item.recorded_from_date).split('-')[0],  
     185                                                str(item.recorded_to_date).split('-')[0]): 
     186                    sound_pub_items.append(item) 
     187            random.shuffle(sound_pub_items) 
     188            sound_pub_items = sound_pub_items[0:2] 
     189             
    179190            revisions = get_revisions(3) 
    180191            context = RequestContext(request, { 
    181192                        'page_content': pages.get_page_content(request, 'home', ignore_slash_issue=True), 
    182                         'items': items, 'revisions': revisions}) 
     193                        'items': items, 'revisions': revisions,  'sound_items': sound_pub_items}) 
    183194            return HttpResponse(template.render(context)) 
    184195        else: 
Note: See TracChangeset for help on using the changeset viewer.