TVE3 Threadsafe Using Reservation System. (1 Viewer)

elliottmc

Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    This has now been included in MediaPortal 1.3.0alpha, which will be released quite soon.

    There have been a couple of last-minute glitches which have delayed things, but we are getting there.
     

    DJBlu

    Portal Pro
    August 14, 2007
    1,670
    813
    Llanelli
    Home Country
    United Kingdom United Kingdom
    Just looking at the code guys and there is no reservation for EPG, just Timeshifting and Recording.

    Is this an oversight?
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    • Thread starter
    • Moderator
    • #15
    Euh Gibman can answer better but if i understand, in setuptv and then in user properties EPG Grabber can be set :)
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    Euh Gibman can answer better but if i understand, in setuptv and then in user properties EPG Grabber can be set :)

    Disregard my post.

    I have found what I needed! :D

    EPG is using tickets just as well as normal timeshifting.

    Code:
    private bool TuneEPGgrabber(Channel channel, IChannel tuning, Card card, TvResult result)
        {
          try
          {
            _user.CardId = card.idCard;
            ITvCardHandler cardHandler;
            if (ServiceManager.Instance.InternalControllerService.CardCollection.TryGetValue(card.idCard, out cardHandler))
            {
              ICardTuneReservationTicket ticket = null;
              try
              {
                ICardReservation cardReservationImpl = new CardReservationTimeshifting();
                ticket = cardReservationImpl.RequestCardTuneReservation(cardHandler, tuning, _user);
     
                if (ticket != null)
                {
                  result = ServiceManager.Instance.InternalControllerService.Tune(ref _user, tuning, channel.idChannel,
                                                                                  ticket);
                  if (result == TvResult.Succeeded)
                  {
                    if (!_isRunning || false == ServiceManager.Instance.InternalControllerService.GrabEpg(this, card.idCard))
                    {
                      if (!_isRunning)
                        Log.Epg("Tuning finished but EpgGrabber no longer enabled");
                      ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
                      _user.CardId = -1;
                      Log.Epg("Epg: card:{0} could not start dvbt grabbing", card.idCard);
                      return false;
                    }
                    _user.CardId = card.idCard;
                    return true;
                  }
                }
              }
              catch (Exception)
              {
                CardReservationHelper.CancelCardReservation((ITvCardHandler) cardHandler, ticket);
                throw;
              }
            }
            _user.CardId = -1;
            Log.Epg("Epg: card:{0} could not tune to channel:{1}", card.idCard, result.ToString());
            return false;
          }
          catch (Exception ex)
          {
            Log.Write(ex);
            throw;
          }
        }
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    regarding 'multiple tuningdetails on the same card' :
    https://forum.team-mediaportal.com/threads/no-cards-available.109338/page-5

    so summarize the problem.

    This is done when tuning a channel:

    1) fetch a list of carddetails from cardallocation
    2) request card reservations (tickets) for all those carddetails from (1)
    3) cancel superfluous tickets, eg. we want max. 2 tickets per timeshifting session.
    4) now iterate tickets, and tune each card until either succesfull or all cards exhausted.
    5) if all tickets are spent, then a new iteration will occur (see step#2) although it keeps track of already tried cards, and avoids those.

    This works fine as long as the list of carddetails (from step#1) does not have the same cardID multiple times.'
    and sadly this is the case with the bug mentioned.

    eg. we have 2 carddetails (for a channel with 2 tuningdetails on dvb-t).
    detail#1 (frequency 111111) with cardid=1
    detail#1 (frequency 222222) with cardid=1

    requesting a cardres. ticket for detail#1 works, now reserved.
    requesting a cardres. ticket for detail#2 fails, since card is already reserved.

    so it looks like it's not possible to request a bunch of tickets based on a list of carddetails containing the same cardId multiple times in one go.

    would an alternative be :
    1) fetch a list of carddetails from cardallocation
    2) iterate carddetails, and request 1 card reservation (ticket) per carddetail
    3) now tune each card until either succesfull or all cards exhausted.
    5) if all tickets are spent, then a new iteration will occur (see step#2) although it keeps track of already tried cards, and avoids those.

    /gibman
     
    Last edited:

    Pat Clark

    Portal Pro
    April 25, 2012
    264
    34
    Wisconsin
    Home Country
    United States of America United States of America
    I thought I should mention that my hybrid cards show separate tuning details for each analog channel, but only one for each QAM channel. I have 3 hybrid cards, so in TV Server Config each analog channel shows 3 tuning details. (And I can't use 1.3.0 Alpha because of the no card available problem.)
     
    Last edited:

    Users who are viewing this thread

    Top Bottom