Ticket #3842: 3842-head-v3.patch
File 3842-head-v3.patch, 31.2 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/videosource.h
110 110 { 111 111 Q_OBJECT 112 112 public: 113 DataDirect_config(const VideoSource& _parent, int _ source = DD_ZAP2IT);113 DataDirect_config(const VideoSource& _parent, int _ddsource); 114 114 115 115 virtual void load(void); 116 116 -
libs/libmythtv/datadirect.h
13 13 14 14 enum DD_PROVIDERS 15 15 { 16 DD_ZAP2IT = 0, 17 DD_PROVIDER_COUNT, 16 DD_ZAP2IT = 0, 17 DD_SCHEDULES_DIRECT = 1, 18 DD_PROVIDER_COUNT = 2, 18 19 }; 19 20 20 21 class DataDirectURLs … … 254 255 QString userid = "", QString password = ""); 255 256 ~DataDirectProcessor(); 256 257 258 QString CreateTempDirectory(void); 259 257 260 // web service commands 258 261 bool GrabData(const QDateTime pstartdate, const QDateTime penddate); 259 262 bool GrabNextSuggestedTime(void); … … 303 306 RawLineup GetRawLineup( const QString &lineupid) const; 304 307 305 308 // sets 306 void SetUserID( QString uid) { userid = uid; }307 void SetPassword( QString pwd) { password = pwd; }309 void SetUserID(const QString &uid); 310 void SetPassword(const QString &pwd); 308 311 void SetListingsProvider(uint i) 309 312 { listings_provider = i % DD_PROVIDER_COUNT; } 310 void SetInputFile(const QString &file) { inputfilename = file; }311 313 314 void SetInputFile(const QString &file); 315 void SetCacheData(bool cd) { cachedata = cd; } 316 312 317 // static commands (these update temp DB tables) 313 318 static void UpdateStationViewTable(QString lineupid); 314 319 static void UpdateProgramViewTable(uint sourceid); … … 326 331 bool ParseLineups(const QString &documentFile); 327 332 bool ParseLineup(const QString &lineupid, const QString &documentFile); 328 333 334 QString GetPostFilename(void) const; 335 QString GetResultFilename(void) const; 336 QString GetCookieFilename(void) const; 337 329 338 void SetAll(const QString &lineupid, bool val); 330 339 void SetDDProgramsStartAt(QDateTime begts) { actuallistingsfrom = begts; } 331 340 void SetDDProgramsEndAt(QDateTime endts) { actuallistingsto = endts; } … … 346 355 347 356 QString userid; 348 357 QString password; 358 QString tmpDir; 359 bool cachedata; 349 360 350 361 QDateTime actuallistingsfrom; 351 362 QDateTime actuallistingsto; … … 356 367 DDLineupList lineups; 357 368 DDLineupMap lineupmaps; 358 369 359 RawLineupMap rawlineups;360 QStringtmpPostFile;361 QStringtmpResultFile;362 QStringcookieFile;363 QDateTime cookieFileDT;370 RawLineupMap rawlineups; 371 mutable QString tmpPostFile; 372 mutable QString tmpResultFile; 373 mutable QString cookieFile; 374 QDateTime cookieFileDT; 364 375 }; 365 376 366 377 #endif -
libs/libmythtv/datadirect.cpp
6 6 7 7 // Qt headers 8 8 #include <qmap.h> 9 #include <qdir.h> 9 10 #include <qfile.h> 10 11 #include <qstring.h> 11 12 #include <qregexp.h> … … 25 26 #define SHOW_WGET_OUTPUT 0 26 27 27 28 #define LOC QString("DataDirect: ") 29 #define LOC_WARN QString("DataDirect, Warning: ") 28 30 #define LOC_ERR QString("DataDirect, Error: ") 29 31 30 32 static QMutex lineup_type_lock; … … 511 513 return true; 512 514 } 513 515 514 static QString makeTempFile(QString name_template)515 {516 const char *tmp = name_template.ascii();517 char *ctemplate = strdup(tmp);518 int ret = mkstemp(ctemplate);519 QString tmpFileName(ctemplate);520 free(ctemplate);521 522 if (ret == -1)523 {524 VERBOSE(VB_IMPORTANT, LOC_ERR + "Creating temp file from " +525 QString("template '%1'").arg(name_template) + ENO);526 return name_template;527 }528 close(ret);529 530 return tmpFileName;531 }532 533 516 DataDirectProcessor::DataDirectProcessor(uint lp, QString user, QString pass) : 534 517 listings_provider(lp % DD_PROVIDER_COUNT), 535 userid(user), password(pass), 536 inputfilename(""), tmpPostFile(""), 537 tmpResultFile(""), cookieFile(""), 518 userid(user), password(pass), 519 tmpDir("/tmp"), cachedata(false), 520 inputfilename(""), tmpPostFile(QString::null), 521 tmpResultFile(QString::null), cookieFile(QString::null), 538 522 cookieFileDT() 539 523 { 540 524 DataDirectURLs urls0( … … 542 526 "http://datadirect.webservices.zap2it.com/tvlistings/xtvdService", 543 527 "http://labs.zap2it.com", 544 528 "/ztvws/ztvws_login/1,1059,TMS01-1,00.html"); 529 DataDirectURLs urls1( 530 "Schedules Direct", 531 "http://webservices.schedulesdirect.tmsdatadirect.com" 532 "/schedulesdirect/tvlistings/xtvdService", 533 "http://schedulesdirect.org", 534 "/login/index.php"); 545 535 providers.push_back(urls0); 546 547 QString tmpDir = "/tmp"; 548 tmpPostFile = makeTempFile(tmpDir + "/mythtv_post_XXXXXX"); 549 tmpResultFile = makeTempFile(tmpDir + "/mythtv_result_XXXXXX"); 550 cookieFile = makeTempFile(tmpDir + "/mythtv_cookies_XXXXXX"); 536 providers.push_back(urls1); 551 537 } 552 538 553 539 DataDirectProcessor::~DataDirectProcessor() 554 540 { 555 unlink(tmpPostFile.ascii()); 556 unlink(tmpResultFile.ascii()); 557 unlink(cookieFile.ascii()); 541 VERBOSE(VB_GENERAL, LOC + "Deleting temporary files"); 542 543 if (!tmpPostFile.isEmpty()) 544 unlink(tmpPostFile.ascii()); 545 546 if (!tmpResultFile.isEmpty()) 547 unlink(tmpResultFile.ascii()); 548 549 if (!cookieFile.isEmpty()) 550 unlink(cookieFile.ascii()); 551 552 QDir d(tmpDir, "mythtv_dd_cache_*", QDir::Name, 553 QDir::Files | QDir::NoSymLinks); 554 555 for (uint i = 0; i < d.count(); i++) 556 { 557 //cout<<"deleting '"<<tmpDir<<"/"<<d[i]<<"'"<<endl; 558 unlink((tmpDir + "/" + d[i]).ascii()); 559 } 560 561 if (tmpDir != "/tmp") 562 rmdir(tmpDir.ascii()); 558 563 } 559 564 565 QString DataDirectProcessor::CreateTempDirectory(void) 566 { 567 if (tmpDir == "/tmp") 568 tmpDir = createTempFile("/tmp/mythtv_ddp_XXXXXX", true); 569 return QDeepCopy<QString>(tmpDir); 570 } 571 560 572 void DataDirectProcessor::UpdateStationViewTable(QString lineupid) 561 573 { 562 574 MSqlQuery query(MSqlQuery::DDCon()); … … 870 882 VERBOSE(VB_GENERAL, "Grabbing next suggested grabbing time"); 871 883 872 884 QString ddurl = providers[listings_provider].webServiceURL; 873 874 QFile postfile( tmpPostFile);885 886 QFile postfile(GetPostFilename()); 875 887 if (!postfile.open(IO_WriteOnly)) 876 888 { 877 889 VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Opening '%1'") 878 .arg( tmpPostFile) + ENO);890 .arg(GetPostFilename()) + ENO); 879 891 return false; 880 892 } 881 893 … … 896 908 897 909 QString command = QString("wget --http-user='%1' --http-passwd='%2' " 898 910 "--post-file='%3' %4 --output-document='%5'") 899 .arg(GetUserID()).arg(GetPassword()).arg( tmpPostFile)900 .arg(ddurl).arg( tmpResultFile);911 .arg(GetUserID()).arg(GetPassword()).arg(GetPostFilename()) 912 .arg(ddurl).arg(GetResultFilename()); 901 913 902 914 if (SHOW_WGET_OUTPUT) 903 915 VERBOSE(VB_GENERAL, "command: "<<command<<endl); … … 909 921 QDateTime NextSuggestedTime; 910 922 QDateTime BlockedTime; 911 923 912 QFile file( tmpResultFile);924 QFile file(GetResultFilename()); 913 925 914 926 bool GotNextSuggestedTime = false; 915 927 bool GotBlockedTime = false; … … 994 1006 995 1007 QString err = ""; 996 1008 QString ddurl = providers[listings_provider].webServiceURL; 1009 QString inputfile = inputfilename; 1010 QString cache_dd_data = QString::null; 997 1011 998 FILE *fp = DDPost(ddurl, tmpPostFile, inputfilename, 1012 if (cachedata) 1013 { 1014 cache_dd_data = tmpDir + QString("/mythtv_dd_cache_%1_%2_%3_%4") 1015 .arg(GetListingsProvider()) 1016 .arg(GetUserID().ascii()) 1017 .arg(pstartDate.toString()) 1018 .arg(pendDate.toString()); 1019 1020 if (QFile(cache_dd_data).exists() && inputfilename.isEmpty()) 1021 { 1022 VERBOSE(VB_GENERAL, LOC + "Copying from DD cache"); 1023 inputfile = cache_dd_data; 1024 } 1025 } 1026 1027 FILE *fp = DDPost(ddurl, GetPostFilename(), inputfile, 999 1028 GetUserID(), GetPassword(), 1000 1029 pstartDate, pendDate, err); 1001 1030 if (!fp) … … 1005 1034 return false; 1006 1035 } 1007 1036 1037 if (cachedata && (inputfile != cache_dd_data)) 1038 { 1039 QFile in, out(cache_dd_data); 1040 bool ok = out.open(IO_WriteOnly); 1041 if (!ok) 1042 { 1043 VERBOSE(VB_IMPORTANT, LOC_WARN + 1044 "Can not open DD cache file in '" + 1045 tmpDir + "' for writing!"); 1046 } 1047 else 1048 { 1049 VERBOSE(VB_GENERAL, LOC + "Saving listings to DD cache"); 1050 ok = in.open(IO_ReadOnly, fp); 1051 out.close(); // let copy routine handle dst file 1052 } 1053 1054 if (ok) 1055 { 1056 if (copy(out, in)) 1057 { 1058 pclose(fp); 1059 fp = fopen(cache_dd_data.ascii(), "r"); 1060 } 1061 else 1062 { 1063 VERBOSE(VB_IMPORTANT, 1064 LOC_ERR + "Failed to save DD cache! " 1065 "redownloading data..."); 1066 cachedata = false; 1067 pclose(fp); 1068 fp = DDPost(ddurl, GetPostFilename(), inputfile, 1069 GetUserID(), GetPassword(), 1070 pstartDate, pendDate, err); 1071 } 1072 } 1073 } 1074 1008 1075 QFile f; 1009 1076 if (f.open(IO_ReadOnly, fp)) 1010 1077 { … … 1083 1150 " channelMinor char(3) )"; 1084 1151 1085 1152 dd_tables["dd_schedule"] = 1086 "( programid char( 12), stationid char(12), "1153 "( programid char(40), stationid char(12), " 1087 1154 " scheduletime datetime, duration time, " 1088 1155 " isrepeat bool, stereo bool, " 1089 1156 " subtitled bool, hdtv bool, " … … 1093 1160 "INDEX progidx (programid) )"; 1094 1161 1095 1162 dd_tables["dd_program"] = 1096 "( programid char( 12) NOT NULL, seriesid char(12), "1163 "( programid char(40) NOT NULL, seriesid char(12), " 1097 1164 " title varchar(120), subtitle varchar(150), " 1098 1165 " description text, mpaarating char(5), " 1099 1166 " starrating char(5), runtime time, " … … 1115 1182 " partnumber int, parttotal int, " 1116 1183 " seriesid char(12), originalairdate date, " 1117 1184 " showtype varchar(30), colorcode varchar(20), " 1118 " syndicatedepisodenumber varchar(20), programid char( 12), "1185 " syndicatedepisodenumber varchar(20), programid char(40), " 1119 1186 " tvrating char(5), mpaarating char(5), " 1120 1187 "INDEX progidx (programid))"; 1121 1188 1122 1189 dd_tables["dd_productioncrew"] = 1123 "( programid char( 12), role char(30), "1190 "( programid char(40), role char(30), " 1124 1191 " givenname char(20), surname char(20), " 1125 1192 " fullname char(41), " 1126 1193 "INDEX progidx (programid), " 1127 1194 "INDEX nameidx (fullname))"; 1128 1195 1129 1196 dd_tables["dd_genre"] = 1130 "( programid char( 12) NOT NULL, class char(30), "1197 "( programid char(40) NOT NULL, class char(30), " 1131 1198 " relevance char(1), " 1132 1199 "INDEX progidx (programid))"; 1133 1200 … … 1148 1215 QString labsURL = providers[listings_provider].webURL; 1149 1216 QString loginPage = providers[listings_provider].loginPage; 1150 1217 1151 bool ok = Post(labsURL + loginPage, list, tmpResultFile, "", cookieFile); 1218 bool ok = Post(labsURL + loginPage, list, GetResultFilename(), "", 1219 GetCookieFilename()); 1152 1220 1153 bool got_cookie = QFileInfo( cookieFile).size() > 100;1221 bool got_cookie = QFileInfo(GetCookieFilename()).size() > 100; 1154 1222 1155 ok &= got_cookie && (!parse_lineups || ParseLineups( tmpResultFile));1223 ok &= got_cookie && (!parse_lineups || ParseLineups(GetResultFilename())); 1156 1224 if (ok) 1157 1225 cookieFileDT = QDateTime::currentDateTime(); 1158 1226 … … 1175 1243 list.push_back(PostItem("submit", "Modify")); 1176 1244 1177 1245 QString labsURL = providers[listings_provider].webURL; 1178 bool ok = Post(labsURL + (*it).get_action, list, tmpResultFile,1179 cookieFile, "");1246 bool ok = Post(labsURL + (*it).get_action, list, GetResultFilename(), 1247 GetCookieFilename(), ""); 1180 1248 1181 return ok && ParseLineup(lineupid, tmpResultFile);1249 return ok && ParseLineup(lineupid, GetResultFilename()); 1182 1250 } 1183 1251 1184 1252 void DataDirectProcessor::SetAll(const QString &lineupid, bool val) … … 1457 1525 .arg(lineupid).arg(list.size() - 1)); 1458 1526 1459 1527 QString labsURL = providers[listings_provider].webURL; 1460 return Post(labsURL + lineup.set_action, list, "", cookieFile, ""); 1528 return Post(labsURL + lineup.set_action, list, "", 1529 GetCookieFilename(), ""); 1461 1530 } 1462 1531 1463 1532 bool DataDirectProcessor::UpdateListings(uint sourceid) … … 1534 1603 return (*it); 1535 1604 } 1536 1605 1606 QString DataDirectProcessor::GetPostFilename(void) const 1607 { 1608 if (tmpPostFile.isEmpty()) 1609 tmpPostFile = createTempFile(tmpDir + "/mythtv_post_XXXXXX"); 1610 return QDeepCopy<QString>(tmpPostFile); 1611 } 1612 1613 QString DataDirectProcessor::GetResultFilename(void) const 1614 { 1615 if (tmpResultFile.isEmpty()) 1616 tmpResultFile = createTempFile(tmpDir + "/mythtv_result_XXXXXX"); 1617 return QDeepCopy<QString>(tmpResultFile); 1618 } 1619 1620 QString DataDirectProcessor::GetCookieFilename(void) const 1621 { 1622 if (cookieFile.isEmpty()) 1623 cookieFile = createTempFile(tmpDir + "/mythtv_cookies_XXXXXX"); 1624 return QDeepCopy<QString>(cookieFile); 1625 } 1626 1627 void DataDirectProcessor::SetUserID(const QString &uid) 1628 { 1629 userid = QDeepCopy<QString>(uid); 1630 } 1631 1632 void DataDirectProcessor::SetPassword(const QString &pwd) 1633 { 1634 password = QDeepCopy<QString>(pwd); 1635 } 1636 1637 void DataDirectProcessor::SetInputFile(const QString &file) 1638 { 1639 inputfilename = QDeepCopy<QString>(file); 1640 } 1641 1537 1642 bool DataDirectProcessor::Post(QString url, const PostList &list, 1538 1643 QString documentFile, 1539 1644 QString inCookieFile, QString outCookieFile) -
libs/libmythtv/videosource.cpp
20 20 #include <qmap.h> 21 21 #include <qdir.h> 22 22 #include <qprocess.h> 23 #include <qdatetime.h> 23 24 24 25 // MythTV headers 25 26 #include "mythconfig.h" … … 44 45 #include "videodev_myth.h" 45 46 #endif 46 47 48 static bool is_grabber_external(const QString &grabber) 49 { 50 return !(grabber == "datadirect" || 51 grabber == "eitonly" || 52 grabber == "schedulesdirect1" || 53 grabber == "/bin/true"); 54 } 55 47 56 VideoSourceSelector::VideoSourceSelector(uint _initial_sourceid, 48 57 const QString &_card_types, 49 58 bool _must_have_mplexid) : … … 295 304 { 296 305 public: 297 306 DataDirectPassword(const VideoSource &parent) : 298 LineEditSetting(this), VideoSourceDBStorage(this, parent, "password") 307 LineEditSetting(this, true), 308 VideoSourceDBStorage(this, parent, "password") 299 309 { 310 SetPasswordEcho(true); 300 311 setLabel(QObject::tr("Password")); 301 312 } 302 313 }; … … 307 318 { 308 319 (void) uid; 309 320 (void) pwd; 310 (void) _source;311 321 #ifdef USING_BACKEND 312 322 if (uid.isEmpty() || pwd.isEmpty()) 313 323 return; … … 348 358 void DataDirect_config::load() 349 359 { 350 360 VerticalConfigurationGroup::load(); 351 if ((userid->getValue() != lastloadeduserid) || 352 (password->getValue() != lastloadedpassword)) 361 bool is_sd_userid = userid->getValue().contains("@") > 0; 362 bool match = ((is_sd_userid && (source == DD_SCHEDULES_DIRECT)) || 363 (!is_sd_userid && (source == DD_ZAP2IT))); 364 if (((userid->getValue() != lastloadeduserid) || 365 (password->getValue() != lastloadedpassword)) && match) 353 366 { 354 367 lineupselector->fillSelections(userid->getValue(), 355 368 password->getValue(), … … 442 455 "instead of just 'mythfilldatabase'.\nYour grabber does not provide " 443 456 "channel numbers, so you have to set them manually."); 444 457 445 if (grabber != "datadirect" && grabber != "eitonly" && 446 grabber != "/bin/true") 458 if (is_grabber_external(grabber)) 447 459 { 448 460 VERBOSE(VB_IMPORTANT, "\n" << err_msg); 449 461 MythPopupBox::showOkPopup( … … 508 520 // only save settings for the selected grabber 509 521 setSaveAll(false); 510 522 511 addTarget("datadirect", new DataDirect_config(parent)); 512 grabber->addSelection("North America (DataDirect) (Internal)", "datadirect"); 523 addTarget("schedulesdirect1", 524 new DataDirect_config(parent, DD_SCHEDULES_DIRECT)); 525 grabber->addSelection("North America (SchedulesDirect.org) " 526 "(Internal)", "schedulesdirect1"); 513 527 528 #if 1 529 addTarget("datadirect", new DataDirect_config(parent, DD_ZAP2IT)); 530 grabber->addSelection( 531 "North America (TMS Labs) (Internal)", "datadirect"); 532 #endif 533 514 534 addTarget("eitonly", new EITOnly_config(parent)); 515 535 grabber->addSelection("Transmitted guide only (EIT)", "eitonly"); 516 536 -
libs/libmyth/settings.cpp
639 639 connect(edit, SIGNAL(changeHelpText(QString)), cg, 640 640 SIGNAL(changeHelpText(QString))); 641 641 642 edit->setRW(rw); 642 setRW(rw); 643 SetPasswordEcho(password_echo); 643 644 644 645 return widget; 645 646 } … … 664 665 } 665 666 } 666 667 668 void LineEditSetting::SetPasswordEcho(bool b) 669 { 670 password_echo = b; 671 if (edit) 672 edit->setEchoMode(b ? QLineEdit::Password : QLineEdit::Normal); 673 } 674 667 675 QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent, 668 676 const char* widgetName) { 669 677 QHBox* widget; -
libs/libmyth/util.cpp
32 32 #include <qpainter.h> 33 33 #include <qpixmap.h> 34 34 #include <qfont.h> 35 #include <qfile.h> 35 36 36 37 // Myth headers 37 38 #include "mythconfig.h" … … 603 604 604 605 return false; 605 606 } 607 608 /** \fn Copy(QFile&,QFile&,uint) 609 * \brief Copies src file to dst file. 610 * 611 * If the dst file is open, it must be open for writing. 612 * If the src file is open, if must be open for reading. 613 * 614 * The files will be in the same open or close state after 615 * this function runs as they were prior to this function being called. 616 * 617 * This function does not care if the files are actual files. 618 * For compatibility with pipes and socket streams the file location 619 * will not be reset to 0 at the end of this function. If the function 620 * is succesful the file pointers will be at the end of the copied 621 * data. 622 * 623 * \param dst Destination QFile 624 * \param src Source QFile 625 * \param block_size Optional block size in bytes, must be at least 1024, 626 * otherwise the default of 16 KB will be used. 627 * \return bytes copied on success, -1 on failure. 628 */ 629 long long copy(QFile &dst, QFile &src, uint block_size) 630 { 631 uint buflen = (block_size < 1024) ? (16 * 1024) : block_size; 632 char *buf = new char[buflen]; 633 bool odst = false, osrc = false; 634 635 if (!buf) 636 return -1LL; 637 638 if (!dst.isWritable() && !dst.isOpen()) 639 odst = dst.open(IO_Raw|IO_WriteOnly|IO_Truncate); 640 641 if (!src.isReadable() && !src.isOpen()) 642 osrc = src.open(IO_Raw|IO_ReadOnly); 643 644 bool ok = dst.isWritable() && src.isReadable(); 645 long long total_bytes = 0LL; 646 while (ok) 647 { 648 long long rlen, wlen, off = 0; 649 rlen = src.readBlock(buf, buflen); 650 if (rlen<0) 651 { 652 ok = false; 653 break; 654 } 655 if (rlen==0) 656 break; 657 658 total_bytes += (long long) rlen; 659 660 while ((rlen-off>0) && ok) 661 { 662 wlen = dst.writeBlock(buf + off, rlen - off); 663 if (wlen>=0) 664 off+= wlen; 665 if (wlen<0) 666 ok = false; 667 } 668 } 669 delete[] buf; 670 671 if (odst) 672 dst.close(); 673 674 if (osrc) 675 src.close(); 676 677 return (ok) ? total_bytes : -1LL; 678 } 679 680 QString createTempFile(QString name_template, bool dir) 681 { 682 const char *tmp = name_template.ascii(); 683 char *ctemplate = strdup(tmp); 684 int ret = -1; 685 686 if (dir) 687 { 688 ret = (mkdtemp(ctemplate)) ? 0 : -1; 689 } 690 else 691 { 692 ret = mkstemp(ctemplate); 693 } 694 695 QString tmpFileName(ctemplate); 696 free(ctemplate); 697 698 if (ret == -1) 699 { 700 VERBOSE(VB_IMPORTANT, QString("createTempFile(%1), Error ") 701 .arg(name_template) + ENO); 702 return name_template; 703 } 704 705 if (!dir && (ret >= 0)) 706 close(ret); 707 708 return tmpFileName; 709 } 710 -
libs/libmyth/util.h
16 16 class QImage; 17 17 class QPainter; 18 18 class QFont; 19 class QFile; 19 20 20 21 class MPUBLIC MythTimer 21 22 { … … 73 74 MPUBLIC bool ping(const QString &host, int timeout); 74 75 MPUBLIC bool telnet(const QString &host, int port); 75 76 77 MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0); 78 MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXX", 79 bool dir = false); 80 76 81 #endif // UTIL_H_ -
libs/libmyth/mythcontext.h
208 208 209 209 /// Update this whenever the plug-in API changes. 210 210 /// Including changes in the libmythtv class methods used by plug-ins. 211 #define MYTH_BINARY_VERSION "0.20.20070 717-1"211 #define MYTH_BINARY_VERSION "0.20.20070817-1" 212 212 213 213 /** \brief Increment this whenever the MythTV network protocol changes. 214 214 * -
libs/libmyth/settings.h
200 200 { 201 201 protected: 202 202 LineEditSetting(Storage *_storage, bool readwrite = true) : 203 Setting(_storage), edit(NULL), rw(readwrite) { }203 Setting(_storage), edit(NULL), rw(readwrite), password_echo(false) { } 204 204 205 205 public: 206 206 virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent, … … 217 217 218 218 virtual void setEnabled(bool b); 219 219 virtual void setVisible(bool b); 220 virtual void SetPasswordEcho(bool b); 220 221 221 222 private: 222 223 MythLineEdit* edit; 223 224 bool rw; 225 bool password_echo; 224 226 }; 225 227 226 228 // TODO: set things up so that setting the value as a string emits -
programs/mythfilldatabase/filldata.cpp
26 26 // filldata headers 27 27 #include "filldata.h" 28 28 29 bool is_grabber_external(const QString &grabber) 30 { 31 return !(grabber == "datadirect" || 32 grabber == "eitonly" || 33 grabber == "schedulesdirect1" || 34 grabber == "/bin/true"); 35 } 36 37 bool is_grabber_datadirect(const QString &grabber) 38 { 39 return (grabber == "datadirect") || (grabber == "schedulesdirect1"); 40 } 41 42 bool is_grabber_labs(const QString &grabber) 43 { 44 return grabber == "datadirect"; 45 } 46 29 47 // DataDirect stuff 30 48 void FillData::DataDirectStationUpdate(Source source, bool update_icons) 31 49 { … … 44 62 icon_data.UpdateSourceIcons(source.id); 45 63 46 64 // Unselect channels not in users lineup for DVB, HDTV 47 if (!insert_channels && (new_channels > 0)) 65 if (!insert_channels && (new_channels > 0) && 66 is_grabber_labs(source.xmltvgrabber)) 48 67 { 49 68 bool ok0 = (logged_in == source.userid); 50 69 bool ok1 = (raw_lineup == source.id); … … 69 88 70 89 bool FillData::DataDirectUpdateChannels(Source source) 71 90 { 91 if (!is_grabber_labs(source.xmltvgrabber)) 92 { 93 VERBOSE(VB_IMPORTANT, "FillData: We only support " 94 "DataDirectUpdateChannels with TMS Labs channel editor"); 95 return false; 96 } 97 72 98 ddprocessor.SetListingsProvider(DD_ZAP2IT); 73 99 ddprocessor.SetUserID(source.userid); 74 100 ddprocessor.SetPassword(source.password); … … 87 113 bool FillData::grabDDData(Source source, int poffset, 88 114 QDate pdate, int ddSource) 89 115 { 116 if (source.dd_dups.empty()) 117 ddprocessor.SetCacheData(false); 118 else 119 { 120 VERBOSE(VB_GENERAL, QString( 121 "This DataDirect listings source is " 122 "shared by %1 MythTV lineups") 123 .arg(source.dd_dups.size()+1)); 124 if (source.id > source.dd_dups[0]) 125 { 126 VERBOSE(VB_IMPORTANT, "We should use cached data for this one"); 127 } 128 else if (source.id < source.dd_dups[0]) 129 { 130 VERBOSE(VB_IMPORTANT, "We should keep data around after this one"); 131 } 132 ddprocessor.SetCacheData(true); 133 } 134 90 135 ddprocessor.SetListingsProvider(ddSource); 91 136 ddprocessor.SetUserID(source.userid); 92 137 ddprocessor.SetPassword(source.password); … … 251 296 252 297 if (xmltv_grabber == "datadirect") 253 298 return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT); 299 if (xmltv_grabber == "schedulesdirect1") 300 return grabDDData(source, offset, *qCurrentDate, DD_SCHEDULES_DIRECT); 254 301 255 302 char tempfilename[] = "/tmp/mythXXXXXX"; 256 303 if (mkstemp(tempfilename) == -1) … … 389 436 bool FillData::fillData(QValueList<Source> &sourcelist) 390 437 { 391 438 QValueList<Source>::Iterator it; 439 QValueList<Source>::Iterator it2; 392 440 393 441 QString status, querystr; 394 442 MSqlQuery query(MSqlQuery::InitCon()); … … 402 450 403 451 need_post_grab_proc = false; 404 452 int nonewdata = 0; 453 bool has_dd_source = false; 405 454 455 // find all DataDirect duplicates, so we only data download once. 406 456 for (it = sourcelist.begin(); it != sourcelist.end(); ++it) 407 457 { 458 if (!is_grabber_datadirect((*it).xmltvgrabber)) 459 continue; 408 460 461 has_dd_source = true; 462 for (it2 = sourcelist.begin(); it2 != sourcelist.end(); ++it2) 463 { 464 if (((*it).id != (*it2).id) && 465 ((*it).xmltvgrabber == (*it2).xmltvgrabber) && 466 ((*it).userid == (*it2).userid) && 467 ((*it).password == (*it2).password)) 468 { 469 (*it).dd_dups.push_back((*it2).id); 470 } 471 } 472 } 473 if (has_dd_source) 474 ddprocessor.CreateTempDirectory(); 475 476 for (it = sourcelist.begin(); it != sourcelist.end(); ++it) 477 { 478 409 479 query.prepare("SELECT MAX(endtime) FROM program p LEFT JOIN channel c " 410 480 "ON p.chanid=c.chanid WHERE c.sourceid= :SRCID " 411 481 "AND manualid = 0;"); … … 427 497 428 498 if (xmltv_grabber == "eitonly") 429 499 { 430 VERBOSE(VB_IMPORTANT, "Source configured to use only the " 431 "broadcasted guide data. Skipping."); 500 VERBOSE(VB_GENERAL, 501 QString("Source %1 configured to use only the " 502 "broadcasted guide data. Skipping.") 503 .arg((*it).id)); 504 432 505 externally_handled++; 433 506 query.exec(QString("UPDATE settings SET data ='%1' " 434 507 "WHERE value='mythfilldatabaseLastRunStart' OR " … … 440 513 xmltv_grabber == "none" || 441 514 xmltv_grabber == "") 442 515 { 443 VERBOSE(VB_IMPORTANT, 444 "Source configured with no grabber. Nothing to do."); 516 VERBOSE(VB_GENERAL, 517 QString("Source %1 configured with no grabber. " 518 "Nothing to do.").arg((*it).id)); 519 445 520 externally_handled++; 446 521 query.exec(QString("UPDATE settings SET data ='%1' " 447 522 "WHERE value='mythfilldatabaseLastRunStart' OR " … … 486 561 487 562 bool hasprefmethod = false; 488 563 489 if ( xmltv_grabber != "datadirect")564 if (is_grabber_external(xmltv_grabber)) 490 565 { 491 566 492 567 QProcess grabber_capabilities_proc(xmltv_grabber); … … 584 659 } 585 660 } 586 661 587 need_post_grab_proc |= (xmltv_grabber != "datadirect");662 need_post_grab_proc |= !is_grabber_datadirect(xmltv_grabber); 588 663 589 if ( (xmltv_grabber == "datadirect") && dd_grab_all)664 if (is_grabber_labs(xmltv_grabber) && dd_grab_all) 590 665 { 591 666 if (only_update_channels) 592 667 DataDirectUpdateChannels(*it); … … 601 676 if (!grabData(*it, 0)) 602 677 ++failures; 603 678 } 604 else if ((*it).xmltvgrabber_baseline || xmltv_grabber == "datadirect") 679 else if ((*it).xmltvgrabber_baseline || 680 is_grabber_datadirect(xmltv_grabber)) 605 681 { 606 682 607 683 QDate qCurrentDate = QDate::currentDate(); … … 612 688 613 689 if (maxDays > 0) // passed with --max-days 614 690 grabdays = maxDays; 615 else if ( xmltv_grabber == "datadirect")691 else if (is_grabber_datadirect(xmltv_grabber)) 616 692 grabdays = 14; 617 693 618 694 grabdays = (only_update_channels) ? 1 : grabdays; … … 620 696 if (grabdays == 1) 621 697 refresh_today = true; 622 698 623 if ( (xmltv_grabber == "datadirect") && only_update_channels)699 if (is_grabber_labs(xmltv_grabber) && only_update_channels) 624 700 { 625 701 DataDirectUpdateChannels(*it); 626 702 grabdays = 0; -
programs/mythfilldatabase/main.cpp
579 579 newsource.xmltvgrabber_prefmethod = ""; 580 580 581 581 sourcelist.append(newsource); 582 if (newsource.xmltvgrabber == "datadirect") 583 usingDataDirect = true; 582 usingDataDirect = 583 ((newsource.xmltvgrabber == "datadirect") || 584 (newsource.xmltvgrabber == "schedulesdirect1")); 584 585 } 585 586 } 586 587 else -
programs/mythfilldatabase/filldata.h
26 26 bool xmltvgrabber_manualconfig; 27 27 bool xmltvgrabber_cache; 28 28 QString xmltvgrabber_prefmethod; 29 vector<int> dd_dups; 29 30 }; 30 31 31 32 class FillData