Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
funkwhale
funkwhale
Commits
5caf4ecc
Verified
Commit
5caf4ecc
authored
Dec 15, 2017
by
Agate
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #45: search template when querying import sources
parent
f8505336
Pipeline
#279
passed with stage
in 29 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
7 deletions
+34
-7
CHANGELOG
CHANGELOG
+2
-0
front/src/components/library/import/ArtistImport.vue
front/src/components/library/import/ArtistImport.vue
+5
-0
front/src/components/library/import/ImportMixin.vue
front/src/components/library/import/ImportMixin.vue
+14
-1
front/src/components/library/import/ReleaseImport.vue
front/src/components/library/import/ReleaseImport.vue
+1
-0
front/src/components/library/import/TrackImport.vue
front/src/components/library/import/TrackImport.vue
+12
-6
No files found.
CHANGELOG
View file @
5caf4ecc
...
...
@@ -5,6 +5,8 @@ Changelog
0.2.5 (unreleased)
------------------
- Import: can now specify search template when querying import sources (#45)
0.2.4 (2017-12-14)
------------------
...
...
front/src/components/library/import/ArtistImport.vue
View file @
5caf4ecc
...
...
@@ -12,6 +12,10 @@
<label>
{{
t
}}
</label>
</div>
</div>
<div
class=
"field"
>
<label>
Query template
</label>
<input
v-model=
"customQueryTemplate"
/>
</div>
</div>
</form>
<template
...
...
@@ -22,6 +26,7 @@
:backends=
"backends"
:defaultEnabled=
"false"
:default-backend-id=
"defaultBackendId"
:query-template=
"customQueryTemplate"
@
import-data-changed=
"recordReleaseData"
@
enabled=
"recordReleaseEnabled"
></release-import>
...
...
front/src/components/library/import/ImportMixin.vue
View file @
5caf4ecc
...
...
@@ -13,10 +13,12 @@ export default {
metadata
:
{
type
:
Object
,
required
:
true
},
defaultEnabled
:
{
type
:
Boolean
,
default
:
true
},
backends
:
{
type
:
Array
},
defaultBackendId
:
{
type
:
String
}
defaultBackendId
:
{
type
:
String
},
queryTemplate
:
{
type
:
String
,
default
:
'
$artist $title
'
}
},
data
()
{
return
{
customQueryTemplate
:
this
.
queryTemplate
,
currentBackendId
:
this
.
defaultBackendId
,
isImporting
:
false
,
enabled
:
this
.
defaultEnabled
...
...
@@ -56,6 +58,9 @@ export default {
return
this
.
backends
.
filter
(
b
=>
{
return
b
.
id
===
self
.
currentBackendId
})[
0
]
},
realQueryTemplate
()
{
}
},
watch
:
{
...
...
@@ -70,6 +75,14 @@ export default {
},
enabled
(
newValue
)
{
this
.
$emit
(
'
enabled
'
,
this
.
importData
,
newValue
)
},
queryTemplate
(
newValue
,
oldValue
)
{
// we inherit from the prop template unless the component changed
// the value
if
(
oldValue
===
this
.
customQueryTemplate
)
{
// no changed from prop, we keep the sync
this
.
customQueryTemplate
=
newValue
}
}
}
}
...
...
front/src/components/library/import/ReleaseImport.vue
View file @
5caf4ecc
...
...
@@ -20,6 +20,7 @@
:release-metadata=
"metadata"
:backends=
"backends"
:default-backend-id=
"defaultBackendId"
:query-template=
"customQueryTemplate"
@
import-data-changed=
"recordTrackData"
@
enabled=
"recordTrackEnabled"
></track-import>
...
...
front/src/components/library/import/TrackImport.vue
View file @
5caf4ecc
...
...
@@ -92,13 +92,7 @@ export default Vue.extend({
releaseMetadata
:
{
type
:
Object
,
required
:
true
}
},
data
()
{
let
queryParts
=
[
this
.
releaseMetadata
[
'
artist-credit
'
][
0
][
'
artist
'
][
'
name
'
],
this
.
releaseMetadata
[
'
title
'
],
this
.
metadata
[
'
recording
'
][
'
title
'
]
]
return
{
query
:
queryParts
.
join
(
'
'
),
isLoading
:
false
,
results
:
[],
currentResultIndex
:
0
,
...
...
@@ -151,6 +145,18 @@ export default Vue.extend({
mbid
:
this
.
metadata
.
recording
.
id
,
source
:
this
.
importedUrl
}
},
query
()
{
let
queryMapping
=
[
[
'
artist
'
,
this
.
releaseMetadata
[
'
artist-credit
'
][
0
][
'
artist
'
][
'
name
'
]],
[
'
album
'
,
this
.
releaseMetadata
[
'
title
'
]],
[
'
title
'
,
this
.
metadata
[
'
recording
'
][
'
title
'
]]
]
let
query
=
this
.
customQueryTemplate
queryMapping
.
forEach
(
e
=>
{
query
=
query
.
split
(
'
$
'
+
e
[
0
]).
join
(
e
[
1
])
})
return
query
}
},
watch
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment