Esempio n. 1
0
def release_description(Name):
    str = ""
    release = ReleaseInfo(name=Name)

    name = release.get_name()
    artist = ArtistInfo(uri=release.get_artist())
    tracks = release.get_tracks()
    cover = release.get_cover()

    str += """<table border="10" id="titletab"><tr id="row1">"""
    str += """<td rowspan="2" id="imagetd"> <img src="%s"/> </td>""" % (cover)
    str += """<td id="song_td"><div id="song_title">%s</div></td></tr>""" % name
    str += (
        """<tr id="row2"><td id="song_artist"><div id="song_artist">by <a href="artist.py?artist=%s">%s</a></div></td></tr>"""
        % (artist.get_name(), artist.get_name())
    )
    str += """<tr id="row3"><td class="section">Tracks</td><td class="element"></td></tr>"""
    pair = False
    for track in tracks:
        pair = not pair
        if pair:
            str += """<tr id="row_even"><td class="section"></td><td class="element">%s</td></tr>""" % (
                TrackInfo(uri=track).get_name()
            )
        else:
            str += """<tr id="row_odd"><td class="section"></td><td class="element">%s</td></tr>""" % (
                TrackInfo(uri=track).get_name()
            )
    str += """</table>"""
    return str
Esempio n. 2
0
def song_description(name):
    str = ""
    pathu = ""
    audio = audio_info.FileInfo(name)
    pathsss = audio.filepath.split("/")[1:]
    for el in pathsss:
        pathu = "%s/%s" % (pathu, el)
    title = audio.localData.title
    artist = sparql_queries.get_artist(audio.uri)
    track = TrackInfo(name=title)
    release = ReleaseInfo(uri=track.get_release())
    release = release.get_name()
    str += """<table border="10" id="titletab"><tr id="row1">"""
    str += """<td rowspan="2" id="imagetd"> <img src="images/audio-volume-high.png"/> </td>"""
    str += """<td id="song_td"><div id="song_title">%s</div></td></tr>""" % title
    str += (
        """<tr id="row2"><td id="song_artist"><div id="song_artist">in <a href="release.py?release=%s">%s</a> by <a href="artist.py?artist=%s">%s</a></div></td></tr>"""
        % (release, release, artist, artist)
    )
    #  str += """<tr id="row3"><td class="section">Releases</td><td class="element"></td></tr>"""
    #  pair = False
    #  for release in releases:
    #    link = "release.py?release=%s"%release.get_name()
    #    pair = not pair
    #    if pair:
    #      str += """<tr id="row_even"><td class="section"></td><td class="element"><a href="%s">%s</a></td></tr>"""%(link,release.get_name())
    #    else:
    #      str += """<tr id="row_odd"><td class="section"></td><td class="element"><a href="%s">%s</a></td></tr>"""%(link,release.get_name())
    str += """<tr><td id="foot_cell"></td> <td class="element"><audio src="%s" preload="auto" /></td></tr>""" % (
        pathu
    )  # audio.path
    str += """</table>"""
    return str