コード例 #1
0
ファイル: streamer.py プロジェクト: nikhilm/muzicast
 def get_track(self, id):
     """
     Get track meta-data given a track ID.
     Returns {} in case of failure
     """
     try:
         track = Track.get(id)
         return track
     except sqlobject.main.SQLObjectNotFound:
         return None
コード例 #2
0
ファイル: track.py プロジェクト: nikhilm/muzicast
def index(id):
    try:
        track = Track.get(id)
        stats = list(TrackStatistics.select(TrackStatistics.q.track == track.id))
        if len(stats) > 0:
        	stats = stats[0]
        else:
        	stats = None

        url = request.environ['HTTP_HOST']
        pos = url.rfind(':' + request.environ['SERVER_PORT'])
        if pos != -1:
            url = url[:pos]
        # otherwise the host is just the host without a port,
        # which is just what we want
        return render_master_page("track.html", title='Muzicast: Track', track=track, url=url, port=STREAM_PORT, stats=stats)
    except SQLObjectNotFound:
        abort(404)
コード例 #3
0
ファイル: playlist.py プロジェクト: nikhilm/muzicast
def playlist_entries():
    if 'playlist' not in session:
        return []
    return (Track.get(id) for id in session['playlist'])