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..511241b --- /dev/null +++ b/mythweb/mythweb_chan_recon.php @@ -0,0 +1,129 @@ + 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); + +$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); +$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'] = 'missing'; + $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]; + } + + $XMLTV_checked = ''; + if ($chan['XMLTV_selected']) $XMLTV_checked = 'checked'; + $href = "\"mythweb_chan_recon.php?action=setXMLTV&channum=$channum&val=\" + val"; + + echo "\n"; +} +?> + +
channumfreqidnamevisibleXMLTV
selected
$channum$freq$name{$chan['visible']}"; + echo ""; + echo "
+ diff --git a/pi-SDtoHD-helper.sh b/pi-SDtoHD-helper.sh index 2b9cf65..5813d78 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." 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 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" <