From 6310449b71e27032fd25cccf9909d66da86694e5 Mon Sep 17 00:00:00 2001 From: Markil3 <75867393+Markil3@users.noreply.github.com> Date: Wed, 11 Aug 2021 12:27:15 -0600 Subject: [PATCH] Removes the vlc://quit call from the playlist This ensures that subsequent calls to the play utility always goes through, even if something else is already playing. One issue is that subsequent calls to this program while an existing instance is running will cause the second program to simply cancel while the first continues with its new playlist. This can make process monitoring difficult. --- play | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/play b/play index 171ac8a..f31eac3 100644 --- a/play +++ b/play @@ -1,26 +1,9 @@ #!/usr/bin/env python - -''' -Copyright (C) 2021 Markil 3 - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' - import pathlib from pathlib import Path from urllib import parse import subprocess +import os import sys import random from os.path import exists @@ -278,13 +261,13 @@ m3u, playlist Normally, playlists are ignored during the file search. vlcArgs = ["cvlc"] if "l" in options: vlcArgs.append("--loop") - else: - files.append("vlc://quit") + #else: + #files.append("vlc://quit") vlcArgs += files #print(" ".join(vlcArgs)) print("Launching VLC: %s" % (vlcArgs)) - process = subprocess.Popen(vlcArgs, stdout=sys.stdout, stderr=sys.stderr) if not "l" in options: - exit(process.wait()) + os.execvp(vlcArgs[0], vlcArgs) else: + subprocess.Popen(vlcArgs, stdout=sys.stdout, stderr=sys.stderr) exit(0)