From 3994fa84ef564cdd2daf162feda43a2aac13eba1 Mon Sep 17 00:00:00 2001 From: bruce Date: Sun, 3 Jan 2021 13:01:27 -0500 Subject: [PATCH 1/7] Generalize sed commands --- pi-SDtoHD-helper.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pi-SDtoHD-helper.sh b/pi-SDtoHD-helper.sh index 2b9cf65..4072b59 100755 --- a/pi-SDtoHD-helper.sh +++ b/pi-SDtoHD-helper.sh @@ -111,12 +111,13 @@ echo -e "Configuring boot from $target_partition" # rootdelay=5 is likely not necessary here, but does no harm. cp /boot/cmdline.txt /boot/cmdline.txt.bak sed -i "s/\( root=PARTUUID=*\)[^ ]*/\1${target_partition_partuuid} rootdelay=5 /" /boot/cmdline.txt +sed -i "s/\( root=\)\/[^ ]*/\1PARTUUID={target_partition_partuuid} rootdelay=5 /" /boot/cmdline.txt sync echo "Commenting out old root partition in /etc/fstab, adding new one" # These changes are made on the new drive after copying so that they # don't have to be undone in order to switch back to booting from the # SD card. -sed -i -r '/-02/s/^/#/' /mnt/etc/fstab +sed -i -r '/\/[ \t]*ext4/s/^/#/' /mnt/etc/fstab sync echo "/dev/disk/by-uuid/${target_partition_uuid} / ext4 defaults,noatime 0 1" >> /mnt/etc/fstab echo "Your new root drive is currently accessible under /mnt." From e88aaba2701c26715f10de89d87dbc46768b6517 Mon Sep 17 00:00:00 2001 From: bruce Date: Sun, 3 Jan 2021 20:43:21 -0500 Subject: [PATCH 2/7] pi-SDtoHD-helper.sh - fixed second /boot/cmdline.txt sed --- pi-SDtoHD-helper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pi-SDtoHD-helper.sh b/pi-SDtoHD-helper.sh index 4072b59..5813d78 100755 --- a/pi-SDtoHD-helper.sh +++ b/pi-SDtoHD-helper.sh @@ -111,7 +111,7 @@ echo -e "Configuring boot from $target_partition" # rootdelay=5 is likely not necessary here, but does no harm. cp /boot/cmdline.txt /boot/cmdline.txt.bak sed -i "s/\( root=PARTUUID=*\)[^ ]*/\1${target_partition_partuuid} rootdelay=5 /" /boot/cmdline.txt -sed -i "s/\( root=\)\/[^ ]*/\1PARTUUID={target_partition_partuuid} rootdelay=5 /" /boot/cmdline.txt +sed -i "s/\( root=\)\/[^ ]*/\1PARTUUID=${target_partition_partuuid} rootdelay=5 /" /boot/cmdline.txt sync echo "Commenting out old root partition in /etc/fstab, adding new one" # These changes are made on the new drive after copying so that they From b63ea0cd7490a3c61d68d87b5e00935a3fac9716 Mon Sep 17 00:00:00 2001 From: bruce Date: Tue, 16 Feb 2021 10:07:48 -0500 Subject: [PATCH 3/7] Fix seg fault on frondend startup --- run_mythfrontend.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run_mythfrontend.sh b/run_mythfrontend.sh index 4bafe4e..1e0a545 100755 --- a/run_mythfrontend.sh +++ b/run_mythfrontend.sh @@ -99,8 +99,9 @@ bash -c "cat >/home/pi/pi_mythfrontend.json" < Date: Sun, 27 Jun 2021 18:09:31 -0400 Subject: [PATCH 4/7] use deb package from google drive --- pi-setup_mythtv_31.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/pi-setup_mythtv_31.sh b/pi-setup_mythtv_31.sh index 192c3ad..97e7b6b 100755 --- a/pi-setup_mythtv_31.sh +++ b/pi-setup_mythtv_31.sh @@ -18,12 +18,10 @@ # Globals #mythtv-light version -MYTHTV_LIGHT_VERSION="deb http://dl.bintray.com/bennettpeter/deb/ buster myth31" -MYTHTV_LIGHT_KEY="https://bintray.com/user/downloadSubjectPublicKey?username=bintray" MYTITLE="MythTV Setup for Raspberry Pi" # my pi-utils repository -PI_UTILS_REPO="https://github.com/MikeB2013/pi-utils.git" +PI_UTILS_REPO="https://github.com/Bamyers99/pi-utils.git" # for whiptail items 0=Yes, 1=No -1=error (not currently checked) DEFAULT_INSTALL=0 @@ -94,23 +92,20 @@ echo -e "A reboot is required, please type sudo reboot\n" do_install_mythtv_from_repo() { -#setup sources.list -ALREADY_ADDED=$(grep -ic "$MYTHTV_LIGHT_VERSION" /etc/apt/sources.list) -#don't add more than once - it generates apt warnings (harmless) -if [ $ALREADY_ADDED = 0 ] ; then - echo "$MYTHTV_LIGHT_VERSION" | sudo tee -a /etc/apt/sources.list - #setup bintray key - wget -O - $MYTHTV_LIGHT_KEY | sudo apt-key add - -fi # install mythtv-light # first make sure we are upto date. sudo apt update sudo apt upgrade -y -sudo apt install git mythtv-light -y +sudo apt install git gdebi-core -y + +#wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1mG4dHUXCshehLZNr6CxC4kdhZoqxiTn4' -O 'mythtv-light_31.0-144-g563a05b7a8-0_armhf_buster.deb' +wget --no-check-certificate --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1mG4dHUXCshehLZNr6CxC4kdhZoqxiTn4' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1mG4dHUXCshehLZNr6CxC4kdhZoqxiTn4" -O "mythtv-light_31.0-144-g563a05b7a8-0_armhf_buster.deb" && rm -rf /tmp/cookies.txt +sudo gdebi 'mythtv-light_31.0-144-g563a05b7a8-0_armhf_buster.deb' if [ $MYTHPLUGINS = 0 ] ; then - sudo apt install mythplugins-light -y + wget --no-check-certificate --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Ds7iDgxzBc6YW9bkjDqefkgqtQrZUC4O' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1Ds7iDgxzBc6YW9bkjDqefkgqtQrZUC4O" -O "mythplugins-light_31.0-144-g563a05b7a8-0_armhf_buster.deb" && rm -rf /tmp/cookies.txt + sudo gdebi 'mythplugins-light_31.0-144-g563a05b7a8-0_armhf_buster.deb' fi # get all scripts from my github repository From b26840534056b7ef8ee996efa50835151e8297cc Mon Sep 17 00:00:00 2001 From: bruce Date: Thu, 26 Aug 2021 19:36:46 -0400 Subject: [PATCH 5/7] new channel reconciliation page --- README.md | 0 mythweb/mythweb_chan_recon.php | 113 +++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) mode change 100644 => 100755 README.md create mode 100644 mythweb/mythweb_chan_recon.php diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/mythweb/mythweb_chan_recon.php b/mythweb/mythweb_chan_recon.php new file mode 100644 index 0000000..40b4702 --- /dev/null +++ b/mythweb/mythweb_chan_recon.php @@ -0,0 +1,113 @@ + to + sudo service apache2 restart + sudo chmod a+w /home/mythtv/.xmltv + sudo chmod a+w /home/mythtv/.xmltv/SchedulesDirect.DB + + */ +?> + + + + + MythTV Channel Reconciliation + + + + +

MythTV Channel Reconciliation

+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +$msconn = new PDO("mysql:host={$_SERVER['db_server']};dbname={$_SERVER['db_name']};charset=utf8", $_SERVER['db_login'], $_SERVER['db_password']); +$msconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +// Load mythtv channel table +$sql = 'SELECT * FROM channel ORDER BY chanid'; +$sth = $msconn->query($sql); +$sth->setFetchMode(PDO::FETCH_NAMED); +$myth_channels = []; + +while ($row = $sth->fetch()) { + $channum = $row['channum']; + if (strpos($channum, '_') === false) continue; // Analog + if ($channum[0] == '_') continue; // Borked + + list($chan, $sub) = explode('_', $channum); + $channum = "$chan.$sub"; + $row['XMLTV_selected'] = '0'; + $row['channum'] = $channum; + + $myth_channels[$channum] = $row; +} + +// Load the XMLTV channels, stations tables +$sql = 'SELECT channum, selected FROM channels'; +$sth = $slconn->query($sql); +$sth->setFetchMode(PDO::FETCH_NAMED); + +while ($row = $sth->fetch()) { + $channum = $row['channum']; + if (strpos($channum, '.') === false) continue; // Analog + + if (! isset($myth_channels[$channum])) continue; + $myth_channels[$channum]['XMLTV_selected'] = $row['selected']; +} + +uasort($myth_channels, function ($a, $b) { + list($achan, $asub) = explode('.', $a['channum']); + list($bchan, $bsub) = explode('.', $b['channum']); + + if ($achan != $bchan) return ($achan <=> $bchan); + return ($asub <=> $bsub); +}); + +?> + + + $chan) { + $rowcolor = ''; + if ($chan['visible'] != $chan['XMLTV_selected']) $rowcolor = ' style="background-color:#eee8e0;"'; + + $freq = $chan['freqid']; + + if ($freq != $prev_freq) $prev_freq = $freq; + else $freq = ' '; + + $name = $chan['name']; + if (preg_match('!^\d+\.\d+ (.*)$!', $name, $matches)) { + $name = $matches[1]; + } + + echo "\n"; +} +?> + +
channumfreqidnamevisibleXMLTV
selected
$channum$freq$name{$chan['visible']}{$chan['XMLTV_selected']}
+ From 5b33142296934dddb0663c888b51009cd740e07a Mon Sep 17 00:00:00 2001 From: bruce Date: Fri, 27 Aug 2021 08:50:44 -0400 Subject: [PATCH 6/7] indicate missing XMLTV channel --- mythweb/mythweb_chan_recon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythweb/mythweb_chan_recon.php b/mythweb/mythweb_chan_recon.php index 40b4702..1ddc62f 100644 --- a/mythweb/mythweb_chan_recon.php +++ b/mythweb/mythweb_chan_recon.php @@ -58,7 +58,7 @@ list($chan, $sub) = explode('_', $channum); $channum = "$chan.$sub"; - $row['XMLTV_selected'] = '0'; + $row['XMLTV_selected'] = 'missing'; $row['channum'] = $channum; $myth_channels[$channum] = $row; From 8120022512bb3e8373b0c7339051becbfc64afb7 Mon Sep 17 00:00:00 2001 From: bruce Date: Sat, 4 Sep 2021 19:09:12 -0400 Subject: [PATCH 7/7] mythweb - update XMLTV selected value --- mythweb/mythweb_chan_recon.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mythweb/mythweb_chan_recon.php b/mythweb/mythweb_chan_recon.php index 1ddc62f..511241b 100644 --- a/mythweb/mythweb_chan_recon.php +++ b/mythweb/mythweb_chan_recon.php @@ -45,6 +45,16 @@ $msconn = new PDO("mysql:host={$_SERVER['db_server']};dbname={$_SERVER['db_name']};charset=utf8", $_SERVER['db_login'], $_SERVER['db_password']); $msconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; + +if ($action == 'setXMLTV') { + $channum = $_REQUEST['channum']; + $val = $_REQUEST['val']; + + $sql = "UPDATE channels SET selected = $val WHERE channum = '$channum'"; + $slconn->exec($sql); +} + // Load mythtv channel table $sql = 'SELECT * FROM channel ORDER BY chanid'; $sth = $msconn->query($sql); @@ -105,7 +115,13 @@ $name = $matches[1]; } - echo "$channum$freq$name{$chan['visible']}{$chan['XMLTV_selected']}\n"; + $XMLTV_checked = ''; + if ($chan['XMLTV_selected']) $XMLTV_checked = 'checked'; + $href = "\"mythweb_chan_recon.php?action=setXMLTV&channum=$channum&val=\" + val"; + + echo "$channum$freq$name{$chan['visible']}"; + echo ""; + echo "\n"; } ?>