ADBTuner: A "channel tuning" application for networked Google TV / Android TV devices

There are a few things going on here.

ADBTuner generates a new key pair for each ADBTuner instance. These files (adbkey, adbkey.pub) are stored in a docker volume by default. It is possible to copy these files between the docker volumes to use the same key pair for both.

This being said, you can authorize more than one key pair for use with ADB so sharing them isn't particularity needed. But in my experience you still can't reliably have more than one ADB connection open at a time.

ADBTuner doesn't maintain a persistent connection. It runs the commands it needs to and then closes the connection. So, in theory, one could share an Android device between ADBTuner instances, but I'm not sure you would want to as there is no way to "lock" a tuner across instances so a tuning request would likely interrupt a recording that is running through the other ADBTuner instance.

Is there a particular issue you are looking to solve? Or are you just looking to easily switch between the stable and experimental versions?

Yes, I was trying to find an easy way to be able to flip between the :latest and :experimental versions - I'm not a Docker expert, but have used Dockers for various Channels DVR features and have a number of other ones on my Unraid server - I try to be conservative about not introducing problems into our DVR/TV system but I would be OK with just changing the tags back and forth on my original/working Docker instance to go from latest to experimental - I am trying to figure out how to do this in Portainer - I created the original docker via the command line, so it's not straightforward to me...

Gotcha. Yeah you should be ok with just switching between the versions. There have been some database schema changes, but only added columns which SQLite tends to just ignore. You would know almost immediately if there is going to be an issue due to that.

I don't have any experience with Portainer though. I presume it's just a change in the web interface to switch tags? @bnhf ?

As always, thank you for help with testing new releases.

@JT-DFW If you created the original ADBTuner container from the command line I'd suggest stopping it from the command line also.

Then, you should be able to create a single Portainer-Stack where you'll be able to switch back-and-forth between versions, by stopping the stack, changing the tag, and then clicking "Update the stack" and using the "Re-pull and redeploy" slider if you want to force the download of the latest version of whichever tag you're using.

Here's my recommended docker-compose for ADBTuner:

version: '3.9'
services:
  # Docker Hub home for this project: https://hub.docker.com/u/turtletank99
  adbtuner:
    image: turtletank99/adbtuner:${TAG}
    container_name: adbtuner
    dns_search: ${DOMAIN} # Change to the name of your LAN's domain, which is usually local or localdomain
    init: true
    ports:
      - ${HOST_PORT}: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
    restart: unless-stopped
volumes:
  adbtuner:
    name: ${HOST_VOLUME}

And, this set of environment variables with your values, which goes in the Environment variables section of Portainer (Advanced mode allows you to copy-and-paste):

TAG=latest
DOMAIN=localdomain
HOST_PORT=5592
HOST_VOLUME=adbtuner_config

When you want to change tags, stop the stack, and change the tag accordingly. This allows you to use the same Docker-Volume, with the same database and adb keys when you switch back-and-forth.

Thank you - this works great and I didn't have to re-approve ADB on the Onn boxes!

Anybody had a luck modifying an apk (android manifest) to allow deep linking once the app is open?

Seen a few examples through google searches to add singleTask to the manifest if the app will only open deep links on the first open.

Not a huge deal if not but always looking to cut down tuning times!

@turtletank would it be possible to make a build with android tv remote protocol from Issues · tronikos/androidtvremote2 · GitHub ?
I know there is channels hdmi etc with scripts and so but i never got it working . Adb tuner with gui is so much easier :raised_hands: Up n running on shield tv!
But also looking for a simple way to use my android sat tuner ( ADB tuner wont work) need to send key 0-9 for switching channels So if a adbtuner ”fork” with android tv remote instead of deeplinks could be made :thinking::pray:

I saw that early on when I was testing out my setup, which is an onn box feeding a URay encoder. I never figured out why it was happening but it mysteriously went away on its own. If ADBtuner is force closing the app after every tune is done, you shouldn't see that error.

I was using my ISP DNS and I switched to 8.8.8.8 and that seemed to clear it up. Either that or it was a red herring

For those who may be interested:

Ended up getting all of my channels that required ‘compatibility mode’ from 22seconds with a Google chromecast TV to under 9 seconds with a shield and changing some of the code in the docker.

