Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
front
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
funkwhale
front
Commits
56eaea3a
Commit
56eaea3a
authored
8 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Fixed
#10
: now record track listens
parent
10efef52
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/audio/queue.js
+11
-0
11 additions, 0 deletions
src/audio/queue.js
with
11 additions
and
0 deletions
src/audio/queue.js
+
11
−
0
View file @
56eaea3a
import
logger
from
'
@/logging
'
import
logger
from
'
@/logging
'
import
cache
from
'
@/cache
'
import
cache
from
'
@/cache
'
import
config
from
'
@/config
'
import
Audio
from
'
@/audio
'
import
Audio
from
'
@/audio
'
import
backend
from
'
@/audio/backend
'
import
backend
from
'
@/audio/backend
'
import
radios
from
'
@/radios
'
import
radios
from
'
@/radios
'
import
Vue
from
'
vue
'
class
Queue
{
class
Queue
{
constructor
(
options
=
{})
{
constructor
(
options
=
{})
{
...
@@ -176,6 +178,7 @@ class Queue {
...
@@ -176,6 +178,7 @@ class Queue {
}
}
handleAudioEnded
(
e
)
{
handleAudioEnded
(
e
)
{
this
.
recordListen
(
this
.
currentTrack
)
if
(
this
.
currentIndex
<
this
.
tracks
.
length
-
1
)
{
if
(
this
.
currentIndex
<
this
.
tracks
.
length
-
1
)
{
logger
.
default
.
info
(
'
Audio track ended, playing next one
'
)
logger
.
default
.
info
(
'
Audio track ended, playing next one
'
)
this
.
next
()
this
.
next
()
...
@@ -185,6 +188,14 @@ class Queue {
...
@@ -185,6 +188,14 @@ class Queue {
}
}
}
}
recordListen
(
track
)
{
let
url
=
config
.
API_URL
+
'
history/listenings/
'
let
resource
=
Vue
.
resource
(
url
)
resource
.
save
({},
{
'
track
'
:
track
.
id
}).
then
((
response
)
=>
{},
(
response
)
=>
{
logger
.
default
.
error
(
'
Could not record track in history
'
)
})
}
previous
()
{
previous
()
{
if
(
this
.
currentIndex
>
0
)
{
if
(
this
.
currentIndex
>
0
)
{
this
.
play
(
this
.
currentIndex
-
1
)
this
.
play
(
this
.
currentIndex
-
1
)
...
...
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