<html><head></head><body>Hi,<br><br>No. That question was already addressed in more details in the first review thread.<br><br><div class="gmail_quote">Le 22 septembre 2020 08:35:04 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">diff --git a/share/ytdl-extract.py b/share/ytdl-extract.py<br>new file mode 100755<br>index 0000000000..71c79e0156<br>--- /dev/null<br>+++ b/share/ytdl-extract.py<br>@@ -0,0 +1,102 @@<br>+#! /usr/bin/python3<br>+#<br>+# Copyright (C) 2020 Rémi Denis-Courmont<br>+#<br>+# This program is free software; you can redistribute it and/or modify it<br>+# under the terms of the GNU Lesser General Public License as published by<br>+# the Free Software Foundation; either version 2.1 of the License, or<br>+# (at your option) any later version.<br>+#<br>+# This program is distributed in the hope that it will be useful,<br>+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>+# GNU Lesser General Public License for more details.<br>+#<br>+# You should have received a copy of the GNU Lesser General Public License<br>+# along with this program; if not, write to the Free Software Foundation,<br>+# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.<br>+<br>+import sys<br>+import youtube_dl<br>+<br>+class logger(object):<br>+    def debug(self, msg):<br>+        pass<br>+<br>+    def warning(self, msg):<br>+        pass<br>+<br>+    def error(self, msg):<br>+        sys.stderr.write(msg)<br>+<br>+def formats_choose_best(fmts):<br>+    # Pick our preferred format out of many<br>+    best_abr = -1<br>+    best_height = -1<br>+    best_format = None<br>+<br>+    for f in fmts:<br>+        if 'height' in f and f['height']:<br>+            height = f['height']<br>+        else:<br>+            height = 0<br>+<br>+        if height < best_height:<br>+            continue<br>+<br>+        if 'abr' in f and f['abr']:<br>+            abr = f['abr']<br>+        else:<br>+            abr = 0<br>+<br>+        if height == best_height or abr < best_abr:<br>+            continue<br>+<br>+        best_abr = abr<br>+        best_height = height<br>+        best_format = f<br>+<br>+    return best_format<br>+<br>+def entry_extract(entry):<br>+    # Process a given entry of a playlist<br>+    if 'formats' in entry:<br>+        fmt = formats_choose_best(entry['formats'])<br>+    else:<br>+        fmt = entry<br>+<br>+    if 'title' in entry:<br>+        print('#EXTINF:,,' + entry['title'].splitlines()[0])<br>+<br>+    if 'url' in fmt:<br>+        print('#EXTVLCOPT:no-ytdl') # don't parse recursively<br>+        print(fmt['url'])<br>+    else:<br>+        print('vlc://nop')<br>+<br>+def url_extract(url):<br>+    opts = {<br>+        'logger': logger(),<br>+    }<br>+<br>+    dl = youtube_dl.YoutubeDL(opts)<br>+    #dl.add_default_info_extractors()<br>+<br>+    # Process a given URL<br>+    infos = dl.extract_info(url, download=False)<br></blockquote><br>What happens if there's an error here ? Should the function/script <br>return an error rather than an empty M3U ?<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">+<br>+    print('#EXTM3U')<br>+<br>+    if 'title' in infos:<br>+        print('#PLAYLIST:' + infos['title'].splitlines()[0])<br>+<br>+    if 'entries' in infos:<br>+        # URL is a playlist: iterate over entries<br>+        for entry in infos['entries']:<br>+            entry_extract(entry)<br>+    else:<br>+        # URL is a single media<br>+        entry_extract(infos)<br>+<br>+<br>+url_extract(sys.argv[1])<br>-- <br>2.28.0<br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>