Would require some testing per app, but for my app, exiting out of the guide to the apps home menu, then going home on my shield and then sending the new deep link via adb enabled the app to stay open (quicker loading) but also use the new deep link which otherwise wouldn’t have worked if I had either just tried to load it or just pressed home and then loaded it.

Strange one but I’m sure other apps may have similar results with some testing

I ended up changing the adb.py code for media playback stop and pause to something like
input keyevent 4 21 23 4
Which was ‘back’ ‘left’ ‘select’ ‘home’

I know I could’ve done this with ah4c but I love the UI of this project, the tuner management and the timeout while the deep link is loaded.

It's a tricky balance. The "well behaved" apps that work outside of compatibility mode will almost always do the right thing when presented with a URL. It's totally up in the air with the other apps, for which there seems to be an almost infinite amount of lol.

Unfortunately, it would just be unsustainable to try to achieve the best possible outcome for every possible application. I've tried a lot of things in the past, but more often than not, fixing one app breaks another one. As such, compatibility mode intentionally does things as safely as possible which unfortunately includes getting the application to a known state by closing it.

@tree2369 thank you for testing and feedback. I took a look at your idea, but unfortunately, it introduced some problematic timing issues when quickly changing channels. As a quick fix attempt, I added a fixed delay before releasing a tuner to make sure all of those events are fired before allowing another tuning event, but I guess that kind of defeats the purpose?

When all was said and done I was still left with situations where the apps I was testing with failed to load a second stream without being restarted. It's awesome that it works in your setup, but I'm not comfortable with making this a universal change. Sorry.

1 Like

Thanks for the feedback. I've been avoiding this because it would be trying to abstract away the complexity of firing a handful of ADB commands to load content. This could quickly get really complicated and confusing for new users. I will think about this though.

No don't be sorry at all, completely understand trying to keep it as universal as possible.

Just if someone was needing to use compatibility mode and wanted a quicker tune due to a slower opening app, then maybe my reply could help.

Ive actually done some more testing and due to one of my links I was testing with working with lowercase in some scenarios for some reason - even though it needed to be capitals...I worked out that I only need to press 'home' while closing a tuner and the next deep link opens successfully.

Got my tune time down to about 4seconds and ive got no app UI appearing now! Absolutely awesome.

So many thanks for putting this together @turtletank

Hopefully my new method can help some other incompatible apps - though the current method is a safe bet to get every app to work :slight_smile:

1 Like

Cool , can you let me know in detail how to try your solution ?

So if you’re having to use compatibility mode, you can untick a couple of channels to test - but you need to find adb.py in your docker.

Then in the code look for where it has the adb commands for stop and pause (control f ‘input keyevent’ should help you find it).

And you can change the keyevent to whatever you need to help the app load the next channel.

Eg for me pausing or stopping the media does not let me send a new deep link - so I was forced to switch on compatibility mode which completely closes the app. But all the app needed was to be put in the background by pressing home, which then let the next channel load quicker and without having to relaunch the entire app.

So I changed it to ‘input keyevent 3’ on both of them.

But you can also try different adb commands - I used terminal to test them out, but you can also like I said, untick a couple of channels, change the keyevent and then ‘preview’ to test.

Let me know if I have to explain in further detail. :slight_smile: I’m no coder so anyone should be able to get it done fairly easily!

1 Like

Just an FYI this does not work with XFINITY Stream you have to close the APP. So in order for XFINITY Stream to work ADBTUNER has to Close the APP. Works great the way it is. Your way keeps opening the previous link.

Yep expected for sure that a lot of apps wouldn’t work like mine has.
Could be a different sequence of keyevent inputs that let the app stay open - or could just be an app that requires a close.

Worth a try for those who want to try get a quicker tune anyway!

1 Like

FYI: The experimental branch has been pretty stable for months so I decided it was time to merge those changes. adbtuner:latest and adbtuner:stable are recommended if stability is a priority.

1 Like

Any news regarding better http "respekt"?

Of possible interest to ADBTuner users, a list of Philo non-TVE channels: Provider - Philo - #211 by wjcarpenter

(Some updates to the data today.)