Skip to content

house.tv

Android TV devices controlled over ADB, their apps, channels and EPG scraping. 54 options.

Attrset of TV devices, keyed by an arbitrary device name (e.g. "livingroom"). Each entry describes how to reach the TV over ADB, its room, its channel lineup, and how to map logical playback/navigation actions to Android keycodes.

Type: attribute set of (submodule)

Default: { }

Example:

{
livingroom = {
apps = {
telenor = "se.telenor.stream/.MainActivity";
tv4 = "se.tv4.tv4playtab/se.tv4.tv4play.ui.mobile.main.BottomNavigationActivity";
};
channels = {
svt1 = {
cmd = "";
icon = /nix/store/ck6yi0d28p0hsx4ddqvfds81ibwb40aw-source/options/icons/svt1.png;
id = 1;
name = "SVT1";
scrape_url = "https://www.svtplay.se/kanaler/svt1";
stream_url = "";
};
tv4 = {
cmd = "am start -n se.tv4.tv4playtab/.MainActivity";
name = "TV4";
scrape_url = "https://www.tv4play.se/kanaler/tv4";
};
};
enable = true;
ip = "192.168.1.42";
isDefault = true;
keymap = {
nav_back = "KEYCODE_BACK";
nav_down = "KEYCODE_DPAD_DOWN";
nav_home = "KEYCODE_HOME";
nav_left = "KEYCODE_DPAD_LEFT";
nav_menu = "KEYCODE_MENU";
nav_right = "KEYCODE_DPAD_RIGHT";
nav_select = "KEYCODE_DPAD_CENTER";
nav_up = "KEYCODE_DPAD_UP";
play_pause = "KEYCODE_MEDIA_PLAY_PAUSE";
power_off = "KEYCODE_SLEEP";
power_on = "KEYCODE_WAKEUP";
volume_down = "KEYCODE_VOLUME_DOWN";
volume_up = "KEYCODE_VOLUME_UP";
};
room = "livingroom";
};
}

Declared in: options/tv.nix

App package names and activities for this TV device

Type: attribute set of string

Default: { }

Example:

{
telenor = "se.telenor.stream/.MainActivity";
tv4 = "se.tv4.tv4playtab/se.tv4.tv4play.ui.mobile.main.BottomNavigationActivity";
}

Declared in: options/tv.nix

Whether to enable communication with this TV via ADB. This requires that network debugging is turned on in the TV’s developer options. It is also strongly recommended to install the VLC Media Player application on the device.

Type: boolean

Default: true

Declared in: options/tv.nix

TV’s static IP address

Type: string

Declared in: options/tv.nix

Whether this TV is the default device when multiple TVs are defined and no specific room or IP is requested.

Type: boolean

Default: false

Declared in: options/tv.nix

Room where the TV is located

Type: one of “bedroom”, “hallway”, “kitchen”, “livingroom”, “other”, “tv-area”, “wc”

Declared in: options/tv.nix

TV channel options

Type: attribute set of (submodule)

Default: { }

Declared in: options/tv.nix

Sequence of ADB commands to launch the channel, separated by &&. Overrides stream_url and id.

Type: string

Default: ""

Declared in: options/tv.nix

Optional file path for channel icon used on dashboard frontend

Type: null or absolute path

Default: null

Declared in: options/tv.nix

Numeric channel ID used when no cmd or stream_url is provided.

Type: null or signed integer

Default: null

Declared in: options/tv.nix

Channel display name

Type: string

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scrape_url

Section titled “house.tv.<name>.channels.<name>.scrape_url”

URL used by tv-scraper to fetch TV guide data for this channel.

Type: string

Default: ""

Declared in: options/tv.nix

Per-channel scraper overrides, layered on top of the device-level scraper and the scraper’s built-in defaults.

Type: submodule

Default: { }

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.default_duration_minutes

Section titled “house.tv.<name>.channels.<name>.scraper.default_duration_minutes”

Fallback duration when the next entry’s start time can’t be parsed. Scraper default: 30.

Type: null or (positive integer, meaning >0)

Default: null

Example: 45

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.desc_xpath

Section titled “house.tv.<name>.channels.<name>.scraper.desc_xpath”

XPath relative to a row, locating the description element. Set to "" to disable descriptions. Scraper default: .//p.

Type: null or string

Default: null

