Skip to content
This repository was archived by the owner on Feb 13, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/Views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def add_to_queue(entry_id):
return "1"

@staticmethod
@bottle.route("/play")
def play(self):
PlayerControl().play()
@bottle.route("/play/<name>")
def play(name):
# For firefox: Use cache to answer duplicate GET requests.
bottle.response.set_header('Cache-Control', 'max-age=1')
PlayerControl().play(name)

@staticmethod
@bottle.route("/play_queue/<entry_id:int>")
Expand All @@ -111,16 +113,22 @@ def play_playlist_entry(playlist, entry_id):
@staticmethod
@bottle.route("/prev")
def play_previous():
# For firefox: Use cache to answer duplicate GET requests.
bottle.response.set_header('Cache-Control', 'max-age=1')
PlayerControl().previous()

@staticmethod
@bottle.route("/next")
def play_next():
# For firefox: Use cache to answer duplicate GET requests.
bottle.response.set_header('Cache-Control', 'max-age=1')
PlayerControl().next()

@staticmethod
@bottle.route("/pause")
def pause():
# For firefox: Use cache to answer duplicate GET requests.
bottle.response.set_header('Cache-Control', 'max-age=1')
PlayerControl().pause()

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions src/WebPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def __get_source_entries(self, source):
entries.append((entry_id, title))
return entries

def play(self):
self.__player.play()
def play(self, unused):
self.__player.playpause(unused)

def play_entry(self, entry_id):
self.__play_entry(entry_id, self.__library)
Expand Down Expand Up @@ -204,4 +204,4 @@ def get_playlist_entries(self, playlist):
return None
else:
return self.__get_source_entries(self.__playlists[playlist])

4 changes: 2 additions & 2 deletions web/layout.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Contributors:
var updateTimer;
$(document).bind("pagechange", function() {
initialize();

var updater = new playerInfoUpdater(true);
updater.update();
updateTimer = $.timer(function() {
Expand Down Expand Up @@ -92,7 +92,7 @@ Contributors:
</div>
<div data-role="controlgroup" data-type="horizontal">
<a class="prevButton control_button" href="#" data-rb-action="prev" data-role="button">Previous</a>
<a class="playButton control_button" href="#" data-rb-action="play" data-role="button">Play</a>
<a class="playButton control_button" href="#" data-rb-action="play/unused" data-role="button">Play</a>
<a class="pauseButton control_button" href="#" data-rb-action="pause" data-role="button">Pause</a>
<a class="stopButton control_button" href="#" data-rb-action="stop" data-role="button">Stop</a>
<a class="nextButton control_button" href="#" data-rb-action="next" data-role="button">Next</a>
Expand Down
4 changes: 3 additions & 1 deletion web/script/rbplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ function playerInfoUpdater(activePage) {
url: "/play_queue/" + id,
type: "GET"
}).success(function() {
$("#queue_popup").popup("close");
$("#queue_popup").popup("close");
// Reload page to force restart of updateTimer (Nokia browser).
location.reload();
});
});
$queue_list.append($link);
Expand Down