Advice Needed - ADBTuner or AH4C?

Neither are needed for the version you're running.

@Helios2

The docker compose from @ChannelSam will give you some good examples of how he has values set. However, my recommendation is to use the compose as shown in post #1 here, which uses environment variables -- so that the compose itself does not need to be edited:

Your unique values can all be placed in the Environment variables section of the Portainer-Stack. That way if the compose is updated, it's relatively easy to swap it out, while keeping your specifics the same. It also makes it easier later to see at glance what's specific to your installation, vs generic to everyone.

2 Likes

100% support using post #1 from the other thread for your starting point...just been to lazy to go back and update mine...
May get to it someday...lol

@Helios2 Definitely follow @bnhf advice about post#1 with respect to the env variables if just starting. :+1:

2 Likes

I've read through the whole thread (this and the original AndroidHDMI for Channels (ah4c) and followed @bnhf and @ChannelSam advices, but I think I'm stuck, I could use some help. I have a Fire TV and an Apple TV. I've setup ah4c in Portainer and it's up and running -Channels DVR shows whatever is on on both Fire TV and ATV- with this stack (I'm using STREAMER_APP=scripts/atv/spectrum here and http://10.10.11.13:7654/m3u/directv.m3u in Custom Channels Settings just for testing purposes):

version: '3.9'
services:
  atvtuner:
    image: bnhf/ah4c:appletv
    container_name: atvtuner
    hostname: atvtuner
    dns_search: localdomain # Specify the name of your LAN's domain, usually local or localdomain
    ports:
      - 5037:5037 # Port used by adb-server
      - 7654:7654 # Port used by this androidhdmi-for-channels proxy
      - 7655:8000 # Port used by ws-scrcpy
    environment:
      - IPADDRESS=10.10.11.13:7654 # Hostname or IP address of this androidhdmi-for-channels extension to be used in M3U file (also add port number if not in M3U)
      - NUMBER_TUNERS=2 # Number of tuners you'd like defined 1, 2, 3 or 4 supported
      - TUNER1_IP=10.10.11.42 # Streaming device #1 with adb port in the form hostname:port or ip:port
      - TUNER2_IP=10.10.11.44:5555 # Streaming device #1 with adb port in the form hostname:port or ip:port

      - ENCODER1_URL=http://10.10.11.43/live/stream1 # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - ENCODER2_URL=http://10.10.11.43/live/stream0 # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream

      - STREAMER_APP=scripts/atv/spectrum # Streaming device name and streaming app you're using in the form scripts/streamer/app (use lowercase with slashes between as shown)
      - CHANNELSIP=10.10.11.10 # Hostname or IP address of the Channels DVR server itself
      
      - ALERT_SMTP_SERVER=${ALERT_SMTP_SERVER} # The domainname:port of the SMTP server you'll be using like smtp.gmail.com:587. This is for sending ah4c alerts if tuning fails.
      - ALERT_AUTH_SERVER=${ALERT_AUTH_SERVER} # The auth server for the e-mail you'll be using like smtp.gmail.com
      - ALERT_EMAIL_FROM=${ALERT_EMAIL_FROM} # The e-mail address you'd like your ah4c failure alert e-mails to show as being from.
      - ALERT_EMAIL_PASS=${ALERT_EMAIL_PASS} # Gmail and Yahoo both support the creation of app-specific e-mail passwords, and this is the way to go! It's NOT recommended to use your everyday e-mail password.
      - ALERT_EMAIL_TO=${ALERT_EMAIL_TO} # The e-mail address you'd like your alert e-mails sent to.
      #- ALERT_WEBHOOK_URL="" # For advanced users, tuning failure alerts can be sent via a webhook.
      - LIVETV_ATTEMPTS=5 # For FireTV Live Guide tuning only, set maximum number of attempts at finding the desired channel
      - CREATE_M3US=false # Set to true to create device-specific M3Us for use with Amazon Prime Premium channels -- requires a FireTV device
      - TZ=America/New_York # Your local timezone in Linux "tz" format
    volumes:
      - /srv/5ab84941-c842-42b9-9bce-80979edd927d/Pool/_AppData/atvtuner/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - /srv/5ab84941-c842-42b9-9bce-80979edd927d/Pool/_AppData/atvtuner/m3u:/opt/m3u # m3u files will be stored here and hosted at http://<hostname or ip>:7654/m3u for use in Channels DVR - Custom Channels settings
      - /srv/5ab84941-c842-42b9-9bce-80979edd927d/Pool/_AppData/atvtuner/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped

Can one instance of ah4c control FTV and ATV at the same time? Can anybody help me on where and how to create scripts to have both Fire TV and Apple TV open an app (Tennis Channel and Max) and start the live stream? Thanks!

No. But you can setup multiple ah4c containers, each assigned its own encoder ports.

@ChannelSam should be able to give you some guidance using an ATV as your "streaming stick".

@uspino

No problem...
I will focus on setting up spectrum with appletv's for now.
Start by loading the Spectrum app on the AppleTV and verify that it can load/view spectrum channels if you haven't done this yet

Use the newest compose file with the separate environmental variable file. Like shown in post #1 on ah4c thread.
This will ensure it will work with the updated docker image and make it much easier to make changes as we go forward.

It looks like you are using MY hard drive location for your volumes...This won't work if that is the case.
Make sure to update all your variables to your hardware ipaddresses

Here is my current Compose/Environment files.

Compose File

version: '3.9'
services:
  ah4c:
    image: bnhf/ah4c:${TAG}
    container_name: atvtuner
    hostname: atvtuner
    dns_search: ${DOMAIN} # Specify the name of your LAN's domain, usually local or localdomain
    ports:
      #- ${ADBS_PORT}:5037 # Port used by adb-server
      - ${HOST_PORT}:7654 # Port used by this ah4c proxy
      #- ${WSCR_PORT}:8000 # Port used by ws-scrcpy
    environment:
      - IPADDRESS=${IPADDRESS} # Hostname or IP address of this ah4c extension to be used in M3U file (also add port number if not in M3U)
      - NUMBER_TUNERS=${NUMBER_TUNERS} # Number of tuners you'd like defined 1, 2, 3 or 4 supported
      - TUNER1_IP=${TUNER1_IP} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - TUNER2_IP=${TUNER2_IP} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - TUNER3_IP=${TUNER3_IP} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - TUNER4_IP=${TUNER4_IP} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - ENCODER1_URL=${ENCODER1_URL} # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - ENCODER2_URL=${ENCODER2_URL} # Full URL for tuner #2 in the form http://hostname/stream or http://ip/stream
      - ENCODER3_URL=${ENCODER3_URL} # Full URL for tuner #3 in the form http://hostname/stream or http://ip/stream
      - ENCODER4_URL=${ENCODER4_URL} # Full URL for tuner #4 in the form http://hostname/stream or http://ip/stream
      - STREAMER_APP=${STREAMER_APP} # Streaming device name and streaming app you're using in the form scripts/streamer/app (use lowercase with slashes between as shown)
      - CHANNELSIP=${CHANNELSIP} # Hostname or IP address of the Channels DVR server itself
      - ALERT_SMTP_SERVER=${ALERT_SMTP_SERVER} # The domainname:port of the SMTP server you'll be using like smtp.gmail.com:587. This is for sending ah4c alerts if tuning fails.
      - ALERT_AUTH_SERVER=${ALERT_AUTH_SERVER} # The auth server for the e-mail you'll be using like smtp.gmail.com
      - ALERT_EMAIL_FROM=${ALERT_EMAIL_FROM} # The e-mail address you'd like your ah4c failure alert e-mails to show as being from.
      - ALERT_EMAIL_PASS=${ALERT_EMAIL_PASS} # Gmail and Yahoo both support the creation of app-specific e-mail passwords, and this is the way to go! It's NOT recommended to use your everyday e-mail password.
      - ALERT_EMAIL_TO=${ALERT_EMAIL_TO} # The e-mail address you'd like your alert e-mails sent to.
      #- ALERT_WEBHOOK_URL=""
      - LIVETV_ATTEMPTS=${LIVETV_ATTEMPTS} # For FireTV Live Guide tuning only, set maximum number of attempts at finding the desired channel
      - CREATE_M3US=${CREATE_M3US} # Set to true to create device-specific M3Us for use with Amazon Prime Premium channels -- requires a FireTV device
      - UPDATE_SCRIPTS=${UPDATE_SCRIPTS} # Set to true if you'd like the sample scripts and STREAMER_APP scripts updated whether they exist or not
      - UPDATE_M3US=${UPDATE_M3US} # Set to true if you'd like the sample m3us updated whether they exist or not
      - TZ=${TZ} # Your local timezone in Linux "tz" format
    volumes:
      - ${HOST_DIR}/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - ${HOST_DIR}/m3u:/opt/m3u # m3u files will be stored here and hosted at http://<hostname or ip>:7654/m3u for use in Channels DVR - Custom Channels settings
      - ${HOST_DIR}/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped

Environmental Variables

TAG=appletv.test2
DOMAIN=localdomain
ADBS_PORT=
HOST_PORT=7654
WSCR_PORT=
IPADDRESS=192.168.1.101:7654
NUMBER_TUNERS=2
TUNER1_IP=192.168.1.54
ENCODER1_URL=http://192.168.1.41:8090/stream3
TUNER2_IP=192.168.1.55
ENCODER2_URL=http://192.168.1.41:8090/stream4
STREAMER_APP=scripts/atv/spectrum
CHANNELSIP=http://192.168.1.20:8089
ALERT_SMTP_SERVER=
ALERT_AUTH_SERVER=
ALERT_EMAIL_FROM=
ALERT_EMAIL_PASS=
ALERT_EMAIL_TO=
LIVETV_ATTEMPTS=5
CREATE_M3US=false
UPDATE_SCRIPTS=false
UPDATE_M3US=false
TZ=America/New_York
HOST_DIR=/srv/5ab84941-c842-42b9-9bce-80979edd927d/Pool/_AppData/atvtuner

Couple quick notes

  • I am using the TAG=appletv.test2 the other builds don't work right for the apple/spectrum setup.

  • On First run you can set CREATE_M3US, UPDATE_SCRIPTS and UPDATE_M3US all to true to see what you get. This should pull in some premade files that will give us a starting point. If you already have something in the directories for adb,scripts,m3u you may want to save them somewhere first to be safe. Make sure to change these back to false after the first run/setup and restart the container.

  • This setup CAN NOT use either adb-server or ws-scrcpy so we only need the {HOST_PORT} for the ah4c proxy.

  • After booting the container go to the ip for ah4c...yours currently looks like 10.10.11.13:7654. On first run it should create your .pyatv.conf in the adb subfolder. In order to do this you will need to be able to see the codes displayed through the encoder on the appletv.

Can you post what your hardware is for appletv and encoder along with what ip addresses you have assigned to them. I use static ip's for all channels stuff.
Also post your new updated enviromental variable list.
That is a good start... :slightly_smiling_face:

1 Like

Thank you so much for this step-by-step guide. I'm new to Docker so still struggling to set this up. The Compose and Environment files are up and running and ah4c server is up. But I'm new to Portainer and I can't figure out how to access scripts, m3u and conf files. Do I have to create a Volume in Portainer? What HOST_DIR would point to that Volume? And how do I browse/edit those files?

I'm using an ATV 4K and LinkPi encoder V3. These variables point to my static IP addresses:

TAG=appletv.test2
DOMAIN=localdomain
ADBS_PORT=
HOST_PORT=7654
WSCR_PORT=
IPADDRESS=10.10.11.13:7654
NUMBER_TUNERS=1
TUNER1_IP=10.10.11.42
ENCODER1_URL=http://10.10.11.43/live/stream1
STREAMER_APP=scripts/atv/spectrum
CHANNELSIP=http://10.10.11.10:8089
ALERT_SMTP_SERVER=
ALERT_AUTH_SERVER=
ALERT_EMAIL_FROM=
ALERT_EMAIL_PASS=
ALERT_EMAIL_TO=
LIVETV_ATTEMPTS=5
CREATE_M3US=true
UPDATE_SCRIPTS=true
UPDATE_M3US=true
TZ=America/New_York
HOST_DIR=/volumes/ah4c_data/_data

Thanks!

Few quick things...
I am also running a linkpi
I would change
ENCODER1_URL=http://10.10.11.43/live/stream1
to
ENCODER1_URL=http://10.10.11.43:8090/stream1

The /live/stream1 simply redirects to :8090/stream1 in the background. This used to create lots of problems in the past and it is just safer.

You are able to reach the ah4c proxy at 10.10.11.13:7654 ???

It has been awhile so don't remember exactly what it will say the first time Did it run a script to enable controlling the appletv from ah4c using the python pyatv/atvremote program.
You will need to be able to see the appletv output screen for the code it will display then enter it in ah4c.
If this is not showing up we can do it manually from within the container.

What are you storing your data files on?
It says they are stored at /volumes/ah4c_data/_data
Can you access this location to look for the files?
You will also need to make sure that docker/ah4c has permissions to access this. Inside this folder you should find 3 directories
adb
m3u
scripts

You should see .pyatv.conf inside /adb
Since you told it STREAMER_APP=scripts/atv/spectrum it hopefully downloaded some scripts into /scripts/atv/spectrum that will give us a start.
May also be a spectrum.m3u along with a bunch of other ones inside /m3u

@ChannelSam Ok here's where I'm lost: docker stack installs and starts correctly, I have access through 7654 port, it creates adb, m3u and scripts directories but... both adb and scripts/atv/spectrum directories are empty. firetv/directv and m3u are correctly populated with files. What can I be doing wrong here? Thanks for your help!

@uspino
Maybe nothing...This is a long term test build...
Let's start with this...

  • Go to Portainer and select this ah4c stack
  • Scroll down to the container that should be running
  • To the right of the name should be some quick options...Click on the first one called Logs
  • Set lines to like 500 and turn off auto refresh
  • Move down and copy the log and paste it here.

Additionally the 4th item over from the container name will be "Exec Console"
Select that and hit the Connect button on the next screen...
In the terminal window type "atvremote" and press enter...This should display usage information for this program if it has been properly installed.

In the mean time I am going to try and spin up a fresh version of mine with none of my preset directories.
If I am understanding you right you are saying you can see the directories but there is no Spectrum specific items in them. I will post my m3u without locals and simple working scripts in a few hours.

1 Like

@uspino

Ok I just spun up a test container...
I think you are fine as long as you get a response from the atvremote command I mentioned using in the EXEC Console in the previous post and you can see all 3 directories
adb
m3u
scripts

I am also showing nothing in the adb and scripts directories and an entire list of m3u files including one for spectrum for I think central time zone Texas.
At this point I would change these setting to false in my environment variables.

CREATE_M3US=false
UPDATE_SCRIPTS=false
UPDATE_M3US=false

Step 1 - Setup atvremote to communicate with appletv from INSIDE the EXEC Console

atvremote -s 10.10.11.42 --protocol airplay pair
atvremote -s 10.10.11.42 --protocol companion pair
atvremote -s 10.10.11.42 --protocol raop pair
mv /root/.pyatv.conf /root/.android
ls -a /root/.android

Remember that after every pair command you must look at the appletv output to get the code to enter.

FYI...You should be able to see the .pyatv.conf file using the last command above. Any directory or file starting with "." is hidden by default that is why we are using -a attrib to tell it to show all.

Step 2 Create Scripts...
Below are the 3 script files to add in the scripts directory. These probably won't run right if you create them on a windows computer (appears to be something to do with how windows and linux identify end of lines)
The safest way to create them is to use nano inside the EXEC Console using these commands...

cd /opt/scripts/atv/spectrum
nano prebmitune.sh
nano bmitune.sh
nano stopbmitune.sh

prebmitune.sh

#!/bin/bash

# Nothing needed in this file!

bmitune.sh

#!/bin/bash

channelID="$1"
streamerIP="$2"
atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP launch_app=spectrumTV://watch.spectrum.net/livetv/$channelID

sleep 45
atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP select

stopbmitune.sh

#!/bin/bash

streamerIP="$1"
channelID="$2"
atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP home delay=250 home delay=5000 up delay=200 up delay=5000 home

The stopbmitune.sh may need to be adjusted depending on how your appletv is setup. This shuts the spectrum app all the way down every time. This is slower but was the most reliable way to do it in the past.
Here is my Spectrum m3u without the locals...I can show you how to look up individual channels later if needed but these should work for the national eastern feeds if that is where you are.

spectrum.m3u

#EXTM3U

#EXTINF:-1 channel-id="59296" channel-number="1018" tvg-name="WEHD" tvc-guide-stationid="59296",WE_TV
http://{{ .IPADDRESS }}/play/tuner/59296

#EXTINF:-1 channel-id="58515" channel-number="1020" tvg-name="TBSHD" tvc-guide-stationid="58515",TBS
http://{{ .IPADDRESS }}/play/tuner/58515

#EXTINF:-1 channel-id="58574" channel-number="1025" tvg-name="FXHD" tvc-guide-stationid="58574",FX
http://{{ .IPADDRESS }}/play/tuner/58574

#EXTINF:-1 channel-id="58623" channel-number="1028" tvg-name="SYFYHD" tvc-guide-stationid="58623",SYFY
http://{{ .IPADDRESS }}/play/tuner/58623

#EXTINF:-1 channel-id="62420" channel-number="1029" tvg-name="CCHD" tvc-guide-stationid="62420",Comedy_Central
http://{{ .IPADDRESS }}/play/tuner/62420

#EXTINF:-1 channel-id="59337" channel-number="1030" tvg-name="AMCHD" tvc-guide-stationid="59337",AMC
http://{{ .IPADDRESS }}/play/tuner/59337

#EXTINF:-1 channel-id="60150" channel-number="1031" tvg-name="LIFEHD" tvc-guide-stationid="60150",Lifetime
http://{{ .IPADDRESS }}/play/tuner/60150

#EXTINF:-1 channel-id="61812" channel-number="1032" tvg-name="EHD" tvc-guide-stationid="61812",E!
http://{{ .IPADDRESS }}/play/tuner/61812

#EXTINF:-1 channel-id="58452" channel-number="1033" tvg-name="USAHD" tvc-guide-stationid="58452",USA
http://{{ .IPADDRESS }}/play/tuner/58452

#EXTINF:-1 channel-id="42642" channel-number="1034" tvg-name="TNTHD" tvc-guide-stationid="42642",TNT
http://{{ .IPADDRESS }}/play/tuner/42642

#EXTINF:-1 channel-id="60046" channel-number="1035" tvg-name="VH1HD" tvc-guide-stationid="60046",VH1
http://{{ .IPADDRESS }}/play/tuner/60046

#EXTINF:-1 channel-id="60964" channel-number="1036" tvg-name="MTVHD" tvc-guide-stationid="60964",MTV
http://{{ .IPADDRESS }}/play/tuner/60964

#EXTINF:-1 channel-id="59186" channel-number="1037" tvg-name="PARHD" tvc-guide-stationid="59186",Paramount
http://{{ .IPADDRESS }}/play/tuner/59186

#EXTINF:-1 channel-id="59440" channel-number="1038" tvg-name="CMTVHD" tvc-guide-stationid="59440",CMT
http://{{ .IPADDRESS }}/play/tuner/59440

#EXTINF:-1 channel-id="59432" channel-number="1040" tvg-name="NIKHD" tvc-guide-stationid="59432",Nickelodeon
http://{{ .IPADDRESS }}/play/tuner/59432

#EXTINF:-1 channel-id="73541" channel-number="1041" tvg-name="TVLNDHD" tvc-guide-stationid="73541",TV_Land
http://{{ .IPADDRESS }}/play/tuner/73541

#EXTINF:-1 channel-id="59684" channel-number="1042" tvg-name="DISNHD" tvc-guide-stationid="59684",Disney
http://{{ .IPADDRESS }}/play/tuner/59684

#EXTINF:-1 channel-id="60048" channel-number="1043" tvg-name="TOONHD" tvc-guide-stationid="60048",Cartoon
http://{{ .IPADDRESS }}/play/tuner/60048

#EXTINF:-1 channel-id="57394" channel-number="1044" tvg-name="APLHD" tvc-guide-stationid="57394",Animal_Planet
http://{{ .IPADDRESS }}/play/tuner/57394

#EXTINF:-1 channel-id="64490" channel-number="1051" tvg-name="TRUTVHD" tvc-guide-stationid="64490",truTV
http://{{ .IPADDRESS }}/play/tuner/64490

#EXTINF:-1 channel-id="58625" channel-number="1052" tvg-name="BRAVOHD" tvc-guide-stationid="58625",Bravo
http://{{ .IPADDRESS }}/play/tuner/58625

#EXTINF:-1 channel-id="70522" channel-number="1053" tvg-name="OXYGNHD" tvc-guide-stationid="70522",Oxygen
http://{{ .IPADDRESS }}/play/tuner/70522

#EXTINF:-1 channel-id="56905" channel-number="1056" tvg-name="DSCHD" tvc-guide-stationid="56905",Discovery
http://{{ .IPADDRESS }}/play/tuner/56905

#EXTINF:-1 channel-id="57391" channel-number="1058" tvg-name="TLCHD" tvc-guide-stationid="57391",TLC
http://{{ .IPADDRESS }}/play/tuner/57391

#EXTINF:-1 channel-id="57708" channel-number="1059" tvg-name="HSTRYHD" tvc-guide-stationid="57708",History
http://{{ .IPADDRESS }}/play/tuner/57708

#EXTINF:-1 channel-id="87182" channel-number="1060" tvg-name="TRAV" tvc-guide-stationid="11180",Travel
http://{{ .IPADDRESS }}/play/tuner/87182

#EXTINF:-1 channel-id="51529" channel-number="1061" tvg-name="AETVHD" tvc-guide-stationid="51529",A&E
http://{{ .IPADDRESS }}/play/tuner/51529

#EXTINF:-1 channel-id="49788" channel-number="1062" tvg-name="HGTVD" tvc-guide-stationid="49788",HGTV
http://{{ .IPADDRESS }}/play/tuner/49788

#EXTINF:-1 channel-id="63236" channel-number="1063" tvg-name="BETHD" tvc-guide-stationid="63236",BET
http://{{ .IPADDRESS }}/play/tuner/63236

#EXTINF:-1 channel-id="50747" channel-number="1065" tvg-name="FOODHD" tvc-guide-stationid="50747",Food_Network
http://{{ .IPADDRESS }}/play/tuner/50747

#EXTINF:-1 channel-id="66268" channel-number="1068" tvg-name="HALLHD" tvc-guide-stationid="66268",HALLMARK
http://{{ .IPADDRESS }}/play/tuner/66268

#EXTINF:-1 channel-id="46710" channel-number="1069" tvg-name="HMMHD" tvc-guide-stationid="46710",Hallmark_Movies_Mysteries
http://{{ .IPADDRESS }}/play/tuner/46710

#EXTINF:-1 channel-id="70388" channel-number="1073" tvg-name="OWNHD" tvc-guide-stationid="70388",OWN
http://{{ .IPADDRESS }}/play/tuner/70388

#EXTINF:-1 channel-id="49438" channel-number="1074" tvg-name="NGCHD" tvc-guide-stationid="49438",National_Geographic
http://{{ .IPADDRESS }}/play/tuner/49438

#EXTINF:-1 channel-id="71280" channel-number="1080" tvg-name="SUNDHD" tvc-guide-stationid="71280",SundanceTV
http://{{ .IPADDRESS }}/play/tuner/71280

#EXTINF:-1 channel-id="65342" channel-number="1081" tvg-name="IDHD" tvc-guide-stationid="65342",Investigation_Discovery
http://{{ .IPADDRESS }}/play/tuner/65342

#EXTINF:-1 channel-id="31046" channel-number="1083" tvg-name="MTHD" tvc-guide-stationid="31046",MotorTrend
http://{{ .IPADDRESS }}/play/tuner/31046

#EXTINF:-1 channel-id="64492" channel-number="1085" tvg-name="BBCAHD" tvc-guide-stationid="64492",BBC_America
http://{{ .IPADDRESS }}/play/tuner/64492

#EXTINF:-1 channel-id="59444" channel-number="1095" tvg-name="IFCHD" tvc-guide-stationid="59444",IFC
http://{{ .IPADDRESS }}/play/tuner/59444

#EXTINF:-1 channel-id="126128" channel-number="1139" tvg-name="EARTHX" tvc-guide-stationid="126128",EarthX
http://{{ .IPADDRESS }}/play/tuner/126128

#EXTINF:-1 channel-id="67375" channel-number="1157" tvg-name="MAGNHD" tvc-guide-stationid="67375",Magnolia
http://{{ .IPADDRESS }}/play/tuner/67375

#EXTINF:-1 channel-id="73413" channel-number="1197" tvg-name="FETV" tvc-guide-stationid="73413",fe_tv
http://{{ .IPADDRESS }}/play/tuner/73413

#EXTINF:-1 channel-id="61960" channel-number="1217" tvg-name="TVONEHD" tvc-guide-stationid="61960",TV_One
http://{{ .IPADDRESS }}/play/tuner/61960

#EXTINF:-1 channel-id="97409" channel-number="1228" tvg-name="ASPREHD" tvc-guide-stationid="97409",ASPiRE
http://{{ .IPADDRESS }}/play/tuner/97409

#EXTINF:-1 channel-id="68796" channel-number="1230" tvg-name="POPHD" tvc-guide-stationid="16715",POP
http://{{ .IPADDRESS }}/play/tuner/68796

#EXTINF:-1 channel-id="62746" channel-number="1231" tvg-name="IONHD" tvc-guide-stationid="62746",ION
http://{{ .IPADDRESS }}/play/tuner/62746

#EXTINF:-1 channel-id="113430" channel-number="1233" tvg-name="CIRCLE" tvc-guide-stationid="113430",CIRCLE
http://{{ .IPADDRESS }}/play/tuner/113430

#EXTINF:-1 channel-id="109454" channel-number="1237" tvg-name="STARTTV" tvc-guide-stationid="109454",Start_TV
http://{{ .IPADDRESS }}/play/tuner/109454

#EXTINF:-1 channel-id="122968" channel-number="1238" tvg-name="STRY" tvc-guide-stationid="122968",Story_TV
http://{{ .IPADDRESS }}/play/tuner/122968

#EXTINF:-1 channel-id="131889" channel-number="1241" tvg-name="CHIMETV" tvc-guide-stationid="131889",ChimeTV
http://{{ .IPADDRESS }}/play/tuner/131889

#EXTINF:-1 channel-id="130088" channel-number="1242" tvg-name="STELLAR" tvc-guide-stationid="130088",Stellar_TV
http://{{ .IPADDRESS }}/play/tuner/130088

#EXTINF:-1 channel-id="83098" channel-number="1264" tvg-name="RVLTHD" tvc-guide-stationid="83098",Revolt
http://{{ .IPADDRESS }}/play/tuner/83098

#EXTINF:-1 channel-id="55887" channel-number="1278" tvg-name="LMNHD" tvc-guide-stationid="55887",LMN
http://{{ .IPADDRESS }}/play/tuner/55887

#EXTINF:-1 channel-id="32645" channel-number="1301" tvg-name="ESPNHD" tvc-guide-stationid="32645",ESPN
http://{{ .IPADDRESS }}/play/tuner/32645

#EXTINF:-1 channel-id="45507" channel-number="1302" tvg-name="ESPN2HD" tvc-guide-stationid="45507",ESPN2
http://{{ .IPADDRESS }}/play/tuner/45507

#EXTINF:-1 channel-id="49848" channel-number="1308" tvg-name="BSGLHD" tvc-guide-stationid="49848",Bally_Sports_Great_Lakes
http://{{ .IPADDRESS }}/play/tuner/49848

#EXTINF:-1 channel-id="68658" channel-number="1309" tvg-name="BSOH3HD" tvc-guide-stationid="68658",Bally_Sports_BSOH3HD
http://{{ .IPADDRESS }}/play/tuner/68658

#EXTINF:-1 channel-id="91114" channel-number="1310" tvg-name="BSOH3AH" tvc-guide-stationid="91114",Bally_Sports_BSOH3AH
http://{{ .IPADDRESS }}/play/tuner/91114

#EXTINF:-1 channel-id="54286" channel-number="1312" tvg-name="BSDHD" tvc-guide-stationid="54286",Bally_Sports_Detroit
http://{{ .IPADDRESS }}/play/tuner/54286

#EXTINF:-1 channel-id="61854" channel-number="1316" tvg-name="GOLFHD" tvc-guide-stationid="61854",Golf
http://{{ .IPADDRESS }}/play/tuner/61854

#EXTINF:-1 channel-id="82547" channel-number="1317" tvg-name="FS1HD" tvc-guide-stationid="82547",Fox_Sports_1
http://{{ .IPADDRESS }}/play/tuner/82547

#EXTINF:-1 channel-id="58321" channel-number="1333" tvg-name="BIG10HD" tvc-guide-stationid="58321",BIG10
http://{{ .IPADDRESS }}/play/tuner/58321

#EXTINF:-1 channel-id="71198" channel-number="1335" tvg-name="BGTEN02" tvc-guide-stationid="71198",BIG10_2
http://{{ .IPADDRESS }}/play/tuner/71198

#EXTINF:-1 channel-id="89714" channel-number="1336" tvg-name="SECH" tvc-guide-stationid="89714",SEC_Network
http://{{ .IPADDRESS }}/play/tuner/89714

#EXTINF:-1 channel-id="45399" channel-number="1346" tvg-name="NFLHD" tvc-guide-stationid="45399",NFL_Network
http://{{ .IPADDRESS }}/play/tuner/45399

#EXTINF:-1 channel-id="111871" channel-number="1348" tvg-name="ACC" tvc-guide-stationid="111871",ACC_Network
http://{{ .IPADDRESS }}/play/tuner/111871

#EXTINF:-1 channel-id="58646" channel-number="1350" tvg-name="CNNHD" tvc-guide-stationid="58646",CNN
http://{{ .IPADDRESS }}/play/tuner/58646

#EXTINF:-1 channel-id="64549" channel-number="1351" tvg-name="HLNHD" tvc-guide-stationid="64549",HLN
http://{{ .IPADDRESS }}/play/tuner/64549

#EXTINF:-1 channel-id="60179" channel-number="1352" tvg-name="FNCHD" tvc-guide-stationid="60179",Fox_News
http://{{ .IPADDRESS }}/play/tuner/60179

#EXTINF:-1 channel-id="58718" channel-number="1353" tvg-name="FBNHD" tvc-guide-stationid="58718",Fox_Business
http://{{ .IPADDRESS }}/play/tuner/58718

#EXTINF:-1 channel-id="64241" channel-number="1354" tvg-name="MSNBC" tvc-guide-stationid="16300",MSNBC
http://{{ .IPADDRESS }}/play/tuner/64241

#EXTINF:-1 channel-id="58780" channel-number="1355" tvg-name="CNBCHD" tvc-guide-stationid="58780",CNBC
http://{{ .IPADDRESS }}/play/tuner/58780

#EXTINF:-1 channel-id="71799" channel-number="1356" tvg-name="BLOOMHD" tvc-guide-stationid="71799",Bloomberg
http://{{ .IPADDRESS }}/play/tuner/71799

#EXTINF:-1 channel-id="62077" channel-number="1357" tvg-name="HSNHD" tvc-guide-stationid="62077",HSN
http://{{ .IPADDRESS }}/play/tuner/62077

#EXTINF:-1 channel-id="99450" channel-number="1358" tvg-name="HSN2HD" tvc-guide-stationid="99450",HSN_2
http://{{ .IPADDRESS }}/play/tuner/99450

#EXTINF:-1 channel-id="68344" channel-number="1359" tvg-name="CSPAN" tvc-guide-stationid="10161",C-SPAN
http://{{ .IPADDRESS }}/play/tuner/68344

#EXTINF:-1 channel-id="68334" channel-number="1360" tvg-name="CSPN2HD" tvc-guide-stationid="68334",C-SPAN_2
http://{{ .IPADDRESS }}/play/tuner/68334

#EXTINF:-1 channel-id="68332" channel-number="1361" tvg-name="CSPN3HD" tvc-guide-stationid="68332",C-SPAN_3
http://{{ .IPADDRESS }}/play/tuner/68332

#EXTINF:-1 channel-id="109435" channel-number="1362" tvg-name="SPNWDTH" tvc-guide-stationid="109435",Spectrum_News_Dayton
http://{{ .IPADDRESS }}/play/tuner/109435

#EXTINF:-1 channel-id="91096" channel-number="1363" tvg-name="NEWSNTN" tvc-guide-stationid="91096",NewsNation
http://{{ .IPADDRESS }}/play/tuner/91096

#EXTINF:-1 channel-id="58812" channel-number="1370" tvg-name="WEATHHD" tvc-guide-stationid="58812",The_Weather_Channel
http://{{ .IPADDRESS }}/play/tuner/58812

#EXTINF:-1 channel-id="91994" channel-number="1371" tvg-name="ACUWTHH" tvc-guide-stationid="91994",AccuWeather
http://{{ .IPADDRESS }}/play/tuner/91994

Step 3 - Set scripts to be executable from inside EXEC Console

cd /opt/scripts/atv/spectrum
chmod 755 prebmitune.sh
chmod 755 bmitune.sh
chmod 755 stopbmitune.sh
ls -a -l

Verify with the last directory command that the files are now executable.

Step 4 - Add m3u to CDVR and enjoy

Success!

Your step-by-step guide was great. The only thing I changed was rename bmitunetest.sh to bmnitune.sh

Now, here's the tough part: I don't have Spectrum. At the moment, I'm trying to get a couple of channels into the tuner. One would be launching the live feed of the Tennis Channel app, the second would launch CNN's live feed in the Max app. Any pointers as to how to achieve this? I tried changing this line

launch_app=spectrumTV://watch.spectrum.net/livetv/$channelID

And I guess it would be something like launch_app=tennischannel://... but don't know how to figure out the right destination...

Anyway, thanks a lot for this great help!

@uspino
I fixed the bmitunetest.sh to bmitune.sh...

The Spectrum App uses DeepLinks to go directly to the live stream for each channel tuned. I don't know your apps or whether they have deep links for the live stream or not. I currently don't know how you go about finding the deeplinks for the ATV. But...we should be able to tune them manually.

As far as the Tennis Channel and CNN Max app or any others.
I will assume 2 things.

  • The app is installed on the ATV that you are using as a tuner
  • You can step through the screens using the remote and play the content you are asking about.

Part 1: Using Portainer and ah4c stack Exec Console

  • Go to the ah4c Stack and log into the Exec Console again.
  • Type atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 app_list
  • Look through list and find the name of the app you want
  • In Spectrum's case it is called Spectrum TV
  • Remove any spaces in the name and try to launch it
  • Type atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 launch_app=spectrumTV:
  • You have to remove all spaces and it may not care about capitalizations. Don't forget the ":" at the end. On the ATV it may ask you if you are trying to launch a specific app the first time and you will have to confirm.

Ok now that you know how to lauch the app...

Part 2: Figure out the remote commands to move through App and start stream if needed...

  • Launch the App...then type in some of the following commands to figure out the correct sequence of commands to get to live stream while watching the ATV output.

atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 up
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 down
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 right
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 left
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 select

  • Create a command combining the required commands with any needed delays to make sure it works everytime...

Example: atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 up delay=100 up delay=200 right right delay=400 select

Part 3: Use "Case" in bmitune.sh script to launch specific channel

Possible m3u file

#EXTM3U
#EXTINF:-1 channel-id="1001" channel-number="1001" tvg-name="Tennis" tvc-guide-stationid=" ",Tennis_Channel
http://{{ .IPADDRESS }}/play/tuner/1001
#EXTINF:-1 channel-id="1002" channel-number="1002" tvg-name="CNN_Live" tvc-guide-stationid=" ",CNN_Live
http://{{ .IPADDRESS }}/play/tuner/1002

Possible bmitune.sh

/bin/bash

channelID="$1"
streamerIP="$2"

case $channelID in

  1001)
    atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP launch_app=TennisTV:
    atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP up delay=100 up delay=200 right right delay=400 select
    ;;

  1002)
    atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP launch_app=MaxCNN:
    atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP up delay=100 up delay=200 right right delay=400 select
    ;;

  *)
    #run this line if nothing matched earlier
    ;;
esac

Let me know how it all works.

Everything is up and running. I had to play with the delay and sleep options to avoid some hiccups. I also added a turn_on command to wake up the ATV before launching the app. Do you also do that? Here's how it looks. First the m3u file (Is there a way to force a specific channel number in CDVR guide? They seem to appear with random numbers in my guide):

#EXTM3U

#EXTINF:-1 channel-id="Tennis Channel" channel-number="8888",TENISHD
http://{{ .IPADDRESS }}/play/tuner/8888

#EXTINF:-1 channel-id="CNN" channel-number="8889",CNNHD
http://{{ .IPADDRESS }}/play/tuner/8889

And here is bmitune.sh:

#!/bin/bash

channelID="$1"
streamerIP="$2"

case $channelID in

  8888)
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP turn_on
        sleep 2
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP launch_app=com.tennischannel.tceverywhere
        sleep 8
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP menu delay=200 down delay=200 down delay=200 down delay=200 down delay=200 down delay=200 select 
        ;;
  8889)
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP turn_on
        sleep 2
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP launch_app=com.wbd.stream
        sleep 5
        atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP select delay=4000 up delay=200 right delay=200 right delay=200 right delay=200 right delay=200 right delay=400 down delay=400 select
         ;;
  *)
            #run this line if nothing matched earlier
        ;;
esac

It's very smart to force-quit the app via stopbmitun.sh when streaming is done.

Ands that's it, hope this thread helps somebody else with Apple TV. Let me know what you think, thanks!

Great to hear everything is working...

I disabled sleep instead.

Did you set it to "Prefer channel-number from M3U" when adding it to CDVR...as long as the numbers don't conflict with something already there I believe it will use your m3u numbers.

I actually changed a handful of settings on the AppleTV...

Sleep After: Never
TV Button: Home Screen
Automatically Update Apps: Off
Automatically Install Apps: Off
Offload Unused Apps: Off
Software Updates:Automatic Updates:Off
Siri:Off

Some apps don't always start up right on app_launch if it is already running and since you are using button presses to navigate it gives you a consistant starting point at channel launch... :slightly_smiling_face: :+1:

Definitely a better option, don't think ATV power consumption in Main Menu is relevant.

Is there deep-linking to different channels in Sling TV app (in the form of launch_app=spectrumTV://watch.spectrum.net/livetv/$channelID)? There seems to be conflicting info on this...

Sling TV Tuning with AppleTV and ah4c

I did a little experimenting with the Sling TV app on the AppleTV...
Looks like they do have deep linking working on it right now.

I don't have a Sling TV subscription so this was done with a few freestream channels and they were able to load and play multiple shows in a row for over 2 hours so it appears that the way I did it is pointing to the "channel" not the individual show.

Start by installing Sling TV on Apple TV tuner
Test starting up Sling TV using atvremote command...

atvremote -s 10.10.11.42 launch_app=slingtv:

First time you may have to confirm that you want to launch the Sling TV app.

Using a computer go to
https://watch.sling.com/dashboard/grid_guide/grid_guide_all

Find a channel you want and select it so it starts to play. After it starts playing right click on playing video and select the option "Create QR code for this page"
Copy the link they show and attach it after the launch_app=slingtv: removing the http: so it starts with the //

Here are 3 samples that should launch...

Alien Nation Channel
atvremote -s 10.10.11.42 launch_app=slingtv://watch.sling.com/1/asset/51f52123df99dc6d97e5887fdf23e6c3/watch

CBS 24/7 News Channel
atvremote -s 10.10.11.42 launch_app=slingtv://watch.sling.com/1/asset/0bf0d288245ed13cb11b9c87a4bc62ba/watch

Alf TV Channel
atvremote -s 10.10.11.42 launch_app=slingtv://watch.sling.com/1/asset/bf658731eeb0d9d4ab7023803cf0caff/watch

Depending on the channels you add you may be able to find guide data inside Channels but I have not tried.
Good Luck

1 Like

It absolutely works! For those using Safari, no QR code creation option, but the same channel id appears in the address bar while watching a channel. I hope this id number does not change often. Again, thanks a lot for taking the time to check this!

1 Like

Update: well, it only took a few days for Sling to change the stream IDs, so I guess I'll have to forget about deep-linking and go back to remote commands. Was really smooth while it worked, but after a few days I got into the "This content is not available".

@uspino

Did you spot check one of the id's for a channel or two to see if they really did change?

I believe Sling is known to not always be the most reliable streaming service.

You sure Sling isn't down/having issues???
If they take to long to tune it will error out.
I am getting lots of errors trying to watch directly from website right now.
Taking LONG time to either load a channel or say error can't play right now. :man_shrugging: