playlists/views.py
def iter_playlist_events_for_view(query):
    """Iterate a query of playlist event objects.

    returns a generator to produce PlaylistEventView() objects
    which contain some extra attributes for the view.
    """
    first_break = False
    events = list(query)
    last_track = memcache.get('playlist.last_track')

    if last_track:
        do_insert = False
        if len(events) and not type(events[0]) is PlaylistBreak:
            do_insert = str(last_track['key']) != str(events[0].key())
            if do_insert:
                log.info('Inserting cached event. %r != %r' %
                         (str(last_track['key']), str(events[0].key())))
        if not len(events) or do_insert:
            # Prepend the last track from cache.
            # Due to HRD lag, it may not be in the result set yet.
            events.insert(0, CachedPlaylistEvent(last_track))
    else:
        log.info('playlist.last_track was not in memcache')

    for playlist_event in events:
        pl_view = PlaylistEventView(playlist_event)
        if pl_view.is_break:
            first_break = True
        if not first_break:
            pl_view.is_new = True
        yield pl_view
Iterate a query of playlist event objects.

    returns a generator to produce PlaylistEventView() objects
    which contain some extra attributes for the view.
    
Iterate a query of playlist event objects.
returns a generator to produce PlaylistEventView() objects
which contain some extra attributes for the view.
Iterate a query of playlist event objects . returns a generator to produce PlaylistEventView () objects which contain some extra attributes for the view .
def iter_playlist_events_for_view(query):
    first_break = False
    events = list(query)
    last_track = memcache.get('playlist.last_track')
    if last_track:
        do_insert = False
        if len(events) and not type(events[0]) is PlaylistBreak:
            do_insert = str(last_track['key']) != str(events[0].key())
            if do_insert:
                log.info('Inserting cached event. %r != %r' %
                         (str(last_track['key']), str(events[0].key())))
        if not len(events) or do_insert:
            events.insert(0, CachedPlaylistEvent(last_track))
    else:
        log.info('playlist.last_track was not in memcache')
    for playlist_event in events:
        pl_view = PlaylistEventView(playlist_event)
        if pl_view.is_break:
            first_break = True
        if not first_break:
            pl_view.is_new = True
        yield pl_view
def iter_playlist_events_for_view ( query ) : first_break = False events = list ( query ) last_track = memcache . get ( 'playlist.last_track' ) if last_track : do_insert = False if len ( events ) and not type ( events [ 0 ] ) is PlaylistBreak : do_insert = str ( last_track [ 'key' ] ) != str ( events [ 0 ] . key ( ) ) if do_insert : log . info ( 'Inserting cached event. %r != %r' % ( str ( last_track [ 'key' ] ) , str ( events [ 0 ] . key ( ) ) ) ) if not len ( events ) or do_insert : events . insert ( 0 , CachedPlaylistEvent ( last_track ) ) else : log . info ( 'playlist.last_track was not in memcache' ) for playlist_event in events : pl_view = PlaylistEventView ( playlist_event ) if pl_view . is_break : first_break = True if not first_break : pl_view . is_new = True yield pl_view
Iterate a query of playlist event objects.
Iterate a query of playlist event objects .
"""Iterate a query of playlist event objects.

    returns a generator to produce PlaylistEventView() objects
    which contain some extra attributes for the view.
    """ # Prepend the last track from cache. # Due to HRD lag, it may not be in the result set yet.
query