Commit Graph

7535 Commits

Author SHA1 Message Date
Rahul Raturi
6fbc47b9c0 Add checkbox to enable/disable adv query syntax 2016-08-01 19:38:13 +05:30
Rahul Raturi
508e7a5a28 Use dictionary to store track details
The existing `Track` class is just a wrapper around a dictionary.
So use a dictionary instead.
2016-08-01 19:38:13 +05:30
Rahul Raturi
6329678ecf Make country name translatable 2016-08-01 19:38:13 +05:30
Rahul Raturi
13fe7d25c5 Fix incorrect query generation on search 2016-08-01 19:38:13 +05:30
Rahul Raturi
b92cdba212 Display actual query when adv search is enabled
Don't allow modifying limit filter. Reason being:
1. As it is unrelated to search.
2. It will be irregular to allow changing the limit when advance
search syntax is enabled but not in the other case. If it's that
necessary, an option can be added to change the limit.
2016-08-01 19:38:13 +05:30
Rahul Raturi
d3b610ca7f Make release type translatable 2016-08-01 19:38:13 +05:30
Rahul Raturi
8524f9dd50 Display track's title on dialog's startup 2016-08-01 19:38:13 +05:30
Rahul Raturi
aab3b11a26 Make release title for NAT translatable 2016-08-01 19:38:13 +05:30
Rahul Raturi
b8616176e2 Replace try/except with if/else
Exception is difficult to follow. Instead use if/else logic.
2016-08-01 19:38:13 +05:30
Rahul Raturi
dc2827efac No need to use a tuple for single filter
Besides it wasn't a tuple, but was intended to be.
2016-08-01 19:38:13 +05:30
Rahul Raturi
022f7fedaa Make button title translatable 2016-08-01 19:38:13 +05:30
Rahul Raturi
8aaea54c8e Rename loading button and enable only on select 2016-08-01 19:38:13 +05:30
Rahul Raturi
2fc9bf70d2 Move show_table method to base class
It is supposed to be common among multiple search dialogs.
Just pass the table headers as arguments.
2016-08-01 19:38:13 +05:30
Rahul Raturi
32b672440a Fix margin of results table 2016-08-01 19:38:13 +05:30
Rahul Raturi
c66488c96d Display entered query when opening search dialog 2016-08-01 19:38:13 +05:30
Rahul Raturi
f26eb4f0e3 Rename similar tracks search action
And add an icon to it.
2016-08-01 19:38:13 +05:30
Rahul Raturi
21be45a457 Searching similar metadata for unmatched files 2016-08-01 19:38:13 +05:30
Rahul Raturi
4118defc04 Track object have no track_id attribute 2016-08-01 19:38:13 +05:30
Rahul Raturi
cf0c159d71 Some code style fixes 2016-08-01 19:38:13 +05:30
Rahul Raturi
e3415bdce6 Move file_ attribute to TrackSearchDialog 2016-08-01 19:38:13 +05:30
Rahul Raturi
e7a03cb9d1 Replace loader gif with a transparent one 2016-08-01 19:38:13 +05:30
Rahul Raturi
6038c19874 Unnecessary if/else logic 2016-08-01 19:38:13 +05:30
Rahul Raturi
39189df835 Rename obj->node 2016-08-01 19:38:13 +05:30
Rahul Raturi
a4b1186453 More precise (& compact) comment 2016-08-01 19:38:13 +05:30
Rahul Raturi
1c0550f58a Add support for NATs
To load an NAT, track's xml node is required. So I've created a
tuple wth track's xml node alongside with a Track(local) object,
and appended them to the search_results list.
2016-08-01 19:38:13 +05:30
Rahul Raturi
b3ee89835a Restructure some code
Reason being, I'm planning to add two more builtin search dialogs.
One for album and one for artist. It makes more sense to move
(possibly) common code to a separate class.
2016-08-01 19:38:13 +05:30
Rahul Raturi
2b790d94c1 Move track properties in a separate class
And some renaming of functions and variables.
2016-08-01 19:38:13 +05:30
Rahul Raturi
4ca5dd84b3 Fix missing space 2016-08-01 19:38:13 +05:30
Rahul Raturi
3051e8e6bc Refactor code for handling search requests
Some noticeable points:
* No need to separate code for auto lookups and searches. Only
the dismax filter setting and escaping lucene syntax part is
additional in searches. Rest is same for both.
* No need to pass advance query setting as argument. It can be
retrieved directly.
2016-08-01 19:38:13 +05:30
Rahul Raturi
0e58f0383a Need to append tuple to filter 2016-08-01 19:38:13 +05:30
Rahul Raturi
0b1079791e Minor code style fixes 2016-08-01 19:38:13 +05:30
Rahul Raturi
a4437a4d74 Fix missing limit filter for searches
And avoid using dismax filter for lookups.
2016-08-01 19:38:13 +05:30
Rahul Raturi
a8fa61d5d4 Update status tip for 'Display more results' 2016-08-01 19:38:13 +05:30
Rahul Raturi
c2da1026d7 Support advanced query syntax
Handle query searches differently from lookups. This would allow
to use the advanced query syntax.
2016-08-01 19:38:13 +05:30
Rahul Raturi
4528f489a3 Clear search results list before reusing 2016-08-01 19:38:13 +05:30
Rahul Raturi
c0caa037bb Better updation of results space
By "result space" I mean the area where feedback to user is
shown , i.e. progress, error and search results. As it is
updated frequently, rather than inserting and deleting widgets
directly into main layout, i.e. verticalLayout, updated a dummy
widget (i.e. center_widget), instead. This helps in two ways:

* Specifying widget properties for this one only.
* Layout remains unaffected.
2016-08-01 19:38:13 +05:30
Rahul Raturi
a77f4a46cf Add a search bar in dialog
* For further searching without closing the dialog.
* Pressing <Enter> after inserting a search query in the search
box would result in closing the dialog rather than searching. This
needs to be fixed.
2016-08-01 19:38:13 +05:30
Rahul Raturi
68ee7fc1b8 Handle dialog close exception
* AttributeError will be raised if the tracks are loading (
self.tracksTable will be undefined) and accept is triggerred.
Handle this case.
* Merge track_selected() and closeEvent() functionality into
self.accept().
2016-08-01 19:38:13 +05:30
Rahul Raturi
ce3e09a111 Display some informative text when tracks won't load 2016-08-01 19:38:13 +05:30
Rahul Raturi
90b1359db0 Make progress_widget attribute of class
* As it makes more sense.
* It is required to be removed later, when tracks are loaded or
some error occurs. So a local widget won't do.
2016-08-01 19:38:13 +05:30
Rahul Raturi
a140abbf04 Show loading gif while fetching results 2016-08-01 19:38:13 +05:30
Rahul Raturi
c6dda84743 Use dismax filter for search request 2016-08-01 19:38:13 +05:30
Rahul Raturi
3d3257f8dc Display track search results in dialog
If user chooses to, i.e. if config.setting["builtin_search"] is
set.
Don't pass the file object to SearchDialog.__init__(), as same
class is used for displaying search results, for which there are
no linked files.
2016-08-01 19:38:13 +05:30
Rahul Raturi
c2f2342ffb Revert metadata.py & file.py to commit -> 816e942
Don't return list of release. Release list can be extracted in
searchdialog.py. This is to make searchdialog.py more generic.
Same method (i.e. parse_tracks) can than be used to parse track
node for both displaying similar tracks and searching.
2016-08-01 19:38:13 +05:30
Rahul Raturi
6e2bb3a8d0 Add option for choice of lookup
If checked, use the search dialog to display results. Otherwise
perform regular browser lookup.
2016-08-01 19:38:13 +05:30
Rahul Raturi
57f194fe65 Show feedback to user during loading 2016-08-01 19:38:13 +05:30
Rahul Raturi
53f84c1ed6 Rename method that starts metadata download process 2016-08-01 19:38:13 +05:30
Rahul Raturi
2d5cfddc78 Move results table ui properties into separate class 2016-08-01 19:38:13 +05:30
Rahul Raturi
295291f9e4 Split restoring dialog state in different methods
Search results table isn't setup immediately after dialog is
displayed. Thus it's header state needs to be restored later, and
hence a separate method for that.
2016-08-01 19:38:13 +05:30
Rahul Raturi
d555e082c2 Use separate methods for handling selection method 2016-08-01 19:38:13 +05:30