示例#1
0
    public void ChangeChannel(string ID)
    {
      if (_started)
        StopPlaying();

      System.Threading.Thread.Sleep(100);

      ErrorLog("Zap to " + ID);
      // zapto ID
      func = new DboxFunctions(server, username, password, boxtype);
      func.Zapto(ID);

      cGlobal.currentID = ID;

      System.Threading.Thread.Sleep(1000);
      ErrorLog("Zap and waited " + ID);

      // get group/channel
      ActBouquetNo = 1;
      for (int i = 0; i < _TV_Bouquets.Rows.Count; i++)
      {
        if (_TV_Bouquets.Rows[i]["ID"].ToString() == cGlobal.currentID)
        {
          ActBouquetNo = Convert.ToInt16(_TV_Bouquets.Rows[i]["BouqNo"].ToString());

          ActBouquet = _TV_Bouquets.Rows[i]["BouqName"].ToString();
          ActChannel = _TV_Bouquets.Rows[i]["Name"].ToString();

          ErrorLog("Actual group " + ActBouquet + " actual channel " + ActChannel);
        }
      }

    }
示例#2
0
    public override bool Init()
    {
      bool result = Load(GUIGraphicsContext.Skin + @"\mydboxmain.xml");
      Mydbox.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage());

      LoadSettings();

      Data dboxdata = new Data(server, username, password, boxtype);
      dboxdata.loadEPGdata(); //load epg data from file

      if (File.Exists(LogPathName)) File.Delete(LogPathName);
      ErrorLog("Init plugin");

      SelChan = new ArrayList();

      // get bouquets
      ParseXML();
      ErrorLog("XML parsed " + _TV_Bouquets.Rows.Count);

      recDirectory.AddExtension(".dat");
      recDirectory.ShowFilesWithoutExtension = false;

      Share share2 = new Share();
      share2.Name = "Recordings";
      share2.Path = RecDir;
      recDirectory.IsRootShare(RecDir);

      if (ah == null) ah = new OnActionHandler(OnAction2);

      #region get some data from box
      try
      {
        // get actual ID
        func = new DboxFunctions(server, username, password, boxtype);
        func.wakeup();
        cGlobal.currentID = func.getID();
        if (cGlobal.currentID != "")
        {
          ErrorLog("Actual ID " + cGlobal.currentID);
          func.setSPTS();
          ErrorLog("SetSPTS has been set");
          ErrorLog("Version=> " + func.getInfo());
          func.showMessage("Mediaportal%20connected");
          // looks box is working
          BoxConn = true;
        }
        else
        {
          ErrorLog("Receiver is not reachable ?");
        }
      }

      catch
      {
        ErrorLog("Receiver is not reachable ?");
      }

      // get group/channel
      ActBouquetNo = 1;
      for (int i = 0; i < _TV_Bouquets.Rows.Count; i++)
      {
        if (_TV_Bouquets.Rows[i]["ID"].ToString() == cGlobal.currentID)
        {
          ActBouquetNo = Convert.ToInt16(_TV_Bouquets.Rows[i]["BouqNo"].ToString());

          ActBouquet = _TV_Bouquets.Rows[i]["BouqName"].ToString();
          ActChannel = _TV_Bouquets.Rows[i]["Name"].ToString();

          ErrorLog("Actual group " + ActBouquet + " actual channel " + ActChannel);
        }
      }

      #endregion

      return result;
    }
