Browse Source

Add error messages.

master
jvs 2 years ago
parent
commit
5cb31670e4
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      striemtrien.py

+ 7
- 7
striemtrien.py View File

@@ -33,17 +33,17 @@ class StriemTrien(object):
mpv_command.insert(1, '--no-video')
mpv_command.insert(2, '--force-window')
mpv_command.insert(3, '--window-scale=0.5')
self.process = subprocess.Popen(mpv_command, start_new_session=True)
def check(self):
self.process = subprocess.Popen(mpv_command, stdout=subprocess.PIPE) #start_new_session=True
#
#def check(self):
begintime = time.time()
while (time.time() - begintime) < 3:
returncode = self.process.poll()
if returncode == 2:
#error = self.process.stdout.read().decode('utf-8')
error = self.process.stdout.read().decode('utf-8')
win.show_message(
"<b>No video could be found for the entered URL. Try again.</b>\n"
# + error
+ error
)
return
Gtk.main_quit()
@@ -77,12 +77,12 @@ class StriemTrienWindow(Gtk.Window):
video_button = Gtk.Button(label="Play video")
hbox.pack_start(video_button, True, True, 1)
video_button.connect("clicked", self.on_button_clicked)
def on_button_clicked(self, widget, video=True):
page_url = self.entry.get_text()
striemtrien = StriemTrien(page_url, video)
striemtrien.start_mpv()
striemtrien.check()
#striemtrien.check()
def show_message(self, message):
print(message)

Loading…
Cancel
Save