mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 13:07:59 +01:00
Merged development into master
This commit is contained in:
commit
4c8fe6c480
4 changed files with 49 additions and 7 deletions
|
@ -75,14 +75,22 @@
|
|||
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $format['index']);
|
||||
|
||||
$response = Response::make('', 200);
|
||||
$filename = $track->getFileFor('MP3');
|
||||
|
||||
if (Config::get('app.sendfile')) {
|
||||
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
||||
$response->header('X-Sendfile', $filename);
|
||||
} else {
|
||||
$response->header('X-Accel-Redirect', $track->getFileFor('MP3'));
|
||||
$response->header('X-Accel-Redirect', $filename);
|
||||
}
|
||||
|
||||
$response->header('Content-Disposition', 'filename="' . $track->getFilenameFor('MP3') . '"');
|
||||
$time = gmdate(filemtime($filename));
|
||||
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $time == $_SERVER['HTTP_IF_MODIFIED_SINCE']) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
exit();
|
||||
}
|
||||
|
||||
$response->header('Last-Modified', $time);
|
||||
$response->header('Content-Type', $format['mime_type']);
|
||||
|
||||
return $response;
|
||||
|
@ -110,15 +118,24 @@
|
|||
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||
|
||||
$response = Response::make('', 200);
|
||||
$filename = $track->getFileFor($format);
|
||||
|
||||
if (Config::get('app.sendfile')) {
|
||||
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
||||
$response->header('X-Sendfile', $filename);
|
||||
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
||||
} else {
|
||||
$response->header('X-Accel-Redirect', $track->getFileFor('MP3'));
|
||||
$response->header('X-Accel-Redirect', $filename);
|
||||
$response->header('Content-Disposition', 'attachment; filename=' . $track->getDownloadFilenameFor($formatName));
|
||||
}
|
||||
|
||||
$time = gmdate(filemtime($filename));
|
||||
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $time == $_SERVER['HTTP_IF_MODIFIED_SINCE']) {
|
||||
header('HTTP/1.0 304 Not Modified');
|
||||
exit();
|
||||
}
|
||||
|
||||
$response->header('Last-Modified', $time);
|
||||
$response->header('Content-Type', $format['mime_type']);
|
||||
|
||||
return $response;
|
||||
|
|
|
@ -38,6 +38,10 @@ angular.module('ponyfm').factory('player', [
|
|||
self.isPlaying = true
|
||||
self.currentSound.play()
|
||||
|
||||
updateCanGo = () ->
|
||||
self.canGoNext = self.playlistIndex < self.playlist.length - 1
|
||||
self.canGoPrev = self.playlistIndex > 0
|
||||
|
||||
self =
|
||||
ready: false
|
||||
isPlaying: false
|
||||
|
@ -47,6 +51,8 @@ angular.module('ponyfm').factory('player', [
|
|||
playlistIndex: 0
|
||||
volume: 0
|
||||
readyDef: readyDef.promise()
|
||||
canGoPrev: false
|
||||
canGoNext: false
|
||||
|
||||
playPause: () ->
|
||||
return if !self.ready
|
||||
|
@ -58,6 +64,8 @@ angular.module('ponyfm').factory('player', [
|
|||
self.currentSound.pause()
|
||||
|
||||
playNext: () ->
|
||||
return if !self.canGoNext
|
||||
|
||||
self.currentSound.stop() if self.currentSound != null
|
||||
self.playlistIndex++
|
||||
if self.playlistIndex >= self.playlist.length
|
||||
|
@ -68,8 +76,11 @@ angular.module('ponyfm').factory('player', [
|
|||
return
|
||||
|
||||
play self.playlist[self.playlistIndex]
|
||||
updateCanGo()
|
||||
|
||||
playPrev: () ->
|
||||
return if !self.canGoPrev
|
||||
|
||||
self.currentSound.stop() if self.currentSound != null
|
||||
self.playlistIndex--
|
||||
if self.playlistIndex <= 0
|
||||
|
@ -80,6 +91,7 @@ angular.module('ponyfm').factory('player', [
|
|||
return
|
||||
|
||||
play self.playlist[self.playlistIndex]
|
||||
updateCanGo()
|
||||
|
||||
seek: (progress) ->
|
||||
return if !self.currentSound
|
||||
|
@ -108,6 +120,7 @@ angular.module('ponyfm').factory('player', [
|
|||
|
||||
$rootScope.$broadcast 'player-starting-playlist', tracks
|
||||
play tracks[index]
|
||||
updateCanGo()
|
||||
|
||||
pfm.soundManager.done () ->
|
||||
self.ready = true
|
||||
|
|
|
@ -112,6 +112,18 @@ body.is-logged {
|
|||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
a {
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
background: transparent;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.volume {
|
||||
position: relative;
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
<strong>{{player.currentTrack.progressSeconds | secondsDisplay}}</strong> /
|
||||
<strong>{{player.currentTrack.duration | secondsDisplay}}</strong>
|
||||
</li>
|
||||
<li><a pfm-eat-click ng-click="playPrev()" class="previous" href="#"><i class="icon-fast-backward"></i></a></li>
|
||||
<li ng-class="{disabled: !player.canGoPrev}"><a pfm-eat-click ng-click="playPrev()" class="previous" href="#"><i class="icon-fast-backward"></i></a></li>
|
||||
<li>
|
||||
<a pfm-eat-click ng-click="playPause()" class="play" href="#">
|
||||
<i class="icon-pause" ng-show="player.currentTrack.isPlaying"></i>
|
||||
<i class="icon-play" ng-hide="player.currentTrack.isPlaying"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li><a pfm-eat-click ng-click="playNext()" class="next" href="#"><i class="icon-fast-forward"></i></a></li>
|
||||
<li ng-class="{disabled: !player.canGoNext}"><a pfm-eat-click ng-click="playNext()" class="next" href="#"><i class="icon-fast-forward"></i></a></li>
|
||||
<li class="volume">
|
||||
<a pfm-eat-click ng-click="" class="volume" href="#">
|
||||
<i class="icon-volume-up"></i>
|
||||
|
|
Loading…
Reference in a new issue