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.
This commit is contained in:
Markil3
2021-08-11 12:27:15 -06:00
committed by GitHub
parent afe8f1465c
commit 6310449b71

27
play
View File

@@ -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 <https://www.gnu.org/licenses/>.
'''
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)