Skip to content

Historical perl #74

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 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/bug-remote.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/feature-request.md

This file was deleted.

19 changes: 0 additions & 19 deletions .github/pull_request_template.md

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/ci.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/nightly-release.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/release.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.zap2xmlrc
compose.yaml

config/
xmltv/
node_modules/
4 changes: 2 additions & 2 deletions .zap2xmlrc-example
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ncdays=0
# ncsdays: Number of days from the start to not cache (default: 0, cmd: -N)
ncsdays=0
# ncmday: Specific day number to not cache, 1-based relative to start (default: -1, cmd: -B)
ncmday=-1
# ncmday=-1

# Output settings
# outfile: Output XML file path (default: xmltv.xml or xtvd.xml, cmd: -o)
Expand All @@ -40,7 +40,7 @@ trailer=/config/trailers

# Network
# proxy: HTTP proxy server URL (default: none, cmd: -P)
proxy=http://localhost:8080
# proxy=http://localhost:8080

# XTVD format settings (only used when outformat=xtvd)
# lineuptype: Type of lineup - Cable/CableDigital/Satellite/LocalBroadcast (default: none)
Expand Down
30 changes: 0 additions & 30 deletions CHANGELOG.md

This file was deleted.

4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM alpine:3.13.5

ENV SLEEPTIME=43200
FROM alpine:3.22.1

RUN apk add --no-cache \
perl \
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Jeffrey LeCompte
Copyright (c) 2025 Jeffrey LeCompte

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ See [zap2xml](https://web.archive.org/web/20200426004001/zap2xml.awardspace.info

## Docker

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

### docker-compose (recommended)

```yaml
Expand All @@ -30,11 +25,11 @@ services:

### Optional environment variables

| Variable | Description | Type | Default |
| ------------ | ---------------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| `USER_AGENT` | Custom user agent string for HTTP requests. | String | `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36` |
| `SLEEPTIME` | Number of seconds to sleep between runs (useful for scheduling in Docker or cron). | Integer | `43200` |
| `TZ` | Timezone for program times (affects output XML and Perl's time calculations). | String | System default |
| Variable | Description | Default |
| ------------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `USER_AGENT` | Custom user agent string for HTTP requests. | `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36` |
| `SLEEPTIME` | Number of seconds to sleep between runs (useful for scheduling in Docker or cron). | `43200` |
| `TZ` | Timezone for program times (affects output XML and Perl's time calculations). | System default |

### Optional run configurations

Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

SLEEPTIME=43200

while true; do
DATE=$(date)
eval /opt/zap2xml.pl "$OPT_ARGS"
Expand Down
1 change: 0 additions & 1 deletion version.txt

This file was deleted.

19 changes: 9 additions & 10 deletions zap2xml.pl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
$sleeptime = 0;
$allChan = 0;
$shiftMinutes = 0;

$userAgent = $ENV{USER_AGENT} || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';

$outputXTVD = 0;
Expand Down Expand Up @@ -264,7 +263,7 @@
my $zstart = substr($ms, 0, -3);
$params = "?time=$zstart&timespan=$gridHours&pref=$zapPref&";
$params .= &getZapGParams();
$params .= '&TMSID=&AffiliateID=lat&FromPage=TV%20Grid';
$params .= '&TMSID=&AffiliateID=chi&FromPage=TV%20Grid';
$params .= '&ActivityID=1&OVDID=&isOverride=true';
$rs = &getURL($urlRoot . "api/grid$params",1);
last if ($rs eq '');
Expand Down Expand Up @@ -432,11 +431,11 @@ sub stationToChannel {
if (defined($options{z})) {
return sprintf("I%s.%s.tvguide.com", $stations{$s}{number},$stations{$s}{stnNum});
} elsif (defined($options{O})) {
return sprintf("C%s%s.gracenote.com",$stations{$s}{number},lc($stations{$s}{name}));
return sprintf("C%s%s.zap2it.com",$stations{$s}{number},lc($stations{$s}{name}));
} elsif (defined($options{9})) {
return sprintf("I%s.labs.gracenote.com",$stations{$s}{stnNum});
return sprintf("I%s.labs.zap2it.com",$stations{$s}{stnNum});
}
return sprintf("I%s.%s.gracenote.com", $stations{$s}{number},$stations{$s}{stnNum});
return sprintf("I%s.%s.zap2it.com", $stations{$s}{number},$stations{$s}{stnNum});
}

sub sortChan {
Expand Down Expand Up @@ -470,7 +469,7 @@ sub printHeader {
if (defined($options{z})) {
print $FH "<tv source-info-url=\"http://tvguide.com/\" source-info-name=\"tvguide.com\"";
} else {
print $FH "<tv source-info-url=\"http://tvlistings.gracenote.com/\" source-info-name=\"gracenote.com\"";
print $FH "<tv source-info-url=\"http://tvlistings.zap2it.com/\" source-info-name=\"zap2it.com\"";
}
print $FH " generator-info-name=\"zap2xml\" generator-info-url=\"zap2xml\@gmail.com\">\n";
}
Expand Down Expand Up @@ -895,7 +894,7 @@ sub getZapParams {
$phash{countryCode} = $country;
$phash{headendId} = $lineupId;
$phash{device} = $device;
$phash{aid} = 'lat';
$phash{aid} = 'chi';
return %phash;
}

Expand Down Expand Up @@ -1345,7 +1344,7 @@ sub parseJSON {
$programs{$cp}{imageUrl} = $turl;
}
if ($program->{'seriesId'} ne '' && $program->{'tmsId'} ne '') {
$programs{$cp}{url} = $urlRoot . "overview-affiliates.html?programSeriesId="
$programs{$cp}{url} = $urlRoot . "/overview.html?programSeriesId="
. $program->{seriesId} . "&tmsId=" . $program->{tmsId};
}

Expand Down Expand Up @@ -1573,7 +1572,7 @@ sub HELP_MESSAGE {
-e = hex encode entities (html special characters like accents)
-E "amp apos quot lt gt" = selectively encode standard XML entities
-F = output channel names first (rather than "number name")
-O = use old tv_grab_na style channel ids (C###nnnn.gracenote.com)
-O = use old tv_grab_na style channel ids (C###nnnn.zap2it.com)
-A "new live" = append " *" to program titles that are "new" and/or "live"
-M = copy movie_year to empty movie sub-title tags
-U = UTF-8 encoding (default = "ISO-8859-1")
Expand All @@ -1587,7 +1586,7 @@ sub HELP_MESSAGE {
-J <xmltv> = include xmltv file in output
-Y <lineupId> (if not using username/password)
-Z <zipcode> (if not using username/password)
-z = use tvguide.com instead of gracenote.com
-z = use tvguide.com instead of zap2it.com
-a = output all channels (not just favorites)
-j = add "series" category to all non-movie programs
END
Expand Down