diff --git a/CHANGELOG b/CHANGELOG index c02e7665e..1b98df96e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) ------------------ diff --git a/api/funkwhale_api/__init__.py b/api/funkwhale_api/__init__.py index d3e404f12..2df7e2034 100644 --- a/api/funkwhale_api/__init__.py +++ b/api/funkwhale_api/__init__.py @@ -1,3 +1,3 @@ # -*- 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('.')]) diff --git a/api/funkwhale_api/music/utils.py b/api/funkwhale_api/music/utils.py index a75cf5de8..df659cb80 100644 --- a/api/funkwhale_api/music/utils.py +++ b/api/funkwhale_api/music/utils.py @@ -1,4 +1,5 @@ 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): diff --git a/api/tests/music/test_utils.py b/api/tests/music/test_utils.py new file mode 100644 index 000000000..0a4f4b994 --- /dev/null +++ b/api/tests/music/test_utils.py @@ -0,0 +1,19 @@ +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' diff --git a/front/index.html b/front/index.html index 55e32a7ee..da815d619 100644 --- a/front/index.html +++ b/front/index.html @@ -3,6 +3,8 @@ Funkwhale + +
diff --git a/front/package.json b/front/package.json index 042e332d0..d6bdb8c56 100644 --- a/front/package.json +++ b/front/package.json @@ -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", diff --git a/front/src/App.vue b/front/src/App.vue index 8453aa339..3e39d7262 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -59,7 +59,7 @@ export default { html, body { @include media(" - + @@ -67,7 +67,7 @@ export default { data () { return { backend: backend, - initialTracks: 4, + initialTracks: 5, showAllTracks: false } }, @@ -85,6 +85,9 @@ export default {