2 '''A GUI to Movies2HDD.'''
19 print (
"Movies2HDD's graphical user interface Copyright (C) 2013 Niklas Sombert")
20 print (
"This program comes with ABSOLUTELY NO WARRANTY.")
21 print (
"This is free software, and you are welcome to redistribute it")
22 print (
"under certain conditions.")
27 sys.stdout.write(
"Loading...")
29 sys.stdout.write(
" PySide")
33 app = QApplication(sys.argv)
35 msg.setWindowTitle(
"Movies2HDD")
36 sys.stdout.write(
" Movies2HDD")
38 from movies2hdd
import Movies2HDD
40 sys.stdout.write(
" ...done.")
42 sys.stdout.write(
"\n")
50 self.setTitle(
"Select the folder and the series")
52 self.
introduction = QLabel(
"First, you need to select the folder where the movies are or should be placed. The name of the series is needed, too.")
53 self.introduction.setWordWrap(
True)
64 self.layout.addLayout(self.
form)
65 self.setLayout(self.
layout)
68 self.registerField(
"lang", self.
lang)
72 folder = QFileDialog.getExistingDirectory()
73 self.folder_selection.setText(folder)
74 self.setField(
"folder_selection", folder)
78 seriesselection.setWindowModality(Qt.WindowModal)
79 seriesselection.show()
82 if self.folder_selection.text() !=
"Select" and self.
series_selection !=
"Select" and self.folder_selection.text() !=
"":
85 msg.setText(
"You need to select a folder and a series first.")
92 self.setTitle(
"Connect to your Dreambox")
97 self.
check = QCheckBox(
"Do the movies need to be &downloaded?")
98 self.check.stateChanged.connect(self.
func_check)
99 self.layout.addWidget(self.
check)
101 self.
group = QGroupBox(
"Connection information")
102 self.group.layout = QVBoxLayout()
103 self.group.form = QFormLayout()
106 self.registerField(
"host", self.
host)
107 self.group.form.addRow(self.tr(
"&Host:"), self.
host)
109 self.registerField(
"user", self.
user)
110 self.group.form.addRow(self.tr(
"&User:"), self.
user)
111 self.
warning = QLabel(
"<strong color='red'>Warning:</strong> Your password will be sent unencryptedly!\nPlease do this only if you trust the network that you are currently connected to.\nOtherwise please tunnel your connection for example via SSH or VPN.")
112 self.warning.setWordWrap(
True)
113 self.group.form.addRow(self.
warning)
115 self.registerField(
"password", self.
password)
116 self.password.setEchoMode(QLineEdit.EchoMode.Password)
117 self.group.form.addRow(self.tr(
"&Password:"), self.
password)
119 self.group.layout.addLayout(self.group.form)
120 self.group.setLayout (self.group.layout)
121 self.layout.addWidget(self.
group)
122 self.group.setEnabled(
False)
124 self.setLayout(self.
layout)
127 self.group.setEnabled(self.check.isChecked())
131 if self.check.isChecked() ==
False:
135 movies2hdd.connect(self.host.text(), self.user.text(), self.password.text())
137 except Exception
as e:
139 msg.setText(
"Could not connect.\nPlease check your input and your connection.\n\nThe detailed error message is:\n"+str(e))
145 if self.check.isChecked() ==
False:
153 self.setTitle(
"Search for and select movies")
156 self.introduction.setWordWrap(
True)
160 self.form.addRow(self.tr(
"&Search string:"), self.
lineEdit)
161 self.layout.addLayout(self.
form)
166 self.layout.addWidget(self.
list)
167 self.setLayout(self.
layout)
173 movies = movies2hdd.getAviableMovies(self.lineEdit.text())
176 movies2hdd.connect(self.field(
"host"), self.field(
"user"), self.field(
"password"))
177 movies = movies2hdd.getAviableMovies(str(
""+self.lineEdit.text()))
178 except Exception
as e:
180 msg.setText(
"Something went wrong.\n\nThe detailed error message is:\n"+str(e))
185 self.list.addItem(QListWidgetItem(x))
193 super(SeriesSelection, self).
__init__(parent)
194 self.setWindowTitle(
"Series Selection")
196 self.
introduction = QLabel(
"Please enter the name of the series to search for and the language code.")
197 self.introduction.setWordWrap(
True)
200 self.form.series = QLineEdit()
201 self.form.addRow(self.tr(
"&Series:"), self.form.series)
202 self.form.lang = QLineEdit()
203 self.form.addRow(self.tr(
"&Language code:"), self.form.lang)
204 self.layout.addLayout(self.
form)
210 self.table.setColumnCount(3)
211 self.table.setHorizontalHeaderLabels([
"ID",
"Series",
"Overview"])
212 self.layout.addWidget(self.
table)
215 self.layout.addWidget(self.
button)
216 self.button.clicked.connect(self.
select)
218 self.setLayout(self.
layout)
230 series = movies2hdd.getSeries(self.form.series.text())
233 self.table.setRowCount(0)
234 self.table.setHorizontalHeaderLabels([
"ID",
"Series",
"Overview"])
237 flags = int(Qt.ItemIsEnabled)
238 self.table.setRowCount(self.table.rowCount() + 1)
239 sidItem = QTableWidgetItem(x[
'seriesid'])
240 sidItem.setFlags(flags)
241 self.table.setItem(self.table.rowCount() - 1, 0, sidItem)
242 SeriesNameItem = QTableWidgetItem(x[
'SeriesName'])
243 SeriesNameItem.setFlags(flags)
244 self.table.setItem(self.table.rowCount() - 1, 1, SeriesNameItem)
245 OverviewItem = QTableWidgetItem(x[
'Overview'].replace(
"\n",
" "))
246 OverviewItem.setFlags(flags)
247 self.table.setItem(self.table.rowCount() - 1, 2, OverviewItem)
248 except Exception
as e:
250 msg.setText(
"An error occured.\n\nThe detailed error message is:\n"+str(e))
257 if(self.form.lang.text()!=
""):
259 item = self.table.item(self.table.currentRow(), 0)
261 sid = str(int(item.text()))
262 self.parent().series_selection.setText(sid)
263 self.parent().setField(
"seriesid", sid)
264 self.parent().setField(
"lang", self.form.lang.text())
267 msg.setText(
"You need to select one series by clicking on it.")
270 msg.setText(
"You need to enter your language code.")
274 mainwindow = QWizard()
275 mainwindow.setWindowTitle(
"Movies2HDD")
276 mainwindow.step1 =
Step1()
277 mainwindow.step2 =
Step2()
278 mainwindow.step3 =
Step3()
279 mainwindow.addPage(mainwindow.step1)
280 mainwindow.addPage(mainwindow.step2)
281 mainwindow.addPage(mainwindow.step3)
285 movies2hdd.disconnect()