def play(request, signed_audiobook_id, format_): try: audiobook_id = Signer().unsign(signed_audiobook_id) except BadSignature: return HttpResponseForbidden() audiobook = get_object_or_404(AudioBook, pk=audiobook_id) if format_ == 'rss': return render(request, 'audiobooks/rss.xml', { 'audiobook': audiobook, }, content_type='application/rss+xml') if format_ == 'xspf': filename = '%s.xspf' % slugify('%s %s' % ( audiobook.title, audiobook.author.long_name(), )) return render_playlist(request, audiobook.get_tracks(), filename) raise NotImplementedError()
def play_music_file(request, music_file_id): music_file = get_object_or_404(MusicFile, pk=music_file_id) return render_playlist(request, [music_file])
def play_cd(request, album_id, cd_id): album = get_object_or_404(Album, pk=album_id) cd = get_object_or_404(album.cds.all(), pk=cd_id) return render_playlist(request, cd.get_tracks())
def play_album(request, album_id): album = get_object_or_404(Album, pk=album_id) return render_playlist(request, album.get_tracks())
def play_recording(request, recording_id): recording = get_object_or_404(Recording, pk=recording_id) return render_playlist(request, recording.get_tracks())