Skip to content

Commit

Permalink
Fix XMLTV file creation issue caused by 'youth_protection_rating' string
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsettrack4 committed Mar 31, 2018
1 parent 74f82ad commit af6fa82
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
28 changes: 14 additions & 14 deletions zguide_fc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date +%Y%m%d)_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -51,7 +51,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '1 day' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -70,7 +70,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '2 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -89,7 +89,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '3 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -108,7 +108,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '4 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -127,7 +127,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '5 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -146,7 +146,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '6 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -165,7 +165,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '7 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -184,7 +184,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '8 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -203,7 +203,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '9 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -222,7 +222,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '10 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -241,7 +241,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '11 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -260,7 +260,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '12 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand All @@ -279,7 +279,7 @@ then
sed -i 's/{"program"/\n/g' workfile
sed -i '1d' workfile
sed -e 's/.*"id"://g' -e 's/},.*//g' $(date -d '13 days' '+%Y%m%d')_manifest_new > manifest_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' workfile > cache_file
sed -e '/"id"/!d' -e 's/.*"id"://g' -e 's/,"categories".*//g' -e 's/,"description".*//g' workfile > cache_file
comm -2 -3 <(sort -u manifest_file) <(sort cache_file) > filecheck
if [ -s filecheck ]
then
Expand Down
3 changes: 3 additions & 0 deletions zguide_su.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,6 @@ then
cat workfile >> ~/ztvh/epg/workfile
sed -i '$i\ ' ~/ztvh/epg/workfile
fi

sed -i '/^\s*$/d' ~/ztvh/epg/workfile
sed -i 's/"success":true}:{"genres":/"success":true}\n:{"genres":/g' ~/ztvh/epg/workfile
11 changes: 10 additions & 1 deletion zguide_xmltv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ sed -i -e 's/\[>\[//g' -e 's/\]<\]//g' workfile
#

echo "Moving strings to setup times and channels data..."
sed -i '/"youth_protection_rating"/s/\("genres":.*\)\("recording_eligible":.*\)\("series_recording_eligible":.*\)\("youth_protection_rating":.*\)\("image_token":.*\)/\1\3\2\5/g' workfile
sed -i '/"youth_protection_rating"/s/"blackout":true/"youth_blackout":true/g' workfile
sed -i '/"youth_blackout":true/s/\("series_recording_eligible":.*\)\("episode_number":.*\)\("youth_blackout":.*\)\("success":.*\)/\1"tv_series_id":0000,\2\4/g' workfile
sed -i '/"youth_protection_rating"/s/\("series_recording_eligible":.*\)\("year":.*\)\("genres":.*\)\("title":.*\)\("start":.*\)\("image_path":.*\)\("credits".*\)\("tv_series_id":.*\)\("country":.*\)/\1\3\6\4\7\9\2\5\8/g' workfile
sed -i '/"youth_protection_rating"/s/\("series_recording_eligible":.*\)\("episode_title":.*\)\("description":.*\)\("start":.*\)\("cid":.*\)/\1\3\5\2\4/g' workfile
sed -i '/"youth_protection_rating"/s/\("series_recording_eligible":.*\)\("episode_title":.*\)\("start":.*\)\("youth_protection_rating":.*\)\("tv_series_id":.*\)/\1\3\5\2\4/g' workfile
sed -i '/"youth_protection_rating"/s/\("series_recording_eligible":.*\)\("episode_number":.*\)\("episode_title":.*\)\("recording_eligible":.*\)\("success":.*\)\("year":.*\)\("id":.*\)\("image_token":.*\)/\1\3\6\4\8\2\5\7/g' workfile
sed -i '/"youth_protection_rating"/s/\("series_recording_eligible":.*\)\("season_number":.*\)\("episode_number":.*\)\("categories":.*\)\("id":.*\)\("youth_protection_rating":.*\)/\1\3\2\5\4\6/g' workfile
sed -i '/"youth_protection_rating"/s/},"image_token":/,"image_token":/g;s/","success":/"},"success":/g;s/"youth_protection_rating":.*//g' workfile
sed -i 's/\("channel_name":.*\)\("cid".*\)\("blackout":.*\)/\2"new_blackout":true,\1/g' workfile
sed -i 's/,"channel_name".*//g' workfile
sed -i 's/\(.*\)\("cid":".*\)/\2\1/g' workfile
Expand Down Expand Up @@ -186,7 +195,7 @@ sed -i '/category lang/s/>Fantasy.*/>Science fiction \/ Fantasy \/ Horror<\/cate
# FINALIZATION: FIX WRONG CHARACTERS, RENAME FILE
#

sed -i -e 's/\&/\&amp;/g' -e 's/\\"/"/g' workfile2
sed -i -e 's/\&/\&amp;/g' -e 's/\\"/"/g' -e 's/\\n/ /g' -e 's/\\r//g' -e 's/\\t//g' workfile2
mv workfile2 ~/ztvh/epg/$(date +%Y%m%d)_zattoo_fullepg.xml && cp ~/ztvh/epg/$(date +%Y%m%d)_zattoo_fullepg.xml ~/ztvh/zattoo_fullepg.xml && rm workfile

echo "- EPG XMLTV FILE CREATED SUCCESSFULLY! -" && echo ""

0 comments on commit af6fa82

Please sign in to comment.