This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
2,097 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#!/usr/bin/perl | ||
|
||
# Copyright (C) 2019 Jan-Luca Neumann | ||
# https://github.com/sunsettrack4/easyepg | ||
# | ||
# Collaborators: | ||
# - DeBaschdi ( https://github.com/DeBaschdi ) | ||
# | ||
# This Program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3, or (at your option) | ||
# any later version. | ||
# | ||
# This Program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with easyepg. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# ############################### | ||
# TVSPIELFILM JSON > XML CONVERTER # | ||
# ############################### | ||
|
||
# CHANNELS | ||
|
||
use strict; | ||
use warnings; | ||
|
||
binmode STDOUT, ":utf8"; | ||
use utf8; | ||
|
||
use JSON; | ||
|
||
# READ JSON INPUT FILE: CHLIST | ||
my $json; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "chlist" or die; | ||
$json = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ JSON INPUT FILE: SWC HARDCODED CHLIST | ||
my $chlist; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "tvtvus_channels.json" or die; | ||
$chlist = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ JSON INPUT FILE: CHANNEL CONFIG | ||
my $chlist_config; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "channels.json" or die; | ||
$chlist_config = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ INIT FILE | ||
my $init; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, '<', "init.json" or die; | ||
$init = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ SETTINGS FILE | ||
my $settings; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, '<', "settings.json" or die; | ||
$settings = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# CONVERT JSON TO PERL STRUCTURES | ||
my $data = decode_json($json); | ||
my $chdata = decode_json($chlist); | ||
my $configdata = decode_json($chlist_config); | ||
my $initdata = decode_json($init); | ||
my $setupdata = decode_json($settings); | ||
|
||
# DEFINE COUNTRY VERSION | ||
my $countryVER = $initdata->{'country'}; | ||
|
||
my @stations = @{ $data->{'stations'} }; | ||
foreach my $stations ( @stations ) { | ||
|
||
# #################### | ||
# DEFINE JSON VALUES # | ||
# #################### | ||
|
||
# DEFINE CHANNEL ID + NAME | ||
my $cname = $stations->{'name'}; | ||
$cname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE LANGUAGE VERSION | ||
# my $languageVER = $initdata->{'language'}; | ||
my $languageVER = $stations->{'Languages'}[0]; | ||
|
||
# DEFINE RYTEC CHANNEL ID (language) | ||
my $rytec = $chdata->{'channels'}{$countryVER}; | ||
|
||
# DEFINE SELECTED CHANNELS | ||
my @configdata = @{ $configdata->{'channels'} }; | ||
|
||
# DEFINE SETTINGS | ||
my $setup_general = $setupdata->{'settings'}; | ||
my $setup_cid = $setup_general->{'cid'}; | ||
|
||
# DEFINE SETTINGS VALUES | ||
my $enabled = "enabled"; | ||
my $disabled = "disabled"; | ||
|
||
|
||
# ################## | ||
# PRINT XML OUTPUT # | ||
# ################## | ||
|
||
# CHANNEL ID (condition) (settings) | ||
foreach my $selected_channel ( @configdata ) { | ||
if( $cname eq $selected_channel ) { | ||
if( $setup_cid eq $enabled ) { | ||
if( defined $rytec->{$cname} ) { | ||
print "<channel id=\"" . $rytec->{$cname} . "\">"; | ||
} else { | ||
print "<channel id=\"" . $cname . "\">"; | ||
print STDERR "[ CHLIST WARNING ] Rytec ID not matched for: " . $cname . "\n"; | ||
} | ||
} else { | ||
print "<channel id=\"" . $cname . "\">"; | ||
} | ||
|
||
# CHANNEL NAME (language) | ||
print "<display-name lang=\"de\">" . $cname . "</display-name></channel>\n"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
#!/usr/bin/perl | ||
|
||
# Copyright (C) 2019 Jan-Luca Neumann | ||
# https://github.com/sunsettrack4/easyepg | ||
# | ||
# Collaborators: | ||
# - DeBaschdi ( https://github.com/DeBaschdi ) | ||
# | ||
# This Program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3, or (at your option) | ||
# any later version. | ||
# | ||
# This Program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with easyepg. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# ################################ | ||
# TVTV-US CHANNEL LIST CREATOR # | ||
# ################################ | ||
|
||
# CREATE JSON FILE FOR COMPARISM | ||
|
||
use strict; | ||
use warnings; | ||
|
||
binmode STDOUT, ":utf8"; | ||
use utf8; | ||
|
||
use JSON; | ||
|
||
# READ JSON INPUT FILE: NEW CHLIST | ||
my $chlist_new; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "/tmp/chlist" or die; | ||
$chlist_new = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ JSON INPUT FILE: OLD CHLIST | ||
my $chlist_old; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "chlist_old" or die; | ||
$chlist_old = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# READ JSON INPUT FILE: CHANNEL CONFIG | ||
my $chlist_config; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "channels.json" or die; | ||
$chlist_config = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# CONVERT JSON TO PERL STRUCTURES | ||
my $newdata = decode_json($chlist_new); | ||
my $olddata = decode_json($chlist_old); | ||
my $configdata = decode_json($chlist_config); | ||
|
||
|
||
# ################## | ||
# NEW CHANNEL LIST # | ||
# ################## | ||
|
||
# TOOL: NAME ==> ID | ||
|
||
print "{ \"newname2id\": {\n"; | ||
|
||
my @newchannels_name2id = @{ $newdata->{'stations'} }; | ||
foreach my $newchannels ( @newchannels_name2id ) { | ||
|
||
# | ||
# DEFINE JSON VALUES | ||
# | ||
|
||
# DEFINE NEW CHANNEL NAME | ||
my $newcname = $newchannels->{'name'}; | ||
$newcname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE NEW CHANNEL ID | ||
my $newcid = $newchannels->{'channelNumber'}; | ||
|
||
# PRINT NEW CHANNEL NAMES | ||
print "\"$newcname\": \"$newcid\",\n"; | ||
} | ||
|
||
# TOOL: ID ==> NAME | ||
|
||
print "\"DUMMY\": \"DUMMY\" },\n\"newid2name\": {\n"; | ||
|
||
my @newchannels_id2name = @{ $newdata->{'stations'} }; | ||
foreach my $newchannels ( @newchannels_id2name ) { | ||
|
||
# | ||
# DEFINE JSON VALUES | ||
# | ||
|
||
# DEFINE NEW CHANNEL NAME | ||
my $newcname = $newchannels->{'name'}; | ||
$newcname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE NEW CHANNEL ID | ||
my $newcid = $newchannels->{'channelNumber'}; | ||
|
||
# PRINT NEW CHANNEL NAMES newcid | ||
print "\"$newcid\": \"$newcname\",\n"; | ||
} | ||
|
||
|
||
# ################## | ||
# OLD CHANNEL LIST # | ||
# ################## | ||
|
||
# TOOL: NAME ==> ID | ||
|
||
print "\"DUMMY\": \"DUMMY\" },\n\"oldname2id\": {\n"; | ||
|
||
my @oldchannels_name2id = @{ $olddata->{'stations'} }; | ||
foreach my $oldchannels ( @oldchannels_name2id ) { | ||
|
||
# | ||
# DEFINE JSON VALUES | ||
# | ||
|
||
# DEFINE OLD CHANNEL NAME | ||
my $oldcname = $oldchannels->{'name'}; | ||
$oldcname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE OLD CHANNEL ID | ||
my $oldcid = $oldchannels->{'channelNumber'}; | ||
|
||
# PRINT OLD CHANNEL NAMES | ||
print "\"$oldcname\": \"$oldcid\",\n"; | ||
} | ||
|
||
# TOOL: ID ==> NAME | ||
|
||
print "\"DUMMY\": \"DUMMY\" },\n\"oldid2name\": {\n"; | ||
|
||
my @oldchannels_id2name = @{ $olddata->{'stations'} }; | ||
foreach my $oldchannels ( @oldchannels_id2name ) { | ||
|
||
# | ||
# DEFINE JSON VALUES | ||
# | ||
|
||
# DEFINE OLD CHANNEL NAME | ||
my $oldcname = $oldchannels->{'name'}; | ||
$oldcname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE OLD CHANNEL ID | ||
my $oldcid = $oldchannels->{'channelNumber'}; | ||
|
||
# PRINT OLD CHANNEL NAMES | ||
print "\"$oldcid\": \"$oldcname\",\n"; | ||
} | ||
|
||
|
||
# ####################### | ||
# CHANNEL CONFIGURATION # | ||
# ####################### | ||
|
||
print "\"DUMMY\": \"DUMMY\" },\n\"config\": [\n"; | ||
|
||
my @configdata = @{ $configdata->{'channels'} }; | ||
|
||
foreach my $configname ( @configdata ) { | ||
print "\"$configname\",\n"; | ||
} | ||
|
||
print "\"DUMMY\"]\n}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/perl | ||
|
||
# Copyright (C) 2019 Jan-Luca Neumann | ||
# https://github.com/sunsettrack4/easyepg | ||
# | ||
# Collaborators: | ||
# - DeBaschdi ( https://github.com/DeBaschdi ) | ||
# | ||
# This Program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3, or (at your option) | ||
# any later version. | ||
# | ||
# This Program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with easyepg. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# ############################### | ||
# TVSPIELFILM CHANNEL ID CREATOR # | ||
# ############################### | ||
|
||
# CHANNEL IDs | ||
|
||
use strict; | ||
use warnings; | ||
|
||
binmode STDOUT, ":utf8"; | ||
use utf8; | ||
|
||
use JSON; | ||
|
||
# READ JSON INPUT FILE: CHLIST | ||
my $json; | ||
{ | ||
local $/; #Enable 'slurp' mode | ||
open my $fh, "<", "/tmp/chlist" or die; | ||
$json = <$fh>; | ||
close $fh; | ||
} | ||
|
||
# CONVERT JSON TO PERL STRUCTURES | ||
my $data = decode_json($json); | ||
|
||
print "{ \"cid\":\n {\n"; | ||
|
||
my @stations = @{ $data->{'stations'} }; | ||
foreach my $stations ( @stations ) { | ||
|
||
# #################### | ||
# DEFINE JSON VALUES # | ||
# #################### | ||
|
||
# DEFINE CHANNEL NAME | ||
my $cname = $stations->{'name'}; | ||
$cname =~ s/\&/\&/g; # REQUIRED TO READ XML FILE CORRECTLY | ||
|
||
# DEFINE CHANNEL ID | ||
my $cid = $stations->{'channelNumber'}; | ||
|
||
# ################### | ||
# PRINT JSON OUTPUT # | ||
# ################### | ||
|
||
# CHANNEL ID (condition) | ||
print " \"$cid\":\"$cname\",\n"; | ||
} | ||
|
||
print " \"000000000000\":\"DUMMY\"\n }\n}"; |
Oops, something went wrong.