Example: ".//div[@class='synopsis']"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.pm_heuristic_after_hour

Section titled “house.tv.<name>.channels.<name>.scraper.pm_heuristic_after_hour”

Only relevant for 12-hour formats that lack an explicit AM/PM marker. Once the previous programme reached or passed this hour, later ambiguous AM hours are promoted to PM. null disables the heuristic.

Type: null or integer between 0 and 23 (both inclusive)

Default: null

Example: 12

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.row_xpath

Section titled “house.tv.<name>.channels.<name>.scraper.row_xpath”

XPath selecting each programme row. Scraper default: //table[@id="channel-schedule"]//tr.

Type: null or string

Default: null

Example: "//div[contains(@class,'programme-row')]"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.time_attr

Section titled “house.tv.<name>.channels.<name>.scraper.time_attr”

Attribute of the time element to read. Set to "" to always use the element’s text content. Scraper default: "datetime".

Type: null or string

Default: null

Example: "data-start"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.time_formats

Section titled “house.tv.<name>.channels.<name>.scraper.time_formats”

strptime formats tried in order, after ISO 8601 is attempted. Scraper default: [ "%H:%M" "%H.%M" ].

Type: null or (list of string)

Default: null

Example:

[
"%I:%M %p"
"%I:%M%p"
"%H:%M"
]

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.time_strip_pattern

Section titled “house.tv.<name>.channels.<name>.scraper.time_strip_pattern”

Regex applied to the raw time string before strptime. Set to "" to disable stripping — required when the format keeps a literal AM/PM marker. Scraper default: "[^\\d:\\.]".

Type: null or string

Default: null

Example: "[^\\d:\\.APM ]"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.time_xpath

Section titled “house.tv.<name>.channels.<name>.scraper.time_xpath”

XPath relative to a row, locating the element containing the start time. Scraper default: .//time.

Type: null or string

Default: null

Example: ".//span[@class='airtime']"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.timezone_offset_hours

Section titled “house.tv.<name>.channels.<name>.scraper.timezone_offset_hours”

Fixed offset applied to every parsed time, in hours. May be fractional (e.g. 5.5). null = use the scraper’s built-in global TIME_OFFSET.

Type: null or signed integer or floating point number

Default: null

Example: 2

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.scraper.title_xpath

Section titled “house.tv.<name>.channels.<name>.scraper.title_xpath”

XPath relative to a row, locating the title element. Scraper default: .//a[contains(@class, "program-title")].

Type: null or string

Default: null

Example: ".//h3"

Declared in: options/tv.nix

house.tv.<name>.channels.<name>.stream_url

Section titled “house.tv.<name>.channels.<name>.stream_url”

Direct stream URL to play on the device. Used when cmd is empty, overrides id.

Type: string

Default: ""

Declared in: options/tv.nix

Mapping of logical actions to Android keycodes

Type: submodule

Default: { }

Declared in: options/tv.nix

Android Keycode for channel down

Type: string

Default: "KEYCODE_CHANNEL_DOWN"

Declared in: options/tv.nix

Android Keycode for channel up

Type: string

Default: "KEYCODE_CHANNEL_UP"

Declared in: options/tv.nix

Android Keycode for back navigation

Type: string

Default: "KEYCODE_BACK"

Declared in: options/tv.nix

Android Keycode for navigation down

Type: string

Default: "KEYCODE_DPAD_DOWN"

Declared in: options/tv.nix

Android Keycode for home

Type: string

Default: "KEYCODE_HOME"

Declared in: options/tv.nix

Android Keycode for navigation left

Type: string

Default: "KEYCODE_DPAD_LEFT"

Declared in: options/tv.nix

Android Keycode for menu

Type: string

Default: "KEYCODE_MENU"

Declared in: options/tv.nix

Android Keycode for recent apps

Type: string

Default: "KEYCODE_APP_SWITCH"

Declared in: options/tv.nix

Android Keycode for navigation right

Type: string

Default: "KEYCODE_DPAD_RIGHT"

Declared in: options/tv.nix

Android Keycode for navigation select/enter

Type: string

Default: "KEYCODE_DPAD_CENTER"

Declared in: options/tv.nix

Android Keycode for navigation up

Type: string

Default: "KEYCODE_DPAD_UP"

Declared in: options/tv.nix

Android Keycode for next media

Type: string

