Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Backend Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Backend Server
Commits
d0983707
Commit
d0983707
authored
Oct 14, 2020
by
Andreas Heimann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added playlist api
parent
80989c10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
src/Controller/API/APISongPlaylistController.php
src/Controller/API/APISongPlaylistController.php
+48
-0
src/Controller/API/Tournament/APITournamentController.php
src/Controller/API/Tournament/APITournamentController.php
+3
-2
No files found.
src/Controller/API/APISongPlaylistController.php
0 → 100644
View file @
d0983707
<?php
namespace
App\Controller\API
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\Routing\Generator\UrlGeneratorInterface
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpClient\HttpClient
;
use
App\Entity\ClientRelease
;
use
App\Entity\Song
;
use
App\Entity\SongPlaylist
;
use
App\Entity\User
;
use
App\Entity\Promo
;
class
APISongPlaylistController
extends
AbstractController
{
/**
* @Route("/api/playlist/{id}", name="api.playlist.detail")
* @param Request $request
* @param $id
* @return JsonResponse
*/
public
function
playlistDetail
(
Request
$request
,
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$data
=
[];
$result
=
$em
->
getRepository
(
SongPlaylist
::
class
)
->
findOneBy
(
array
(
'id'
=>
$id
));
$baseUrl
=
$request
->
getScheme
()
.
'://'
.
$request
->
getHttpHost
()
.
$request
->
getBasePath
();
if
(
!
$result
)
{
$response
=
new
JsonResponse
([
'version'
=>
$this
->
getParameter
(
'api_version'
),
'status'
=>
404
,
'data'
=>
[]]);
$response
->
headers
->
set
(
'Access-Control-Allow-Origin'
,
'*'
);
return
$response
;
}
else
{
$data
=
$result
->
getJSON
();
$data
[
'paths'
][
'cover'
]
=
$baseUrl
.
"/uploads/cover/"
.
$result
->
getFileReference
()
.
".png"
;
$response
=
new
JsonResponse
([
'version'
=>
$this
->
getParameter
(
'api_version'
),
'status'
=>
200
,
'data'
=>
$data
]);
$response
->
headers
->
set
(
'Access-Control-Allow-Origin'
,
'*'
);
return
$response
;
}
}
}
src/Controller/API/Tournament/APITournamentController.php
View file @
d0983707
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Controller\API\Tournament
;
namespace
App\Controller\API\Tournament
;
use
App\Entity\SongPlaylist
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\Routing\Generator\UrlGeneratorInterface
;
use
Symfony\Component\Routing\Generator\UrlGeneratorInterface
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Routing\Annotation\Route
;
...
@@ -24,9 +25,9 @@ class APITournamentController extends AbstractController
...
@@ -24,9 +25,9 @@ class APITournamentController extends AbstractController
$baseUrl
=
$request
->
getScheme
()
.
'://'
.
$request
->
getHttpHost
()
.
$request
->
getBasePath
();
$baseUrl
=
$request
->
getScheme
()
.
'://'
.
$request
->
getHttpHost
()
.
$request
->
getBasePath
();
// Botch
// Botch
$tournament
Charts
=
$em
->
getRepository
(
Song
::
class
)
->
findBy
(
array
(
'isTournament'
=>
true
));
$tournament
Playlist
=
$em
->
getRepository
(
SongPlaylist
::
class
)
->
findOneBy
(
array
(
'id'
=>
"2"
));
foreach
(
$tournament
Charts
as
$tournamentChart
)
{
foreach
(
$tournament
Playlist
->
getSongs
()
as
$tournamentChart
)
{
$chartItem
=
$tournamentChart
->
getJSON
();
$chartItem
=
$tournamentChart
->
getJSON
();
$chartItem
[
'srtbMD5'
]
=
md5_file
(
$this
->
getParameter
(
'srtb_path'
)
.
DIRECTORY_SEPARATOR
.
$tournamentChart
->
getFileReference
()
.
".srtb"
);
$chartItem
[
'srtbMD5'
]
=
md5_file
(
$this
->
getParameter
(
'srtb_path'
)
.
DIRECTORY_SEPARATOR
.
$tournamentChart
->
getFileReference
()
.
".srtb"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment