Skip those endless credits and get to the next episode instantly!
atv-seq is a command-line tool that executes pre-defined command sequences on your Apple TV using the pyatv library. Perfect for skipping long end credits or automating any repetitive remote control actions.
- Custom sequences: Define any sequence of remote control actions in JSON
- Modular: Use different sequence files for different scenarios
- Pairing support: Securely pair with your Apple TV and save credentials
- IP from credentials: Automatically uses the IP address from stored pairing credentials
- Simple CLI: Easy to use command-line interface
pipx install git+https://github.com/byamo/atv-seq.gitcd atv-seq
pipx install -e .- Python 3.10+
- An Apple TV on the same network
- pyatv library (installed automatically)
Before you can control your Apple TV, you need to pair with it. The IP address will be automatically saved for future use:
atv-seq --pairFollow the on-screen instructions. You'll need to enter a PIN that appears on your Apple TV or enter the displayed PIN on your device.
Credentials (including IP address) are saved automatically in credentials.json and reused for future connections.
Execute the default sequence (skip to next episode). The script automatically uses the IP from stored credentials:
atv-seqatv-seq -s /path/to/your_sequence.jsonIf you have multiple Apple TVs or need to override the stored IP:
atv-seq --ip 10.0.0.100 -s your_sequence.jsonThis will also update the credentials storage with the new IP address.
Sequences are defined in JSON files with the following structure:
{
"name": "Skip Intro",
"description": "Navigates to next episode",
"steps": [
{"action": "select", "delay": 0.5},
{"action": "up", "delay": 0.3},
{"action": "right", "delay": 0.3},
{"action": "select", "delay": 0}
]
}All standard Apple TV remote control actions are supported:
- Navigation:
up,down,left,right,select - Playback:
play,pause,play_pause,stop,next,previous - Volume:
volume_up,volume_down,mute - Menu:
menu,home,top_menu - Power:
wake,sleep
The delay field (in seconds) controls how long to wait after each action. This is useful for giving the Apple TV time to respond between commands.
{
"name": "Skip End Credits",
"steps": [
{"action": "select", "delay": 0.5},
{"action": "down", "delay": 0.2},
{"action": "down", "delay": 0.2},
{"action": "select", "delay": 0}
]
}{
"name": "Volume Up x3",
"steps": [
{"action": "volume_up", "delay": 0.1},
{"action": "volume_up", "delay": 0.1},
{"action": "volume_up", "delay": 0.1}
]
}{
"name": "Home to App",
"steps": [
{"action": "home", "delay": 1.0},
{"action": "right", "delay": 0.5},
{"action": "right", "delay": 0.5},
{"action": "select", "delay": 0}
]
}The default sequence (default.json) performs the typical "next episode" navigation:
select -> up -> right -> select.
This works for some streaming apps to skip end credits and go to the next episode.
The script automatically manages IP addresses:
- First use: Run
atv-seq --pairto discover and pair with your Apple TV. The IP is automatically saved. - Subsequent uses: Simply run
atv-seq- the script uses the IP from stored credentials. - Multiple devices: Use
--ipto specify which Apple TV to target. The script will update credentials for that IP. - View stored IP: Check
atv_seq/credentials.jsonto see saved configurations.
- Create a new JSON file with your sequence
- Test it with:
atv-seq -s your_sequence.json - Adjust delays if commands execute too fast
- Save it for later use
atv-seq/
├── atv_seq/
│ ├── __init__.py
│ ├── __main__.py # Main script
│ ├── default.json # Default skip sequence
│ └── credentials.json # Pairing credentials (generated, gitignored)
├── .gitignore
├── MANIFEST.in
├── pyproject.toml
└── README.md
- Try to increase the
--delay-factorto slow down actions
- Run
atv-seq --pairfirst to pair and save your Apple TV's IP - Or specify an IP manually with
--ip 10.0.0.100
- Verify the Apple TV is on and connected to the same network
- Check the IP address with
cat atv_seq/credentials.json - Make sure your computer can ping the Apple TV:
ping <IP> - Your Apple TV's IP may have changed - run
--pairagain
- Run
atv-seq --pairfirst - Follow the pairing instructions on screen
- If pairing fails, delete
credentials.jsonand try again
- The action may not be available on your Apple TV model
- The script uses Companion protocol for navigation commands
- Check the available actions in the pyatv documentation
- Try using only:
select,up,down,left,right
- Most common cause: Pairing was not completed successfully
- Verify Companion protocol is available: look for
Companionin the service list when running the script - Run
atv-seq --pairagain and ensure you complete the pairing process - The default sequence requires Companion protocol for navigation commands
- Restart your Apple TV
- Forget the device: remove
credentials.jsonand run--pairagain - Check your firewall allows local network connections
MIT License - feel free to use, modify, and distribute.
Built with pyatv - A Python library for Apple TV and AirPlay devices.