示例#3
0
    public void OnAction2(Action action)
    {
      Debug.WriteLine("Action2:" + action.wID.ToString());

      if (GUIWindowManager.ActiveWindowEx == (int)GUIWindow.Window.WINDOW_DIALOG_MENU) return;
      //bool actionTaken = true;

      //Debug.WriteLine(action.wID.ToString());

      object key;
      switch (action.wID)
      {
        case Action.ActionType.ACTION_EXIT:
          { // prepare for exit
            OnPageDestroy(0);
            break;
          }
        case Action.ActionType.ACTION_PREVIOUS_MENU:
          {
            if (_isFullScreen)
            {
              if (t_Chan > 0) t_Chan = 0; // channel osd is up, kill it
              else if (t_OSD > 0) t_OSD = 0; // epg is up, kill it
              else if (t_Info > 0)
              {
                t_Info = 0;
                t_OSD = 2; // info is up, go back to epg
              }
              else                            // no osd is up, exit fullscreen
              {
                _isFullScreen = false;
                _wasFullscreen = true;
                SetWindows();
              }
            }
            break;
          }
        case Action.ActionType.ACTION_MOVE_LEFT:
          if ((_isFullScreen == true) && (cGlobal.VLC_Live == true))
          {
            if (t_Chan > 0)
            { // only if already visible
              ActBouquetNo--;
            }

            if (ActBouquetNo == 0)
              ActBouquetNo = MaxBouq;

            t_Chan = 10;
            t_OSD = 0;
            chan.DisplayBouq(ActBouquetNo.ToString(), "0");
          }
          break;
        case Action.ActionType.ACTION_MOVE_RIGHT:
          if ((_isFullScreen == true) && (cGlobal.VLC_Live == true))
          {
            if (t_Chan > 0)
            { // only if already visible
              ActBouquetNo++;
            }
            if (ActBouquetNo > MaxBouq)
              ActBouquetNo = 1;

            t_Chan = 10;
            t_OSD = 0;
            chan.DisplayBouq(ActBouquetNo.ToString(), "-1");
          }
          break;
        case Action.ActionType.ACTION_MOVE_DOWN:
        case Action.ActionType.ACTION_MOVE_UP:
          if ((_isFullScreen == true) && (cGlobal.VLC_Live == true))
          {
            t_Chan = 10;
            t_OSD = 0;
          }
          break;
        case Action.ActionType.ACTION_VOLUME_MUTE:
          DboxFunctions func = new DboxFunctions(server, username, password, boxtype);
          func.toggleMute();
          break;
        case Action.ActionType.ACTION_FORWARD:
        case Action.ActionType.ACTION_MUSIC_FORWARD:
          key = vlcControl.Player.getVariable("key-faster");
          vlcControl.Player.setVariable("key-pressed", key);
          break;
        case Action.ActionType.ACTION_MUSIC_REWIND:
        case Action.ActionType.ACTION_REWIND:
          key = vlcControl.Player.getVariable("key-slower");
          vlcControl.Player.setVariable("key-pressed", key);
          break;
        case Action.ActionType.ACTION_PREV_CHANNEL:
          OnPreviousChannel();
          PlayCurrentChannel();
          break;
        case Action.ActionType.ACTION_PAGE_DOWN:
          OnPreviousChannel();
          PlayCurrentChannel();
          break;
        case Action.ActionType.ACTION_NEXT_CHANNEL:
          OnNextChannel();
          PlayCurrentChannel();
          break;
        case Action.ActionType.ACTION_PAGE_UP:
          OnNextChannel();
          PlayCurrentChannel();
          break;
        case Action.ActionType.ACTION_PLAY:
        case Action.ActionType.ACTION_MUSIC_PLAY:
          PlayCurrentChannel();
          break;
        case Action.ActionType.ACTION_STOP:
          StopPlaying();
          btnTVOnOff.Selected = false;
          break;
        case Action.ActionType.ACTION_PAUSE:
          if (_started)
          {
            if (!vlcControl.Player.Playing)
            {
              _paused = false;
              vlcControl.Player.play();
            }
            else
            {
              _paused = true;
              vlcControl.Player.pause();
            }
          }
          break;
        case (Action.ActionType.ACTION_RECORD):
          if (btnRecord.Selected)
          {
            btnRecord.Selected = false;
            imgRecord.Visible = false;
          }
          else
          {
            btnRecord.Selected = true;
            imgRecord.Visible = true;
            OnRecord();
          }
          break;
        case (Action.ActionType.ACTION_SHOW_FULLSCREEN):
          SetWindows();
          break;
        case (Action.ActionType.ACTION_SHOW_GUI):
          if (_isFullScreen == false)
          {
            //vlcControl.Player.fullscreen(); 
            _isFullScreen = true;
            SetWindows();
          }
          else
          {
            if (chan.Visible == false)
            {
              //vlcControl.Player.fullscreen(); 
              _isFullScreen = false;
              SetWindows();
            }
            else
            {

            }
          }
          break;
        case Action.ActionType.ACTION_SELECT_ITEM:
          string t = chan.GetChannel(ActBouquet);
          if ((t != "") && (_isFullScreen == true))
          {
            if (t_Chan > 0)
            {
              t_Chan = 0;
              ChangeChannel(t);
              PlayCurrentChannel();
            }
          }
          break;
        case (Action.ActionType.ACTION_CONTEXT_MENU):
          if (t_OSD > 0)
          {
            if (cGlobal.VLC_Live == true)
            {
              t_OSD = 0;
              t_Info = 10;
            }
            else
              t_OSD = 0;
          }
          else
          {
            t_OSD = 10;
            t_Info = 0;
            t_Chan = 0;
          }
          break;
        case Action.ActionType.ACTION_KEY_PRESSED:
          if (cGlobal.VLC_Live == true)
          {
            switch (action.m_key.KeyChar)
            {
              case '1':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "1";
                SelStr = callSelect(SelStr);
                break;
              case '2':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "2";
                SelStr = callSelect(SelStr);
                break;
              case '3':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "3";
                SelStr = callSelect(SelStr);
                break;
              case '4':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "4";
                SelStr = callSelect(SelStr);
                break;
              case '5':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "5";
                SelStr = callSelect(SelStr);
                break;
              case '6':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "6";
                SelStr = callSelect(SelStr);
                break;
              case '7':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "7";
                SelStr = callSelect(SelStr);
                break;
              case '8':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "8";
                SelStr = callSelect(SelStr);
                break;
              case '9':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "9";
                SelStr = callSelect(SelStr);
                break;
              case '0':
                t_Sel = 2;
                t_Info = 0;
                SelStr = SelStr + "0";
                SelStr = callSelect(SelStr);
                break;
              case '#':
                if ((SelStr != "....") & (SelStr != "") & (SelStr.Length > 0) & (t_Sel > 0))
                {
                  int x = Convert.ToInt16(SelStr) - 1;
                  try
                  {
                    t_Sel = 0;
                    ChangeChannel(_TV_Bouquets.Rows[x]["ID"].ToString());
                    PlayCurrentChannel();
                  }
                  catch
                  {
                  }
                }
                break;
            }
          }
          break;
        case (Action.ActionType.ACTION_ASPECT_RATIO):
          if ((SelStr != "....") & (SelStr != "") & (SelStr.Length > 0) & (t_Sel > 0))
          {
            int x = Convert.ToInt16(SelStr) - 1;
            try
            {
              t_Sel = 0;
              ChangeChannel(_TV_Bouquets.Rows[x]["ID"].ToString());
              PlayCurrentChannel();
            }
            catch
            {
            }
          }
          break;

        default:
          //actionTaken = false;
          break;
      }
    }
示例#4
0
    public void PlayCurrentChannel()
    {
      if (!btnTVOnOff.Selected)
        return;
      string url;
      // get LiveURL
      func = new DboxFunctions(server, username, password, boxtype);

      if (cGlobal.currentID.Contains("rootX"))
      { // workaround for e1 internal hdd movieplaying
        url = cGlobal.currentID;
        cGlobal.VLC_Live = false; // kill the live flag, don't want epg and such
      }
      else
      { // normally this is the code we use
        url = func.getLiveUrl();
        cGlobal.VLC_Live = true;
      }
      ErrorLog("Get live url = " + url);



      if (url == null)
      {
        ErrorLog("ERROR: NOTHING TO PLAY !");
        GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
        dlg.SetHeading("Error nothing to play");
        dlg.SetLine(1, "Channel is not playable !");
        dlg.SetLine(2, String.Empty);
        dlg.SetLine(3, String.Empty);
        dlg.DoModal(GUIWindowManager.ActiveWindow);
      }

      if (url != null)
      {

        //GUIGraphicsContext.IsFullScreenVideo = false;

        cGlobal.VLC_File = url;
        cGlobal.VLC_StartPlay = true;
        ErrorLog("SetStartPlay " + url);
      }
    }