-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
383f636
commit 8a48bb3
Showing
1 changed file
with
32 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,36 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
import os | ||
import sys, os | ||
from PyQt4 import QtGui, QtCore | ||
|
||
class Youtube2VLC(QtGui.QMainWindow): | ||
|
||
def __init__(self): | ||
super(Youtube2VLC, self).__init__() | ||
self.initUI() | ||
|
||
def initUI(self): | ||
self.btn = QtGui.QPushButton('Enter URL', self) | ||
self.btn.move(40, 20) | ||
self.btn.clicked.connect(self.showDialog) | ||
|
||
self.btn = QtGui.QPushButton('Exit', self) | ||
self.btn.move(180, 20) | ||
self.btn.clicked.connect(QtGui.qApp.quit) | ||
|
||
lbl = QtGui.QLabel('Last URL:', self) | ||
lbl.move(10, 60) | ||
|
||
self.lurl = QtGui.QLineEdit(self) | ||
self.lurl.move(100, 60) | ||
|
||
self.setGeometry(100, 100, 290, 100) | ||
self.setWindowTitle('Youtube2VLC') | ||
self.show() | ||
|
||
def showDialog(self): | ||
|
||
text, ok = QtGui.QInputDialog.getText(self, 'Video URL', | ||
'Enter video url:') | ||
|
||
if ok: | ||
self.lurl.setText(str(text)) | ||
os.system("vlc "+ str(text)) | ||
|
||
|
||
def main(): | ||
|
||
app = QtGui.QApplication(sys.argv) | ||
ex = Youtube2VLC() | ||
sys.exit(app.exec_()) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
def play(): | ||
os.system("vlc "+ (str(yturledit.text())) + " --play-and-exit") | ||
|
||
app = QtGui.QApplication(sys.argv) | ||
mainWindow = QtGui.QMainWindow() | ||
mainWindow.setWindowTitle("Youtube2VLC") | ||
mainWidget=QtGui.QWidget(mainWindow) | ||
mainWindow.setCentralWidget(mainWidget) | ||
layout=QtGui.QGridLayout(mainWidget) | ||
mainWindow.move(300,300) | ||
|
||
headerLabel=QtGui.QLabel(u"<h1>Youtube2VLC</h1>",mainWidget) | ||
headerLabel.setAlignment(QtCore.Qt.AlignHCenter) | ||
|
||
yturl=QtGui.QLabel("Youtube video URL:",mainWidget) | ||
yturledit=QtGui.QLineEdit(mainWidget) | ||
|
||
showPushButton=QtGui.QPushButton(u"Play",mainWidget) | ||
closePushButton=QtGui.QPushButton(u"Close",mainWidget) | ||
|
||
layout.addWidget(headerLabel,0,0,1,2) | ||
layout.addWidget(yturl,1,0) | ||
layout.addWidget(yturledit,1,1) | ||
layout.addWidget(showPushButton,3,0) | ||
layout.addWidget(closePushButton,3,1) | ||
|
||
app.connect(closePushButton,QtCore.SIGNAL("clicked ()"),mainWindow.close) | ||
app.connect(showPushButton,QtCore.SIGNAL("clicked ()"),play) | ||
|
||
mainWindow.show() | ||
sys.exit(app.exec_()) |