<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body>
    <p>I didn't get a response about this patch that I sent on 12.8.20,</p>
    <p>could you please review it?</p>
    <p>Thanks, <br>
    </p>
    <p>Alon<br>
    </p>
    <div class="moz-forward-container">-------- Forwarded Message
      --------
      <table class="moz-email-headers-table" cellspacing="0"
        cellpadding="0" border="0">
        <tbody>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Subject:
            </th>
            <td>[PATCH] Add VLSub feature: Download multiple subtitles</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Date: </th>
            <td>Tue, 11 Aug 2020 18:20:21 +0000</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">From: </th>
            <td>Alon Sirota <a class="moz-txt-link-rfc2396E" href="mailto:sirotaalon@gmail.com"><sirotaalon@gmail.com></a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">To: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:vlc-devel@videolan.org">vlc-devel@videolan.org</a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">CC: </th>
            <td>Alon Sirota <a class="moz-txt-link-rfc2396E" href="mailto:sirota.alon@gmail.com"><sirota.alon@gmail.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      All selected subtitles are now downloaded, instead of only one.<br>
      <br>
      Change 'get_first_sel' function to return ALL selected subtitles<br>
      instead of only one, and refactored name to 'get_all_sel'.<br>
      <br>
      Change 'download_subtitles' function to iterate over 'get_all_sel'<br>
      returned table instead of downloading the only subtitle from old
      'get_first_sel'.<br>
      ---<br>
      share/lua/extensions/VLSub.lua | 20 ++++++++++++--------<br>
      1 file changed, 12 insertions(+), 8 deletions(-)<br>
      <br>
      diff --git a/share/lua/extensions/VLSub.lua
      b/share/lua/extensions/VLSub.lua<br>
      index 2edc73ecdc..ceb49e302d 100644<br>
      --- a/share/lua/extensions/VLSub.lua<br>
      +++ b/share/lua/extensions/VLSub.lua<br>
      @@ -1429,12 +1429,15 @@ function display_subtitles()<br>
      lang["mess_no_res"])<br>
      end<br>
      -function get_first_sel(list)<br>
      + function get_all_sel(list)<br>
      local selection = list:get_selection()<br>
      + local indexes = {}<br>
      + local i = 1 -- key counter<br>
      for index, name in pairs(selection) do<br>
      - return index<br>
      + indexes[i] = index<br>
      + i = i + 1<br>
      end<br>
      - return 0<br>
      + return indexes<br>
      end<br>
      function find_subtitle_in_archive(archivePath, subfileExt)<br>
      @@ -1453,18 +1456,18 @@ function
      find_subtitle_in_archive(archivePath, subfileExt)<br>
      end<br>
      function download_subtitles()<br>
      - local index = get_first_sel(input_table["mainlist"])<br>
      -<br>
      - if index == 0 then<br>
      + local indexes = get_all_sel(input_table["mainlist"])<br>
      + if #indexes == 0 then -- if no subtitles selected<br>
      setMessage(lang["mess_no_selection"])<br>
      return false<br>
      end<br>
      -<br>
      openSub.actionLabel = lang["mess_downloading"]<br>
      display_subtitles() -- reset selection<br>
      - local item = openSub.itemStore[index]<br>
      + -- for each subtitle index<br>
      + for _, index in pairs(indexes) do<br>
      + item = openSub.itemStore[index]<br>
      if openSub.option.downloadBehaviour == 'manual'<br>
      or not openSub.file.hasInput then<br>
      @@ -1581,6 +1584,7 @@ function download_subtitles()<br>
      setMessage(message)<br>
      end<br>
      +end<br>
      function dump_zip(url, dir, subfileName)<br>
      -- Dump zipped data in a temporary file<br>
      <pre class="moz-signature">-- 
2.28.0

</pre>
    </div>
  </body>
</html>