mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Maybe fixed mobile issue
This commit is contained in:
parent
0000c4297d
commit
1617b605f6
19 changed files with 98 additions and 39 deletions
|
@ -20,7 +20,7 @@
|
|||
->explicitFilter()
|
||||
->published()
|
||||
->orderBy('published_at', 'desc')
|
||||
->take(20);
|
||||
->take(30);
|
||||
|
||||
$recentTracks = [];
|
||||
|
||||
|
|
|
@ -66,16 +66,29 @@
|
|||
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
||||
}
|
||||
|
||||
public function getStream($id) {
|
||||
public function getStream($id, $extension) {
|
||||
$track = Track::find($id);
|
||||
if (!$track || !$track->canView(Auth::user()))
|
||||
App::abort(404);
|
||||
|
||||
$format = Track::$Formats['MP3'];
|
||||
$format = null;
|
||||
$formatName = null;
|
||||
|
||||
foreach (Track::$Formats as $name => $item) {
|
||||
if ($item['extension'] == $extension) {
|
||||
$format = $item;
|
||||
$formatName = $name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($format == null)
|
||||
App::abort(404);
|
||||
|
||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $format['index']);
|
||||
|
||||
$response = Response::make('', 200);
|
||||
$filename = $track->getFileFor('MP3');
|
||||
$filename = $track->getFileFor($formatName);
|
||||
|
||||
if (Config::get('app.sendfile')) {
|
||||
$response->header('X-Sendfile', $filename);
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
Log::listen(function($level, $message, $context) use ($profiler) {
|
||||
$profiler->log($level, $message, $context);
|
||||
});
|
||||
}
|
||||
|
||||
App::error(function($exception) {
|
||||
return Response::view('errors.404', array(), 404);
|
||||
});
|
||||
App::error(function($exception) {
|
||||
return Response::view('errors.500', array(), 404);
|
||||
});
|
||||
}
|
||||
|
||||
App::missing(function($exception) {
|
||||
return Response::view('errors.404', array(), 404);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
use Helpers;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
@ -54,7 +55,7 @@
|
|||
}
|
||||
|
||||
public static function popular($count, $allowExplicit = false) {
|
||||
$trackIds = Cache::remember('popular_tracks-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit) {
|
||||
$trackIds = Cache::remember('popular_tracks' . $count . '-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit, $count) {
|
||||
$query = static
|
||||
::published()
|
||||
->join(DB::raw('
|
||||
|
@ -65,7 +66,7 @@
|
|||
'tracks.id', '=', 'ranged_plays.track_id')
|
||||
->groupBy('id')
|
||||
->orderBy('plays', 'desc')
|
||||
->take(20);
|
||||
->take($count);
|
||||
|
||||
if (!$allowExplicit)
|
||||
$query->whereIsExplicit(false);
|
||||
|
@ -197,7 +198,9 @@
|
|||
'normal' => $track->getCoverUrl(Image::NORMAL)
|
||||
],
|
||||
'streams' => [
|
||||
'mp3' => $track->getStreamUrl('MP3')
|
||||
'mp3' => $track->getStreamUrl('MP3'),
|
||||
'aac' => (!Config::get('app.debug') || is_file($track->getFileFor('AAC')) ) ? $track->getStreamUrl('AAC') : null,
|
||||
'ogg' => ( Config::get('app.debug') || is_file($track->getFileFor('OGG Vorbis'))) ? $track->getStreamUrl('OGG Vorbis') : null
|
||||
],
|
||||
'user_data' => $userData,
|
||||
'permissions' => [
|
||||
|
@ -350,8 +353,8 @@
|
|||
return $this->cover->getUrl($type);
|
||||
}
|
||||
|
||||
public function getStreamUrl() {
|
||||
return URL::to('/t' . $this->id . '/stream');
|
||||
public function getStreamUrl($format = 'MP3') {
|
||||
return URL::to('/t' . $this->id . '/stream.' . self::$Formats[$format]['extension']);
|
||||
}
|
||||
|
||||
public function getDirectory() {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
Route::get('tracks/{id}-{slug}', 'TracksController@getTrack');
|
||||
Route::get('t{id}', 'TracksController@getShortlink' );
|
||||
Route::get('t{id}/embed', 'TracksController@getEmbed' );
|
||||
Route::get('t{id}/stream', 'TracksController@getStream' );
|
||||
Route::get('t{id}/stream.{extension}', 'TracksController@getStream' );
|
||||
Route::get('t{id}/dl.{extension}', 'TracksController@getDownload' );
|
||||
|
||||
Route::get('albums', 'AlbumsController@getIndex');
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
angular.module('ponyfm').directive 'pfmSrcLoader', () ->
|
||||
(scope, element, attrs) ->
|
||||
size = attrs.pfmSrcSize || 'normal'
|
||||
url = attrs.pfmSrcLoader
|
||||
element.css {opacity: .5}
|
||||
|
||||
element.attr 'src', '/images/icons/loading_' + size + '.png'
|
||||
update = (val) ->
|
||||
element.attr 'src', '/images/icons/loading_' + size + '.png'
|
||||
|
||||
image = element.clone()
|
||||
image.removeAttr 'pfm-src-loader'
|
||||
image.removeAttr 'pfm-src-size'
|
||||
image = element.clone()
|
||||
image.removeAttr 'pfm-src-loader'
|
||||
image.removeAttr 'pfm-src-size'
|
||||
|
||||
image[0].onload = ->
|
||||
element.replaceWith image
|
||||
image.css {opacity: 0}
|
||||
image.animate {opacity: 1}, 250
|
||||
image[0].onload = ->
|
||||
element.attr 'src', val
|
||||
element.css {opacity: 0}
|
||||
element.animate {opacity: 1}, 250
|
||||
|
||||
image[0].src = url
|
||||
image[0].src = val
|
||||
|
||||
update scope.$eval attrs.pfmSrcLoader
|
||||
|
||||
scope.$watch attrs.pfmSrcLoader, update
|
|
@ -6,8 +6,18 @@ angular.module('ponyfm').factory('player', [
|
|||
play = (track) ->
|
||||
self.currentTrack = track
|
||||
$rootScope.$broadcast 'player-starting-track', track
|
||||
|
||||
streams = []
|
||||
streams.push track.streams.mp3
|
||||
streams.push track.streams.ogg if track.streams.ogg
|
||||
streams.push track.streams.aac if track.streams.aac
|
||||
|
||||
track.progress = 0
|
||||
track.progressSeconds = 0
|
||||
track.loadingProgress = 0
|
||||
|
||||
self.currentSound = soundManager.createSound
|
||||
url: track.streams.mp3,
|
||||
url: streams,
|
||||
volume: self.volume
|
||||
|
||||
whileloading: () -> $rootScope.safeApply ->
|
||||
|
@ -83,7 +93,8 @@ angular.module('ponyfm').factory('player', [
|
|||
|
||||
self.currentSound.stop() if self.currentSound != null
|
||||
self.playlistIndex--
|
||||
if self.playlistIndex <= 0
|
||||
|
||||
if self.playlistIndex < 0
|
||||
self.playlist.length = 0
|
||||
self.currentTrack = null
|
||||
self.currentSong = null
|
||||
|
|
|
@ -14,13 +14,39 @@ body.is-logged {
|
|||
float: left;
|
||||
width: 43px;
|
||||
height: 43px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding: 1px;
|
||||
|
||||
img {
|
||||
.img-polaroid();
|
||||
.box-shadow(none);
|
||||
|
||||
display: block;
|
||||
width: 100%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.loader {
|
||||
.transition(top 250ms linear);
|
||||
|
||||
z-index: 1000;
|
||||
background: rgba(0, 0, 0, .6);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: -50px;
|
||||
left: 2px;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
line-height: 43px;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
|
||||
&.showing {
|
||||
top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.inner {
|
||||
|
@ -51,7 +77,7 @@ body.is-logged {
|
|||
}
|
||||
|
||||
.transport {
|
||||
background: @pfm-light-grey;
|
||||
background: #aaa;
|
||||
height: 8px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<ul class="account-albums-listing stretch-to-bottom">
|
||||
<li ng-repeat="album in albums" ng-class="{selected: album.id == data.selectedAlbum.id}">
|
||||
<a href="/account/albums/edit/{{album.id}}">
|
||||
<img pfm-src-loader="{{album.covers.normal}}" pfm-src-size="normal" class="image" />
|
||||
<img pfm-src-loader="album.covers.normal" pfm-src-size="normal" class="image" />
|
||||
<span class="title">{{album.title}}</span>
|
||||
<span class="published">{{album.created_at | pfmdate:'MM/dd/yyyy'}}</span>
|
||||
</a>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<div class="stretch-to-bottom details-columns">
|
||||
<div class="right">
|
||||
<img class="cover" pfm-src-loader="{{album.covers.normal}}" pfm-src-size="normal" />
|
||||
<img class="cover" pfm-src-loader="album.covers.normal" pfm-src-size="normal" />
|
||||
|
||||
<div class="share-buttons" pfm-share-buttons>
|
||||
<a class="tumblr" bo-href="album.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ul class="artist-listing">
|
||||
<li ng-repeat="artist in artists" bindonce>
|
||||
<a href="{{artist.url}}">
|
||||
<img class="image" pfm-src-loader="{{artist.avatars.small}}" pfm-src-size="small" />
|
||||
<img class="image" pfm-src-loader="artist.avatars.small" pfm-src-size="small" />
|
||||
<span class="info">
|
||||
<span class="title" bo-text="artist.name"></span>
|
||||
<span class="published">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<ul class="albums-listing {{class}}">
|
||||
<li ng-repeat="album in albums" bindonce>
|
||||
<a bo-href="album.url">
|
||||
<img class="image" pfm-src-loader="{{album.covers.small}}" pfm-src-size="small" />
|
||||
<img class="image" pfm-src-loader="album.covers.small" pfm-src-size="small" />
|
||||
<span class="info">
|
||||
<span class="title" bo-text="album.title"></span>
|
||||
<span class="published">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
There are no comments yet!
|
||||
</li>
|
||||
<li bindonce ng-repeat="comment in resource.comments">
|
||||
<img pfm-src-loader="{{comment.user.avatars.thumbnail}}" pfm-src-size="thumbnail" />
|
||||
<img pfm-src-loader="comment.user.avatars.thumbnail" pfm-src-size="thumbnail" />
|
||||
<div class="content">
|
||||
<a bo-href="comment.user.url" bo-text="comment.user.name"></a>
|
||||
<span bo-text="comment.content"></span>
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
<div class="image">
|
||||
<img pfm-src-loader="{{player.currentTrack.covers.thumbnail}}" pfm-src-size="thumbnail" />
|
||||
<div class="loader" ng-class="{showing: player.currentTrack.loadingProgress == 0}"><i class="icon-spin icon-rotate-right"></i></div>
|
||||
<img pfm-src-loader="player.currentTrack.covers.thumbnail" pfm-src-size="thumbnail" />
|
||||
</div>
|
||||
<div class="inner">
|
||||
<div class="title">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<ul class="playlists-listing {{class}}">
|
||||
<li ng-repeat="playlist in playlists" bindonce>
|
||||
<a href="{{playlist.url}}">
|
||||
<img class="image" pfm-src-loader="{{playlist.covers.small}}" pfm-src-size="small" />
|
||||
<img class="image" pfm-src-loader="playlist.covers.small" pfm-src-size="small" />
|
||||
<span class="info">
|
||||
<span class="title">{{playlist.title}}</span>
|
||||
<span class="published">
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
<i class="icon-play" ng-show="!track.isPlaying"></i>
|
||||
<i class="icon-pause" ng-hide="!track.isPlaying"></i>
|
||||
</a>
|
||||
<img pfm-src-loader="{{track.covers.thumbnail}}" pfm-src-size="thumbnail" />
|
||||
<img pfm-src-loader="track.covers.thumbnail" pfm-src-size="thumbnail" />
|
||||
</div>
|
|
@ -5,7 +5,7 @@
|
|||
<i class="icon-play" ng-show="!track.isPlaying"></i>
|
||||
<i class="icon-pause" ng-hide="!track.isPlaying"></i>
|
||||
</a>
|
||||
<img pfm-src-loader="{{track.covers.thumbnail}}" pfm-src-size="thumbnail" />
|
||||
<img pfm-src-loader="track.covers.thumbnail" pfm-src-size="thumbnail" />
|
||||
</div>
|
||||
<div class="icons">
|
||||
<span><i ng-class="{'icon-microphone-off': !track.is_vocal, 'icon-microphone': track.is_vocal}"></i></span>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<div class="stretch-to-bottom details-columns">
|
||||
<div class="right">
|
||||
<img class="cover" pfm-src-loader="{{playlist.covers.normal}}" pfm-src-size="normal" />
|
||||
<img class="cover" pfm-src-loader="playlist.covers.normal" pfm-src-size="normal" />
|
||||
|
||||
<div class="share-buttons" pfm-share-buttons>
|
||||
<a class="tumblr" bo-href="playlist.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<div class="stretch-to-bottom details-columns">
|
||||
<div class="right">
|
||||
<img class="cover" pfm-src-loader="{{track.covers.normal}}" pfm-src-size="normal" />
|
||||
<img class="cover" pfm-src-loader="track.covers.normal" pfm-src-size="normal" />
|
||||
|
||||
<div class="share-buttons" pfm-share-buttons>
|
||||
<a class="tumblr" bo-href="track.share.tumblrUrl" title="Share on Tumblr" style="display:inline-block; overflow:hidden; width:20px; height:20px; background:url('/images/tumblr-share.png') top left no-repeat transparent;"></a>
|
||||
|
|
Loading…
Reference in a new issue