diff options
| -rwxr-xr-x | iptv.sh | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -96,9 +96,9 @@ make_epg () { response=$(curl --silent $curl_args "$endpoint") step "Create the EPG XML file" - echo '<?xml version="1.0" encoding="UTF-8"?>' > $output_file - echo '<!DOCTYPE tv SYSTEM "xmltv.dtd">' >> $output_file - echo "<tv date=\"$(date +"%Y%m%d%H%M%S %z")\">" >> $output_file + echo '<?xml version="1.0" encoding="UTF-8"?>' > "$output_file" + echo '<!DOCTYPE tv SYSTEM "xmltv.dtd">' >> "$output_file" + echo "<tv date=\"$(date +"%Y%m%d%H%M%S %z")\">" >> "$output_file" while read -r item; do item_title=$(echo "$item" | jq -r '.itemTitle') @@ -113,24 +113,24 @@ make_epg () { channel_title=$(echo "$response" | jq -r '.channel.title') hwcode=$(echo "$response" | jq -r '.channel.params.hwcode') - echo " <channel id=\"$hwcode\">" >> $output_file - echo " <display-name lang=\"zh\"><![CDATA[$channel_title]]></display-name>" >> $output_file - echo " <icon src=\"$channel_icon\"/>" >> $output_file - echo " </channel>" >> $output_file + echo " <channel id=\"$hwcode\">" >> "$output_file" + echo " <display-name lang=\"zh\"><![CDATA[$channel_title]]></display-name>" >> "$output_file" + echo " <icon src=\"$channel_icon\"/>" >> "$output_file" + echo " </channel>" >> "$output_file" while read -r schedule; do schedule_title=$(echo "$schedule" | jq -r '.title') schedule_starttime=$(echo "$schedule" | jq -r '.starttime') schedule_endtime=$(echo "$schedule" | jq -r '.endtime') - echo " <programme start=\"$schedule_starttime +0800\" stop=\"$schedule_endtime +0800\" channel=\"$hwcode\">" >> $output_file - echo " <title lang=\"zh\"><![CDATA[$schedule_title]]></title>" >> $output_file - echo " </programme>" >> $output_file + echo " <programme start=\"$schedule_starttime +0800\" stop=\"$schedule_endtime +0800\" channel=\"$hwcode\">" >> "$output_file" + echo " <title lang=\"zh\"><![CDATA[$schedule_title]]></title>" >> "$output_file" + echo " </programme>" >> "$output_file" done < <(echo "$response" | jq -c '.schedules[]') fi done < <(echo "$response" | jq -c '.areaDatas[].items[]') - echo '</tv>' >> $output_file + echo '</tv>' >> "$output_file" step "EPG built sucessfully!" @@ -244,8 +244,8 @@ make_playlist () { http://$host/EPG/interEpg/channellist/batch) step "Decode channels from the HTTP response" - echo "#EXTM3U" > $output_file - echo "#EXT-X-VERSION:3" >> $output_file + echo '#EXTM3U' > "$output_file" + echo '#EXT-X-VERSION:3' >> "$output_file" echo "$response" | jq -c '.channellist[]' | while read -r channel; do channelcode=$(echo "$channel" | jq -r '.channelcode') @@ -261,8 +261,8 @@ make_playlist () { group=$(categorize_by_channel_name "$channelname") - echo "#EXTINF:-1 tvg-id=\"$channelcode\" tvg-name=\"$channelname\" tvg-logo=\"${logos[$channelcode]}\" group-name=\"$group\",$channelname" >> $output_file - echo "$udpxy_endpoint/udp/$host" >> $output_file + echo "#EXTINF:-1 tvg-id=\"$channelcode\" tvg-name=\"$channelname\" tvg-logo=\"${logos[$channelcode]}\" group-name=\"$group\",$channelname" >> "$output_file" + echo "$udpxy_endpoint/udp/$host" >> "$output_file" fi done |
