From 8c7e943013b7adb4d246d3ec0b50cfb36dc8467d Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 18:27:41 +0100 Subject: [PATCH 01/12] Fixed #73: broken file upload --- CHANGELOG | 3 +++ api/funkwhale_api/music/utils.py | 9 ++++++++- api/tests/music/test_utils.py | 19 +++++++++++++++++++ .../components/library/import/FileUpload.vue | 4 ++-- 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 api/tests/music/test_utils.py diff --git a/CHANGELOG b/CHANGELOG index c02e7665e..dc8f4df03 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,9 @@ Changelog 0.6 (Unreleased) ---------------- +- Fixed broken file import due to wrong url (#73) +- More accurate mimetype detection + 0.5.1 (2018-02-24) ------------------ 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/src/components/library/import/FileUpload.vue b/front/src/components/library/import/FileUpload.vue index 35b7b636a..1b90adc9d 100644 --- a/front/src/components/library/import/FileUpload.vue +++ b/front/src/components/library/import/FileUpload.vue @@ -29,7 +29,7 @@ -

+

Once all your files are uploaded, simply head over import detail page to check the import status.

@@ -73,7 +73,7 @@ export default { data () { return { files: [], - uploadUrl: 'import-jobs/', + uploadUrl: '/api/v1/import-jobs/', batch: null } }, From 94f8aabaa27dc5c3a86664a8850fbf38649f4a74 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 19:01:14 +0100 Subject: [PATCH 02/12] Fixed really small size on small screens --- CHANGELOG | 1 + front/index.html | 1 + front/src/App.vue | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index dc8f4df03..529d6fb7c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Changelog - Fixed broken file import due to wrong url (#73) - More accurate mimetype detection +- Fixed really small size on small screens. 0.5.1 (2018-02-24) diff --git a/front/index.html b/front/index.html index 55e32a7ee..d3cf01069 100644 --- a/front/index.html +++ b/front/index.html @@ -3,6 +3,7 @@ Funkwhale +
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(" Date: Mon, 26 Feb 2018 20:07:29 +0100 Subject: [PATCH 03/12] Install masonry dependency --- front/package.json | 2 ++ front/src/main.js | 3 +++ 2 files changed, 5 insertions(+) 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/main.js b/front/src/main.js index 2e351310a..caf924188 100644 --- a/front/src/main.js +++ b/front/src/main.js @@ -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 From ce1447064e89481a7b7d5610a3b4772b3d9dfe79 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 20:08:23 +0100 Subject: [PATCH 04/12] Masonry on artist list --- front/src/components/audio/album/Card.vue | 2 +- front/src/components/audio/artist/Card.vue | 4 ++-- front/src/components/library/Artists.vue | 10 +++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/front/src/components/audio/album/Card.vue b/front/src/components/audio/album/Card.vue index 968b828a4..45e50f897 100644 --- a/front/src/components/audio/album/Card.vue +++ b/front/src/components/audio/album/Card.vue @@ -67,7 +67,7 @@ export default { data () { return { backend: backend, - initialTracks: 4, + initialTracks: 5, showAllTracks: false } }, diff --git a/front/src/components/audio/artist/Card.vue b/front/src/components/audio/artist/Card.vue index 9a82d6c8f..a51114345 100644 --- a/front/src/components/audio/artist/Card.vue +++ b/front/src/components/audio/artist/Card.vue @@ -54,8 +54,8 @@ export default { data () { return { backend: backend, - initialAlbums: 3, - showAllAlbums: false + initialAlbums: 30, + showAllAlbums: true } }, computed: { diff --git a/front/src/components/library/Artists.vue b/front/src/components/library/Artists.vue index c9bea5efc..3cf123447 100644 --- a/front/src/components/library/Artists.vue +++ b/front/src/components/library/Artists.vue @@ -34,8 +34,16 @@ -
+
Date: Mon, 26 Feb 2018 20:08:50 +0100 Subject: [PATCH 05/12] Fixed usernamed not displayed on import request --- front/src/components/requests/Card.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/components/requests/Card.vue b/front/src/components/requests/Card.vue index deb9c3fe0..17fecde52 100644 --- a/front/src/components/requests/Card.vue +++ b/front/src/components/requests/Card.vue @@ -5,10 +5,10 @@
-
+
@@ -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 - +
From 86fb49a71c4711899504c8baf5257a594a5d0d34 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 20:09:02 +0100 Subject: [PATCH 06/12] Masonry on request list --- front/src/components/requests/RequestsList.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/front/src/components/requests/RequestsList.vue b/front/src/components/requests/RequestsList.vue index cb3e9af00..33ba04f53 100644 --- a/front/src/components/requests/RequestsList.vue +++ b/front/src/components/requests/RequestsList.vue @@ -34,8 +34,16 @@
-
+
Date: Mon, 26 Feb 2018 20:09:16 +0100 Subject: [PATCH 07/12] Minor responsive tweak --- front/src/components/library/Artist.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/components/library/Artist.vue b/front/src/components/library/Artist.vue index c2834e1de..7724428ca 100644 --- a/front/src/components/library/Artist.vue +++ b/front/src/components/library/Artist.vue @@ -30,7 +30,7 @@

Albums by this artist

-
+
From 7b9792c2f408d5f3c2774f9c25b4877e64ebf96e Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 20:10:35 +0100 Subject: [PATCH 08/12] Masonry on radios list --- front/src/components/library/Radios.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/front/src/components/library/Radios.vue b/front/src/components/library/Radios.vue index 1952908ff..303ce100e 100644 --- a/front/src/components/library/Radios.vue +++ b/front/src/components/library/Radios.vue @@ -36,8 +36,16 @@
-
+
Date: Mon, 26 Feb 2018 20:11:21 +0100 Subject: [PATCH 09/12] Fixed #68: changelog --- CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 529d6fb7c..2a898eb06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,7 +6,8 @@ Changelog - Fixed broken file import due to wrong url (#73) - More accurate mimetype detection -- Fixed really small size on small screens. +- Fixed really small size on small screens +- Added masonry layout for artists, requests and radios (#68) 0.5.1 (2018-02-24) From 61c7e2d1e2932675940a69454c1d0d7dff0efa65 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Mon, 26 Feb 2018 21:20:24 +0100 Subject: [PATCH 10/12] We now have a favicon --- CHANGELOG | 1 + front/index.html | 1 + front/static/favicon.png | Bin 0 -> 8190 bytes 3 files changed, 2 insertions(+) create mode 100644 front/static/favicon.png diff --git a/CHANGELOG b/CHANGELOG index 2a898eb06..42b149c37 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ Changelog - 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! 0.5.1 (2018-02-24) diff --git a/front/index.html b/front/index.html index d3cf01069..da815d619 100644 --- a/front/index.html +++ b/front/index.html @@ -3,6 +3,7 @@ Funkwhale + diff --git a/front/static/favicon.png b/front/static/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..089442fab7cb4e68cec9de87d421b64495e3263a GIT binary patch literal 8190 zcmeI1zi;J45XZ;&lIJA%a!y=O;+8)GWPvCU0--CAKvYOThXhn0L7pj)PKX8(nk&#< zM@dHqmJp(#prD|jz$N7?T|7NAvpch%-Ssb_6d=W?*yG*V&wl5J?I;J3;J^DX0-jIc z?*iZn0C)<2?&Hrj{?Pc?@%(eoz$-7m0B^khD!lXdoAAN=@50q5AHk1bJPSX4^%8vk z;4}E;;cM{q^_TGLe`2GR>`NK8*_4A`K{O$N{25vL(AI?C2 z(+9>nkG#w_o6UN?#`DGHy!$NkUWzdPIL)TH)6Ba*Ox@j^z)mnTg%~i?i!tmdlkzur zjO1X1IipcFO9v}9%#7kwYDAO62Wc8(!2;a ziplBZ9C@PEBPxQud9J*jOBFMiFpF4+gi2!!_3Fa&B8O^Z-GTrNlL5x&6BlhLD$We) zhVq4Pqwn`WL#jg}U4flk};1U_Eijc&`lMCmf`d9Or(cr}mb^pYhy>GjbcC(}Tj zMc+9e9|@c z-66AcM`i3fp#fv>0Sd7j{AP-ct6*z=(8V~B|Bmd`jyGiE0vfNNKsRdx(ra9d;|IvP zu7#3py5K-T_Rh$tGO`=mvujdgr)2C_WY<}T65539s%!zWJsQx#7B^nurGf)`;s2mo z8!vcltFnT9av-~`iwfG+9H@1E!kHI<+d)-uC7+7pX~$LSyKXz?^nB3 zlcF@TQA(Tc*lr4(6T4&^_Gwcd>^KJF?4(WWr=PUrpYF5f!)(+GyOo3^qelq=y-PQ Date: Mon, 26 Feb 2018 21:31:39 +0100 Subject: [PATCH 11/12] Fixed #65: truncated play icon --- CHANGELOG | 1 + front/src/components/audio/album/Card.vue | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 42b149c37..1f2dd97b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ Changelog - 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/front/src/components/audio/album/Card.vue b/front/src/components/audio/album/Card.vue index 45e50f897..ea42f06a8 100644 --- a/front/src/components/audio/album/Card.vue +++ b/front/src/components/audio/album/Card.vue @@ -17,7 +17,7 @@
-
+ @@ -85,6 +85,9 @@ export default {