diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 3d44aa1..65d3244 100644
a
|
b
|
void TV::ProcessNetworkControlCommand(PlayerContext *ctx, |
4634 | 4634 | DoSeek(ctx, rel_frame, tr("Jump To")); |
4635 | 4635 | } |
4636 | 4636 | } |
| 4637 | else if (tokens.size() >= 3 && tokens[1] == "VOLUME") { |
| 4638 | QRegExp re = QRegExp("(\\d+)%"); |
| 4639 | if (tokens[2].contains(re)) { |
| 4640 | QStringList matches = re.capturedTexts(); |
| 4641 | |
| 4642 | VERBOSE(VB_IMPORTANT, QString("Set Volume to %1%").arg(matches[1])); |
| 4643 | |
| 4644 | bool ok = false; |
| 4645 | |
| 4646 | int vol = matches[1].toInt(&ok); |
| 4647 | |
| 4648 | if (ok) { |
| 4649 | if ( 0 <= vol && vol <= 100) { |
| 4650 | ctx->LockDeletePlayer(__FILE__, __LINE__); |
| 4651 | if (!ctx->player) |
| 4652 | { |
| 4653 | ctx->UnlockDeletePlayer(__FILE__, __LINE__); |
| 4654 | } |
| 4655 | else |
| 4656 | { |
| 4657 | vol -= ctx->player->GetVolume(); |
| 4658 | vol = ctx->player->AdjustVolume(vol); |
| 4659 | ctx->UnlockDeletePlayer(__FILE__, __LINE__); |
| 4660 | |
| 4661 | if (!browsemode) |
| 4662 | { |
| 4663 | UpdateOSDStatus(ctx, tr("Adjust Volume"), tr("Volume"), |
| 4664 | QString::number(vol), |
| 4665 | kOSDFunctionalType_PictureAdjust, "%", vol * 10, |
| 4666 | kOSDTimeout_Med); |
| 4667 | SetUpdateOSDPosition(false); |
| 4668 | } |
| 4669 | } |
| 4670 | } |
| 4671 | } |
| 4672 | } |
| 4673 | } |
4637 | 4674 | else if (tokens.size() >= 3 && tokens[1] == "QUERY") |
4638 | 4675 | { |
4639 | 4676 | if (tokens[2] == "POSITION") |
… |
… |
void TV::ProcessNetworkControlCommand(PlayerContext *ctx, |
4717 | 4754 | ctx->UnlockPlayingInfo(__FILE__, __LINE__); |
4718 | 4755 | |
4719 | 4756 | QString message = QString("NETWORK_CONTROL ANSWER %1") |
4720 | | .arg(infoStr); |
| 4757 | .arg(infoStr); |
4721 | 4758 | MythEvent me(message); |
4722 | 4759 | gCoreContext->dispatch(me); |
4723 | 4760 | } |
| 4761 | else if (tokens[2] == "VOLUME") { |
| 4762 | QString infoStr = QString("%1%").arg(ctx->player->GetVolume()); |
| 4763 | |
| 4764 | QString message = QString("NETWORK_CONTROL ANSWER %1") |
| 4765 | .arg(infoStr); |
| 4766 | MythEvent me(message); |
| 4767 | gCoreContext->dispatch(me); |
| 4768 | } |
4724 | 4769 | } |
4725 | 4770 | } |
4726 | 4771 | |
diff --git a/mythtv/programs/mythfrontend/networkcontrol.cpp b/mythtv/programs/mythfrontend/networkcontrol.cpp
index dd89a48..9f19296 100644
a
|
b
|
QString NetworkControl::processPlay(NetworkCommand *nc, int clientID) |
731 | 731 | } |
732 | 732 | else if (is_abbrev("stop", nc->getArg(1), 2)) |
733 | 733 | message = QString("NETWORK_CONTROL STOP"); |
| 734 | else if (is_abbrev("volume", nc->getArg(1),2)) { |
| 735 | |
| 736 | if (nc->getArgCount() < 3) |
| 737 | return QString("ERROR: See 'help %1' for usage information") |
| 738 | .arg(nc->getArg(0)); |
| 739 | |
| 740 | QString token2 = nc->getArg(2).toLower(); |
| 741 | if (token2.contains(QRegExp("^\\d+%$"))) |
| 742 | message = QString("NETWORK_CONTROL VOLUME %1").arg(token2); |
| 743 | else |
| 744 | return QString("ERROR: See 'help %1' for usage information") |
| 745 | .arg(nc->getArg(0)); |
| 746 | } |
734 | 747 | else |
735 | 748 | return QString("ERROR: See 'help %1' for usage information") |
736 | 749 | .arg(nc->getArg(0)); |
… |
… |
QString NetworkControl::processQuery(NetworkCommand *nc) |
848 | 861 | str = QString("Could not determine memory stats."); |
849 | 862 | return str; |
850 | 863 | } |
| 864 | else if (is_abbrev("volume", nc->getArg(1))) |
| 865 | { |
| 866 | QString str = "0%"; |
| 867 | |
| 868 | QString location = GetMythUI()->GetCurrentLocation(false,false); |
| 869 | |
| 870 | if (location == "Playback") |
| 871 | { |
| 872 | gotAnswer = false; |
| 873 | QString message = QString("NETWORK_CONTROL QUERY VOLUME"); |
| 874 | MythEvent me(message); |
| 875 | gCoreContext->dispatch(me); |
| 876 | |
| 877 | QTime timer; |
| 878 | timer.start(); |
| 879 | while (timer.elapsed() < 2000 && !gotAnswer) |
| 880 | usleep(10000); |
| 881 | |
| 882 | if (gotAnswer) |
| 883 | str = answer; |
| 884 | else |
| 885 | str = "ERROR: Timed out waiting for reply from player"; |
| 886 | } |
| 887 | |
| 888 | return str; |
| 889 | } |
851 | 890 | else if ((nc->getArgCount() == 4) && |
852 | 891 | is_abbrev("recording", nc->getArg(1)) && |
853 | 892 | (nc->getArg(2).contains(QRegExp("^\\d+$"))) && |
… |
… |
QString NetworkControl::processHelp(NetworkCommand *nc) |
956 | 995 | else if (is_abbrev("play", command)) |
957 | 996 | { |
958 | 997 | helpText += |
| 998 | "play volume VOLx - Change volume to given integer value\r\n" |
959 | 999 | "play channel up - Change channel Up\r\n" |
960 | 1000 | "play channel down - Change channel Down\r\n" |
961 | 1001 | "play channel NUMBER - Change to a specific channel number\r\n" |
… |
… |
QString NetworkControl::processHelp(NetworkCommand *nc) |
989 | 1029 | { |
990 | 1030 | helpText += |
991 | 1031 | "query location - Query current screen or location\r\n" |
| 1032 | "query volume - Query the current playback volume\r\n" |
992 | 1033 | "query recordings - List currently available recordings\r\n" |
993 | 1034 | "query recording CHANID STARTTIME\r\n" |
994 | 1035 | " - List info about the specified program\r\n" |