<commit_before>#!/usr/bin/env python
from buildshell import *


def player_block(songs):
    block="""<section>
    <audio id="main_player">Sorry, you need HTML 5</audio>
    <div class="player">
    	<div class="playerbuttons">
            <div class="rTable">
                <div class="rTableRow">
                    <div class="rTableCell playerbutton"><button id="bPrevSong" onclick="prevSong()"><img id="bPrevSong_img" src="SITEURLimages/prev.png" alt="Previous"></button></div>
    		        <div class="rTableCell playerbutton"><button id="bPlayPause" onclick="togglePlayPause()"><img id="bPlayPause_img" src="SITEURLimages/play.png" alt="Play"></button></div>
    		        <div class="rTableCell playerbutton"><button id="bNextSong" onclick="nextSong()"><img id="bNextSong_img" src="SITEURLimages/next.png" alt="Next"></button></div>
                </div>
            </div>
    	</div>
    </div>
    </section>"""   
    block+="""<section>
                <div class="songlist">
                    <ol id="playlist">"""
    for song in songs:
        block+=indexed_song_list_item_block(song,songs.index(song))  
    block+="""</ol>
            </div>
        </section>"""
    return block
    
def now_playing_block(songs):
    block="""<section>
    <div id="now_playing"><div class="tab_title">Now playing</div>"""
    for song in songs:
        block+=indexed_song_block(song,songs.index(song))
    block+='</div>'
    return block
    
        
        
def album_table_block(albums,columns):
    done=False
    counter=0
    block='<div class="album_table rTable">'
    while not done:
        block+='<div class="rTableRow">'
        for i in range(counter, counter+columns):
            if i<len(albums): 
                block+=album_table_item_block(albums[i])
            else:
                done=True
        block+='</div>'
        counter += columns
    block +='</div>'
    return block
       
    
def playlist_table_block(playlists,columns):
    done=False
    counter=0
    block='<div class="playlist_table rTable">'
    while not done:
        block+='<div class="rTableRow">'
        for i in range(counter, counter+columns):
            if i<len(playlists): 
                block+=playlist_table_item_block(playlists[i])
            else:
                done=True
        block+='</div>'
        counter += columns
    block +='</div>'
    return block
     
#make index page - this shows the most recent album with the option to see more
for p in playlists:
    if p.name == "showcase":
        showcase_playlist=p


with open(build_dir+'index.html','w') as templ:
    content="""<div id="player_container">
                    <div id="player_source_container">"""
    try:
        content+=playlist_block(showcase_playlist)
        content+=player_block(showcase_playlist.tracks())
        content+="""</div>
                    <div id="now_playing_container">"""
        content+=now_playing_block(showcase_playlist.tracks())
    except:
        album=album_list(True)[0]
        content+=album_block(album)     
        content+=player_block(album.tracks());
        content+="""</div>
                    <div id="now_playing_container">"""
        content+=now_playing_block(album.tracks())
    content+='</div></div>'
    templ.write(fill_in_page(bandname,content).encode('utf8')) 

#Build Explore by Album
with open(build_dir+'albums.html','w') as templ:
    content='<div class="explore_album">'
    content+='<header class="content_header">Explore by Album</header>'
    content+=album_table_block(album_list(True),5)
    content+='</div>'<commit_msg>Changed the name of the showcase playlist.<commit_after>#!/usr/bin/env python
from buildshell import *


def player_block(songs):
    block="""<section>
    <audio id="main_player">Sorry, you need HTML 5</audio>
    <div class="player">
    	<div class="playerbuttons">
            <div class="rTable">
                <div class="rTableRow">
                    <div class="rTableCell playerbutton"><button id="bPrevSong" onclick="prevSong()"><img id="bPrevSong_img" src="SITEURLimages/prev.png" alt="Previous"></button></div>
    		        <div class="rTableCell playerbutton"><button id="bPlayPause" onclick="togglePlayPause()"><img id="bPlayPause_img" src="SITEURLimages/play.png" alt="Play"></button></div>
    		        <div class="rTableCell playerbutton"><button id="bNextSong" onclick="nextSong()"><img id="bNextSong_img" src="SITEURLimages/next.png" alt="Next"></button></div>
                </div>
            </div>
    	</div>
    </div>
    </section>"""   
    block+="""<section>
                <div class="songlist">
                    <ol id="playlist">"""
    for song in songs:
        block+=indexed_song_list_item_block(song,songs.index(song))  
    block+="""</ol>
            </div>
        </section>"""
    return block
    
def now_playing_block(songs):
    block="""<section>
    <div id="now_playing"><div class="tab_title">Now playing</div>"""
    for song in songs:
        block+=indexed_song_block(song,songs.index(song))
    block+='</div>'
    return block
    
        
        
def album_table_block(albums,columns):
    done=False
    counter=0
    block='<div class="album_table rTable">'
    while not done:
        block+='<div class="rTableRow">'
        for i in range(counter, counter+columns):
            if i<len(albums): 
                block+=album_table_item_block(albums[i])
            else:
                done=True
        block+='</div>'
        counter += columns
    block +='</div>'
    return block
       
    
def playlist_table_block(playlists,columns):
    done=False
    counter=0
    block='<div class="playlist_table rTable">'
    while not done:
        block+='<div class="rTableRow">'
        for i in range(counter, counter+columns):
            if i<len(playlists): 
                block+=playlist_table_item_block(playlists[i])
            else:
                done=True
        block+='</div>'
        counter += columns
    block +='</div>'
    return block
     
#make index page - this shows the most recent album with the option to see more
for p in playlists:
    if p.name == "Showcase":
        showcase_playlist=p


with open(build_dir+'index.html','w') as templ:
    content="""<div id="player_container">
                    <div id="player_source_container">"""
    try:
        content+=playlist_block(showcase_playlist)
        content+=player_block(showcase_playlist.tracks())
        content+="""</div>
                    <div id="now_playing_container">"""
        content+=now_playing_block(showcase_playlist.tracks())
    except:
        album=album_list(True)[0]
        content+=album_block(album)     
        content+=player_block(album.tracks());
        content+="""</div>
                    <div id="now_playing_container">"""
        content+=now_playing_block(album.tracks())
    content+='</div></div>'
    templ.write(fill_in_page(bandname,content).encode('utf8')) 

#Build Explore by Album
with open(build_dir+'albums.html','w') as templ:
    content='<div class="explore_album">'
    content+='<header class="content_header">Explore by Album</header>'
    content+=album_table_block(album_list(True),5)
    content+='</div>'
{'fraction_non_alphanumeric': 0.15113871635610765, 'fraction_numerical': 0.0016563146997929607, 'mean_word_length': 2.7350515463917526, 'pattern_counts': {'":': 2, '<': 123, '<?xml version=': 0, '>': 119, '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': '4871670', 'n_tokens_mistral': 2287, 'n_tokens_neox': 2205, 'n_words': 411}