예제 #1
0
def get_item_informations(item_id, configuration):
    # Get item
    item = query(Items).get(item_id = item_id)
    
    js_files = set()
    css_files = set()
    ext_js_files = set()
    ext_css_files = set()
    
    informations = {'item': {'artist': str(item.item_artist),
                             'song': str(item.item_song)},
                    'remaining_time': 0,
                    'sequence': []
                    }
    
    # TODO according to configuration, add sequence
    for youtube_item in query(YoutubeItems).filter(youtube_item_id = item_id):
        informations['sequence'].append({'type': 'youtube',
                                         'videoId': str(youtube_item.youtube_item_youtube_id),
                                         'autoplay': '1',
                                         'start': youtube_item.youtube_item_start,
                                         'end': youtube_item.youtube_item_end,
                                         'showinfo': '0',
                                         'rel': '0',
                                         'modestbranding': '1',
                                         'iv_load_policy': '3',
                                         'controls': '0',
                                         'enablejsapi': '1'})
        informations['remaining_time'] += youtube_item.youtube_item_end - youtube_item.youtube_item_start
        js_files.add('youtube.js')
        ext_js_files.add('https://www.youtube.com/player_api')
        
    return (informations, js_files, css_files, ext_js_files, ext_css_files)
    
예제 #2
0
def common(request):
    return {'favicon': 'img/favicon.png',
            'js_files': {'static': ['jquery-1.11.3.min.js',
                                    'bootstrap.min.js'],
                         'external': []
                         },
            'css_files': {'static': ['bootstrap.min.css',
                                     'bootstrap.min.css.map',
                                     'main.css'],
                          'external': []
                          },
            'footer': {'songs_count': query(Items).count(),
                       'last_update': date.today()}}