Commercial Skip

dsmithdsmith Junior MemberPosts: 28
Hello, I want to create some code that references another button for the purpose of skipping commercials. My code is as follows:

// UVERSE Controls
BUTTON_EVENT[vdvTP,38]
BUTTON_EVENT[vdvTP,39]
BUTTON_EVENT[vdvTP,40]
BUTTON_EVENT[vdvTP,41]
BUTTON_EVENT[vdvTP,42]
BUTTON_EVENT[vdvTP,43]
BUTTON_EVENT[vdvTP,44]
BUTTON_EVENT[vdvTP,45]
BUTTON_EVENT[vdvTP,46]
BUTTON_EVENT[vdvTP,47]
BUTTON_EVENT[vdvTP,48]
BUTTON_EVENT[vdvTP,49]
BUTTON_EVENT[vdvTP,50]
BUTTON_EVENT[vdvTP,51]
BUTTON_EVENT[vdvTP,52]
BUTTON_EVENT[vdvTP,53]
BUTTON_EVENT[vdvTP,54]
BUTTON_EVENT[vdvTP,55]
BUTTON_EVENT[vdvTP,56]
BUTTON_EVENT[vdvTP,57]
BUTTON_EVENT[vdvTP,58]
BUTTON_EVENT[vdvTP,59]
BUTTON_EVENT[vdvTP,60]
BUTTON_EVENT[vdvTP,61]
BUTTON_EVENT[vdvTP,62] // Record
BUTTON_EVENT[vdvTP,63]
BUTTON_EVENT[vdvTP,64]
BUTTON_EVENT[vdvTP,65]
BUTTON_EVENT[vdvTP,66]
BUTTON_EVENT[vdvTP,67]
BUTTON_EVENT[vdvTP,68] // Skip 7 seconds FF
BUTTON_EVENT[vdvTP,69]
BUTTON_EVENT[vdvTP,70] // Commercial Skip (5 times Skip)
{
PUSH:
{
TO [UVERSE,BUTTON.INPUT.CHANNEL-37]
}
}

As you can [vdvTP,68] can be pressed 5 times to get the required results, but how can I write the code for button 70 to run 5 times?

Thanks, Donald

Comments

  • viningvining X Member Posts: 4,328
    Without calling a function and starting a timeline you could try something like this (not tested):
    BUTTON_EVENT[vdvTP,65]
    BUTTON_EVENT[vdvTP,66]
    BUTTON_EVENT[vdvTP,67]
    BUTTON_EVENT[vdvTP,68] // Skip 7 seconds FF
    BUTTON_EVENT[vdvTP,69]
    BUTTON_EVENT[vdvTP,70] // Commercial Skip (5 times Skip)
         {
         PUSH:
          {
          STACK_VAR INTEGER nBtn;
          LOCAL_VAR INTEGER nCnt;
          
          nBtn = BUTTON.INPUT.CHANNEL-37;
          if(nBtn == 33)//70
               {
               if(nCnt < 5)
                {
                nCnt++;
                SEND_COMMAND UVERSE,"'SP',nBtn";
                WAIT 6 'COMMERCIAL_SKIP'//assumes sp time left at 5 (set CTON and CTOF in online event)
                 {
                 DO_PUSH_TIMED(vdvTP,70,1);
                 }
                }
               else //send pulse # 5, reset count
                {
                nCnt = 0;
                SEND_COMMAND UVERSE,"'SP',nBtn";
                }
               }
          else
               {
               if(nCnt && nCnt<5)//commerial skip in progress but another button pushed so abort
                {
                CANCEL_WAIT'COMMERCIAL_SKIP';
                SEND_COMMAND UVERSE,"'CP',33;//clear any backed up commands
                nCnt = 0;
                }
               else if(nCnt)//just in case
                {
                nCnt = 0;
                }
               SEND_COMMAND UVERSE,"'SP',nBtn";
               }
          }
    
  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,126
    You know, it might be simple as just going ahead and sending the CTON and CTOF commands first and then going ahead and sending all 5 Send_Command dvIR, ' 'SP',whatever_ir_channel" commands right away. The IR device does have a buffer to house commands. I just don't know how big it is. but I do quite often get away with sending 2 or 3 commands and they time out nicely. 5 might be a bit of a stretch. also, who's to say if you change out IR devices and/or firmware that it won't change later.
  • viningvining X Member Posts: 4,328
    ericmedley wrote: »
    You know, it might be simple as just going ahead and sending the CTON and CTOF commands first and then going ahead and sending all 5 Send_Command dvIR, ' 'SP',whatever_ir_channel" commands right away. The IR device does have a buffer to house commands. I just don't know how big it is. but I do quite often get away with sending 2 or 3 commands and they time out nicely. 5 might be a bit of a stretch. also, who's to say if you change out IR devices and/or firmware that it won't change later.
    It's definitely worth a try, I just didn't think of it. I'm not sure how big the buffer is either but there's been times on hold an repeat channel commands where the repeat rate was faster than the the cton/ctof times and the channels would keep changing long after the button release which is why I started using the cp command in the release to dump any backed up buffered commands.
  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,126
    vining wrote: »
    It's definitely worth a try, I just didn't think of it. I'm not sure how big the buffer is either but there's been times on hold an repeat channel commands where the repeat rate was faster than the the cton/ctof times and the channels would keep changing long after the button release which is why I started using the cp command in the release to dump any backed up buffered commands.


    yeah, I suppose I'm just lazy. :) to be honest, I'd probably just do a quick timeline myself.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file