Default: "KEYCODE_MEDIA_NEXT"

Declared in: options/tv.nix

Android Keycode for play/pause

Type: string

Default: "KEYCODE_MEDIA_PLAY_PAUSE"

Declared in: options/tv.nix

Android Keycode for turning the TV off

Type: string

Default: "KEYCODE_SLEEP"

Declared in: options/tv.nix

Android Keycode for turning the TV on

Type: string

Default: "KEYCODE_WAKEUP"

Declared in: options/tv.nix

Android Keycode for previous media

Type: string

Default: "KEYCODE_MEDIA_PREVIOUS"

Declared in: options/tv.nix

Android Keycode for volume down

Type: string

Default: "KEYCODE_VOLUME_DOWN"

Declared in: options/tv.nix

Android Keycode for volume up

Type: string

Default: "KEYCODE_VOLUME_UP"

Declared in: options/tv.nix

Scraper tunables applied to every channel on this device. Any subset may be overridden per channel via channels.<name>.scraper.

Type: submodule

Default: { }

Example:

{
default_duration_minutes = 30;
desc_xpath = ".//p";
pm_heuristic_after_hour = null;
row_xpath = "//table[@id=\"channel-schedule\"]//tr";
time_attr = "datetime";
time_formats = [
"%H:%M"
"%H.%M"
];
time_strip_pattern = "[^\\d:\\.]";
time_xpath = ".//time";
timezone_offset_hours = null;
title_xpath = ".//a[contains(@class, \"program-title\")]";
}

Declared in: options/tv.nix

house.tv.<name>.scraper.default_duration_minutes

Section titled “house.tv.<name>.scraper.default_duration_minutes”

Fallback duration when the next entry’s start time can’t be parsed. Scraper default: 30.

Type: null or (positive integer, meaning >0)

Default: null

Example: 45

Declared in: options/tv.nix

XPath relative to a row, locating the description element. Set to "" to disable descriptions. Scraper default: .//p.

Type: null or string

Default: null

Example: ".//div[@class='synopsis']"

Declared in: options/tv.nix

house.tv.<name>.scraper.pm_heuristic_after_hour

Section titled “house.tv.<name>.scraper.pm_heuristic_after_hour”

Only relevant for 12-hour formats that lack an explicit AM/PM marker. Once the previous programme reached or passed this hour, later ambiguous AM hours are promoted to PM. null disables the heuristic.

Type: null or integer between 0 and 23 (both inclusive)

Default: null

Example: 12

Declared in: options/tv.nix

XPath selecting each programme row. Scraper default: //table[@id="channel-schedule"]//tr.

Type: null or string

Default: null

Example: "//div[contains(@class,'programme-row')]"

Declared in: options/tv.nix

Attribute of the time element to read. Set to "" to always use the element’s text content. Scraper default: "datetime".

Type: null or string

Default: null

Example: "data-start"

Declared in: options/tv.nix

strptime formats tried in order, after ISO 8601 is attempted. Scraper default: [ "%H:%M" "%H.%M" ].

Type: null or (list of string)

Default: null

Example:

[
"%I:%M %p"
"%I:%M%p"
"%H:%M"
]

Declared in: options/tv.nix

house.tv.<name>.scraper.time_strip_pattern

Section titled “house.tv.<name>.scraper.time_strip_pattern”

Regex applied to the raw time string before strptime. Set to "" to disable stripping — required when the format keeps a literal AM/PM marker. Scraper default: "[^\\d:\\.]".

Type: null or string

Default: null

Example: "[^\\d:\\.APM ]"

Declared in: options/tv.nix

XPath relative to a row, locating the element containing the start time. Scraper default: .//time.

Type: null or string

Default: null

Example: ".//span[@class='airtime']"

Declared in: options/tv.nix

house.tv.<name>.scraper.timezone_offset_hours

Section titled “house.tv.<name>.scraper.timezone_offset_hours”

Fixed offset applied to every parsed time, in hours. May be fractional (e.g. 5.5). null = use the scraper’s built-in global TIME_OFFSET.

Type: null or signed integer or floating point number

Default: null

Example: 2

Declared in: options/tv.nix

XPath relative to a row, locating the title element. Scraper default: .//a[contains(@class, "program-title")].

Type: null or string

Default: null

Example: ".//h3"

Declared in: options/tv.nix