Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
344b7f54
Commit
344b7f54
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
only show songs for which the current user has songs indexed
parent
d6d38ac3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/media/ajax/api.php
+2
-0
2 additions, 0 deletions
apps/media/ajax/api.php
apps/media/lib_collection.php
+13
-10
13 additions, 10 deletions
apps/media/lib_collection.php
with
15 additions
and
10 deletions
apps/media/ajax/api.php
+
2
−
0
View file @
344b7f54
...
@@ -67,10 +67,12 @@ if($arguments['action']){
...
@@ -67,10 +67,12 @@ if($arguments['action']){
$artists
=
OC_MEDIA_COLLECTION
::
getArtists
();
$artists
=
OC_MEDIA_COLLECTION
::
getArtists
();
foreach
(
$artists
as
&
$artist
){
foreach
(
$artists
as
&
$artist
){
$artist
[
'albums'
]
=
OC_MEDIA_COLLECTION
::
getAlbums
(
$artist
[
'artist_id'
]);
$artist
[
'albums'
]
=
OC_MEDIA_COLLECTION
::
getAlbums
(
$artist
[
'artist_id'
]);
$artistHasSongs
=
false
;
foreach
(
$artist
[
'albums'
]
as
&
$album
){
foreach
(
$artist
[
'albums'
]
as
&
$album
){
$album
[
'songs'
]
=
OC_MEDIA_COLLECTION
::
getSongs
(
$artist
[
'artist_id'
],
$album
[
'album_id'
]);
$album
[
'songs'
]
=
OC_MEDIA_COLLECTION
::
getSongs
(
$artist
[
'artist_id'
],
$album
[
'album_id'
]);
}
}
}
}
echo
json_encode
(
$artists
);
echo
json_encode
(
$artists
);
break
;
break
;
case
'scan'
:
case
'scan'
:
...
...
This diff is collapsed.
Click to expand it.
apps/media/lib_collection.php
+
13
−
10
View file @
344b7f54
...
@@ -123,13 +123,14 @@ class OC_MEDIA_COLLECTION{
...
@@ -123,13 +123,14 @@ class OC_MEDIA_COLLECTION{
if
(
!
$exact
and
$search
!=
'%'
){
if
(
!
$exact
and
$search
!=
'%'
){
$search
=
"%
$search
%"
;
$search
=
"%
$search
%"
;
}
}
$query
=
OC_DB
::
prepare
(
"SELECT
* FROM
*PREFIX*media_artists
WHERE
artist_name
LIKE ?"
);
$query
=
OC_DB
::
prepare
(
"SELECT
DISTINCT
*PREFIX*media_artists
.
artist_name
AS name , *PREFIX*media_artists.artist_id AS id FROM *PREFIX*media_artists
$artists
=
$query
->
execute
(
array
(
$search
))
->
fetchAll
(
);
INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=?"
);
if
(
is_array
(
$artists
)){
$artists
=
$query
->
execute
(
array
(
$search
,
OC_USER
::
getUser
()))
->
fetchAll
();
re
turn
$artists
;
$
re
sult
=
array
()
;
}
else
{
foreach
(
$artists
as
$artist
)
{
re
turn
array
(
);
$
re
sult
[
$artist
[
'id'
]]
=
array
(
'artist_name'
=>
$artist
[
'name'
],
'artist_id'
=>
$artist
[
'id'
]
);
}
}
return
$result
;
}
}
/**
/**
...
@@ -175,11 +176,13 @@ class OC_MEDIA_COLLECTION{
...
@@ -175,11 +176,13 @@ class OC_MEDIA_COLLECTION{
}
}
$query
=
OC_DB
::
prepare
(
$cmd
);
$query
=
OC_DB
::
prepare
(
$cmd
);
$albums
=
$query
->
execute
(
$params
)
->
fetchAll
();
$albums
=
$query
->
execute
(
$params
)
->
fetchAll
();
if
(
is_array
(
$albums
)){
$result
=
array
();
return
$albums
;
foreach
(
$albums
as
$album
){
}
else
{
if
(
count
(
self
::
getSongs
(
$album
[
'album_artist'
],
$album
[
'album_id'
]))){
return
array
();
$result
[
$album
[
'album_id'
]]
=
$album
;
}
}
}
return
$result
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment