Comments (3)
any plans to add this? I have a (stupid) patch that yields Albums and Artists of the found tracks. Of course this may be incomplete as not all matching tracks for the search are returned. Anyway here is my patch:
diff --git a/mopidy_local_sqlite/library.py b/mopidy_local_sqlite/library.py
index 594068b..312961b 100644
--- a/mopidy_local_sqlite/library.py
+++ b/mopidy_local_sqlite/library.py
@@ -79,8 +79,18 @@ class SQLiteLibrary(local.Library):
filters = [f for uri in uris or [] for f in self._filters(uri) if f]
with self._connect() as c:
tracks = schema.search_tracks(c, q, limit, offset, exact, filters)
+ #extract album and artist data from the search result
+ #fixme: this only yields albums and artists that are referenced by the
+ #tracks result, which may be incomplete in case there is more than limit
+ #matching entries. To get the right behaviour, FTS should be implemented
+ #for artists and albums as well... (in the sql schema)
+ albums = set()
+ artists = set()
+ for t in tracks:
+ albums.add(t.album)
+ artists.add(t.artist)
uri = uritools.uricompose('local', path='search', query=q)
- return SearchResult(uri=uri, tracks=tracks)
+ return SearchResult(uri=uri, tracks=tracks, artists = artists, albums = albums)
def get_distinct(self, field, query=None):
q = []
I am sure, a proper solution would be to implement FTS for album and artist tables. But as I am not fluent in SQL, that's beyond my capabilities
from mopidy-local.
Thanks for sharing, but this wasn't exactly what I had in mind, though I see that it will improve things somewhat for some use cases.
I'd refrain from merging this though, because of the number of false positives it generates - for example, if the search string is found only in one track's title, I wouldn't expect the track's album to be part of the result.
from mopidy-local.
@chrisgee: The really tricky part is not just implementing this in SQL/FTS, but doing so efficiently, so it will run with medium-sized libraries (say 10,000 - 100,000 tracks) on a Pi0 in less than a second or so ;-)
from mopidy-local.
Related Issues (20)
- UTF-8 error with local extension HOT 3
- Always provide tags from Mopidy-Local if the track is indexed in the database
- TypeError: '<' not supported between instances of 'NoneType' and 'int' HOT 2
- Concept of 'local/directories'? HOT 3
- Prefer embed album art to folder album art HOT 3
- Support MusicBrainz ID queries
- get_distinct does not support field 'track'
- where is the SQLite database saved HOT 4
- Browsing directories by type 'date' returns incorrect names when format is not YYYY-MM-DD HOT 2
- Limit of searchresults are hardcoded HOT 5
- Multiple Music Directories HOT 1
- Doesn't Add any Music to Library HOT 6
- Compiling for nanoPi M4 (AArch64) – How? HOT 3
- Artist sort order HOT 7
- Not extracting images from m4a files when scanning HOT 11
- Not load from global config file HOT 1
- Prompt for confirmation when local library is empty HOT 5
- 'mopidy local scan' is using the wrong config file HOT 1
- Folder directory HOT 1
- Multiple filtering criteria when browsing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mopidy-local.