Ticket #5394: mythtv-0.21-play-video.patch
File mythtv-0.21-play-video.patch, 6.5 KB (added by , 16 years ago) |
---|
-
programs/mythfrontend/playbackbox.cpp
17 17 #include <qsqldatabase.h> 18 18 #include <qmap.h> 19 19 #include <qwaitcondition.h> 20 #include <qdir.h> 20 21 21 22 #include <cmath> 22 23 #include <unistd.h> … … 2672 2673 if (m_player) 2673 2674 return true; 2674 2675 2676 if(!rec->isVideo) 2677 { 2675 2678 rec->pathname = rec->GetPlaybackURL(true); 2676 2679 2677 2680 if (rec->availableStatus == asNotYetAvailable) … … 2723 2726 2724 2727 return false; 2725 2728 } 2729 } 2726 2730 2727 2731 ProgramInfo *tvrec = new ProgramInfo(*rec); 2728 2732 … … 4234 4238 gContext->dispatch(me); 4235 4239 } 4236 4240 } 4241 else if (tokens.size() == 4 && tokens[2] == "VIDEO") 4242 { 4243 VERBOSE(VB_IMPORTANT, 4244 QString("NetworkControl: Trying to %1 video '%2'") 4245 .arg(tokens[1]).arg(tokens[3])); 4246 4247 if (playingSomething) 4248 { 4249 VERBOSE(VB_IMPORTANT, 4250 "NetworkControl: ERROR: Already playing"); 4251 4252 MythEvent me("NETWORK_CONTROL RESPONSE ERROR: Unable to play, " 4253 "player is already playing another recording."); 4254 gContext->dispatch(me); 4255 return; 4256 } 4257 4258 // Most of the info is empty for now 4259 ProgramInfo *tmpItem = new ProgramInfo(); 4260 tmpItem->recstartts = QDateTime::currentDateTime().addSecs(-180); 4261 tmpItem->recendts = QDateTime::currentDateTime().addSecs(-60); 4262 tmpItem->startts.setDate(QDate::fromString(QString("1970-01-01"), 4263 Qt::ISODate)); 4264 tmpItem->endts = QDateTime::currentDateTime().addSecs(-180); 4265 tmpItem->lenMins = 60; 4266 tmpItem->description = ""; 4267 tmpItem->title = ""; 4268 tmpItem->isVideo = true; 4269 tmpItem->pathname = tokens[3]; 4270 4271 QDir d(tokens[3] + "/VIDEO_TS"); 4272 if (tokens[3].findRev(".iso", -1, false) == (int)tokens[3].length() - 4 || 4273 tokens[3].findRev(".img", -1, false) == (int)tokens[3].length() - 4 || 4274 d.exists()) 4275 { 4276 tmpItem->pathname = QString("dvd:%1").arg(tokens[3]); 4277 } 4278 4279 if (tmpItem) 4280 { 4281 if (curitem) 4282 delete curitem; 4283 4284 curitem = tmpItem; 4285 4286 MythEvent me("NETWORK_CONTROL RESPONSE OK"); 4287 gContext->dispatch(me); 4288 4289 if (tokens[1] == "PLAY") 4290 curitem->setIgnoreBookmark(true); 4291 4292 underNetworkControl = true; 4293 4294 playSelected(); 4295 underNetworkControl = false; 4296 } 4297 else 4298 { 4299 QString message = QString("NETWORK_CONTROL RESPONSE " 4300 "ERROR: Could not find video %1") 4301 .arg(tokens[3]); 4302 MythEvent me(message); 4303 gContext->dispatch(me); 4304 } 4305 } 4237 4306 } 4238 4307 } 4239 4308 -
programs/mythfrontend/networkcontrol.cpp
334 334 QStringList tokens; 335 335 while (socket->canReadLine()) 336 336 { 337 lineIn = socket->readLine(); 338 lineIn.replace(QRegExp("[^-a-zA-Z0-9\\s\\.:_#/$%&()*+,;<=>?\\[\\]\\|]"), ""); 337 // Video filenames are in UTF8 338 lineIn = QString::fromUtf8(socket->readLine()); 339 // lineIn.replace(QRegExp("[^-a-zA-Z0-9\\s\\.:_#/$%&()*+,;<=>?\\[\\]\\|]"), ""); 339 340 lineIn.replace(QRegExp("[\r\n]"), ""); 340 341 lineIn.replace(QRegExp("^\\s"), ""); 341 342 … … 547 548 .arg(gContext->getCurrentLocation()); 548 549 } 549 550 } 551 else if ((tokens.size() >= 3) && 552 (is_abbrev("video", tokens[1]))) 553 { 554 if (gContext->getCurrentLocation() == "Playback") 555 { 556 QString message = QString("NETWORK_CONTROL STOP"); 557 MythEvent me(message); 558 gContext->dispatch(me); 559 560 QTime timer; 561 timer.start(); 562 while ((timer.elapsed() < 10000) && 563 (gContext->getCurrentLocation() == "Playback")) 564 usleep(10000); 565 } 566 567 if (gContext->getCurrentLocation() != "PlaybackBox") 568 { 569 gContext->GetMainWindow()->JumpTo(jumpMap["playbackbox"]); 570 571 QTime timer; 572 timer.start(); 573 while ((timer.elapsed() < 10000) && 574 (gContext->getCurrentLocation() != "PlaybackBox")) 575 usleep(10000); 576 } 577 578 if (gContext->getCurrentLocation() == "PlaybackBox") 579 { 580 QString action = "PLAY"; 581 if (tokens.size() == 5 && tokens[4] == "resume") 582 action = "RESUME"; 583 584 QString message = QString("NETWORK_CONTROL %1 VIDEO %2") 585 .arg(action).arg(tokens[2]); 586 MythEvent me(message); 587 gContext->dispatch(me); 588 589 result = ""; 590 } 591 else 592 { 593 result = QString("ERROR: Unable to change to PlaybackBox from " 594 "%1, can not play requested file.") 595 .arg(gContext->getCurrentLocation()); 596 } 597 } 550 598 // Everything below here requires us to be in playback mode so check to 551 599 // see if we are 552 600 else if (gContext->getCurrentLocation().lower() != "playback") … … 765 813 " - Play program with chanid & starttime\r\n" 766 814 "play program CHANID yyyy-mm-ddThh:mm:ss resume\r\n" 767 815 " - Resume program with chanid & starttime\r\n" 816 "play video filename\r\n" 817 " - Play filename video with Internal player\r\n" 818 "play video filename resume\r\n" 819 " - Resume filename video with Internal player\r\n" 768 820 "play save screenshot FILENAME\r\n" 769 821 " - Save screenshot from current position\r\n" 770 822 "play seek beginning - Seek to the beginning of the recording\r\n"