-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch2.py
More file actions
19 lines (17 loc) · 812 Bytes
/
scratch2.py
File metadata and controls
19 lines (17 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import mysql.connector as mariadb
import os.path
import subprocess
dirname = os.path.dirname(__file__)
file = os.path.join(dirname, 'NowOnAir/NowOnAir.txt')
NowOnAir = open(file, encoding='utf-8').readline()
NowOnAir = NowOnAir[7:]
conn = mariadb.connect(host='192.168.150.251', user='videostream', database='songsDB')
cursor = conn.cursor(buffered=True)
cursor.execute("""SELECT youtubeLink FROM songsDB WHERE songName = ' ' + '%s' """), (NowOnAir)
#cursor.execute("""SELECT youtubeLink FROM songsDB WHERE songName = 'Disclosure - Ultimatum' """)
conn.commit()
youtubeLink = cursor.fetchone()
youtubeLink = ' '.join(map(str, (youtubeLink)))
print (youtubeLink)
vlc_path = 'C:/Program Files/VideoLAN/VLC/vlc.exe'
subprocess.call([vlc_path, youtubeLink, '--play-and-exit', '--qt-start-minimized'], shell=False)