'Search and then list files from direcrtories and subdirectories

I have a bunch of movie and tv .strm files in kodi that im trying to search. The .strm files are located in library/video/movies and library/video/tv/{showname}

What im trying to do is enter a search string eg. Sta and get a list of movies or shows for example Star Wars, Star Wars - the Empire Strikes Back etc. note if I type Apex I do get Apex and Apex predators.

Also instead of printing it in the log I would like to display the results so that I can open the found links.

    PATH = xbmc.translatePath('special://home/userdata/library/') 
    fileName= xbmcgui.Dialog().input('Movie Title')

    @plugin.route('/movies_search')
    def movies_search():

        for root, dirs, files in os.walk(PATH):
            print('Looking in:',root)
            for Files in files:
                try:
                    found = Files.find(fileName)
                    # print(found)
                    if found != -1:
                        print()
                        print(fileName, 'Found\n')
                        break
                except:
                    exit()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source