ADBTuner: Create Channels, Custom Config and CDVR Custom Channels for DirecTV

I also figured out the cURL is pulling true duplicate channels with the same Callsign and resource.

dtvnow://deeplink.directvnow.com/play/channel/MSGALT-3/c1bbf6e4-6716-c336-ec60-887acda607ab
dtvnow://deeplink.directvnow.com/play/channel/MSGALT-3/c1bbf6e4-6716-c336-ec60-887acda607ab
I think that's actually most of the problem. For some reason it's only happening for some of the regional sports networks. I'm not sure why there are so many copies of them. I really do only have 333 unique channels. I think that's what's going on here is for some reason the curl request is pulling duplicates in for some reason in addition to the duplicate numbers.

If you would like, I feel totally comfortable DMing you my curl request along with my bearer token. If you want to pull my channel list for debugging purposes, I'd be happy to help. I can also just run the curl in my console and send you the output as well if that is helpful.

Doing this would be helpful. Nothing like working with real data.

Here you go: https://mackid1993.com/dtv.txt

Edit:

Interestingly enough, I went through that curl output and there aren't a bunch of duplicates.
I think there could be a race condition when the channel number is the same, where possibly the Bash script is making duplicates? I don't know for sure. But the main culprit was the Madison Square Garden channels. And those do have duplicate channel numbers. Multiple 635's. But there aren't three of them for one alternate. Like what pulled in to ADB tuner.

I think I fixed this. I sent you a DM with a modified shell script. I had to use a different endpoint because the standard API endpoint doesn't accept decimals. I also set it to use the Gracenote IDs directly from the DirectTV JSON output.

Posting to /admin/channel vs /api/v1/channel worked!

Here's an updated ADBTuner Custom Config for use with DirecTV Deeplinks. This includes the new keep alive function, and should work on all streaming sticks (previous versions using awk don't work properly on FireSticks and possibly other platforms):

{
    "name": "DirecTV Deep Links",
    "author": "bnhf",
    "version": "1.0",
    "description": "Load content via DirecTV deep link URLs with keep active command.",
    "uuid": "3f94f6c2-5516-45bb-81b0-37b0a4fce041",
    "global_options": {
        "wait_for_video_playback_detection": true,
        "use_fixed_delay": false,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false,
        "wait_after_post_playback_start_commands_seconds": 0
    },
    "pre_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP"
    ],
    "tune_commands": [
        "am start -W -n '||TARGET_PACKAGE_NAME||'/com.clientapp.MainActivity -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||'"
    ],
    "post_playback_start_commands": [],
    "post_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP",
        "input keyevent KEYCODE_HOME"
    ],
    "timed_keep_active_commands": [
        {
            "run_every_minutes": 60,
            "commands": [
                "input keyevent KEYCODE_MEDIA_PLAY"
            ]
        }
    ]
}
2 Likes

My goal was to resolve the activity dynamically just in case it changes in the future.
But I see how that could cause problems on different platforms, so I guess it's sort of a trade-off. Thank you for writing this. I wonder if sed is available on Firesticks.

I take it back -- awk does work, and so does sed (I needed parentheses around my test command), at least on the FireStick 4K Max 2 (Android 11 based).

Oh, that's really funny. I'm going to go back to my old config then.

1 Like

Actually, two quick questions. Is there a good reason to call the activity directly rather than my config using awk? Would it tune any faster, maybe?

My other question was, is there an environment variable to set my ADBTuner hostname? It likes to default to something that I have not set anywhere so I am not sure how to change that.

That's done in the Docker Compose, to set the hostname for the container itself, something like this:

services:
  adbtuner:
    # GitHub home for this project with setup instructions: Caution! This project is not open source, and is not available on GitHub
    # Docker Hub home for this project: https://hub.docker.com/u/turtletank99
    image: turtletank99/adbtuner:${TAG:-latest}
    container_name: adbtuner
    hostname: ${HOSTNAME:-adbtuner}
    dns_search: ${DOMAIN:-localdomain} # Change to the name of your LAN's domain, which is usually local or localdomain
    init: true
    ports:
      - ${HOST_PORT:-5592}:5592 # Use the same port number the container is using, or optionally change it if the port is already in use on your host
    volumes:
      - adbtuner:/app/.config
    extra_hosts:
      - host.docker.internal:${DOCKER_GATEWAY:-host-gateway} # host.docker.internal is generally not predefined on Linux hosts.
    restart: unless-stopped
volumes:
  adbtuner:
    name: ${HOST_VOLUME:-adbtuner_config}

However, that hostname is only usable by other Docker containers on the same Docker network (not including the default bridge network where there's no Docker DNS).

I've never seen one of those package names change, so it seems like an unnecessary moving part to awk for it -- but I don't believe there'd be a discernable speed difference.

It seems that many of us who are testing new ADBT custom configurations change them often as new versions evolve. Is there a quick and easy way to change all the channels from a certain provider (DirecTV) to use a new or different config?

Usually when I'm testing, I'll just change the config for a few channels at a time. Sometimes I'll set different groups of channels to use different configs to compare them. Then, when I settle on which config I prefer, It would be nice to apply that selection universally to the rest of the channels.

Yes, via the new Action, as described here:

It only takes a couple of minutes to both update your ADBTuner DirecTV virtual channels to sync them with what's available in your DTV package, and to change Custom Configurations. All of the drudgery involved in managing large numbers of virtual DTV channels is gone!

2 Likes

Thanks so much. I will switch to yours then, since I agree that it is an unnecessary moving part if those package names don't change!! I couldn't get the hostname to populate on Unraid, but that's not such a big deal.

It's likely because I'm using Unraid's template for ADB Tuner and not Project One Click.

This is awesome! I wasn't sure if it was mainly intended for the initial set up of DirecTV as an ADBTuner source. If it can be used for maintenance tasks for that source...that's even more awesome! Looks like I have something to fiddle around with today!

It seems that you, @mackid1993 and @turtletank have figured a way to prevent the "still watching" prompt from occuring. If that's the case, I'll try to set this up as a contender against, or supplement to the Roku Tuner Bridge I have been using for my DTV channels.

I'm eager to see how well this works with my ONN 4k boxes.

I can attest to it working extremely well.

1 Like
{
    "name": "DirecTV",
    "author": "David B.",
    "version": "4.0.0",
    "description": "Fast tuning for DirecTV. Prevent are you still there prompt from showing.",
    "uuid": "3c7d5a19-6f2e-4b8a-9d3f-8e1c4b7a5f92",
    "global_options": {
        "wait_for_video_playback_detection": true,
        "use_fixed_delay": false,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false,
        "wait_after_post_playback_start_commands_seconds": 0
    },
    "pre_tune_commands": [
        "input keyevent KEYCODE_WAKEUP",
        "input keyevent KEYCODE_MEDIA_STOP"
    ],
    "tune_commands": [
        "pidof '||TARGET_PACKAGE_NAME||' && am start -W -n '||TARGET_PACKAGE_NAME||'/com.clientapp.MainActivity -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||' || am start -W -S -n '||TARGET_PACKAGE_NAME||'/com.clientapp.MainActivity -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||'"
    ],
    "post_playback_start_commands": [],
    "post_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP",
        "input keyevent KEYCODE_HOME"
    ],
    "timed_keep_active_commands": [
        {
            "run_every_minutes": 60,
            "commands": [
                "input keyevent KEYCODE_MEDIA_PLAY"
            ]
        }
    ]
}

I was messing with my config. I actually ran into an issue where if the app was not started, it would tune the previous channel, not the channel intended to be tuned, which could obviously mess up a DVR recording. Using the -S flag leads to really slow tuning. So I wrote a tune command that will only use that flag if the process hasn't started. If the process has started, it'll just tune the channel really quickly.

So essentially it'll only fresh start the app if it needs to be fresh started like it wasn't running before for some reason. I'm hoping this helps with random tunes to the home screen, for example.

I'm not sure if anyone wants to play around with this, I just kind of created this now, so I haven't played with it much yet, but hopefully it helps with reliability a little bit. I wanted to kind of throw this out there in case anyone else is running through the same issue.

I just loaded the configuration with my onn 4k boxes and it does tune nice and fast.
Appreciate all this help with Directv. The genre pack is great especially with the free streaming services.

What I figured out is if the app hasn't started it needs a force stop with the -S flag or it will tune whatever channel it was on previously. However, if it's running in the background, it will deep link to the correct channel. So I updated my tune command with conditional logic, so it checks to see if the process is active. If it's active, it doesn't use the -S flag it doesn't stop the app, it just tunes. So it'll tune quickly when it can and tune reliably when it has to. That's my idea at least.

Hopefully a few more people are willing to test this.

So far, it's been pretty good from what I've been seeing. Nice background with the app and done adb shell am kill com.att.tv and it's worked pretty much every time. Previously it would tune the wrong channel every time. This explains why I would randomly have a recording of the wrong channel entirely.

I saw the problem when trying to watch Cozi tv on the app.
When i applied the updated config, things seem to be doing a bit better and Cozi is tuning in properly the first time.

I'm really glad it helped.
I actually cleaned up the syntax a little bit to make it a little bit shorter and cleaner.

{
    "name": "DirecTV",
    "author": "David B.",
    "version": "4.0.0",
    "description": "Fast tuning for DirecTV. Prevent are you still there prompt from showing.",
    "uuid": "3c7d5a19-6f2e-4b8a-9d3f-8e1c4b7a5f92",
    "global_options": {
        "wait_for_video_playback_detection": true,
        "use_fixed_delay": false,
        "fixed_delay_seconds": 0,
        "check_for_and_clear_whos_watching_prompts": false,
        "wait_after_post_playback_start_commands_seconds": 0
    },
    "pre_tune_commands": [
        "input keyevent KEYCODE_WAKEUP",
        "input keyevent KEYCODE_MEDIA_STOP"
    ],
    "tune_commands": [
        "pidof '||TARGET_PACKAGE_NAME||' && am start -n '||TARGET_PACKAGE_NAME||'/com.clientapp.MainActivity -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||' || am start -S -n '||TARGET_PACKAGE_NAME||'/com.clientapp.MainActivity -a android.intent.action.VIEW -d '||TARGET_URL_OR_IDENTIFIER||'"
    ],
    "post_playback_start_commands": [],
    "post_tune_commands": [
        "input keyevent KEYCODE_MEDIA_STOP",
        "input keyevent KEYCODE_HOME"
    ],
    "timed_keep_active_commands": [
        {
            "run_every_minutes": 60,
            "commands": [
                "input keyevent KEYCODE_MEDIA_PLAY"
            ]
        }
    ]
}

Unfortunately the DirecTV app is just a complex mess and half the time it'll tune to the correct channel and if it's cold started it'll tune to the last channel it was on so it needs that -S to force stop it completely prior to tuning. However, if it's warm, I can just deeplink to the next channel quickly. It's really, really stupid, but I'm glad I figured it out because that was driving me crazy.