Verified Commit 9dc69ac1 authored by Agate's avatar Agate 💬

Merge branch 'release/0.5.2'

parents 452193c6 84d6e22e
......@@ -5,6 +5,17 @@ Changelog
----------------
0.5.2 (2018-02-26)
------------------
- Fixed broken file import due to wrong url (#73)
- More accurate mimetype detection
- Fixed really small size on small screens
- Added masonry layout for artists, requests and radios (#68)
- We now have a favicon!
- Fixed truncated play icon (#65)
0.5.1 (2018-02-24)
------------------
......
# -*- coding: utf-8 -*-
__version__ = '0.5.1'
__version__ = '0.5.2'
__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])
import magic
import mimetypes
import re
from django.db.models import Q
......@@ -42,7 +43,13 @@ def get_query(query_string, search_fields):
def guess_mimetype(f):
b = min(100000, f.size)
return magic.from_buffer(f.read(b), mime=True)
t = magic.from_buffer(f.read(b), mime=True)
if t == 'application/octet-stream':
# failure, we try guessing by extension
mt, _ = mimetypes.guess_type(f.path)
if mt:
t = mt
return t
def compute_status(jobs):
......
from funkwhale_api.music import utils
def test_guess_mimetype_try_using_extension(factories, mocker):
mocker.patch(
'magic.from_buffer', return_value='audio/mpeg')
f = factories['music.TrackFile'].build(
audio_file__filename='test.ogg')
assert utils.guess_mimetype(f.audio_file) == 'audio/mpeg'
def test_guess_mimetype_try_using_extension_if_fail(factories, mocker):
mocker.patch(
'magic.from_buffer', return_value='application/octet-stream')
f = factories['music.TrackFile'].build(
audio_file__filename='test.mp3')
assert utils.guess_mimetype(f.audio_file) == 'audio/mpeg'
......@@ -3,6 +3,8 @@
<head>
<meta charset="utf-8">
<title>Funkwhale</title>
<link rel="shortcut icon" type="image/png" href="/static/favicon.png"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="app"></div>
......
......@@ -20,6 +20,7 @@
"js-logger": "^1.3.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.4",
"masonry-layout": "^4.2.1",
"moment": "^2.20.1",
"moxios": "^0.4.0",
"raven-js": "^3.22.3",
......@@ -27,6 +28,7 @@
"showdown": "^1.8.6",
"vue": "^2.3.3",
"vue-lazyload": "^1.1.4",
"vue-masonry": "^0.10.16",
"vue-router": "^2.3.1",
"vue-upload-component": "^2.7.4",
"vuedraggable": "^2.14.1",
......
......@@ -59,7 +59,7 @@ export default {
html, body {
@include media("<desktop") {
font-size: 200%;
font-size: 90%;
}
}
#app {
......
......@@ -17,7 +17,7 @@
<table class="ui very basic fixed single line compact unstackable table">
<tbody>
<tr v-for="track in tracks">
<td>
<td class="play-cell">
<play-button class="basic icon" :track="track" :discrete="true"></play-button>
</td>
<td colspan="6">
......@@ -67,7 +67,7 @@ export default {
data () {
return {
backend: backend,
initialTracks: 4,
initialTracks: 5,
showAllTracks: false
}
},
......@@ -85,6 +85,9 @@ export default {
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
table.fixed td.play-cell {
overflow: auto;
}
tr {
.favorite-icon:not(.favorited) {
display: none;
......
......@@ -54,8 +54,8 @@ export default {
data () {
return {
backend: backend,
initialAlbums: 3,
showAllAlbums: false
initialAlbums: 30,
showAllAlbums: true
}
},
computed: {
......
......@@ -30,7 +30,7 @@
</div>
<div class="ui vertical stripe segment">
<h2>Albums by this artist</h2>
<div class="ui stackable three column grid">
<div class="ui stackable doubling three column grid">
<div class="column" :key="album.id" v-for="album in albums">
<album-card :mode="'rich'" class="fluid" :album="album"></album-card>
</div>
......
......@@ -34,8 +34,16 @@
</div>
</div>
<div class="ui hidden divider"></div>
<div v-if="result" class="ui stackable three column grid">
<div
v-if="result"
v-masonry
transition-duration="0"
item-selector=".column"
percent-position="true"
stagger="0"
class="ui stackable three column doubling grid">
<div
v-masonry-tile
v-if="result.results.length > 0"
v-for="artist in result.results"
:key="artist.id"
......
......@@ -36,8 +36,16 @@
</div>
</div>
<div class="ui hidden divider"></div>
<div v-if="result" class="ui stackable three column grid">
<div
v-if="result"
v-masonry
transition-duration="0"
item-selector=".column"
percent-position="true"
stagger="0"
class="ui stackable three column doubling grid">
<div
v-masonry-tile
v-if="result.results.length > 0"
v-for="radio in result.results"
:key="radio.id"
......
......@@ -29,7 +29,7 @@
</button>
</div>
<div class="ui hidden divider"></div>
<p>
<p v-if="batch">
Once all your files are uploaded, simply head over <router-link :to="{name: 'library.import.batches.detail', params: {id: batch.id }}">import detail page</router-link> to check the import status.
</p>
<table class="ui single line table">
......@@ -73,7 +73,7 @@ export default {
data () {
return {
files: [],
uploadUrl: 'import-jobs/',
uploadUrl: '/api/v1/import-jobs/',
batch: null
}
},
......
......@@ -5,10 +5,10 @@
<div class="description">
<div
v-if="request.albums" v-html="$options.filters.markdown(request.albums)"></div>
<div v-if="request.comment" class="ui comments">
<div class="ui comments">
<comment
:user="request.user"
:content="request.comment"
:content="request.comment || ''"
:date="request.creation_date"></comment>
</div>
</div>
......@@ -24,7 +24,7 @@
@click="createImport"
v-if="request.status === 'pending' && importAction && $store.state.auth.availablePermissions['import.launch']"
class="ui mini basic green right floated button">Create import</button>
</div>
</div>
</template>
......
......@@ -34,8 +34,16 @@
</div>
</div>
<div class="ui hidden divider"></div>
<div v-if="result" class="ui stackable three column grid">
<div
v-if="result"
v-masonry
transition-duration="0"
item-selector=".column"
percent-position="true"
stagger="0"
class="ui stackable three column doubling grid">
<div
v-masonry-tile
v-if="result.results.length > 0"
v-for="request in result.results"
:key="request.id"
......
......@@ -9,6 +9,7 @@ import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import {VueMasonryPlugin} from 'vue-masonry'
import VueLazyload from 'vue-lazyload'
import store from './store'
import config from './config'
......@@ -24,7 +25,9 @@ window.$ = window.jQuery = require('jquery')
// play really nice with webpack and I want to get rid of Google Fonts
// require('./semantic/semantic.css')
require('semantic-ui-css/semantic.js')
require('masonry-layout')
Vue.use(VueMasonryPlugin)
Vue.use(VueLazyload)
Vue.config.productionTip = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment