def Search(item):
  sub_data = read_sub(item)
  #### Do whats needed to get the list of subtitles from service site
  #### use item["some_property"] that was set earlier
  #### once done, set xbmcgui.ListItem() below and pass it to xbmcplugin.addDirectoryItem()
  if sub_data != None:
    log_my(sub_data)
    for it in sub_data:
      listitem = xbmcgui.ListItem(label=it['id'],                    # language name for the found subtitle
                                label2=get_info(it),               # file name for the found subtitle
                                iconImage=str(int(round(float(it['rating'])))), # rating for the subtitle, string 0-5
                                thumbnailImage="bg"          # language flag, ISO_639_1 language + gif extention, e.g - "en.gif"
                                )

      listitem.setProperty( "sync",        '{0}'.format("false").lower() )  # set to "true" if subtitle is matched by hash,
                                                                         # indicates that sub is 100 Comaptible

      listitem.setProperty( "hearing_imp", '{0}'.format("false").lower() ) # set to "true" if subtitle is for hearing impared


      ## below arguments are optional, it can be used to pass any info needed in download function
      ## anything after "action=download&" will be sent to addon once user clicks listed subtitle to downlaod
      url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (__scriptid__,
                                                                      it['url'],
                                                                      it['id'],
                                                                      "filename of the subtitle")
      ## add it to list, this can be done as many times as needed for all subtitles found
      xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem,isFolder=False)

    Notify('Server', 'ok')
  else:
    Notify('Server', 'error')
def Search(item):
    it = []
    _item = dict(item)
    it.append(item)
    _item['title'], _item['year'] = xbmc.getCleanMovieTitle(item['title'])
    it.append(_item)

    sub_data = read_sub(*it)
    #### Do whats needed to get the list of subtitles from service site
    #### use item["some_property"] that was set earlier
    #### once done, set xbmcgui.ListItem() below and pass it to xbmcplugin.addDirectoryItem()
    if sub_data != None:
        log_my(sub_data)
        for it in sub_data:
            listitem = xbmcgui.ListItem(
                label=it['id'],  # language name for the found subtitle
                label2=get_info(it),  # file name for the found subtitle
                iconImage=str(int(round(float(
                    it['rating'])))),  # rating for the subtitle, string 0-5
                thumbnailImage=
                "bg"  # language flag, ISO_639_1 language + gif extention, e.g - "en.gif"
            )

            listitem.setProperty("sync", '{0}'.format("false").lower(
            ))  # set to "true" if subtitle is matched by hash,
            # indicates that sub is 100 Comaptible

            listitem.setProperty("hearing_imp", '{0}'.format("false").lower(
            ))  # set to "true" if subtitle is for hearing impared

            ## below arguments are optional, it can be used to pass any info needed in download function
            ## anything after "action=download&" will be sent to addon once user clicks listed subtitle to downlaod
            url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (
                __scriptid__, it['url'], it['id'], "filename of the subtitle")
            ## add it to list, this can be done as many times as needed for all subtitles found
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                        url=url,
                                        listitem=listitem,
                                        isFolder=False)

        Notify('Server', 'ok')
    else:
        Notify('Server', 'error')