Understood! I will report back after I find time to test it. Is there a concisions streaming service that works best with deep linking? Are there deeplinking for Peacock Events?
Walmart has onn Google TV 4K Pro on sale for $39.00, and possibly $5 Walmart Cash for some accounts. Very similar to the popular $20 onn 4K, but this has Ethernet which makes it very interesting for the price.
Happy Streaming!
@bnhf
Been awhile but I am working on my scripts for the AppleTV Spectrum setup again...It is still working fantastic overall.
Currently still running bnhf/ah4c:appletv.test2
I have added "select" button press after a delay to clear the overlay on the few occasions it comes up. It doesn't mess anything up if the overlay isn't there... So this was easier than trying to implement tesseract for this.
Added to bmitune.sh file
sleep 45
atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP select
I am working on solving 2 additional issues...
- Keep "tuner" running for a predetermined amount of time before completely closing the app. This allows faster tuning when surfing.
- Send key press after so long to keep "Are You Still Watching" from coming up.
Issue 1
I believe I have a solution for the first but am having problems implementing it. When stopbmitune.sh is called I am attempting to run a 2nd script from within it called stopdelay.sh
stopdelay.sh
#!/bin/bash
streamerIP="$1"
echo ""$$"" > /root/.android/$streamerIP.stop.txt
sleep 300
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Killing Feed on ATV "$streamerIP"" >> /root/.android/$streamerIP.txt
atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP home delay=250 home delay=5000 up delay=250 up delay=5000 home
This stopdelay.sh script passes the current streamerIP in from stopbmitune.sh. It then records the process number into a file that I use to kill this script in my bmitune.sh script if I tune another channel before the timer shuts down the stream.
All these scripts are located in the scripts directory and have the same attributes including the right to be executed.
Here is the stopbmitune.sh script I am trying to use...
#!/bin/bash
streamerIP="$1"
channelID="$2"
tunekill="$(< /root/.android/$streamerIP.tune.txt)"
kill $tunekill
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Running stopbmitune.sh..." >> /root/.android/$streamerIP.txt
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
I have tried many different versions to run the second script with no luck...
Here are some of them
stopdelay.sh $streamerIP
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
/opt/scripts/atv/spectrum/stopdelay.sh "192.168.1.54" &
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP
./opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
/bin/bash /opt/scripts/atv/spectrum/stopdelay.sh $streamerIP
And others I can't remember right now.
I believe I need the & at the end so this script runs but allows the stopbmitune.sh script to finish without waiting for stopdelay.sh to finish. This allows the tuner to be marked as "ready for use" and tune the next channel without waiting.
Also here is the bmitune.sh
#!/bin/bash
channelID="$1"
streamerIP="$2"
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Running bmitune.sh..." >> /root/.android/$streamerIP.txt
echo ""$$"" > /root/.android/$streamerIP.tune.txt
delaykill="$(< /root/.android/$streamerIP.stop.txt)"
kill $delaykill
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Tuning Channel "$channelID" on ATV "$streamerIP"" > /root/.android/$streamerIP.txt
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
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Sent Select Command to Clear Menu on ATV "$streamerIP"" >> /root/.android/$streamerIP.txt
sleep 10
title="`atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP title`"
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Playing "$title"" >> /root/.android/$streamerIP.txt
sleep 13200
echo ""$(date +"%Y-%m-%d %I:%M:%S%p")" ...Sending Still Watching IR Commands" >> /root/.android/$streamerIP.txt
#No commands sent through atvremote work to stop "Are You Still Watching" from coming up.
#This will be used to send IR commands probably using curl to prevent this instead.
I think I just need to figure out how to run the stopdelay.sh inside of stopbmitune.sh and I will have this. I am not an expert on shell scripts and just can't seem to figure out the right way to do it
Issue2
IR commands... looking for the best/cheapest way to do this just using something really simple like curl commands from my scripts sent to a microcontroller like ESP8266 or ir hub that can receive curl commands and send to multiple "tuners". Don't want to add a bunch of extra stuff like HomeLab/HomeAssistant. Let me know if anyone has suggestions.
I believe I may have figured out Issue 1...
I created the bash file stopdelay.sh using Notepad++ on windows...
Even when I edited it to a very simple script and tried to run it I could not get it to run right.
Blank lines would even give errors running from the CLI
I made a copy of my working stopbmitune.sh and cleared everything out of it, renamed to stopdelay.sh and started puting stuff back in it.
Have now successfully ran a simple script from both command line and from inside scripts...
This is now working to call it from inside script...
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
Feeling pretty dumb about this now.
Apparently I am wrong about what tells the system that a tuner is available...
With my updated scripts the stopbmitune.sh script runs and finishes immediately after calling
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
I can then watch the tuners run out the timer in stopdelay.sh before shutting down...BUT the tuners are not freed up until this stopdelay.sh finishes so there must be another lock somewhere...
Is there a variable i can set to tell ah4c that the tuner is now available?
Edit #1:
Looking at logs and it looks like it is not "finishing" the stopbmitune.sh until after the stopdelay.sh finishes. So it looks like the & at the end is not doing what I thought it would...I will keep looking for the correct command structure.
Edit #2:
Using "exit 0" at end of stopbmitune.sh doesn't appear to work either.
Edit #3:
I verified that the proc for stopbmitune.sh is finishing within 5 seconds using ps -p $PID
I also used ...
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
job_id=$! # Get the job ID of the background process
disown -h $job_id #Disown the job
in the stopbmitune to make sure that the script is disowned...
Yet the log for ah4c keeps taking the full 5 min to say stopbmitune.sh has finished and release the tuner even though I can see in the command line that is has finished in 5 seconds and the process is now done and gone.
Im thinking of buying an hdmi encoder to get this to work but I would like to know, with an HDMI encoder am I able to watch any channel coming from a subscription like say hulu, or only the channel currently playing on that particular subscription or service? Thanks in advance
You could try launching your script using nohup
. I've had pretty could luck with that launching child scripts, while still being able to fully terminate the parent. The child script is started in its own shell as I recall.
Both ah4c and ADBTuner are proxies that turn an HDMI Encoder, and one or more streaming sticks, into virtual tuners. So for supported apps, tuning to a particular live TV channel in CDVR causes the proxy to send the commands necessary to the streaming stick to launch the app and select the desired channel. The proxy then passes the encoder's output stream to CDVR.
ok thanks, so as I understand it I would be able to tune to any desired channel if I have the equipment and everything setup correctly, Im sorry its just that I am new at this lol, could you please recommend the equipment needed to make this happen, like say from amazon? I currently have a firestick and subscriptions to directv, fubo, hulu tv, and dish. I would appreciate it in advance!
just to be clear will I be able to change the channel from the channelsdvr app or would i need to change it from some other device or medium, because ideally my dream would be able to tune to any provider from the channelsdvr app, thanks in advance!
Yes you will be able to "tune" any channel that you have set up in CDVR through your CDVR client.
Here is basically what you would need to do to start (Sorry if you already know all this...Just thought I would clarify it)
- Get Subscriptions to whichever services you wish to use
- Get and setup an adb debug capable android dongle(firetv stick, onn, or a different dongle that can work with adb debug commands) that can be used with your live tv streaming app. Need as many of these as tuners you wish to have. Connect these to the HDMI inputs on the Encoders.
- Buy and setup an hdmi encoder for how ever many "tuners" you what to be able to use at one time. This can be single encoders or multi encoders (Many people on here use either URAY or LinkPi encoders)
- Set up the ADBTuner or ah4c software on a computer running docker. (Either of these two programs act as the middle man handling the communications between the CDVR --- "Tuner" Dongles --- HDMI Encoders.
Once everything is setup you simply watch/record tv through CDVR like any other channels you have setup in CDVR.
I just tried both...
nohup /opt/scripts/atv/spectrum/stopdelay.sh $streamerIP
nohup /opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
and before...
/opt/scripts/atv/spectrum/stopdelay.sh $streamerIP &
along with the other things I mentioned.
All of the above appear to be separating the stopdelay.sh script from the stopbmitune.sh
If I watch them using ps -p $PID from within the ah4c docker terminal they show that the stopbmitune.sh finishes when it should while the stopdelay.sh continues running until it times out at the currently set 5 minutes.
BUT in the log for ah4c it shows that the stopbmitune.sh does not finish for 5 minutes STILL apparently waiting on stopdelay.sh or something
atvtuner:/opt# ps -p 1918
PID TTY TIME CMD
1918 ? 00:00:00 stopbmitune.sh
atvtuner:/opt# ps -p 1925
PID TTY TIME CMD
1925 ? 00:00:00 stopdelay.sh
atvtuner:/opt#
atvtuner:/opt#
atvtuner:/opt# ps -p 1918
PID TTY TIME CMD
atvtuner:/opt# ps -p 1925
PID TTY TIME CMD
1925 ? 00:00:00 stopdelay.sh
atvtuner:/opt#
Attempting network tune for device http://192.168.1.41:8090/stream3 192.168.1.54 58515
[EXECUTE] Running [./scripts/atv/spectrum/prebmitune.sh 192.168.1.54 58515]
[EXECUTE] Stdout: ''
[EXECUTE] Stderr: ''
[EXECUTE] Finished running ./scripts/atv/spectrum/prebmitune.sh in 5.059817ms
[EXECUTE] Running [./scripts/atv/spectrum/bmitune.sh 58515 192.168.1.54]
[STATS] CPU usage: 3.8143881764808616%
[STATS] Alloc = 2 MiB
[STATS] TotalAlloc = 159 MiB
[STATS] Sys = 14 MiB
[STATS] NumGC = 649
[STATS] Total memory: 14945 MiB
[STATS] Memory used: 3123 MiB
[STATS] Memory used percent: 20.895883258262966%
[IO] io.Copy: write tcp 172.26.0.2:7654->192.168.1.20:54728: write: broken pipe
[IOINFO] Successfully copied 55022524 bytes
[IOINFO] Transfer speed: 5.551282869535697 Mbits/second
Performing Close() for 192.168.1.54
[EXECUTE] Running [./scripts/atv/spectrum/stopbmitune.sh 192.168.1.54 58515]
Tuner 0 is active - skipping
Attempting network tune for device http://192.168.1.41:8090/stream4 192.168.1.55 58515
[EXECUTE] Running [./scripts/atv/spectrum/prebmitune.sh 192.168.1.55 58515]
[EXECUTE] Stdout: ''
[EXECUTE] Stderr: ''
[EXECUTE] Finished running ./scripts/atv/spectrum/prebmitune.sh in 4.748084ms
[EXECUTE] Running [./scripts/atv/spectrum/bmitune.sh 58515 192.168.1.55]
[EXECUTE] Stdout: ''
[EXECUTE] Stderr: ''
**[EXECUTE] Finished running ./scripts/atv/spectrum/stopbmitune.sh in 5m12.281905959s**
[GIN-debug] Request: 192.168.1.20 GET /play/tuner/58515, latency: 6m31.583909747s, status: 200
So in the above example you can see that both stopbmitune and stopdelay are running initially...I wait until stopbmitune shows it is finished (currently set at 1 minute) and while stopdelay is still running (currently set at 5 minutes) and try to watch the channel again...but as you can see it comes back with ...Tuner 0 is active - skipping in the log.
And the log shows stopbmitune taking the full 5min...
[EXECUTE] Finished running ./scripts/atv/spectrum/stopbmitune.sh in 5m12.281905959s
If they are truely separated as they appear AND the PS command is showing that stopbmitune.sh is finished I don't understand what is going on here. I am not very knowledgable with linux so I am probably not seeing something obvious.
Could you give me the short version of what you're trying to accomplish? Are you trying to stop the stream on the ATV without closing the app, or are you trying to keep the stream and the app active? Or what exactly?
If I had a better grasp on exactly what state you're trying to leave the ATV and the encoder in, maybe I can help figure out a simpler way to approach it -- ideally leveraging something I've previously written.
lol...I will do my best to keep it short.
I want to leave the App streaming for a predefined amount of time after leaving the channel but make it IMMEDIATELY available to be used to tune to another channel.
AppleTV Spectrum App is always streaming video no matter what screen it is showing(live, guide,on demand, library, setup)
I don't want them to keep streaming ALL the time for 2 reasons...Bandwidth restrictions and the "Are you still watching" dialog.
Various Tuning Times...
Launch App............+45sec
App in Background...10-20sec
App Left Streaming...~5sec or less
I was looking to keep the appletv spectrum stream running for extra time probably 5 to 15 minutes so when I am channel surfing it tunes much faster.
There was originally extra problems at times if it was left as background app instead of closing it all the way but I currently don't remember what those were without experimenting again.
Still running image: bnhf/ah4c:appletv.test2
I have figured out my scripts so the tuners will stay running on the current channel for 10 minutes but allows them to tune a different channel if asked.
NEW problem is that anything I add to crontab never runs. I have verified they have "chmod 755" and will run manually.
Example that does show when I run crontab -l
*/5 * * * * /opt/scripts/atv/spectrum/tuners_stop_delay.sh > /root/.android/tuners_stop_delay.log 2>&1
I know anything I add to crontab will be tempory and will be lost on reboot but I can't figure out WHY it never runs even once. I made sure that this and any scripts it calls have the complete path. I had some issues when I ran them in the background...
It didn't like
atvremote --storage-filename /root/.android/.pyatv.conf -s 192.168.1.55 home delay=300 home delay=3000 up delay=300 up delay=3000 home
so I had to change it to what I show below in all the scripts
/usr/local/bin/atvremote --storage-filename /root/.android/.pyatv.conf -s 192.168.1.55 home delay=300 home delay=3000 up delay=300 up delay=3000 home
Since crontab didn't work I created a slightly different script that uses a while loop.
I manually launch this from EXEC Console when starting the stack
/opt/scripts/atv/spectrum/tuners_stop_delay.sh & > /root/.android/tuners_stop_delay.log 2>&1
tuners_stop_delay.sh
#!/bin/bash
while true; do
if [ -f "/root/.android/192.168.1.54.stop.lock" ]; then
:
else
/opt/scripts/atv/spectrum/192.168.1.54.stop.sh &
fi
if [ -f "/root/.android/192.168.1.55.stop.lock" ]; then
:
else
/opt/scripts/atv/spectrum/192.168.1.55.stop.sh &
fi
sleep 600
done
So 2 questions....
- Do you know why I can't get something to run that I add to crontab?
- Can I somehow add something in my docker stack that will make this script run automatically when I start my stack. Possibly a CMD line in the stack?
Thanks
Cron is pretty much a no-go in a Docker container.
What if I added an environment variable that would allow for the running of a custom script at startup (in addition to the standard startup script). The script would need to be placed in the scripts
directory, and the script name assigned to the env var.
I have a few other things in the hopper ahead of you, but I'll get it done reasonably soon.
Hello I am trying to setup ah4c but I am stuck in the part where it says: "Specify the name of your LAN's domain", how do i obtain this? Thanks in advance!
This is for hostname resolution, and is especially useful for anyone using Tailscale. But it's a worthwhile data point to know. localdomain
or local
are common, but other names are used.
It's also not uncommon for routers to have a local domain name setting that's unused leading to the need to use LAN IP addresses for everything.
Here's what ChatGPT says on the subject:
To determine your LAN's domain name, you can try one of the following methods:
1. Check Your Router's Configuration
- Log in to your router's web interface:
- Open a web browser and enter your router's IP address (commonly
192.168.1.1
or192.168.0.1
). - Log in with your admin username and password.
- Look for the "LAN Settings" or "DHCP Settings" section.
- Find the "Domain Name" or "Local Domain" field. This will display your LAN's domain name, if configured.
2. Use the hostname
Command (Linux/MacOS)
Run the following command in a terminal:
hostname -d
If your LAN domain is set, it will display the domain name.
Alternatively, check the fully qualified domain name (FQDN):
hostname -f
This will display the hostname along with the domain name.
3. Use the ipconfig
Command (Windows)
- Open Command Prompt.
- Run:
ipconfig /all
- Look for the "Primary DNS Suffix" or "Connection-specific DNS Suffix" under your active network adapter.
4. Check the resolv.conf
File (Linux)
- Open a terminal.
- View the contents of the
/etc/resolv.conf
file:
cat /etc/resolv.conf
- Look for the
search
ordomain
entries, which indicate the LAN domain name.
5. Use the nslookup
Command
- Run the following command:
nslookup <your LAN IP address>
- The result may include the LAN domain name associated with the IP address.
6. Contact Your Network Administrator
If the above steps do not yield results, contact your network administrator or Internet Service Provider (ISP) to inquire about your LAN's domain name, especially if it was manually configured.