MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal TV-Server » Help on Development » Development


Development You want to code something for the TV-Server? Share it in here!

Reply
 
Thread Tools Display Modes
Old 2007-07-16, 17:52   #1 (permalink)
W_Z
Portal Member
 
Join Date: Apr 2007
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post

Country:

My System

Default Change channel by channelNumber or SID (w. code)

North American satellite users (and perhaps others) are used to having channel numbers that are based on serviceID. Currently, when you type in a number in the guide it goes to the offset in the guide. Also, there is a hardcoded limit of two digits. As far as I can tell this was partially corrected in the standalone MP but never made it to the TV plugin.

Here is code that allows for channel numbers of 3 digits in length and changes based on channelNumber. I haven't looked at the code for fullscreen and miniepg yet so this is only for finding channels in the guide.

TvGuideBase.cs
Code:
void OnKeyCode(char chKey)
    {
      if (chKey >= '0' && chKey <= '9') //Make sure it's only for the remote
      {
        TimeSpan ts = DateTime.Now - _keyPressedTimer;
        if (_lineInput.Length >= 3 || ts.TotalMilliseconds >= 800)
        {
          _lineInput = String.Empty;
        }
        _keyPressedTimer = DateTime.Now;
        if (chKey == '0' && _lineInput.Length == 0)
          return;
        _lineInput += chKey;
        if (_lineInput.Length == 3)
        {
          // change channel
          int iChannel = Int32.Parse(_lineInput);
          ChangeChannelNr(iChannel);

        }
      }
    }

    void ChangeChannelNr(int iChannelNr)
    {
     // iChannelNr--;

      int iCounter = 0;
      bool found = false;

      Channel chan;

      while (iCounter < _channelList.Count && found == false)
      {
          chan = (Channel)_channelList[iCounter];

          foreach (TuningDetail detail in chan.ReferringTuningDetail())
          {
              if (detail.channelNumber == iChannelNr)
              {
                  iChannelNr = iCounter;
                  found = true;
              }
          }
          iCounter++;
      }

      if (iChannelNr >= 0 && iChannelNr < _channelList.Count)
      {
        UnFocus();
        _channelOffset = 0;
        _cursorX = 0;

        // Last page adjust (To get a full page channel listing)
        if (iChannelNr > _channelList.Count - _channelCount + 1)
        {
          _channelOffset = _channelList.Count - _channelCount;
          iChannelNr = iChannelNr - _channelOffset;
        }

        while (iChannelNr >= _channelCount)
        {
          iChannelNr -= _channelCount;
          _channelOffset += _channelCount;
        }
        _cursorX = iChannelNr;

        Update(false);
        SetFocus();
      }
    }

I propose that instead of serviceID we use channelNumber as this should be a more universal system because I believe analog input devices, etc already populate this field. With this setup we'd need to have the channelNumber field in the database populated with serviceID when a scan is done. I think this would only be for North American users so we may need a checkbox next to the scan button. Users can use the following query in the meantime to manually copy SID to channelNumber:

Code:
UPDATE dbo.TuningDetail SET channelNumber = serviceId;
W_Z is offline   Reply With Quote
This User Say Thank You:
Old 2007-07-17, 03:05   #2 (permalink)
Portal Member
 
Join Date: Mar 2007
Location: Denver, Colorado
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts

Country:

My System

Send a message via MSN to IcePickrg
Default

I want to thank W_Z for working on this code - it is awesome to finally see this fix!

I think rather then having a max digit input that we extend and/or make configurable the timeout value. This would allow for fine tuning for remote.

I beleive this code is what is causing my 0 issue.

<code>_lineInput = String.Empty;
}
_keyPressedTimer = DateTime.Now;
if (chKey == '0' && _lineInput.Length == 0)
return;
</code>
__________________
IcePick
IcePickrg is offline   Reply With Quote
Old 2007-07-17, 11:12   #3 (permalink)
W_Z
Portal Member
 
Join Date: Apr 2007
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post

Country:

My System

Default

I have improved my code a bit.

Here’s my list of updates in this. It should have no effect on non-NA users whatsoever now.
- the indexed channel number option in MP setup should function correctly now - it is either by channel number or index.
- if you enter a channel number and it doesn’t exist it will go to the nearest number.
- the first “time” label at the top of the guide has been used to show the channel numbers as you enter them. When you finish or let it time out (800ms) it goes back to how it was.
- options for ‘show channel number in guide’ and ‘channel number max. length’ have been added in MP setup.

To do:
-make channel entry work in fullscreen and miniepg
-add an option to sort by channel name in TVE3. I think adding a ‘Channel Number’ column header that you could click on to sort would be perfect.
-add a checkbox/option to set channelNumber field to SID when scanning dvb.

Hopefully this will get tested and added to SVN soon.

Thanks for the feedback so far.

