Ticket #1140: errorpatch

File errorpatch, 3.2 KB (added by lucas@…, 20 years ago)
Line 
1Index: mythdvd/mythdvd/dvdripbox.cpp
2===================================================================
3--- mythdvd/mythdvd/dvdripbox.cpp (revision 8742)
4+++ mythdvd/mythdvd/dvdripbox.cpp (working copy)
5@@ -439,12 +439,19 @@
6 QString line_from_server = QString::fromUtf8(client_socket->readLine());
7 line_from_server = line_from_server.replace( QRegExp("\n"), "" );
8 line_from_server = line_from_server.replace( QRegExp("\r"), "" );
9- line_from_server.simplifyWhiteSpace();
10- // cout << "Getting \"" << line_from_server.local8Bit() << "\"" << endl ;
11- QStringList tokens = QStringList::split(" ", line_from_server);
12- if(tokens.count() > 0)
13+
14+ if (line_from_server.startsWith("error"))
15 {
16- parseTokens(tokens);
17+ handleError(line_from_server);
18+ } else
19+ {
20+ line_from_server.simplifyWhiteSpace();
21+ // cout << "Getting \"" << line_from_server.local8Bit() << "\"" << endl ;
22+ QStringList tokens = QStringList::split(" ", line_from_server);
23+ if(tokens.count() > 0)
24+ {
25+ parseTokens(tokens);
26+ }
27 }
28 }
29 }
30@@ -481,6 +488,12 @@
31 }
32 }
33
34+void DVDRipBox::handleError(const QString& error) const
35+{
36+ MythPopupBox::showOkPopup(gContext->GetMainWindow(), tr("Error in MTD"), error);
37+}
38+
39+
40 void DVDRipBox::startStatusPolling()
41 {
42 status_timer->start(1000);
43Index: mythdvd/mythdvd/dvdripbox.h
44===================================================================
45--- mythdvd/mythdvd/dvdripbox.h (revision 8742)
46+++ mythdvd/mythdvd/dvdripbox.h (working copy)
47@@ -120,6 +120,7 @@
48
49 void wireUpTheme();
50 void createSocket();
51+ void handleError(const QString& errort) const;
52
53 QSocket *client_socket;
54 QTimer *status_timer;
55Index: mythdvd/mtd/mtd.cpp
56===================================================================
57--- mythdvd/mtd/mtd.cpp (revision 8742)
58+++ mythdvd/mtd/mtd.cpp (working copy)
59@@ -258,7 +258,8 @@
60 QString job_command = iterator->getJobString();
61 if(problem.length() > 0)
62 {
63- emit writeToLog(QString("job failed: %1").arg(job_command));
64+ emit writeToLog(QString("job failed: %1\nreason: %2").arg(job_command).arg(problem));
65+ errors_to_report << (QString("Problem: %1 Job: %2").arg(problem).arg(command));
66 //emit writeToLog(QString(" reason: %1").arg(problem));
67 }
68 else
69@@ -424,7 +425,11 @@
70 // each job.
71 //
72
73-
74+ for (uint i = 0; i < errors_to_report.count(); i++)
75+ {
76+ sendMessage(socket,"error "+errors_to_report[i]);
77+ }
78+ errors_to_report.clear();
79
80 sendMessage(socket, QString("status dvd summary %1").arg(job_threads.count()));
81
82Index: mythdvd/mtd/mtd.h
83===================================================================
84--- mythdvd/mtd/mtd.h (revision 8742)
85+++ mythdvd/mtd/mtd.h (working copy)
86@@ -103,6 +103,7 @@
87 QMutex *concurrent_transcodings_mutex;
88 int concurrent_transcodings;
89 int max_concurrent_transcodings;
90+ QStringList errors_to_report;
91 };
92
93 #endif // mtd_h_