Kodi Community Forum
Release GlobalSearch Script - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: Release GlobalSearch Script (/showthread.php?tid=109301)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42


RE: [Release] GlobalSearch Script - ronie - 2014-04-13

(2014-04-13, 21:40)rayman1278 Wrote: Hi ronie,

your script is great, is it working on Gotham and Aeon Nox 4.1.9 ?
I think here is a bug in the info few. My Version of globalsearch is 2.0.8.

Image

Thanks for your help

Alex

since that's a skin problem, you'll have to report it to the author of Aeon Nox 4.1.9


RE: [Release] GlobalSearch Script - braz - 2014-04-27

Hi Ronie,

Thanks for a great addon, I use it all the time. I just skinned Global Search for a mod of Aeon Nox 5 that I'm working on. I want to put the number of results in the topbar but can't change the font weight because it is defined in the script.

For the next version of GS, would it be possible to bold these controls in the theme files rather than in the script?

The affected labels are 110, 120, 130, 140, 150, 160, 170, 180. And button 198.

Thanks!

http://forum.xbmc.org/showthread.php?tid=192623&pid=1691921#pid1691921


RE: [Release] GlobalSearch Script - ronie - 2014-04-27

(2014-04-27, 00:44)bryanbrazil Wrote: Hi Ronie,

Thanks for a great addon, I use it all the time. I just skinned Global Search for a mod of Aeon Nox 5 that I'm working on. I want to put the number of results in the topbar but can't change the font weight because it is defined in the script.

For the next version of GS, would it be possible to bold these controls in the theme files rather than in the script?

The affected labels are 110, 120, 130, 140, 150, 160, 170, 180. And button 198.

Thanks!

http://forum.xbmc.org/showthread.php?tid=192623&pid=1691921#pid1691921

you can define the font weight in the Font.xml file of the skin:
Code:
        <font>
            <name>font20</name>
            <filename>Arial.ttf</filename>
            <size>20</size>
            <style>bold</style>
        </font>



RE: [Release] GlobalSearch Script - braz - 2014-04-28

(2014-04-27, 15:28)ronie Wrote: you can define the font weight in the Font.xml file of the skin:
Code:
        <font>
            <name>font20</name>
            <filename>Arial.ttf</filename>
            <size>20</size>
            <style>bold</style>
        </font>

Thanks, that worked.


RE: [Release] GlobalSearch Script - braz - 2014-04-29

(2014-04-28, 03:46)bryanbrazil Wrote:
(2014-04-27, 15:28)ronie Wrote: you can define the font weight in the Font.xml file of the skin:
Code:
        <font>
            <name>font20</name>
            <filename>Arial.ttf</filename>
            <size>20</size>
            <style>bold</style>
        </font>

Thanks, that worked.

At least I thought it worked. Can't seem to unbold the "Searching...Movies" label using <style>normal</style>.


RE: [Release] GlobalSearch Script - ronie - 2014-04-30

(2014-04-29, 04:58)bryanbrazil Wrote: At least I thought it worked. Can't seem to unbold the "Searching...Movies" label using <style>normal</style>.

yeah, that one is indeed controlled by the script.
i'll probably change that in a future version, so skins can have full control over it.


Re: RE: [Release] GlobalSearch Script - braz - 2014-04-30

(2014-04-30, 16:31)ronie Wrote:
(2014-04-29, 04:58)bryanbrazil Wrote: At least I thought it worked. Can't seem to unbold the "Searching...Movies" label using <style>normal</style>.

yeah, that one is indeed controlled by the script.
i'll probably change that in a future version, so skins can have full control over it.

Thanks!


RE: [Release] GlobalSearch Script - spoyser - 2014-05-24

@ronie

Any chance you could make a small change to the script, something along the lines of this:

Code:
if ( __name__ == "__main__" ):
    searchstring = None
    if len(sys.argv) > 1:
        try:
            param = sys.argv[1]
            if param.startswith('searchstring:'):
                import urllib
                searchstring = param.split(':')[1]
                searchstring = urllib.unquote_plus(searchstring)
                searchstring = searchstring.replace('\'', '')
                searchstring = searchstring.replace('"',  '')
        except:
            searchstring = None
            
    if not searchstring:    
        keyboard = xbmc.Keyboard( '', __language__(32101), False )
        keyboard.doModal()
        if ( keyboard.isConfirmed() ):
            searchstring = keyboard.getText()

    if searchstring:
        import gui
        ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring )
        ui.doModal()
        del ui
        sys.modules.clear()

