[fixed] No connection to TV Server (1 Viewer)

elliottmc

Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    Specifically, we need @jameson_uk

    Regarding reverting this behaviour, we did vote within the team, and decided that actually this (going to the last-used channel) is good, so we should not revert without more discussion.

    However, jameson_uk's fix is very simple if it works (I assume it does) so it is far better than having what I am seeing. We should definitely consider it.
     
    Last edited:

    elliottmc

    Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    With this

    Code:
        private void PositionGuideCursorToCurrentChannel()
        {
          _cursorX = 0;
          _cursorY = 1; // cursor should be on the program guide item
          ChannelOffset = 0;
    
    Log.Error("PositionGuideCursorToCurrentChannel() running");
    Log.Error("PositionGuideCursorToCurrentChannel() _channelList.count = {0}, _currentChannel.IdChannel = {1}", _channelList.Count, _currentChannel.IdChannel);
    
    
          // Attempt to position to the current channel in the new list of channels.  If the channel is not in
          // the group then the first channel in the group is selected.
          bool channelInGroup = false;
          for (int i = 0; i < _channelList.Count; i++)
          {
            Channel chan = ((GuideChannel)_channelList[i]).channel;
            if (chan.IdChannel == _currentChannel.IdChannel)
            {
              _cursorX = i;
              channelInGroup = true;
    
    Log.Error("PositionGuideCursorToCurrentChannel() about to break");
    
              break;
            }
          }
    
            Log.Error("PositionGuideCursorToCurrentChannel: finished the loop");
    
    
          if (channelInGroup)
          {
            Log.Error("PositionGuideCursorToCurrentChannel: channelInGroup is true!");
            while (_cursorX >= _channelCount)
            {
              _cursorX -= _channelCount;
              ChannelOffset += _channelCount;
            }
              Log.Error("_cursorx = {0}. ChannelOffset = {1}", _cursorX, ChannelOffset);
          }
          else
          {
              Log.Error("PositionGuideCursorToCurrentChannel: channelInGroup is false!");
              ChannelOffset = 1;
          }
        }

    all I see in the log is

    Code:
    2012-12-15 19:33:03.204400 [ERROR][MPMain(1)]: LoadSettings running
    2012-12-15 19:33:03.206400 [ERROR][MPMain(1)]: PositionGuideCursorToCurrentChannel() running
    2012-12-15 19:33:03.232400 [ERROR][MPMain(1)]: ProcessWindows exception:System.NullReferenceException: Object reference not set to an instance of an object.
       at TvPlugin.TvGuideBase.Process()

    Am I doing something wrong with the logging so that

    Log.Error("PositionGuideCursorToCurrentChannel() _channelList.count = {0}, _currentChannel.IdChannel = {1}", _channelList.Count, _currentChannel.IdChannel);

    does nothing?
     

    elliottmc

    Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    Tested jameson_uk's fix, and I can confirm that removing all calls to PositionGuideCursorToCurrentChannel fixes the problem in that the EPG never gets corrupted. It will always default to the first channel.

    So, we either find out what is going wrong, or use the fix we have.
     

    Holzi

    Super Moderator
  • Team MediaPortal
  • April 21, 2010
    7,934
    2,235
    Ba-Wü
    Home Country
    Germany Germany
    As said before: I have no problem. ;)
    @Testers anyone can confirm?
     

    elliottmc

    Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    Okay, done some more work with this, and the fix seems quite simple.

    Code:
        private void LoadSettings()
        {
          using (Settings xmlreader = new MPSettings())
          {
            String channelName = xmlreader.GetValueAsString("mytv", "channel", String.Empty);
            TvBusinessLayer layer = new TvBusinessLayer();
            IList<Channel> channels = layer.GetChannelsByName(channelName);
    
            if (channels != null && channels.Count > 0)
            {
              _currentChannel = channels[0];
            }
            if (channelName !=String.Empty) PositionGuideCursorToCurrentChannel();

    Only call PositionGuideCursorToCurentChannel() if channelName is not the empty string.

    For me, after running the EPG once, the 'channel' is correctly set anyway, so this should be enough.

    TvPlugin.dll with this change attached for testing.
     

    Attachments

    • TvPlugin.rar
      159 KB

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Probably the issue is that _channelList is null. A better fix would be to add a check *inside* PositionGuideCursorToCurrentChannel() like so:

    Code:
    if (_channelList == null)
    {
      return;
    }

    ...or alternatively, have some logic to set the _channelList as the first channel group in this case.

    Edit: _currentChannel could also be null, so that should be checked too.
     
    Last edited:

    SiLenTYL

    Retired Team Member
  • Premium Supporter
  • April 23, 2004
    1,144
    159
    Melbourne
    Home Country
    Australia Australia
    yeh u basically cannot use the tv guide until theres some info inside it...then u can select a channel
     

    TLD

    Portal Pro
    October 26, 2007
    962
    395
    Rainy Washington
    Home Country
    United States of America United States of America
    I have info in my EPG on the other client on a different machine the EPG works fine it's just the client on the TV server that doesn't work it just shows "Missing Label".
     
    Last edited:

    Users who are viewing this thread

    Top Bottom