Created
November 29, 2023 10:33
-
-
Save kleutzinger/8a7af528fdccba68d53b912315f98534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
#__PUSH__# gist -u 8a7af528fdccba68d53b912315f98534 #__file__# | |
""" | |
from subprocess import check_output | |
import os | |
import time | |
VLC_CONFIG_PATH = os.path.join( | |
os.path.expanduser("~"), ".config", "vlc", "vlc-qt-interface.conf" | |
) | |
with open(VLC_CONFIG_PATH, "r") as f: | |
lines = f.readlines() | |
found = False | |
line = "" | |
for line in lines: | |
if found: | |
break | |
if "[RecentsMRL]" in line: | |
found = True | |
for i, val in enumerate(line.split(",")): | |
val = val.strip() | |
if i == 0: | |
val = val.lstrip("list=") | |
print(val) | |
# get zenity to confirm correct, capturing exit code | |
try: | |
output = check_output(["zenity", "--question", "--text", val]) | |
output = True | |
except: | |
output = False | |
if output: | |
print("confirmed") | |
else: | |
print("not confirmed") | |
exit() | |
with open( | |
os.path.join(os.path.expanduser("~"), ".t", "coconut.txt"), "a" | |
) as f2: | |
current_datetime = time.strftime("%Y-%m-%d %H:%M:%S") | |
f2.write(f"{current_datetime}\n{val}\n\n") | |
exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment