mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Hearth's Warming Contest stuff
This commit is contained in:
parent
d9dc582c08
commit
926e410721
9 changed files with 148 additions and 5 deletions
|
@ -27,6 +27,7 @@ use Poniverse\Ponyfm\Models\Image;
|
|||
use Poniverse\Ponyfm\Models\Track;
|
||||
use Poniverse\Ponyfm\Models\TrackType;
|
||||
use Poniverse\Ponyfm\Models\User;
|
||||
use Poniverse\Ponyfm\Models\Playlist;
|
||||
use DB;
|
||||
|
||||
class EditTrackCommand extends CommandBase
|
||||
|
@ -136,7 +137,7 @@ class EditTrackCommand extends CommandBase
|
|||
|
||||
DB::table('tracks')->whereUserId($track->user_id)->update(['is_latest' => false]);
|
||||
$track->is_latest = true;
|
||||
|
||||
|
||||
Notification::publishedNewTrack($track);
|
||||
}
|
||||
|
||||
|
@ -177,6 +178,22 @@ class EditTrackCommand extends CommandBase
|
|||
]);
|
||||
}
|
||||
|
||||
if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime("2016-12-18 00:00:00")) {
|
||||
$playlist = Playlist::where('user_id', 22549)->first();
|
||||
|
||||
if ($this->_input['hwc_submit'] === true) {
|
||||
if (!$playlist->tracks()->get()->contains($track)) {
|
||||
$songIndex = $playlist->trackCount() + 1;
|
||||
$playlist->tracks()->attach($track, ['position' => $songIndex]);
|
||||
$playlist->touch();
|
||||
|
||||
Playlist::where('id', $playlist->id)->update([
|
||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResponse::succeed(['real_cover_url' => $track->getCoverUrl(Image::NORMAL)]);
|
||||
}
|
||||
|
||||
|
|
58
app/Console/Commands/MigrateEncryption.php
Normal file
58
app/Console/Commands/MigrateEncryption.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Poniverse\Ponyfm\Console\Commands;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
use Laravel\LegacyEncrypter\McryptEncrypter;
|
||||
|
||||
class MigrateEncryption extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'migrate-encryption';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Migrates from mcrypt to openssl. Needs key and mcryptKey set in config/app.php';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$key = $this->laravel['config']['app.mcryptKey'];
|
||||
$cipher = $this->laravel['config']['app.mcryptCipher'];
|
||||
|
||||
$legacy = new McryptEncrypter($key, $cipher);
|
||||
|
||||
$caches = DB::select('SELECT * FROM cache');
|
||||
|
||||
foreach ($caches as $cache) {
|
||||
$newValue = encrypt(
|
||||
$legacy->decrypt($cache->value)
|
||||
);
|
||||
|
||||
DB::update('UPDATE cache SET value = ? WHERE key = ?', [$cache->key, $newValue]);
|
||||
|
||||
$this->info("Updated {$cache->key}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -533,6 +533,9 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
|||
$returnValue['license_id'] = $track->license_id != null ? $track->license_id : 3;
|
||||
$returnValue['username'] = User::whereId($track->user_id)->first()->username;
|
||||
|
||||
// Seasonal
|
||||
$returnValue['hwc_submit'] = Playlist::where('user_id', 22549)->first()->tracks()->get()->contains($track);
|
||||
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
|
@ -731,7 +734,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
|||
{
|
||||
return $this->getMasterTrackFile()->isLossy();
|
||||
}
|
||||
|
||||
|
||||
public function getCoverUrl($type = Image::NORMAL)
|
||||
{
|
||||
if (!$this->hasCover()) {
|
||||
|
|
|
@ -99,15 +99,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-row">
|
||||
<div class="col-md-3 form-row">
|
||||
<label for="is_explicit"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_explicit" type="checkbox" ng-model="track.is_explicit" /> Contains Explicit Content</label>
|
||||
</div>
|
||||
<div class="col-md-4 form-row">
|
||||
<div class="col-md-3 form-row">
|
||||
<label for="is_downloadable"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_downloadable" type="checkbox" ng-model="track.is_downloadable" /> Is Downloadable</label>
|
||||
</div>
|
||||
<div class="col-md-4 form-row">
|
||||
<div class="col-md-3 form-row">
|
||||
<label for="is_listed"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_listed" type="checkbox" ng-model="track.is_listed" /> Is Listed</label>
|
||||
</div>
|
||||
<div class="col-md-3 form-row">
|
||||
<label for="hwc_submit"><input ng-disabled="isSaving" ng-change="touchModel()" id="hwc_submit" type="checkbox" ng-model="track.hwc_submit" /> Submit to <a href="https://mlpforums.com/topic/159868-ponyfms-hearths-warming-contest/">Hearth's Warming Contest</a></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-show="isAdmin">
|
||||
<div class="col-sm-6 form-row" ng-class="{'has-error': errors.username != null}">
|
||||
|
|
29
public/templates/pages/hwc-terms.html
Normal file
29
public/templates/pages/hwc-terms.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<h1>Hearth's Warming Contest 2016: Rules and Terms</h1>
|
||||
<div class="stretch-to-bottom">
|
||||
<h2>1. Eligibility</h2>
|
||||
<p>This contest is open to anyone with a Poniverse.net user account “Poniverse account”. Entrants are required produce an original song or remix of a song from My Little Pony: Friendship is Magic based around the theme of “Hearth’s Warming” (Christmas).This contest is open worldwide to anyone over the age of 18 and void where prohibited by law. Members of Poniverse are allowed to enter this contest with the exception of those who are directly connected with the administration or development of Pony.fm and/or administration or judging of this contest.</p>
|
||||
|
||||
|
||||
<h2>2. Agreement to terms</h2>
|
||||
<p>By submitting a song to this contest on the Pony.fm website, the entrant is indicating their agreement to these terms and conditions and agree to be fully bound by these rules</p>
|
||||
|
||||
|
||||
<h2>3. Contest time frame</h2>
|
||||
<p>This contest opens for submissions on 21st of November 2016, the contest will stop accepting submissions on 18th of December 2016. All times for this contest will be in GMT.</p>
|
||||
|
||||
|
||||
<h2>4. Entry</h2>
|
||||
<p>To enter the contest, entrants must upload a song to the Pony.fm website and enable the “Submit to Hearth’s Warming Contest” checkbox when publishing their song. Upon doing this, the entrant is agreeing to the rules and terms laid out here. Entrants that do not follow the rules may be disqualified at the discretion of Poniverse. An entrant can submit an unlimited number of entries. The amount of entries submitted does not automatically increase the odds of winning. The judges will also create a playlist of the majority of entries submitted to the contest for featuring on Pony.fm. Entering the contest does not result in a guaranteed place on this list. Judges will add most of the entries submitted, with the exception of: entries that break the rules and entries that are deemed to be of poor quality. If an entrant submits multiple entries, they can only have a maximum of three entries on the contest playlist.</p>
|
||||
|
||||
|
||||
<h2>5. Winner selection</h2>
|
||||
<p>There will be three prize winners picked from this contest. Winners are picked by group of Poniverse members. The group of Poniverse members who will judge this entries will be chosen by the Poniverse member, “Logic”. Judges will award up to three winners. These winners will be picked based on the quality of the entries as perceived by the judges. The winning entrants, as chosen by judges, are final unless it is later found that one or more of the winners have broken the rules. Winners will be announced some time after the contest has closed. Poniverse reserves the right to redraw winners at any point if there is suspicion or proof that a winner has broken the terms.</p>
|
||||
|
||||
|
||||
<h2>6. Prizes</h2>
|
||||
<p>The first place prize winner will receive a 50 USD Amazon.com gift voucher code. Second place will receive a 25 USD Amazon.com gift voucher code. Third place will recieve a 10 USD Amazon.com gift voucher code. The three winners will also have their entries featured on the Pony.fm homepage for 1 week after the winners are announced. Prizes are nontransferable. The winner must have a valid Poniverse.net account with a valid and current email registered with that account. Poniverse will attempt to contact the winner upon winning, if Poniverse does not receive a response within a reasonable amount of time (determined by Poniverse), the winners may be redrawn. If the winner is not living in the United States of America when they win the contest, Poniverse will attempt to offer an Amazon gift voucher in their resident country with an approximate equal value in their resident country’s currency. If Poniverse cannot provide an Amazon gift voucher to the winner for any reason, Poniverse will seek alternative prize offerings. If an alternative prize cannot be agreed upon within a reasonable amount of time, Poniverse will redraw the winners. Poniverse does not accept responsibility for the prize being lost or stolen.</p>
|
||||
|
||||
|
||||
<h2>7. Copyright</h2>
|
||||
<p>Upon submitting an entry to the contest, entrants are confirming that their entry is their own original work or their own original remix of a song from My Little Pony: Friendship is Magic based around the theme of “Hearth’s Warming” (Christmas). Remixes of songs from the show will be reviewed for originality. Poniverse may choose to disqualify some remixes that sound too similar to the original song. Entries produced by multiple people may be submitted if all parties have agreed on its submission. The entrant agrees, upon entering their song in the contest, they have the right to submit the song. Poniverse will disqualify tracks that are in breach of copyright law.</p>
|
||||
</div>
|
|
@ -250,6 +250,10 @@ ponyfm.config [
|
|||
url: '/mlpforums-advertising-program'
|
||||
templateUrl: '/templates/pages/mlpforums-advertising-program.html'
|
||||
|
||||
state.state 'pages.hwc-terms',
|
||||
url: '/hwc2016-rules'
|
||||
templateUrl: '/templates/pages/hwc-terms.html'
|
||||
|
||||
# Auth
|
||||
|
||||
state.state 'login',
|
||||
|
|
|
@ -175,6 +175,8 @@ module.exports = angular.module('ponyfm').directive 'pfmTrackEditor', () ->
|
|||
album_id: track.album_id
|
||||
is_published: track.is_published
|
||||
is_listed: track.is_listed
|
||||
# Seasonal
|
||||
hwc_submit: track.hwc_submit
|
||||
|
||||
$scope.selectedSongs = {}
|
||||
$scope.selectedSongs[song.id] = song for song in track.show_songs
|
||||
|
|
23
resources/views/pages/hwc-terms.blade.php
Normal file
23
resources/views/pages/hwc-terms.blade.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{--
|
||||
Pony.fm - A community for pony fan music.
|
||||
Copyright (C) 2016 Josef Citrine
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--}}
|
||||
|
||||
@extends('pages._layout')
|
||||
|
||||
@section('static_page')
|
||||
{{Helpers::template('pages/hwc-terms.html')}}
|
||||
@endsection
|
|
@ -65,6 +65,10 @@ Route::get('/mlpforums-advertising-program', function () {
|
|||
return View::make('pages.mlpforums-advertising-program');
|
||||
});
|
||||
|
||||
Route::get('/hwc2016-rules', function () {
|
||||
return View::make('pages.hwc-terms');
|
||||
});
|
||||
|
||||
Route::get('i{id}/{type}.{extension}', 'ImagesController@getImage')->where('id', '\d+');
|
||||
|
||||
Route::get('playlist/{id}-{slug}', 'PlaylistsController@getPlaylist');
|
||||
|
|
Loading…
Reference in a new issue