Skip to content

fix: Season, Episode, and Previously Shown #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2f34787
Update tvlistings.ts
jesmannstl Jul 25, 2025
2c3b703
Update xmltv.ts
jesmannstl Jul 25, 2025
da95bec
Update tvlistings.ts
jesmannstl Jul 25, 2025
0d86455
Update README.md
jesmannstl Jul 25, 2025
8644c8b
Update README.md
jesmannstl Jul 25, 2025
6ca7fb7
Update tvlistings.ts
jesmannstl Jul 25, 2025
4b8246d
Add files via upload
jesmannstl Jul 26, 2025
1430851
Update README.md
jesmannstl Jul 26, 2025
b88f82f
Made add Series to non-movie by default
jesmannstl Jul 27, 2025
9ba3fee
Removed --includeSeriesGenre option as built in
jesmannstl Jul 27, 2025
8f0edbf
Update tvlistings.ts
jesmannstl Jul 29, 2025
3c10e5b
updates
roblatour Jul 30, 2025
652277d
Update README.md
jesmannstl Jul 31, 2025
840055d
updates
roblatour Jul 31, 2025
b0476cb
Update config.ts
roblatour Jul 31, 2025
bea355e
Merge upstream changes and resolve README conflicts - Remove --includ…
roblatour Jul 31, 2025
0328c9e
Merge pull request #3 from roblatour/main
jesmannstl Aug 3, 2025
3dcf717
Update <date> add. ep. naming --addAsterisk option
jesmannstl Aug 4, 2025
04d81ff
Update <date> add. ep. naming --addAsterisk option
jesmannstl Aug 4, 2025
33e5472
Update README.md
jesmannstl Aug 4, 2025
28cc6c2
Update README.md --appendAsterisk
jesmannstl Aug 4, 2025
1df1640
Minor correction
jesmannstl Aug 4, 2025
45bb262
Added SYYYYEMMDD to Series without any ex (News)
jesmannstl Aug 4, 2025
8ded7d6
Update ci.yaml
jesmannstl Aug 4, 2025
2e6da8d
Delete .github/workflows/ci.yaml
jesmannstl Aug 4, 2025
6124c7f
Create ci.yml
jesmannstl Aug 4, 2025
d2475c2
Create docker-image.yml
jesmannstl Aug 4, 2025
d1048dc
Update README.md
jesmannstl Aug 4, 2025
a165763
Update nightly-release.yaml
jesmannstl Aug 4, 2025
7dbd11f
Update nightly-release.yaml
jesmannstl Aug 4, 2025
9d5163e
Update README.md
jesmannstl Aug 4, 2025
adc7a67
Update Season Episode if not Movie/Sports
jesmannstl Aug 5, 2025
3c6be3b
Updated Changelog with all updates since 7/22
jesmannstl Aug 6, 2025
2242456
Update xmltv.ts
jesmannstl Aug 6, 2025
122d987
Added changes on this fork
jesmannstl Aug 6, 2025
5fa1723
Update README.md with recent updates
jesmannstl Aug 6, 2025
e6748ef
Update README.md with recent updates
jesmannstl Aug 6, 2025
1c855ed
Added many countries and mediaportal option
jesmannstl Aug 6, 2025
7c11fa0
Updated options and country
jesmannstl Aug 6, 2025
db5eae2
Update Valid Country Codes.md
jesmannstl Aug 6, 2025
7d4f403
Update README.md
jesmannstl Aug 6, 2025
c0c99d4
Removed icon width for better viewing
jesmannstl Aug 7, 2025
dbecf0b
Merge branch 'main' of https://github.com/jesmannstl/zap2xml
jesmannstl Aug 7, 2025
2d1ed65
Update README.md
jesmannstl Aug 7, 2025
1d9a836
Update README.md
jesmannstl Aug 7, 2025
f1fb732
Updated date tag added length
jesmannstl Aug 7, 2025
0850ccb
Update README.md
jesmannstl Aug 7, 2025
9b84599
Update FUNDING.yml
jesmannstl Aug 7, 2025
8710a1f
Postal Code not required except OTA
jesmannstl Aug 8, 2025
dad2b56
Reordered Program fields to match original Perl output order
jesmannstl Aug 8, 2025
0089561
Fixed Sorting by channel/time
jesmannstl Aug 10, 2025
3de1db4
Fixed "dd_progid" tag
jesmannstl Aug 10, 2025
c739794
chore(main): release 2.2.1 (#1)
github-actions[bot] Aug 11, 2025
cae96f3
Update README.md with Lineup links
jesmannstl Aug 11, 2025
7089c83
Update README.md With lineup links
jesmannstl Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: jef
custom: ["https://www.paypal.me/jxf"]
github: jesmannstl
custom: ["https://www.paypal.me/jesmannstl"]
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: docker build .

build-lint-test:
name: Build, Lint, and Test
name: Build and Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -38,9 +38,6 @@ jobs:
- name: Lint
run: npm run lint

- name: Unit tests
run: npm run test:run

- name: Integration tests
run: |
node dist/index.js --lineupId=USA-DITV751-X --timespan=3 --postalCode=80020 --outputFile=dtv.xml
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag zap2xml:$(date +%s)
4 changes: 2 additions & 2 deletions .github/workflows/nightly-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .
-t "ghcr.io/${GITHUB_REPOSITORY}:latest" .

- name: Release Docker image
if: steps.code-change.outputs.should-run == 'true'
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"
docker push "ghcr.io/${GITHUB_REPOSITORY}:latest"
54 changes: 53 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,75 @@
# Changelog

## (2025-08-07)

* Updated channel logo no longer has fixed width so can display in better quality

## (2025-08-06)

* Added Valid Country Codes that can be used
* Added `--mediaportal` option to use `<episode-num system="xmltv_ns">` before others so Media Portal will display Season/Episode properly


## (2025-08-05)

### Changes since previous release

These changes are currently on the [jesmannstl/zap2xml](https://github.com/jesmannstl/zap2xml) fork

* Added Category if available (Movie, Sports, News, Talk, Family etc)
* Added Category "Series" to all programs that did not return a category
* Added additional Season Episode formats for various players
* Added year as Season for programs that only list an episode number like daily cable news
* Added <date> tag to all programs without an aired date normalized to America/New York
* Added xmltv\_ns with the date aired as Season YYYY Episode MMYY to Non Movie or Sports with no other Season/Episode like local news so would have the ability to record as Series is most players.
* Added URL to program details from old Perl function.
* Added --appendAsterisk to add \* to title on programs that are New and/or Live
* Added <previously-shown /> tag to programs that are not <New> and/or <Live>
* Updated affiliateId after orbebb stopped working
* Updated Docker with these changes use APPEND\_ASTERISK: TRUE for the --appendAsterisk option



## [2.2.1](https://github.com/jesmannstl/zap2xml/compare/v2.2.0...v2.2.1) (2025-08-10)


### Bug Fixes

* series and episode info ([6e6fa26](https://github.com/jesmannstl/zap2xml/commit/6e6fa26b75c3b47f9e29f3131daabac0401144c0))

## [2.2.0](https://github.com/jef/zap2xml/compare/v2.1.1...v2.2.0) (2025-07-22)



### Features

* update rating, new, stereo, and cc ([e077f27](https://github.com/jef/zap2xml/commit/e077f2721c78d278db14037776ebdeb4cdee660d))



### Bug Fixes

* add thumbnails for programs ([3ab0370](https://github.com/jef/zap2xml/commit/3ab0370d725c029d64441febb981eeec04f2e1ef))
* args work now ([#54](https://github.com/jef/zap2xml/issues/54)) ([ad7aa8e](https://github.com/jef/zap2xml/commit/ad7aa8e5815b80f6fcb5ae118f29281d481e03d1))
* headendId when OTA, add tests ([1696b15](https://github.com/jef/zap2xml/commit/1696b15712753039d896a6fcbe3145331f9b5b76))



### Continuous Integration

* clean up and conventions ([#52](https://github.com/jef/zap2xml/issues/52)) ([60321a3](https://github.com/jef/zap2xml/commit/60321a37e6410f120be4c8198d39896b8ebea017))



### Documentation

* add FAQ ([4ac37de](https://github.com/jef/zap2xml/commit/4ac37de08e6e4adaeb060465a246558bdc6c2bb7))
* include so links to wiki, update SLEEP_TIME default ([b5cec7c](https://github.com/jef/zap2xml/commit/b5cec7c951da794041820407860bcee8e0c5b24a))
* include so links to wiki, update SLEEP\_TIME default ([b5cec7c](https://github.com/jef/zap2xml/commit/b5cec7c951da794041820407860bcee8e0c5b24a))

## [2.1.1](https://github.com/jef/zap2xml/compare/v2.1.0...v2.1.1) (2025-07-19)



### Documentation

* fix defaults ([a655a3e](https://github.com/jef/zap2xml/commit/a655a3e84c2bc7191803d48d581c20b340f3c4e6))
Expand All @@ -36,13 +78,15 @@
## [2.1.0](https://github.com/jef/zap2xml/compare/v2.0.0...v2.1.0) (2025-07-19)



### Features

* support upto 15 days of listings ([ee8c32d](https://github.com/jef/zap2xml/commit/ee8c32dfbb319225b181e8c0d956a56e8473d8cd))

## [2.0.0](https://github.com/jef/zap2xml/compare/v1.0.3...v2.0.0) (2025-07-19)



### ⚠ BREAKING CHANGES

* uses TypeScript, better API usage ([#38](https://github.com/jef/zap2xml/issues/38))
Expand All @@ -53,12 +97,14 @@
* make user agent configurable ([9aae5cd](https://github.com/jef/zap2xml/commit/9aae5cd1e5575e12d56cf04bb550c20fc63e636d))



### Miscellaneous

* remove node-fetch, fix lint issues ([4c22bfa](https://github.com/jef/zap2xml/commit/4c22bfa9e22273893622f476b33319901bd1c810))
* update configs, signify version bump ([5e00aa2](https://github.com/jef/zap2xml/commit/5e00aa2dfc642d3c8a33fb2254178986bedd87a8))



### Continuous Integration

* add release-type ([f8549b0](https://github.com/jef/zap2xml/commit/f8549b00b63aefe3593188ef16e86bf0b06a00dc))
Expand All @@ -69,20 +115,23 @@
* use v3, update changelog-types ([19b49a0](https://github.com/jef/zap2xml/commit/19b49a0c4fb9d0f0a6e841055c888d558652dc86))



### Documentation

* add build for easier arg additions ([dada5b3](https://github.com/jef/zap2xml/commit/dada5b3154a2cb0ad7c4f3dcf2a71dcfc34c3705))
* better descriptions ([bc74ac6](https://github.com/jef/zap2xml/commit/bc74ac6f06664ce8df8db14e5d6a01c46c51b4be)), closes [#8](https://github.com/jef/zap2xml/issues/8)
* update lineup id info ([206be57](https://github.com/jef/zap2xml/commit/206be57e8fc44ca33de683dd8776a9e164ef404f))



### Refactoring

* uses TypeScript, better API usage ([#38](https://github.com/jef/zap2xml/issues/38)) ([fb28b7d](https://github.com/jef/zap2xml/commit/fb28b7d6e6b7316e76637005cc38bee1a44ec8b0))

### [1.0.3](https://www.github.com/jef/zap2xml/compare/v1.0.2...v1.0.3) (2025-07-15)



### Bug Fixes

* command line errors ([#11](https://www.github.com/jef/zap2xml/issues/11)) ([ac2fd43](https://www.github.com/jef/zap2xml/commit/ac2fd43215f474b051cfeb94d0845752aa4c5ced))
Expand All @@ -91,20 +140,23 @@
### [1.0.2](https://www.github.com/jef/zap2xml/compare/v1.0.1...v1.0.2) (2025-04-02)



### Bug Fixes

* gracenote.com local URLs throughout code ([#17](https://www.github.com/jef/zap2xml/issues/17)) ([ec67964](https://www.github.com/jef/zap2xml/commit/ec67964282b3b1a391b7fe2190181c562701b89b))

### [1.0.1](https://www.github.com/jef/zap2xml/compare/v1.0.0...v1.0.1) (2025-04-02)



### Bug Fixes

* update zap2it URL ([#13](https://www.github.com/jef/zap2xml/issues/13)) ([a41eab9](https://www.github.com/jef/zap2xml/commit/a41eab9f222f1625c4e20a29068bf81562a38829))

## 1.0.0 (2021-04-24)



### Features

* update docker and pipeline ([e31071b](https://www.github.com/jef/zap2xml/commit/e31071bda880b57cabc174591e6b92a639735436))
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ COPY rollup.config.ts rollup.config.ts
COPY entrypoint.sh entrypoint.sh
COPY src/ src/

# Fix line endings for the entrypoint script and make it executable
RUN sed -i 's/\r$//' /app/entrypoint.sh && chmod +x /app/entrypoint.sh

RUN npm run build

RUN ls -l /app

ENTRYPOINT ["/bin/sh", "-c", "/app/entrypoint.sh"]
ENTRYPOINT ["/app/entrypoint.sh"]
142 changes: 51 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,51 @@
# zap2xml

Automate TV guides to XMLTV format. Easy to use, up-to-date. See below for getting started.

I also _somewhat_ maintain a version of the original in the [historical-perl branch](https://github.com/jef/zap2xml/tree/historical-perl) if you're interested in that.

## How to use

### Node.js

```bash
npm i && npm run build && node dist/index.js
```

See [Command line arguments](#command-line-arguments) for configuration options.

### Docker

| Tag | Description |
| ------- | ----------------------- |
| latest | Stable zap2xml releases |
| nightly | HEAD zap2xml release |

#### docker-compose

```yaml
services:
zap2xml:
container_name: zap2xml
image: ghcr.io/jef/zap2xml:latest
environment:
OUTPUT_FILE: /xmltv/xmltv.xml
volumes:
- ./xmltv:/xmltv
restart: unless-stopped
```

See [Environment variables](#environment-variables) for configuration options.

## Configuration

### Environment variables

| Variable | Description | Default |
| ------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `LINEUP_ID` | Lineup ID; Read more in the [Wiki](https://github.com/jef/zap2xml/wiki/Retrieving-Lineup-ID) | `USA-lineupId-DEFAULT` (Attenna) |
| `TIMESPAN` | Timespan in hours (up to 360 = 15 days, default: 6) | 6 |
| `PREF` | User Preferences, comma separated list. `m` for showing music, `p` for showing pay-per-view, `h` for showing HD | (empty) |
| `COUNTRY` | Country code (default: `USA`) | USA |
| `POSTAL_CODE` | Postal code of where shows are available. | 30309 |
| `USER_AGENT` | Custom user agent string for HTTP requests. | Uses random if not specified |
| `TZ` | Timezone | System default |
| `SLEEP_TIME` | Sleep time before next run in seconds (default: 21600, Only used with Docker.) | 21600 |
| `OUTPUT_FILE` | Output file name (default: xmltv.xml) | xmltv.xml |

### Command line arguments

| Argument | Description | Default |
| -------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `--lineupId` | Lineup ID; Read more in the [Wiki](https://github.com/jef/zap2xml/wiki/Retrieving-Lineup-ID) | `USA-lineupId-DEFAULT` (Attenna) |
| `--timespan` | Timespan in hours (up to 360 = 15 days, default: 6) | 6 |
| `--pref` | User Preferences, comma separated list. `m` for showing music, `p` for showing pay-per-view, `h` for showing HD | (empty) |
| `--country` | Country code (default: `USA`) | USA |
| `--postalCode` | Postal code of where shows are available. | 30309 |
| `--userAgent` | Custom user agent string for HTTP requests. | Uses random if not specified |
| `--timezone` | Timezone | System default |
| `--outputFile` | Output file name (default: xmltv.xml) | xmltv.xml |

## Setup and running in intervals

### Running natively

You can run zap2xml natively on your system. It is recommended to use a task scheduler to run it in intervals.

Here are some links to get you started on your machine:

- Linux and Raspberry Pi: https://github.com/jef/zap2xml/wiki/Running-on-Linux-and-Raspberry-Pi
- macOS: https://github.com/jef/zap2xml/wiki/Running-on-macOS
- Windows: https://github.com/jef/zap2xml/wiki/Running-on-Windows

If you want to run zap2xml in intervals, you can use a task scheduler like `cron` on Linux or the Task Scheduler on Windows. Each of the wiki pages above has a section on how to set up zap2xml to run in intervals.

### Running in Docker

You can run zap2xml in a Docker container. The `SLEEP_TIME` environment variable can be used to set the interval between runs. The default is 21600 seconds (6 hours).

## FAQ

### How do I get my Lineup ID?

Visit https://github.com/jef/zap2xml/wiki/Retrieving-Lineup-ID
# zap2xml

Automate TV guides to XMLTV format. Easy to use, up-to-date. See below for getting started.

I also *somewhat* maintain a version of the original in the [historical-perl branch](https://github.com/jesmannstl/zap2xml/tree/historical-perl) if you're interested in that.

## First Time [Installation in node.js](https://github.com/jesmannstl/zap2xml/wiki/Installation), [How to Run](https://github.com/jesmannstl/zap2xml/wiki/How-to-Run), [Scheduling](https://github.com/jesmannstl/zap2xml/wiki/Scheduling) or [using Docker](https://github.com/jesmannstl/zap2xml/wiki/Using-Docker) see [Wiki](https://github.com/jesmannstl/zap2xml/wiki) for instructions

### Need help? [Finding a lineup](https://github.com/jesmannstl/zap2xml/wiki/Finding-a-Lineup-ID) or for [Dish and DirecTV lineups](https://github.com/jesmannstl/zap2xml/wiki/US-Dish-Directv-Lineups). Other help? Drop a line in the [Discussions](https://github.com/jesmannstl/zap2xml/discussions)

# Recent updates

# (2025-08-09)

* Restored `<episode-num system="dd_progid">` tag that Plex uses that was missing.
* Fixed Sorting so output is listed by Channel ID (common station/gracenote id) then by date/time.

# (2025-08-07)

* Reordered Program fields to match original Perl script output
* `--postalCode` not required as long as Country and lineup Id correct except Over the Air
* Moved `<date>` above `<category>` to match original Perl output. Corrected where Movie Release Year is properly displayed.
* Added `<length>` tag.
* Updated channel logo no longer has fixed width so can display in better quality

# (2025-08-06)

* Added Valid Country Codes that can be used
* Added `--mediaportal` option to use `<episode-num system="xmltv_ns">` before others so Media Portal will display Season/Episode properly

# (2025-08-05)

# Changes since previous release

These changes are currently on the [jesmannstl/zap2xml](https://github.com/jesmannstl/zap2xml) fork

* Added Category if available (Movie, Sports, News, Talk, Family etc)
* Added Category "Series" to all programs that did not return a category
* Added additional Season Episode formats for various players
* Added year as Season for programs that only list an episode number like daily cable news
* Added <date> tag to all programs without an aired date normalized to America/New York
* Added xmltv_ns with the date aired as Season YYYY Episode MMYY to Non Movie or Sports with no other Season/Episode like local news so would have the ability to record as Series is most players.
* Added URL to program details from old Perl function.
* Added --appendAsterisk to add * to title on programs that are New and/or Live
* Added <previously-shown /> tag to programs that are not <New> and/or <Live>
* Updated affiliateId after orbebb stopped working

Updated Docker with these changes use APPEND_ASTERISK: TRUE for the --appendAsterisk option



Loading