mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-29 16:17: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']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $format['index']);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = Response::make('', 200);
|
||||||
|
$filename = $track->getFileFor('MP3');
|
||||||
|
|
||||||
if (Config::get('app.sendfile')) {
|
if (Config::get('app.sendfile')) {
|
||||||
$response->header('X-Sendfile', $track->getFileFor('MP3'));
|
$response->header('X-Sendfile', $filename);
|
||||||
} else {
|
} 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']);
|
$response->header('Content-Type', $format['mime_type']);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -110,15 +118,24 @@
|
||||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||||
|
|
||||||
$response = Response::make('', 200);
|
$response = Response::make('', 200);
|
||||||
|
$filename = $track->getFileFor($format);
|
||||||
|
|
||||||
if (Config::get('app.sendfile')) {
|
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) . '"');
|
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
||||||
} else {
|
} else {
|
||||||
$response->header('X-Accel-Redirect', $track->getFileFor('MP3'));
|
$response->header('X-Accel-Redirect', $filename);
|
||||||
$response->header('Content-Disposition', 'attachment; filename=' . $track->getDownloadFilenameFor($formatName));
|
$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']);
|
$response->header('Content-Type', $format['mime_type']);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -38,6 +38,10 @@ angular.module('ponyfm').factory('player', [
|
||||||
self.isPlaying = true
|
self.isPlaying = true
|
||||||
self.currentSound.play()
|
self.currentSound.play()
|
||||||
|
|
||||||
|
updateCanGo = () ->
|
||||||
|
self.canGoNext = self.playlistIndex < self.playlist.length - 1
|
||||||
|
self.canGoPrev = self.playlistIndex > 0
|
||||||
|
|
||||||
self =
|
self =
|
||||||
ready: false
|
ready: false
|
||||||
isPlaying: false
|
isPlaying: false
|
||||||
|
@ -47,6 +51,8 @@ angular.module('ponyfm').factory('player', [
|
||||||
playlistIndex: 0
|
playlistIndex: 0
|
||||||
volume: 0
|
volume: 0
|
||||||
readyDef: readyDef.promise()
|
readyDef: readyDef.promise()
|
||||||
|
canGoPrev: false
|
||||||
|
canGoNext: false
|
||||||
|
|
||||||
playPause: () ->
|
playPause: () ->
|
||||||
return if !self.ready
|
return if !self.ready
|
||||||
|
@ -58,6 +64,8 @@ angular.module('ponyfm').factory('player', [
|
||||||
self.currentSound.pause()
|
self.currentSound.pause()
|
||||||
|
|
||||||
playNext: () ->
|
playNext: () ->
|
||||||
|
return if !self.canGoNext
|
||||||
|
|
||||||
self.currentSound.stop() if self.currentSound != null
|
self.currentSound.stop() if self.currentSound != null
|
||||||
self.playlistIndex++
|
self.playlistIndex++
|
||||||
if self.playlistIndex >= self.playlist.length
|
if self.playlistIndex >= self.playlist.length
|
||||||
|
@ -68,8 +76,11 @@ angular.module('ponyfm').factory('player', [
|
||||||
return
|
return
|
||||||
|
|
||||||
play self.playlist[self.playlistIndex]
|
play self.playlist[self.playlistIndex]
|
||||||
|
updateCanGo()
|
||||||
|
|
||||||
playPrev: () ->
|
playPrev: () ->
|
||||||
|
return if !self.canGoPrev
|
||||||
|
|
||||||
self.currentSound.stop() if self.currentSound != null
|
self.currentSound.stop() if self.currentSound != null
|
||||||
self.playlistIndex--
|
self.playlistIndex--
|
||||||
if self.playlistIndex <= 0
|
if self.playlistIndex <= 0
|
||||||
|
@ -80,6 +91,7 @@ angular.module('ponyfm').factory('player', [
|
||||||
return
|
return
|
||||||
|
|
||||||
play self.playlist[self.playlistIndex]
|
play self.playlist[self.playlistIndex]
|
||||||
|
updateCanGo()
|
||||||
|
|
||||||
seek: (progress) ->
|
seek: (progress) ->
|
||||||
return if !self.currentSound
|
return if !self.currentSound
|
||||||
|
@ -108,6 +120,7 @@ angular.module('ponyfm').factory('player', [
|
||||||
|
|
||||||
$rootScope.$broadcast 'player-starting-playlist', tracks
|
$rootScope.$broadcast 'player-starting-playlist', tracks
|
||||||
play tracks[index]
|
play tracks[index]
|
||||||
|
updateCanGo()
|
||||||
|
|
||||||
pfm.soundManager.done () ->
|
pfm.soundManager.done () ->
|
||||||
self.ready = true
|
self.ready = true
|
||||||
|
|
|
@ -112,6 +112,18 @@ body.is-logged {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
a {
|
||||||
|
color: #ccc;
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: transparent;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.volume {
|
&.volume {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
<strong>{{player.currentTrack.progressSeconds | secondsDisplay}}</strong> /
|
<strong>{{player.currentTrack.progressSeconds | secondsDisplay}}</strong> /
|
||||||
<strong>{{player.currentTrack.duration | secondsDisplay}}</strong>
|
<strong>{{player.currentTrack.duration | secondsDisplay}}</strong>
|
||||||
</li>
|
</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>
|
<li>
|
||||||
<a pfm-eat-click ng-click="playPause()" class="play" href="#">
|
<a pfm-eat-click ng-click="playPause()" class="play" href="#">
|
||||||
<i class="icon-pause" ng-show="player.currentTrack.isPlaying"></i>
|
<i class="icon-pause" ng-show="player.currentTrack.isPlaying"></i>
|
||||||
<i class="icon-play" ng-hide="player.currentTrack.isPlaying"></i>
|
<i class="icon-play" ng-hide="player.currentTrack.isPlaying"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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">
|
<li class="volume">
|
||||||
<a pfm-eat-click ng-click="" class="volume" href="#">
|
<a pfm-eat-click ng-click="" class="volume" href="#">
|
||||||
<i class="icon-volume-up"></i>
|
<i class="icon-volume-up"></i>
|
||||||
|
|
Loading…
Reference in a new issue