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 zcmZQzU}Ruq2=oHc91Jhy85qPE7#K7d7#IQ>7#OB7K*Skv02e1)27g}?Ke4K)ncw|6ky z-ZzEe{?P?EOdk~<4S~@R7|bCcL~X#pz(CkYL4F<{9yT^M9v&V6LBh%jn#sq`h7LI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 zApZcwX8*xZ|DS>X1Aha<2mTKrcd|p+57__z|G@l%y@BC_`~i@g!R!a}2ju_%|HJr) zxq;zrY~N51V%IT(!uEhYV*^7& z9rF(c26+hkABfHWz@DLjq2Ukn2j&Ot59Av_Z1xZQKiEG&*$?FZFvHpQP&UIK_6PR= zAmR)^5NyUD><4V*AmWXG_#ag8Gyjl30E&zM|3C1<7|$^j5I`v)ld2LprsKR6qdP9W*_2LmXbFo4tT X4^YPW0}=lN$xz_54GLl~ZeRcaQ1K)n literal 0 HcmV?d00001 From b01ea2a77a94a98054ff42ac20be94e5edf378e0 Mon Sep 17 00:00:00 2001 From: Eliot Berriot 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 {