Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nextcloud-app-radio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
onny
nextcloud-app-radio
Commits
d5038611
Commit
d5038611
authored
Nov 21, 2020
by
onny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implementing categories
parent
290d3581
Pipeline
#218
failed with stages
in 12 minutes and 56 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
40 deletions
+91
-40
src/components/Main.vue
src/components/Main.vue
+74
-36
src/components/Table.vue
src/components/Table.vue
+16
-3
src/router.js
src/router.js
+1
-1
No files found.
src/components/Main.vue
View file @
d5038611
...
...
@@ -63,6 +63,7 @@ export default {
favorites
:
[],
showSidebar
:
false
,
sidebarStation
:
{},
queryParams
:
{},
}),
computed
:
{
player
()
{
...
...
@@ -223,7 +224,6 @@ export default {
html5
:
true
,
volume
:
vm
.
player
.
volume
,
onplay
()
{
console
.
log
(
'
onplay
'
)
vm
.
$store
.
dispatch
(
'
isPlaying
'
,
true
)
vm
.
$store
.
dispatch
(
'
isBuffering
'
,
false
)
},
...
...
@@ -284,36 +284,63 @@ export default {
let
sortBy
=
'
clickcount
'
if
(
vm
.
$route
.
name
===
'
CATEGORIES
'
)
{
vm
.
tableData
=
[
{
name
:
t
(
'
radio
'
,
'
Countries
'
),
type
:
'
folder
'
,
path
:
'
#/categories/countries
'
,
},
{
name
:
t
(
'
radio
'
,
'
States
'
),
type
:
'
folder
'
,
path
:
'
#/categories/states
'
,
},
{
name
:
t
(
'
radio
'
,
'
Languages
'
),
type
:
'
folder
'
,
path
:
'
#/categories/languages
'
,
},
{
name
:
t
(
'
radio
'
,
'
Tags
'
),
type
:
'
folder
'
,
path
:
'
#/categories/tags
'
,
},
]
vm
.
pageLoading
=
false
return
true
if
(
vm
.
$route
.
path
===
'
/categories
'
)
{
vm
.
tableData
=
[
{
name
:
t
(
'
radio
'
,
'
Countries
'
),
type
:
'
folder
'
,
path
:
'
/categories/countries
'
,
},
{
name
:
t
(
'
radio
'
,
'
States
'
),
type
:
'
folder
'
,
path
:
'
/categories/states
'
,
},
{
name
:
t
(
'
radio
'
,
'
Languages
'
),
type
:
'
folder
'
,
path
:
'
/categories/languages
'
,
},
{
name
:
t
(
'
radio
'
,
'
Tags
'
),
type
:
'
folder
'
,
path
:
'
/categories/tags
'
,
},
]
vm
.
pageLoading
=
false
return
true
}
else
if
(
vm
.
$route
.
params
.
category
===
'
tags
'
)
{
if
(
vm
.
$route
.
params
.
query
)
{
queryURI
=
this
.
$apiUrl
+
'
/json/stations/search?tag=
'
+
vm
.
$route
.
params
.
query
+
'
&tagExact=true
'
}
else
{
queryURI
=
this
.
$apiUrl
+
'
/json/tags
'
}
}
else
if
(
vm
.
$route
.
params
.
category
===
'
countries
'
)
{
if
(
vm
.
$route
.
params
.
query
)
{
queryURI
=
this
.
$apiUrl
+
'
/json/stations/search?country=
'
+
vm
.
$route
.
params
.
query
+
'
&countryExact=true
'
}
else
{
queryURI
=
this
.
$apiUrl
+
'
/json/countries
'
}
}
else
if
(
vm
.
$route
.
params
.
category
===
'
states
'
)
{
if
(
vm
.
$route
.
params
.
query
)
{
queryURI
=
this
.
$apiUrl
+
'
/json/stations/search?state=
'
+
vm
.
$route
.
params
.
query
+
'
&stateExact=true
'
}
else
{
queryURI
=
this
.
$apiUrl
+
'
/json/states
'
}
}
else
if
(
vm
.
$route
.
params
.
category
===
'
languages
'
)
{
if
(
vm
.
$route
.
params
.
query
)
{
queryURI
=
this
.
$apiUrl
+
'
/json/stations/search?language=
'
+
vm
.
$route
.
params
.
query
+
'
&languageExact=true
'
}
else
{
queryURI
=
this
.
$apiUrl
+
'
/json/languages
'
}
}
}
// Skip loading more stations on certain sites
if
(
vm
.
tableData
.
length
>
0
&&
(
vm
.
$route
.
name
===
'
FAVORITES
'
||
vm
.
$route
.
name
===
'
RECENT
'
))
{
||
vm
.
$route
.
name
===
'
RECENT
'
||
vm
.
$route
.
name
===
'
CATEGORIES
'
))
{
return
true
}
...
...
@@ -330,23 +357,34 @@ export default {
queryURI
=
generateUrl
(
'
/apps/radio/api/recent
'
)
}
if
(
menuState
!==
'
CATEGORIES
'
)
{
vm
.
queryParams
=
{
limit
:
20
,
order
:
sortBy
,
reverse
:
true
,
offset
:
vm
.
tableData
.
length
,
}
}
else
{
vm
.
queryParams
=
{}
}
try
{
await
axios
.
get
(
queryURI
,
{
params
:
{
limit
:
20
,
order
:
sortBy
,
reverse
:
true
,
offset
:
vm
.
tableData
.
length
,
},
params
:
vm
.
queryParams
,
})
.
then
(
function
(
response
)
{
for
(
let
i
=
0
;
i
<
response
.
data
.
length
;
i
++
)
{
const
obj
=
response
.
data
[
i
]
let
blurHash
=
vm
.
blurHashes
[
obj
.
stationuuid
]
if
(
!
blurHash
)
{
blurHash
=
'
L1TSUA?bj[?b~qfQfQj[ayfQfQfQ
'
if
(
obj
.
stationuuid
)
{
let
blurHash
=
vm
.
blurHashes
[
obj
.
stationuuid
]
if
(
!
blurHash
)
{
blurHash
=
'
L1TSUA?bj[?b~qfQfQj[ayfQfQfQ
'
}
response
.
data
[
i
].
blurHash
=
blurHash
}
else
{
response
.
data
[
i
].
type
=
'
folder
'
response
.
data
[
i
].
path
=
vm
.
$route
.
path
+
'
/
'
+
obj
.
name
}
response
.
data
[
i
].
blurHash
=
blurHash
}
vm
.
tableData
=
vm
.
tableData
.
concat
(
response
.
data
)
vm
.
pageLoading
=
false
...
...
src/components/Table.vue
View file @
d5038611
...
...
@@ -10,7 +10,7 @@
</tr>
</thead>
<tbody>
<template
v-if=
"
stationData[0].type!=='folder'
"
>
<template
v-if=
"
!isFolder
"
>
<tr
v-for=
"(station, idx) in stationData"
:key=
"idx"
...
...
@@ -55,11 +55,11 @@
</td>
</tr>
</
template
>
<
template
v-if=
"
stationData[0].type==='folder'
"
>
<
template
v-if=
"
isFolder
"
>
<tr
v-for=
"(station, idx) in stationData"
:key=
"idx"
@
click=
"
doPlay(idx, station
)"
>
@
click=
"
changeRoute(station.path
)"
>
<td>
<span
class=
"icon-folder"
/>
</td>
...
...
@@ -98,6 +98,16 @@ export default {
data
:
()
=>
({
activeItem
:
null
,
}),
computed
:
{
isFolder
()
{
if
(
this
.
stationData
[
0
])
{
if
(
this
.
stationData
[
0
].
type
===
'
folder
'
)
{
return
true
}
}
return
false
},
},
methods
:
{
doPlay
(
idx
,
station
)
{
this
.
activeItem
=
idx
...
...
@@ -109,6 +119,9 @@ export default {
toggleSidebar
(
station
)
{
this
.
$emit
(
'
toggleSidebar
'
,
station
)
},
changeRoute
(
path
)
{
this
.
$router
.
push
({
path
})
},
},
}
</
script
>
...
...
src/router.js
View file @
d5038611
...
...
@@ -33,7 +33,7 @@ const router = new Router({
name
:
'
FAVORITES
'
,
},
{
path
:
'
/categories
'
,
path
:
'
/categories
/:category?/:query?
'
,
component
:
Main
,
name
:
'
CATEGORIES
'
,
},
...
...
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