This would allow the script to be initiated in code but with the search term pre-configured like this:

Code:
xbmc.executebuiltin('RunScript(script.globalsearch,searchstring:The%20Flintstones)')


The would be very useful for something I'm developing, and useful for other too of course Smile

Edit:
Not to worry, I have achieved the same result using a bespoke loader for your GUI
Great script by the way!


RE: [Release] GlobalSearch Script - josch - 2014-06-11

@spoyser: I wanted the same function and just did the needed changes in the code.

For those who want to achieve the same:

File to edit: default.py

Replace:
Code:
if ( __name__ == "__main__" ):
    keyboard = xbmc.Keyboard( '', __language__(32101), False )
    keyboard.doModal()
    if ( keyboard.isConfirmed() ):
        searchstring = keyboard.getText()
        if searchstring:
            import gui
            ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring )
            ui.doModal()
            del ui
            sys.modules.clear()

With:
Code:
if ( __name__ == "__main__" ):
    if len(sys.argv) > 1 and sys.argv[1][:13] == "searchstring:":
        searchstring = sys.argv[1][13:]
    else:
        keyboard = xbmc.Keyboard( '', __language__(32101), False )
        keyboard.doModal()
        if ( keyboard.isConfirmed() ):
            searchstring = keyboard.getText()
            
    if searchstring:
        import gui
        ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring )
        ui.doModal()
        del ui
        sys.modules.clear()

Now you can use the globalsearch script like:

RunScript(script.globalsearch,searchstring:yoursearchterm)


[Release] GlobalSearch Script - spoyser - 2014-06-13

(2014-06-11, 16:48)josch Wrote: @spoyser: I wanted the same function and just did the needed changes in the code.

For those who want to achieve the same:

File to edit: default.py

Replace:
Code:
if ( __name__ == "__main__" ):
    keyboard = xbmc.Keyboard( '', __language__(32101), False )
    keyboard.doModal()
    if ( keyboard.isConfirmed() ):
        searchstring = keyboard.getText()
        if searchstring:
            import gui
            ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring )
            ui.doModal()
            del ui
            sys.modules.clear()

With:
Code:
if ( __name__ == "__main__" ):
    if len(sys.argv) > 1 and sys.argv[1][:13] == "searchstring:":
        searchstring = sys.argv[1][13:]
    else:
        keyboard = xbmc.Keyboard( '', __language__(32101), False )
        keyboard.doModal()
        if ( keyboard.isConfirmed() ):
            searchstring = keyboard.getText()
            
    if searchstring:
        import gui
        ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring )
        ui.doModal()
        del ui
        sys.modules.clear()

Now you can use the globalsearch script like:

RunScript(script.globalsearch,searchstring:yoursearchterm)

I actually did it a different way in the end which didn't require any changes to the original script, by instantiating a gui.GUI object in my own code.


RE: [Release] GlobalSearch Script - whatUwant - 2014-09-18

I have the same problem:
(2014-03-02, 20:22)emitflesti Wrote: Hello.
Nice script and quick replies, I see.

I'm having difficulties searching on Original Title. I have verified my test entries have an original title by choosing the Movie Information context from List View in library. The field Original Title has text in it.

When I search on that text, I get no results.

Any thoughts?

Please and thanks
ef

(2014-03-02, 22:48)ronie Wrote: [xbmc does not provide a way to filter out movies by original title through the json interface the addon uses.
Indeed. GlobalSearch utilizes VideoLibrary.GetMovies method of JSON-RPC API while List.Filter.Fields.Movies does not support filtering by originaltitle.

So I decide to do it in a much slower way: traversing every single movie item and searching title/originaltitle fields for the search term.

File to edit: gui.py
  1. Line 126, replace
    Code:
    json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["title", "streamdetails", "genre", "studio", "year", "tagline", "plot", "plotoutline", "runtime", "fanart", "thumbnail", "file", "trailer", "playcount", "rating", "mpaa", "director", "writer"], "sort": { "method": "label" }, "filter": {"field":"title","operator":"contains","value":"%s"} }, "id": 1}' % self.searchstring)
    with
    Code:
    json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["title", "streamdetails", "genre", "studio", "year", "tagline", "plot", "plotoutline", "runtime", "fanart", "thumbnail", "file", "trailer", "playcount", "rating", "mpaa", "director", "writer", "originaltitle"], "sort": { "method": "label" } }, "id": 1}')
  2. Before line 131
    Code:
    movie = item['title']
    insert new lines
    Code:
    if (item['title'].lower().find(unicode(self.searchstring.lower(), 'utf-8', errors='ignore')) == -1) and (item['originaltitle'].lower().find(unicode(self.searchstring.lower(), 'utf-8', errors='ignore')) == -1):
                        continue
  3. Save the file and restart XBMC

I practically know nothing about Python so my solution is probably quite ugly. But it works. Wink


RE: [Release] GlobalSearch Script - Milhouse - 2014-10-13

With a current Helix build, I've noticed the following errors when performing a Global Search (skin is stock Confluence):
Code:
23:31:10 6657.607910 T:2682254416  NOTICE: Thread LanguageInvoker start, auto delete: false
23:31:11 6657.955566 T:2682254416  NOTICE: -->Python Interpreter Initialized<--
23:31:34 6681.797852 T:2682254416   ERROR: EXCEPTION: Non-Existent Control 219
23:31:34 6681.829590 T:3043323904   ERROR: Control 9000 in window 13002 has been asked to focus, but it can't
23:31:35 6682.129883 T:3043323904   ERROR: Control 141 in window 13002 has been asked to focus, but it can't
and then after closing the search listing (either by dismissing it, or selecting an item for playback):
Code:
23:32:46 6753.496582 T:2682254416   ERROR: CPythonInvoker(11, /storage/.xbmc/addons/script.globalsearch/default.py): failed to run the gc to clean up after running prior to shutting down the Interpreter
23:32:46 6753.497070 T:2682254416 WARNING: CPythonInvoker(11, /storage/.xbmc/addons/script.globalsearch/default.py): the python script "/storage/.xbmc/addons/script.globalsearch/default.py" has left several classes in memory that we couldn't clean up. The classes include: N14PythonBindings30XBMCAddon_xbmc_Player_DirectorE,N14PythonBindings42XBMCAddon_xbmcgui_WindowXMLDialog_DirectorE

Log here (with debug enabled for Global Search at the end)


RE: [Release] GlobalSearch Script - ronie - 2014-10-13

(2014-10-13, 00:40)Milhouse Wrote: With a current Helix build, I've noticed the following errors when performing a Global Search (skin is stock Confluence):
Code:
23:31:10 6657.607910 T:2682254416  NOTICE: Thread LanguageInvoker start, auto delete: false
23:31:11 6657.955566 T:2682254416  NOTICE: -->Python Interpreter Initialized<--
23:31:34 6681.797852 T:2682254416   ERROR: EXCEPTION: Non-Existent Control 219
23:31:34 6681.829590 T:3043323904   ERROR: Control 9000 in window 13002 has been asked to focus, but it can't
23:31:35 6682.129883 T:3043323904   ERROR: Control 141 in window 13002 has been asked to focus, but it can't

thanx! i thought i'd taken care of that long time ago, but apparently it slipped my mind.

fix: https://github.com/xbmc/xbmc/commit/5f8406b05d7e8a36d55f2961fb2ed821a751343b

(2014-10-13, 00:40)Milhouse Wrote: and then after closing the search listing (either by dismissing it, or selecting an item for playback):
Code:
23:32:46 6753.496582 T:2682254416   ERROR: CPythonInvoker(11, /storage/.xbmc/addons/script.globalsearch/default.py): failed to run the gc to clean up after running prior to shutting down the Interpreter
23:32:46 6753.497070 T:2682254416 WARNING: CPythonInvoker(11, /storage/.xbmc/addons/script.globalsearch/default.py): the python script "/storage/.xbmc/addons/script.globalsearch/default.py" has left several classes in memory that we couldn't clean up. The classes include: N14PythonBindings30XBMCAddon_xbmc_Player_DirectorE,N14PythonBindings42XBMCAddon_xbmcgui_WindowXMLDialog_DirectorE

Log here (with debug enabled for Global Search at the end)

i have no idea what any of that means. that's the territory of jfcarroll. ;-)


RE: [Release] GlobalSearch Script - Milhouse - 2014-10-13

(2014-10-13, 18:29)ronie Wrote: i have no idea what any of that means. that's the territory of jfcarroll. ;-)

Do you want a Trac ticket, or is jfcarroll known to pass through this way? Smile


RE: [Release] GlobalSearch Script - ronie - 2014-10-13

(2014-10-13, 18:33)Milhouse Wrote:
(2014-10-13, 18:29)ronie Wrote: i have no idea what any of that means. that's the territory of jfcarroll. ;-)

Do you want a Trac ticket, or is jfcarroll known to pass through this way? Smile

ticket or irc :-)