Merge branch 'feature/shortcuts' into 'develop'
Feature/shortcuts See merge request funkwhale/funkwhale!16
This commit is contained in:
commit
0744669649
|
@ -1,4 +1,7 @@
|
||||||
import factory
|
import factory
|
||||||
|
import os
|
||||||
|
|
||||||
|
SAMPLES_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
class ArtistFactory(factory.django.DjangoModelFactory):
|
class ArtistFactory(factory.django.DjangoModelFactory):
|
||||||
|
@ -33,7 +36,8 @@ class TrackFactory(factory.django.DjangoModelFactory):
|
||||||
|
|
||||||
class TrackFileFactory(factory.django.DjangoModelFactory):
|
class TrackFileFactory(factory.django.DjangoModelFactory):
|
||||||
track = factory.SubFactory(TrackFactory)
|
track = factory.SubFactory(TrackFactory)
|
||||||
audio_file = factory.django.FileField()
|
audio_file = factory.django.FileField(
|
||||||
|
from_path=os.path.join(SAMPLES_PATH, 'test.ogg'))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = 'music.TrackFile'
|
model = 'music.TrackFile'
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"js-logger": "^1.3.0",
|
"js-logger": "^1.3.0",
|
||||||
"semantic-ui-css": "^2.2.10",
|
"semantic-ui-css": "^2.2.10",
|
||||||
"vue": "^2.3.3",
|
"vue": "^2.3.3",
|
||||||
|
"vue-global-events": "^1.0.2",
|
||||||
"vue-resource": "^1.3.4",
|
"vue-resource": "^1.3.4",
|
||||||
"vue-router": "^2.3.1",
|
"vue-router": "^2.3.1",
|
||||||
"vuedraggable": "^2.14.1"
|
"vuedraggable": "^2.14.1"
|
||||||
|
|
|
@ -86,6 +86,8 @@ class Queue {
|
||||||
cache.remove('queue')
|
cache.remove('queue')
|
||||||
}
|
}
|
||||||
setVolume (newValue) {
|
setVolume (newValue) {
|
||||||
|
newValue = Math.min(newValue, 1)
|
||||||
|
newValue = Math.max(newValue, 0)
|
||||||
this.state.volume = newValue
|
this.state.volume = newValue
|
||||||
if (this.audio.setVolume) {
|
if (this.audio.setVolume) {
|
||||||
this.audio.setVolume(newValue)
|
this.audio.setVolume(newValue)
|
||||||
|
@ -94,7 +96,9 @@ class Queue {
|
||||||
}
|
}
|
||||||
cache.set('volume', newValue)
|
cache.set('volume', newValue)
|
||||||
}
|
}
|
||||||
|
incrementVolume (value) {
|
||||||
|
this.setVolume(this.state.volume + value)
|
||||||
|
}
|
||||||
reorder (oldIndex, newIndex) {
|
reorder (oldIndex, newIndex) {
|
||||||
// called when the user uses drag / drop to reorder
|
// called when the user uses drag / drop to reorder
|
||||||
// tracks in queue
|
// tracks in queue
|
||||||
|
|
|
@ -87,10 +87,15 @@
|
||||||
<div class="ui inverted segment player-wrapper">
|
<div class="ui inverted segment player-wrapper">
|
||||||
<player></player>
|
<player></player>
|
||||||
</div>
|
</div>
|
||||||
|
<GlobalEvents
|
||||||
|
@keydown.r.stop="queue.restore"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import GlobalEvents from 'vue-global-events'
|
||||||
|
|
||||||
import Player from '@/components/audio/Player'
|
import Player from '@/components/audio/Player'
|
||||||
import favoriteTracks from '@/favorites/tracks'
|
import favoriteTracks from '@/favorites/tracks'
|
||||||
import Logo from '@/components/Logo'
|
import Logo from '@/components/Logo'
|
||||||
|
@ -109,7 +114,8 @@ export default {
|
||||||
Player,
|
Player,
|
||||||
SearchBar,
|
SearchBar,
|
||||||
Logo,
|
Logo,
|
||||||
draggable
|
draggable,
|
||||||
|
GlobalEvents
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -56,10 +56,20 @@
|
||||||
<i title="Clear your queue" @click="queue.clean()" :class="['ui', 'trash', 'secondary', {'disabled': queue.tracks.length === 0}, 'icon']" :disabled="queue.tracks.length === 0"></i>
|
<i title="Clear your queue" @click="queue.clean()" :class="['ui', 'trash', 'secondary', {'disabled': queue.tracks.length === 0}, 'icon']" :disabled="queue.tracks.length === 0"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<GlobalEvents
|
||||||
|
@keydown.space.prevent="pauseOrPlay"
|
||||||
|
@keydown.ctrl.left.prevent="queue.previous"
|
||||||
|
@keydown.ctrl.right.prevent="queue.next"
|
||||||
|
@keydown.ctrl.down.prevent="queue.incrementVolume(-0.1)"
|
||||||
|
@keydown.ctrl.up.prevent="queue.incrementVolume(0.1)"
|
||||||
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import GlobalEvents from 'vue-global-events'
|
||||||
|
|
||||||
import queue from '@/audio/queue'
|
import queue from '@/audio/queue'
|
||||||
import Track from '@/audio/track'
|
import Track from '@/audio/track'
|
||||||
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
||||||
|
@ -68,7 +78,8 @@ import radios from '@/radios'
|
||||||
export default {
|
export default {
|
||||||
name: 'player',
|
name: 'player',
|
||||||
components: {
|
components: {
|
||||||
TrackFavoriteIcon
|
TrackFavoriteIcon,
|
||||||
|
GlobalEvents
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue