Browse Source

Do not use youtube-dl.

master
jvs 2 years ago
parent
commit
48a3da42ec
1 changed files with 9 additions and 14 deletions
  1. 9
    14
      striemtrien.py

+ 9
- 14
striemtrien.py View File

@@ -14,24 +14,20 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import subprocess
import time

class StriemTrien(object):
def __init__(self, page_url):
mpv_command = ['mpv', '--really-quiet', '--title=Striemtrien', page_url]
process = subprocess.Popen(mpv_command, stderr=subprocess.PIPE)
youtube_dl_command = "youtube-dl --get-url " + page_url
youtube_dl_output = subprocess.getoutput(youtube_dl_command)
if 'ERROR' in youtube_dl_output:
win.show_message("No video could be found for the entered URL. Try again.")
else:
video_url = youtube_dl_output
mpv_command = "mpv --really-quiet --title=Striemtrien " + video_url
subprocess.Popen(mpv_command.split())
Gtk.main_quit()

begintime = time.time()
while (time.time() - begintime) < 15:
if process.poll() == 2:
win.show_message("No video could be found for the entered URL. Try again.")
return
Gtk.main_quit()

class StriemTrienWindow(Gtk.Window):

@@ -60,7 +56,6 @@ class StriemTrienWindow(Gtk.Window):
button.connect("clicked", self.on_button_clicked)
def on_button_clicked(self, widget):
self.label.set_text(" ")
page_url = self.entry.get_text()
StriemTrien(page_url)

Loading…
Cancel
Save