Code is attached as I know some of you are interested.
Attached Files
File Type: zip Channel Number patch 07-17-07 - WZ.zip (3.3 KB, 38 views)
W_Z is offline   Reply With Quote
Old 2007-07-18, 01:26   #4 (permalink)
Portal Member
 
Krusty's Avatar
 
Join Date: Jun 2007
Location: Near London, Ontario, Canada
Age: 1
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

Country:

My System

Default

Thanks W_Z

Any chance of getting a pre-compiled version? No coding ability here ;0)
__________________
"I'm going on a bender to end all benders" - Krusty
Krusty is offline   Reply With Quote
Old 2007-07-20, 21:49   #5 (permalink)
Portal Tester
 
Muldini's Avatar
 
Join Date: Feb 2007
Posts: 197
Thanks: 42
Thanked 0 Times in 0 Posts

Country:

My System

Default

Just had the chance to test this, what he coded so far works like a charm for me. Keep up the good work.

Regards,
Muldini
Muldini is offline   Reply With Quote
Old 2007-07-20, 22:05   #6 (permalink)
Portal Member
 
Join Date: Jun 2007
Age: 25
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts


Default

it works well!!!

i hope to see this put in the new svn soon!!! amazng work!!
bfrye26 is offline   Reply With Quote
Old 2007-07-21, 10:24   #7 (permalink)
Portal Developer
 
frodo's Avatar
 
Join Date: Apr 2004
Location: The Netherlands
Age: 36
Posts: 1,516
Thanks: 3
Thanked 119 Times in 44 Posts

Country:

My System

Default

Please post the complete new/modified files and not a .patch file
Then i'll add it to svn

Frodo
frodo is offline   Reply With Quote
Old 2007-07-24, 08:57   #8 (permalink)
W_Z
Portal Member
 
Join Date: Apr 2007
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post

Country:

My System

Default

Please see: http://sourceforge.net/tracker/index...97&atid=647927

NOTE: Users will need to manually copy serviceID to channelNumber in the
database until scanning can populate the channelNumber field.

Use:
Code:
UPDATE dbo.TuningDetail SET channelNumber = serviceId;
W_Z is offline   Reply With Quote
Old 2007-07-24, 15:01   #9 (permalink)
Portal Member
 
jdugas's Avatar
 
Join Date: Apr 2006
Location: NY
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post

Country:

My System

Default

Quote:
Originally Posted by W_Z View Post
Please see: http://sourceforge.net/tracker/index...97&atid=647927

NOTE: Users will need to manually copy serviceID to channelNumber in the
database until scanning can populate the channelNumber field.

Use:
Code:
UPDATE dbo.TuningDetail SET channelNumber = serviceId;
Thanks for the update W_Z. I cant wait to try this out. For those that use more than one Sat provider (Dish and Bev), this Query may be useful... I like to number my Dish channels the same as the SID and the Bev channels the SID + 1000.

For those that are not familiar with the MS SQL Server Management Studio Express utility, open it up and log in using the username/password that you provided when setting up the TV Server.

Drill down until you find the TvLibrary under the Databases section on the left of the screen. Right click on TvLibrary and choose Tasks > Back Up > backup your database before doing the next steps (Just in case).

Now, Click on New Query, paste the following into the query editor:

UPDATE dbo.TuningDetail
SET channelNumber = serviceId
WHERE networkId = 4100

UPDATE dbo.TuningDetail
SET channelNumber = serviceId
WHERE networkId = 4102

UPDATE dbo.TuningDetail
SET channelNumber = 1000 + serviceId
WHERE networkId = 256

UPDATE dbo.TuningDetail
SET channelNumber = 1000 + serviceId
WHERE networkId = 257

After you have this in the query editor, click on the Execute button.

This query will only work with Dish/Bev setups... you will need to modify it to work with other sats.
__________________
jdugas is offline   Reply With Quote
This User Say Thank You:
Old 2007-07-24, 15:29   #10 (permalink)
Portal Member
 
Join Date: Jun 2007
Age: 25
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts


Default

Amazing work!! keep it up...... this is an amazing feature to see in MP finaly people in NA have ssid again
bfrye26 is offline   Reply With Quote
Reply

Bookmarks

Tags
change, channel, channelnumber, code, sid

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use SID as channel number when scanning your Sats. ASiDiE Improvement Suggestions 8 2008-01-30 01:00
Changing channel by Sid not channelid Nox71 pre 1.0 RC1 1 2007-05-02 08:09
twinhan dvb-t signal 0, code change lar282 The old Bugreport Forum 3 2006-03-10 11:41
Change Channel using F7/F8 Changes Group, not channel Anonymous General Support 2 2005-11-04 16:30
TV Channel code all over the place Anonymous General Development (no feature request here!) 4 2004-12-13 10:05


All times are GMT +1. The time now is 22:13.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress