diff options
Diffstat (limited to 'abs/core/tweaker/bin')
21 files changed, 0 insertions, 4047 deletions
diff --git a/abs/core/tweaker/bin/LocalIPCheck.pl b/abs/core/tweaker/bin/LocalIPCheck.pl deleted file mode 100755 index b744fb6..0000000 --- a/abs/core/tweaker/bin/LocalIPCheck.pl +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl - -# Valid private IP ranges - -my @LOCAL_IP_RANGES = ("10.0.0.0", "10.255.255.255", - "172.16.0.0", "172.31.255.255", - "192.168.0.0", "192.168.255.255"); - -# input: A dotted quad IP address. - -# output: 0 if a public (internet) address -# : 8 if a class A private (LAN) address -# : 12 if a class B private (LAN) address -# : 16 if a class C private (LAN) address - -sub get_IP_number () { - my ($dotted_quad) = @_; - my $IP_number=0; - - split(/\./, $dotted_quad); - - for (my $i=0; $i < 4; $i++) { - $IP_number=$IP_number+@_[3-$i]*(2**(8*$i)); - } - return $IP_number; -} - -while(<>) { - chop; - my $IPnumber=&get_IP_number($_); - my $class=16; - - while (@LOCAL_IP_RANGES) { - my $highIPnumber = &get_IP_number(pop(@LOCAL_IP_RANGES)); - my $lowIPnumber = &get_IP_number(pop(@LOCAL_IP_RANGES)); - - if (($lowIPnumber <= $IPnumber) && ($highIPnumber >= $IPnumber)) { - exit($class); # PRIVATE IP - } else { - $class += 4; - } - } -} - -exit(0); # PUBLIC IP - - diff --git a/abs/core/tweaker/bin/SQLtweaker.sh b/abs/core/tweaker/bin/SQLtweaker.sh deleted file mode 100755 index 5760e5d..0000000 --- a/abs/core/tweaker/bin/SQLtweaker.sh +++ /dev/null @@ -1,86 +0,0 @@ -# This isn't to be run. Do not chmod it +x and try - it won't do anything. - -# This function will change or create entries in various tables within -# the mythconverg database. -# If the key value already exists in $SQL_FILENAME, then it is changed. Otherwise, -# it will create the necessary SQL to make the entry if it does not exist. -# -# For the purposes of this function, a key is defined as any unique string of text -# after which a comma and a value or values follow. E.g.: -# in an entry like this: -# INSERT INTO `videotypes` VALUES (6,'mpeg','',0,1); -# we can define the key as "6" if we wanted, but that would be ambiguous. So we can instead -# define it as "6,'mpeg'" and we gain the ability to control the values of the fields after -# the first two. So this function call -# -# ChangeOrMakeEntry "6,'mpeg'" "'mplayer -fs -zoom', 0,1" "videotypes" -# -# would change the above SQL entry into this: -# -# INSERT INTO `videotypes` VALUES (6,'mpeg','mplayer -fs -zoom', 0,1); - -# parameters: name, value, table - -# Some tables have simple key, value pairs. Others have several potential keys and values. -# The 'settings' table is a simple key, value pair table, plus the name of the system on which -# the settings hold true, e.g.: -# INSERT INTO `settings` VALUES ('FooHat','Peas with sauce:drizzle','MythTVhost'); -### -function ChangeOrMakeEntry { - NAME=$1 ; shift - VALUE=$1 ; shift - TABLE=$1 ; shift - - if [ `grep -c "$NAME" $SQL_FILENAME` == 0 ]; then - # There is no setting for $SETTING_NAME, so we need to make it - echo "INSERT INTO \`$TABLE\`" VALUES \($NAME,$VALUE\)\; >> $SQL_FILENAME - else - # There is a setting for $SETTING_NAME, so make sure it's what we want it to be. - sed -i "s@$NAME,.*);@$NAME,$VALUE);@" $SQL_FILENAME - fi -} - -# shortcut function to ChangeOrMakeEntry for 'settings' table -function ChangeOrMakeSetting { - NAME=$1 ; shift - VALUE=$1 ; shift - - ChangeOrMakeEntry "$NAME" "$VALUE, 'MythTVhost'" "settings" -} - -# shortcut function to ChangeOrMakeEntry for 'settings' table -function ChangeOrMakeKeybinding { - NAME=$1 ; shift - VALUE=$1 ; shift - - ChangeOrMakeEntry "$NAME" "$VALUE, 'MythTVhost'" "keybindings" -} - -# This only works for North America at the moment. -LocaleCode() { # no arguments. Obtain a zipcode or locale, either using - # SchedulesDirect subscription info or by asking the user. - - mysqldump --tab=/tmp --opt mythconverg videosource - # Get the first data direct "Video Source" - dd_src=$(awk -F'\t' '$3 == "schedulesdirect1" {print $0; exit 0;}' </tmp/videosource.txt) - /bin/rm -f /tmp/videosource.txt - if [ -n "$dd_src" ]; then - # we have a chance at getting a usable locale from the schedulesdirect data - cd /usr/LH/ - - SCHEDULESDIRECT_USERNAME=$(echo "$dd_src" | cut -f4) - SCHEDULESDIRECT_PASSWORD=$(echo "$dd_src" | cut -f7) - - sed -i "s/<userName>.*<\/userName>/<userName>$SCHEDULESDIRECT_USERNAME<\/userName>/" xtvd.xml - sed -i "s/<password>.*<\/password>/<password>$SCHEDULESDIRECT_PASSWORD<\/password>/" xtvd.xml - datadirect-parse.pl &> /dev/null - - SQL_LocaleCode=`grep -i postalCode \`ls -1tr *xml | tail -1\` | perl -e '%zips=""; while(<>) { split(/postalCode=/); @_[1] =~ m/(\d{5})/; if ($1) { $zips{$1}=$1; } } @keys = keys %zips; if ($#keys == 1) { print values %zips,"\n"; }'` - - if [ "$SQL_LocaleCode" == "" ]; then # zipcode was ambiguous or was not extractable - echo -e "\nPlease enter your US zipcode or Canadian Postal Code:" - read SQL_LocaleCode - fi - echo $SQL_LocaleCode > /tmp/locale.txt # remember this just long enough to make use of it in PostSQLTweaker.sh - fi -} diff --git a/abs/core/tweaker/bin/create-linhes-sql.sh b/abs/core/tweaker/bin/create-linhes-sql.sh deleted file mode 100755 index 478eed0..0000000 --- a/abs/core/tweaker/bin/create-linhes-sql.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash - -# Written by Bob Igo from the MythTV Store at http://MythiC.TV -# Email: bob@stormlogic.com -# -# If you run into problems with this script, please send me email - -# PURPOSE: -# -------------------------- -# This script automates the creation of a new LinHES.sql based -# on the contents of the current mythconverg database. - -if [ `whoami` != "root" ]; then - echo "This script must be run as root." - exit -1 -fi - -# Every file we may create, edit, or delete -########################################### -export LINHES_SQL_PROTOTYPE=/data/database/LinHES.sql-new -export MYTHTV_SQL_OLD=/data/database/LinHES.sql-backup -export TMPFILE=/tmp/LinHES.sql-tmp - -echo "" -echo " ** ONLY CESMAN SHOULD EVER NEED TO RUN THIS SCRIPT **" -echo "" -echo " WARNING: This will archive your mythconverg database to a file," -echo " then delete mythconverg from MySQL. It will then launch mythbackend" -echo " to repopulate mythconverg, with a goal of creating the smallest-possible" -echo " mythconverg database that MythTV can load without complanining." -echo " Every attempt will be made to restore your original database, but" -echo " ***no guarantee is made***." -echo "" -echo " ** ONLY CESMAN SHOULD EVER NEED TO RUN THIS SCRIPT **" -echo "" - -echo -n "Proceed? [y|N] " -read FEAR - -if [ "$FEAR" != "y" ] && [ "$FEAR" != "Y" ]; then - echo "***NO OPERATION WILL BE PERFORMED***" - exit -fi - -# Archive the current mythconverg table from the MySQL database: -echo "DROP DATABASE IF EXISTS mythconverg; CREATE DATABASE mythconverg; USE mythconverg;" > $MYTHTV_SQL_OLD -mysqldump mythconverg >> $MYTHTV_SQL_OLD - -# delete the mythconverg database from MySQL -killall mythbackend -mysql -e "DROP DATABASE IF EXISTS mythconverg; CREATE DATABASE mythconverg;" - -mythtv-setup --geometry 640x480 2>&1 > /dev/null & - -echo "*" -echo "* 1) PICK ANY LANGUAGE WHEN PROMPTED." -echo "* 2) AGREE TO THE SCHEMA UPGRADE." -echo "* 3) PRESS ENTER HERE WHEN THE MYTHTV-SETUP MENU LAUNCHES." -echo "*" -read KEYPRESS - -mysql -e "USE mythconverg; \ -INSERT INTO settings VALUES ('SecurityPin','0000','"`hostname`"'); \ -INSERT INTO settings VALUES ('BackendServerIP','127.0.0.1','"`hostname`"'); \ -INSERT INTO storagegroup VALUES ('\N', 'Default','"`hostname`"','/');" - -echo "*" -echo "* 1) EXIT MYTHTV-SETUP" -echo "* 2) PRESS ENTER HERE WHEN READY TO CONTINUE." -echo "*" -read KEYPRESS - -# let mythbackend repopulate mythconverg from scratch -mythbackend 2>&1 > /dev/null & -sleep 3 - -mythfrontend --geometry 640x480 2>&1 > /dev/null & -echo "*" -echo "* 1) EXIT MYTHFRONTEND" -echo "* 2) PRESS ENTER HERE WHEN READY TO CONTINUE." -echo "*" -read KEYPRESS - -killall mythfrontend -killall mythbackend - -# save off the mostly-pristine MythTV myconverg database -# (It would be 100% pristine, but mythbackend won't run unless BackendServerIP is given a value, -# and both mythtv-setup and the mythfrontend won't proceed until you've picked a language.) - -# Edit the pristine MythTV mythconverg database so that we can use it to prime -# the database during a semi-automated LinHES installation. - -SQL_FILENAME=$LINHES_SQL_PROTOTYPE - -# load our library functions -. /usr/LH/tweaker/bin/SQLtweaker.sh -# -echo "*" -echo "* Writing $LINHES_SQL_PROTOTYPE..." -echo "*" -# -echo "/*" > $LINHES_SQL_PROTOTYPE -echo " * MythTV raw SQL creation file." >> $LINHES_SQL_PROTOTYPE -echo " */" >> $LINHES_SQL_PROTOTYPE -echo "" >> $LINHES_SQL_PROTOTYPE -echo "-- #################################################################### --" >> $LINHES_SQL_PROTOTYPE -echo "-- Drop any initial database:" >> $LINHES_SQL_PROTOTYPE -echo "DROP DATABASE IF EXISTS mythconverg;" >> $LINHES_SQL_PROTOTYPE -echo "" >> $LINHES_SQL_PROTOTYPE -echo "-- #################################################################### --" >> $LINHES_SQL_PROTOTYPE -echo "-- Create an empty new database:" >> $LINHES_SQL_PROTOTYPE -echo "CREATE DATABASE mythconverg;" >> $LINHES_SQL_PROTOTYPE -echo "GRANT ALL ON mythconverg.* TO mythtv@localhost IDENTIFIED BY \"mythtv\";" >> $LINHES_SQL_PROTOTYPE -echo "FLUSH PRIVILEGES;" >> $LINHES_SQL_PROTOTYPE -echo "GRANT CREATE TEMPORARY TABLES ON mythconverg.* TO mythtv@localhost IDENTIFIED BY \"mythtv\";" >> $LINHES_SQL_PROTOTYPE -echo "FLUSH PRIVILEGES;" >> $LINHES_SQL_PROTOTYPE -echo "USE mythconverg;" >> $LINHES_SQL_PROTOTYPE -echo "" >> $LINHES_SQL_PROTOTYPE -echo "-- #################################################################### --" >> $LINHES_SQL_PROTOTYPE -echo "-- Create all the tables:" >> $LINHES_SQL_PROTOTYPE -echo "" >> $LINHES_SQL_PROTOTYPE - -# Dump the database, removing all unneeded DB inserts - when LinHES launches mythtv-setup and mythfrontend, -# anything undefined will be given default values by the applications, except for the INSERTs below. -mysqldump mythconverg | sed -e "s/`hostname`/MythTVhost'/g" -e "s/AUTO_INCREMENT=[0-9]* //g" > $TMPFILE -grep -v "INSERT INTO" $TMPFILE >> $LINHES_SQL_PROTOTYPE -sed "s/,(/,\n(/g" $TMPFILE | grep DBSchema | sed "s/\(.*\)NULL),/INSERT INTO settings VALUES \1'MythTVhost');/g" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('SecurityPin','0000','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('BackendServerIP','127.0.0.1','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('MasterServerIP','127.0.0.1','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('MasterServerPort','6543','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('Theme', 'LinHES','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO settings VALUES ('HostMyhostname', 'type_hostname_here','MythTVhost');" >> $LINHES_SQL_PROTOTYPE -echo "INSERT INTO storagegroup VALUES ('\N', 'Default','MythTVhost','/');" >> $LINHES_SQL_PROTOTYPE - -rm $TMPFILE - -# -echo "*" -echo "...DONE" -echo "*" -# - -echo "*" -echo "* PRESS ENTER HERE WHEN READY TO RESTORE THE OLD DATABASE" -echo "* AND RE-LAUNCH MYTHBACKEND" -echo "*" -read KEYPRESS - -# -echo "Restoring original database from $MYTHTV_SQL_OLD..." -# -# Restore the original mythconverg database -cat $MYTHTV_SQL_OLD | mysql 2>&1 > /dev/null -# -echo "...DONE" -# - -# -echo "restarting mythbackend..." -# -mythbackend & -# -echo "...DONE" -# diff --git a/abs/core/tweaker/bin/tweaker.pl b/abs/core/tweaker/bin/tweaker.pl deleted file mode 100755 index 28519df..0000000 --- a/abs/core/tweaker/bin/tweaker.pl +++ /dev/null @@ -1,333 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007, 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -package Tweaker; - -use strict; -use Getopt::Lucid qw( :all ); -# see http://search.cpan.org/~dagolden/Getopt-Lucid-0.16/lib/Getopt/Lucid.pm for usage details -use XML::Twig; -# see http://xmltwig.com for usage details -use Log::Log4perl qw(get_logger); - -# see http://search.cpan.org/~mschilli/Log-Log4perl-1.14/lib/Log/Log4perl.pm for usage details -# http://www.perl.com/pub/a/2002/09/11/log4perl.html is highly recommended as well - -use Tweaker::Script; -use Tweaker::Definitions; - -# To install the above modules: -# -- -# sudo cpan install Getopt::Lucid XML::Twig Log::Log4perl List::Member -# choose the defaults for all options, agree to install all dependencies -# Copy TweakerDefinitions.pm to /etc/perl - -use vars qw($debug); -use vars qw($interactivity); -use vars qw($logfile); -use vars qw($twig); - -my $bottom = Tweaker::Definitions::get_global_variable_value("bottom"); -my $optional = Tweaker::Definitions::get_global_variable_value("optional"); -my $minimal = Tweaker::Definitions::get_global_variable_value("minimal"); -my $null = Tweaker::Definitions::get_global_variable_value("null"); - -# As each tweak tag is processed, this subroutine is called. Here we will -# see if any previous tweak tag had the same name attribute. If so, we will -# replace the previous tweak tag with this new tweak tag's contents. -sub uniquify_tweaks { - my ($twig, $this_tweak) = @_; - my $tweak_name = $this_tweak->att('name'); - my $previous_tweak = $this_tweak->prev_sibling( qq{tweak[\@name="$tweak_name"]}); - my $logger = get_logger('tweaker'); - - # If the tweak's name is found elsewhere, replace the first - # instance with the latest one, then delete the latest one. - if ($previous_tweak) { - my $log_entry; - # Requirement 6.3.1 - $log_entry = sprintf("\tReplacing\n\t\t%s\n\twith\n\t\t%s\n", $previous_tweak->sprint, $this_tweak->sprint); - $logger->info($log_entry); - $this_tweak->cut; - $this_tweak->replace($previous_tweak); - } -} - -$twig = XML::Twig->new(load_DTD => 1, - expand_external_ents => 1, - twig_handlers => { 'tweak' => \&uniquify_tweaks } - ); - -# Requirement 4.2 -# Print advice on usage and invocation. -sub help () { - my $logger = get_logger('tweaker'); - $logger->fatal("USAGE:\n$0 --tcf file1.tcf [--tcf file2.tcf ...] [--help]"); - exit; -} - -sub print_tcf { - my(@tweaks) = @_; - my $logger = get_logger('tweaker'); - - $logger->debug('<?xml version="1.0"?>'); # print the XML declaration - $logger->debug('<!DOCTYPE stats SYSTEM "tcf.dtd">'); - $logger->debug('<tcf>'); # then the root element start tag - - foreach my $tweak (@tweaks) { # the list of tweaks - $logger->debug($tweak->sprint); # print the xml content of the element - } - - $logger->debug("</tcf>\n"); # close the document -} - -# For each tweak, invoke the option that was selected. -# Requirement 9.1.5 -# Requirement 13 -sub invoke_selected_options { - my @tweaks= $twig->root->children; # get the tweak list - my $logger = get_logger('tweaker'); - my $has_selected_option; - my $recommendationlevel = $bottom; - - foreach my $tweak (@tweaks) { # the list of tweaks - if ($tweak->att('name')) { - $has_selected_option=0; - $logger->debug("TWEAK ", $tweak->att('name')); - my @options = $tweak->descendants('option'); - foreach my $option (@options) { - if ($option->first_child('selected')) { - $has_selected_option++; - $recommendationlevel = $option->first_child('selected')->text; - $logger->info("\t", $tweak->att('name'), " : ", $option->att('name'), " is selected (recommendationlevel is ", $recommendationlevel, ")"); - # If the selected option is merely $optional, and we are in $minimal interactivity mode, we - # really don't know if this option is useful for the user. Just skip it. - if (($recommendationlevel == $optional) && ($interactivity eq $minimal)) { # UI Requirement 9.1.4 - $logger->debug("\tSKIPPING"); - next; - } elsif (($tweak->first_child('script')->text) && - ($tweak->first_child('script')->text) ne $null) { - $logger->debug("\tRUNNING"); - my $command = sprintf("%s --implement %s", $tweak->first_child('script')->text, $option->att('name')); - $logger->info("\t\tRunning '$command' to run a tweak."); - - open(COMMAND, "$command|"); - while(<COMMAND>) { # should only be one line of results - if ($_) { - $logger->debug("script returned text: ", $_); - } else { - $logger->debug("no return value from script"); - } - } - close(COMMAND); - } else { - $logger->debug("\tNO SCRIPT TO RUN"); - } - } - } - if ($has_selected_option == 0) { - $logger->debug("\tNO OPTION SELECTED"); - } - } - } -} - - -# Parses an XML file in TCF format, loading its information into memory. -# Rely on the DTD to mandate required tags. -sub parse_tcf { - my $this_tcf = shift(@_); - my $logger = get_logger('tweaker'); - - $logger->info("Parsing $this_tcf..."); - $twig->safe_parsefile($this_tcf) || $logger->fatal("Bad TCF $this_tcf: $@"); - if ($@) { - return 0; - } - # ??? For Requirement 5.1, we need to catch parse errors here - # $twig now has the parsed $this_tcf - $logger->info("DONE parsing $this_tcf"); - - my $root= $twig->root; # get the root of the twig (tcf) - my @tweaks= $root->children; # get the tweak list - - print_tcf(@tweaks) if $debug; - - return 1; # successfully parsed $this_tcf -} - -sub parse_core_tcf { - my ($core_tcf_pathname) = @_; - my $logger = get_logger('tweaker'); - - $logger->debug("core TCF pathname: $core_tcf_pathname"); - - # Requirement 5.1 - if (!(parse_tcf($core_tcf_pathname))) { - # Part of Requirement 6.4.1 - $logger->fatal("$0 requires at least one valid .tcf file."); - $logger->fatal("$core_tcf_pathname, or a .tcf that it includes, did not parse."); - exit; - } - # $twig->root->print; -} - -sub process_parameters () { - # Accept these parameters: - # -- - my @parameters = ( - Switch("help")->anycase, # Requirement 4.2 - Switch("debug")->anycase, - # part of Requirement 8 - Param("interactivity")->default($minimal), # side-effect of UI Requirement 9 for v0.7 - ); - - my $opt = Getopt::Lucid->getopt( \@parameters ); - my $help = $opt->get_help; - $debug = $opt->get_debug; - $interactivity = $opt->get_interactivity; - - if ($interactivity ne $minimal) { # side-effect of UI Requirement 9 for v0.7 - my $logger = get_logger('tweaker'); - $logger->warn("This version of Tweaker ignores requests for $interactivity interactivity and defaults to $minimal."); - $interactivity = $minimal; - } - - if ( $help > 0 ) { - help; - } -} - -# Requirement 6.6: Tweaker shall determine Recommendation Levels and default Options -# Requirements 6.6.1 and 6.6.2 -sub post_process_tweaks { - my $logger = get_logger('tweaker'); - - # Requirement 6.6.1 - - my $root= $twig->root; # get the root of the twig (tcf) - my @tweaks= $root->children; # get the tweak list - - foreach my $tweak (@tweaks) { - $logger->debug("#######"); - my @options = $tweak->descendants('option'); - - my $name_of_most_recommended_option=""; - my $most_recommended_option; - my $highest_recommendationlevel=$bottom; - - foreach my $option (@options) { - $logger->debug("===== OPTION"); - $logger->debug($option->sprint); - - my $recommendationlevel = $option->first_child('recommendationlevel'); - if ($recommendationlevel) { - # Requirement 6.6.1.1 - $logger->debug("\t+++"); - $logger->debug("\tUsing predefined recommendation level:", $recommendationlevel->text); - } else { - # Requirement 6.6.1.4 - my $result="optional"; - my $explanation=""; - - if (($tweak->first_child('script')->text) && - ($tweak->first_child('script')->text) ne $null) { - # Requirement 6.6.1.2 - $logger->debug("\t---"); - $logger->debug("\tThis has no defined recommendation level."); - - # Get the name of the script for this tweak and invoke it with the name of the option. - my $command = sprintf("%s --poll %s", $tweak->first_child('script')->text, $option->att('name')); - $logger->debug("\t\tRunning '$command' to see what it should be."); - # Create a recommendationlevel element and populate it with the script's return value. - - open(COMMAND, "$command|"); - while(<COMMAND>) { # should only be one line of results - $logger->debug("Got this: ", $_); - if ($_) { - chop; - my @text = split(/\|/); - $result = $text[0]; - if ($text[1]) { - $explanation = $text[1]; - } - } - } - close(COMMAND); - } - # Requirement 6.6.1.3 - $option->set_field ( 'recommendationlevel', $result ); - if ($explanation) { - $option->set_field ( 'explanation', $explanation ); - } - #$logger->debug("*** Paste results: ", $option->sprint); - } - # Requirement 6.6.2 : Auto-select the Option with the highest non-negative Recommendation Level. - # Requirement 6.6.2.1 : If there is a tie, Tweaker shall auto-select the first Option with the highest Recommendation Level. - $recommendationlevel = $option->first_child('recommendationlevel'); - if ($recommendationlevel) { - if ($name_of_most_recommended_option) { - $logger->debug("comparing ", $name_of_most_recommended_option, "'s recommendationlevel ($highest_recommendationlevel) to ", $recommendationlevel->text, " (",Tweaker::Definitions::get_global_variable_value($recommendationlevel->text),")"); - } else { - $logger->debug("considering recommendationlevel ", $recommendationlevel->text, " (",Tweaker::Definitions::get_global_variable_value($recommendationlevel->text),")"); - } - if (($highest_recommendationlevel < Tweaker::Definitions::get_global_variable_value($recommendationlevel->text)) - && (Tweaker::Definitions::get_global_variable_value($recommendationlevel->text) >= 0)) { - $highest_recommendationlevel = Tweaker::Definitions::get_global_variable_value($recommendationlevel->text); - $name_of_most_recommended_option = $option->att('name'); - $most_recommended_option = $option; - $logger->debug("now recommending: ", $name_of_most_recommended_option, " at level ", $highest_recommendationlevel); - } - } else { - $logger->error("No recommendationlevel defined for ", $option->att('name')); - } - # Select the best option, based on recommendation level - } - if ($most_recommended_option) { - $logger->debug("(1) BEST OPTION: ", $most_recommended_option->sprint); - $most_recommended_option->set_field ( 'selected', $highest_recommendationlevel ); - } - } -} - -sub main () { - my $tweaker_root; - - if (!($tweaker_root = Tweaker::Script::get_environment_variable("\$TWEAKER_ROOT"))) { - Log::Log4perl->easy_init(); - my $logger = get_logger(); - $logger->fatal("\$TWEAKER_ROOT not defined. Exiting."); - exit -1; - } - my $core_tcf_path = "$tweaker_root/tcf"; - my $core_tcf = "tweaker-core.tcf"; - my $core_tcf_pathname = "$core_tcf_path/$core_tcf"; - my $log4perl_conf = "$tweaker_root/log4perl.conf"; - - Log::Log4perl::init_and_watch($log4perl_conf,10); - - process_parameters; - parse_core_tcf($core_tcf_pathname); - post_process_tweaks; - # ??? need to add Requirement 11 here - invoke_selected_options; -} - -main; - -#my @tweaks= $twig->root->children; # get the tweak list -#print_tcf(@tweaks) if $debug; diff --git a/abs/core/tweaker/bin/twk_EXAMPLE.pl b/abs/core/tweaker/bin/twk_EXAMPLE.pl deleted file mode 100755 index 7dfb075..0000000 --- a/abs/core/tweaker/bin/twk_EXAMPLE.pl +++ /dev/null @@ -1,134 +0,0 @@ -# This is not an executable. It provides an example of how you would implement a -# Tweaker Script. For details on the functions provided by Tweaker::Script, -# such as execute_shell_command, get_environment_variable, connect_to_db, etc. -# see Tweaker/Script.pm -# -# See the corresponding EXAMPLE.tcf for the Tweak that would correspond to this script. - -# -# BEGIN EXAMPLE -# - -#!/usr/bin/perl -w - -# Copyright 2009 YOUR NAME HERE -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -# List all the options that this script supports. Make sure it matches what's in -# the corresponding .tcf entry. -set_known_options( 'option1', 'option2', 'option3' ); - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - # If you need a subroutine that is specific to the task of implementing an option, - # define it inside the above subroutine. - sub my_subroutune { - # ... - } - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - switch ($option) { - # List all the options that this script supports. You can have as many as you like. - case "option1" { - # Perform the actions necessary to implement option1. - # You may want to call do_query, change_or_make_setting, or change_or_make_entry to make changes to the MySQL database. - # You may want to call execute_shell_command to make changes from the shell. - } - case "option2" { - # Perform the actions necessary to implement option2. - # You may want to call do_query, change_or_make_setting, or change_or_make_entry to make changes to the MySQL database. - # You may want to call execute_shell_command to make changes from the shell. - } - case "option3" { - # Perform the actions necessary to implement option3. - # You may want to call do_query, change_or_make_setting, or change_or_make_entry to make changes to the MySQL database. - # You may want to call execute_shell_command to make changes from the shell. - } - } - } else { # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: Unable to connect to mythconverg database"); - $logger->error("ERROR: Unable to implement option $option."); - exit -1; # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - } # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - disconnect_from_db(); # You may not have to do this. It's only when you need to change MySQL settings for MythTV. -} - -# Poll the system to see what recommendationlevel the given option has on the system. -sub poll_options { - my($option) = @_; - - # If you need a subroutine that is specific to the task of implementing an option, - # define it inside the above subroutine. - sub my_subroutune { - # ... - } - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - switch ($option) { - # List all the options that this script supports. You can have as many as you like. - case "option1" { - # Perform the actions necessary to determine a recommendation level for option1. - # You may want to call do_query to query to the MySQL database. - # You may want to call execute_shell_command to check things in the shell. - # When you're done, you can use the recommendation_level subroutine to return the - # resulting recommendation level. - } - case "option2" { - # Perform the actions necessary to determine a recommendation level for option2. - # You may want to call do_query to query to the MySQL database. - # You may want to call execute_shell_command to check things in the shell. - # When you're done, you can use the recommendation_level subroutine to return the - # resulting recommendation level. - } - case "option3" { - # Perform the actions necessary to determine a recommendation level for option3. - # You may want to call do_query to query to the MySQL database. - # You may want to call execute_shell_command to check things in the shell. - # When you're done, you can use the recommendation_level subroutine to return the - # resulting recommendation level. - } - } - } else { # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - exit -1; # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - } # You may not have to do this. It's only when you need to change MySQL settings for MythTV. - disconnect_from_db(); # You may not have to do this. It's only when you need to change MySQL settings for MythTV. -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; # mandatory - -# -# END EXAMPLE -# diff --git a/abs/core/tweaker/bin/twk_RAM.pl b/abs/core/tweaker/bin/twk_RAM.pl deleted file mode 100755 index 2eea598..0000000 --- a/abs/core/tweaker/bin/twk_RAM.pl +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'low', 'medium', 'high' ); - -# ??? Need to make this update a class variable so it only ever needs to run once. -sub determine_RAM_size() { - my $result = execute_shell_command("cat /proc/meminfo | grep MemTotal"); - if ($result =~ m/.*MemTotal:\s*(\d+) .*/) { - return $1; - } - return 0; -} - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # MythTV's GUI allows setting this value in multiples of 4700kB. - # We will arbitrarily set the HDRingbufferSize to the value that is closest to - # 3.3% of the total RAM. - my $RAM_size = determine_RAM_size(); - my $ringbuffer_size = int($RAM_size * 0.033 / 4700) * 4700; - change_or_make_setting('HDRingbufferSize', $ringbuffer_size) || exit -1; - - # change any existing mplayer cache setting to one based on available RAM size - # We will arbitrarily set the cache size to 1/16 of available RAM - my $cachesize = int($RAM_size / 16); - execute_shell_command("if [[ `grep -e cache.*=.*\$ /etc/mplayer/mplayer.conf` ]]; then sed -i 's/cache.*=.*/cache=$cachesize/g' /etc/mplayer/mplayer.conf; else echo 'cache=$cachesize' >> /etc/mplayer/mplayer.conf; fi") || exit -1; - - # If there's enough RAM, make mtd run by default. - # ??? unimplemented - } else { - exit -1; - } - disconnect_from_db(); -} - -# Poll the system to see what recommendationlevel the given option has on the system. -sub poll_options { - my($option) = @_; - my $fudge_factor = .985; - my $low_RAM = int($fudge_factor * 512*1024); # ~512MB - my $medium_RAM = int($fudge_factor * 1024*1024); # ~1GB - my $high_RAM = int($fudge_factor * 2048*1024); # ~2GB - - threshold_test($option, determine_RAM_size(), "RAM", $low_RAM, $medium_RAM, $high_RAM); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_audio.pl b/abs/core/tweaker/bin/twk_audio.pl deleted file mode 100755 index 47a2415..0000000 --- a/abs/core/tweaker/bin/twk_audio.pl +++ /dev/null @@ -1,390 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'analogstereo', 'analogsurround', 'digital' ); - -# Poll the system to find the digital output device. -sub poll_for_digital_output_device { - my $card=-1; - my $device=-1; - my $poll_command = "aplay -l | grep card"; - - my @digital_matches = ( "digital", "IEC958" ); - - my $results = execute_shell_command($poll_command); - if ($results) { - foreach my $digital_match (@digital_matches) { - if ($results =~ /card (\d):.*device (\d).*$digital_match.*/i) { - $card = $1; - $device = $2; - } - } - } else { - recommendation_level("not available", "No audio devices detected."); - exit(-1); - } - return ($card, $device); -} - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - use vars qw($card); - use vars qw($device); - ($card, $device) = poll_for_digital_output_device; - use vars qw($asound_conf); - $asound_conf = "/etc/asound.conf"; - use vars qw($mplayer_conf); - $mplayer_conf = "/etc/mplayer/mplayer.conf"; - use vars qw($xine_conf); - $xine_conf = "/home/mythtv/.xine/config"; - - sub generate_asound_conf { - my($option) = @_; - my $command1; - my $command2; - - switch ($option) { - case "analogstereo" { - # Analog stereo usually needs no asound.conf, but sometimes it needs to be there to - # support more than one app using sound simultaneously. - $command1 = "[ -e $asound_conf ] && /bin/cp $asound_conf $asound_conf-TWEAKERBACKUP"; - # Assumption: The proper analog device is always device 0. - if ($card >= 0) { - $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,0/g' $asound_conf"; - } else { - $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:0,0/g' $asound_conf"; - } - } - case "analogsurround" { - # Not supported yet. - } - case "digital" { - # Digital audio starts with an asound.conf that references the - # hardware address on the sound device corresponding to digital - # output. - $command1 = "/bin/cp \$TWEAKER_ROOT/fs$asound_conf /etc/"; - if (($card >= 0) && ($device >= 0)) { - $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf"; - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: Unable to poll for digital sound output device."); - exit(-1); - } - } - } - if (my $error = execute_shell_command($command1)) { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - if (my $error = execute_shell_command($command2)) { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - my $logger = get_logger('tweaker.script'); - $logger->info("Generated $asound_conf for $option audio."); - } - - sub edit_mplayer_conf { - my($option) = @_; - # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c,f].*=.*#TWEAKER/d' $mplayer_conf && sed -i '/^speed.*=.*#TWEAKER/d' $mplayer_conf"; - # comment out old entries that some other process may have made - my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c,f].*=.*\\)/#\\1/g' $mplayer_conf && sed -i 's/^\\(speed.*=.*\\)/#\\1/g' $mplayer_conf"; - my $command1; - my $command2=""; - ($card, $device) = poll_for_digital_output_device; - my $logger = get_logger('tweaker.script'); - - if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - switch($option) { - case "analogstereo" { - # No additional work needed; the above commands comment out ao and ac entries, - # leaving a baseline which works with analog stereo. - } - case "analogsurround" { - # Not supported yet. - } - case "digital" { - $command2 = "echo -e 'ac=hwac3,hwdts, #TWEAKER\nao=alsa:device=plughw=$card.$device #TWEAKER' >> $mplayer_conf"; - if (my $error = execute_shell_command($command2)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - my @digital_audio_device_patterns = ( - [ - # Asus T3-M2NC51PV onboard audio - ".*0403.*10de.*026c.*1043.*821f", "T3-M2NC51PV", "[ -e $mplayer_conf ] && sed -i 's/plughw.* #TWEAKER/spdif #TWEAKER/g' $mplayer_conf" - ] - ); - - foreach my $pattern_and_workaround_command (@digital_audio_device_patterns) { - my $pattern=@$pattern_and_workaround_command[0]; - my $name=@$pattern_and_workaround_command[1]; - my $workaround_command=@$pattern_and_workaround_command[2]; - - if (execute_shell_command('lspci -mn | grep -e "'.$pattern.'"')) { - $logger->info("Applying workaround for $name audio"); - execute_shell_command($workaround_command); - last; - } - } - } - } - # for all options - $command2 = "echo -e 'af=scaletempo=stride=30:overlap=.50:search=10 #TWEAKER\nspeed=1.0 #TWEAKER' >> $mplayer_conf"; - if (my $error = execute_shell_command($command2)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - $logger->info("Edited $mplayer_conf for $option audio."); - } - - sub edit_xine_conf { - my($option)=@_; - # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "[ -e $xine_conf ] && sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf"; - # comment out entries that some other process may have made - my $comment_out_external_edits = "[ -e $xine_conf ] && sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf"; - my $logger = get_logger('tweaker.script'); - - if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - my $command1; - - switch($option) { - case "analogstereo" { - $command1 = "echo 'audio.output.speaker_arrangement:Stereo 2.0 #TWEAKER' >> $xine_conf"; - } - case "analogsurround" { - # Not supported yet. - } - case "digital" { - $command1 = "echo -e 'audio.output.speaker_arrangement:Pass Through #TWEAKER\naudio.synchronization.passthrough_offset:$device #TWEAKER' >> $xine_conf"; - } - } - if (my $error = execute_shell_command($command1)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - $logger->info("Edited $xine_conf for $option audio."); - } - - sub reload_modules { - my($option) = @_; - my $command = "update-modules; depmod -a; rmmod snd-pcm-oss; modprobe snd-pcm-oss"; - my $logger = get_logger('tweaker.script'); - - if (my $error = execute_shell_command($command)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - $logger->info("Reloaded sound modules for $option audio."); - } - - sub set_mixer_values { - my($option) = @_; - my $logger = get_logger('tweaker.script'); - - # Some sound devices work poorly in their default state, so we will load in a known-good - # state for them. - - my @digital_audio_device_patterns = ( - [ - # Chaintech AV-710 - ".*0401.*1412.*1724.*1412.*1724", "AV710" - ], - [ - # Realtek ALC888 High Definition onboard Audio - ".*0403.*10de.*055c.*1565.*820c", "ALC888" - ] - ); - - foreach my $pattern_and_name_pairing (@digital_audio_device_patterns) { - my $name=@$pattern_and_name_pairing[1]; - my $pattern=@$pattern_and_name_pairing[0]; - - if (execute_shell_command('lspci -mn | grep -e "'.$pattern.'"')) { - $logger->info("Applying ALSA state workaround for $name audio"); - execute_shell_command("/bin/cp \$TWEAKER_ROOT/fs/var/lib/alsa/$name.asound.state /var/lib/alsa/asound.state"); - execute_shell_command("alsactl restore"); - last; - } - } - - # Now, do what works for all sound devices. - - my $command = "su - mythtv -c \"aumix -v 70 -m 0 -l 0 -l R -w 70\""; # ok for analog and digital - - if (my $error = execute_shell_command($command)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - if ("$option" eq "digital") { - # Poll system for IEC958 controls, and try to turn them all 'on' - $command = "amixer scontrols | grep IEC958"; - my @results = split('\n', execute_shell_command($command)); - foreach my $line (@results) { - if ($line =~ /Simple mixer control (.*),.*/i) { - $command = "su - mythtv -c \"amixer set $1 on\""; # Tries to set all IEC958 devices to 'on' - # but some are just placeholders and can't be turned 'on', therefore don't error out if we fail - execute_shell_command($command); - } - } - } - execute_shell_command("alsactl store"); # persist the above change(s) - $logger->info("Reset mixer volume levels for $option audio."); - } - - sub edit_mythtv_configuration { - my($option)=@_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - switch ($option) { - case "analogstereo" { - change_or_make_setting('AC3PassThru', '0') || exit -1; - change_or_make_setting('DTSPassThru', '0') || exit -1; - change_or_make_setting('MTDac3Flag', '0') || exit -1; - change_or_make_setting('MythControlsVolume', '1') || exit -1; - } - case "analogsurround" { - # Not supported yet. - } - case "digital" { - change_or_make_setting('AC3PassThru', '1') || exit -1; - change_or_make_setting('DTSPassThru', '1') || exit -1; - change_or_make_setting('MTDac3Flag', '1') || exit -1; - change_or_make_setting('MythControlsVolume', '0') || exit -1; - } - } - change_or_make_setting('AudioOutputDevice', 'ALSA:default') || exit -1; - change_or_make_setting('MixerDevice', 'ALSA:default') || exit -1; - change_or_make_setting('MusicAudioDevice', 'default') || exit -1; - } else { - exit -1; - } - disconnect_from_db(); - } - - generate_asound_conf($option); - edit_mplayer_conf($option); - #edit_xine_conf($option); - #reload_modules($option); - edit_mythtv_configuration($option); - set_mixer_values($option); -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - my @digital_audio_device_patterns = ( - [ - # Pattern matches for PCI IDs of perfect devices, comma-separated within the brackets - [ ".*0403.*8086.*284b.*8086.*2504", # Intel DG965WH onboard audio - ".*0403.*10de.*026c.*1043.*821f", # Asus T3-M2NC51PV onboard audio - ".*0403.*8086.*293e.*8086.*3001" # Intel AusDragon onboard audio - ], - "optional|Your sound device works very well in digital mode. Unless you don't have a receiver that can accept digital inputs, you should use digital mode.", - ], - [ - # Pattern matches for PCI IDs of suboptimal devices, comma-separated within the brackets - [ ".*0401.*1412.*1724.*1412.*1724", # Chaintech AV-710 PCI card (regressions in R5.5) - ], - "inadvisable|Your sound device is known to have some problems in digital mode, but you may try it if you like, starting at low volume in your receiver.", - ], - [ - [ ], # Leave blank for unknown devices - "optional|Your sound device may or may not work well in digital mode. Please tell us if it works, and how well.", - ] - ); - - switch ($option) { - case "analogstereo" { - my ($card, $device) = poll_for_digital_output_device; - if (($card >= 0) && ($device >= 0)) { # A digital output device was detected. - recommendation_level("optional"); - } else { - recommendation_level("recommended", "You seem to have no digital output option. If this is not true, please tell us."); - } - } - case "analogsurround" { - my ($card, $device) = poll_for_digital_output_device; - recommendation_level("unsupported", "No configuration data exists yet for this option."); - } - case "digital" { - my ($card, $device) = poll_for_digital_output_device; - if (($card >= 0) && ($device >= 0)) { # A digital output device was detected. - my $recommendation_return_string; - foreach my $pattern_and_recommendation_pairing (@digital_audio_device_patterns) { - $recommendation_return_string=@$pattern_and_recommendation_pairing[1]; - foreach my $patterns (@$pattern_and_recommendation_pairing[0]) { - foreach my $pattern (@$patterns) { - if (execute_shell_command('lspci -mn | grep -e "'.$pattern.'"')) { - recommendation_level($recommendation_return_string); - return; - } - } - } - } - # Because we didn't return a recommendation level above, return a default recommendation level. - recommendation_level($recommendation_return_string); - return; - } else { # No digital output device was detected. - recommendation_level("not available"); - } - } - } -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_cpu.pl b/abs/core/tweaker/bin/twk_cpu.pl deleted file mode 100755 index 8d5e563..0000000 --- a/abs/core/tweaker/bin/twk_cpu.pl +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'low', 'medium', 'high' ); - -# These values are in BOGOMIPS. They are arbitrary and will be refined, if possible, -# as more data is collected. Obviously, BOGOMIPS are not the best CPU benchmarking -# tool. -my $rrd_threshold = 1650; # bogomips at or below this mean rrdtool is too much of a strain -#my $rrd_threshold = 3365; - -my $low_threshold = 2500; -my $medium_threshold = 4050; -my $high_threshold = 7400; - -# Poll the system to find the CPU type. Currently, we use bogomips (the bogosity of which -# is in the name itself) to guess how powerful the CPU is. -sub get_CPU_strength { - my $bogomips=0; - my @results = split("\n", execute_shell_command("cat /proc/cpuinfo | grep bogomips")); - foreach my $result (@results) { # Count the bogomips for each core. Again, this is rough. - if ($result =~ /bogomips\s*:\s*(\d+.\d+)/) { - $bogomips+=$1; - } - } - return $bogomips; -} - -# ??? Need to test for storage groups and LVM -# Specific to KnoppMyth -sub get_HDD_size { - my @HDD_info = split(" +", execute_shell_command("df -h /myth | grep myth")); - - chop($HDD_info[1]); - return($HDD_info[1] || 0); -} - -#sub disable_rrdtool { -# -#} - -# Edit mplayer.conf to tell mplayer to drop video frames when necessary. This should do no harm -# on systems that don't need the option, and it should make video watchable on those that do. -sub edit_mplayer_conf { - use vars qw($mplayer_conf); - $mplayer_conf = "/etc/mplayer/mplayer.conf"; - - # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*hardframedrop.*=.*#TWEAKER/d' $mplayer_conf"; - # comment out old entries that some other process may have made - my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(hardframedrop.*=.*\\)/#\\1/g' $mplayer_conf"; - my $command1; - my $command2=""; - my $logger = get_logger('tweaker.script'); - - if (my $error = execute_shell_command("$delete_old_tweaker_edits && $comment_out_external_edits")) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - $command2 = "echo -e 'hardframedrop=true #TWEAKER' >> $mplayer_conf"; - if (my $error = execute_shell_command($command2)) { - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - - $logger->info("Edited $mplayer_conf to drop video frames when CPU is overloaded."); -} - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - # ??? This will need some work to properly integrate with MythTV 0.21's own CPU-based playback settings. - # For now, set profile to CPU++ no matter what CPU type, and just change what CPU++ provides. - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - switch ($option) { - case "low" { - change_or_make_setting('AutoCommflagWhileRecording', '0') || exit -1; - change_or_make_setting('Theme', 'Iulius') || exit -1; # Low eye candy, high performance - #change_or_make_setting('PreferredMPEG2Decoder', 'libmpeg2') || exit -1; # Least CPU usage, lowest quality - #change_or_make_entry("displayprofiles", [["pref_decoder", "libmpeg2"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Least CPU usage, lowest quality - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU--') || exit -1; # best playback defaults for weak hardware - # Should libmpeg2/ffmpeg be triggered based on CPU type? libmpeg2 is usually - # recommended for AMD CPUs. - # ??? when to use xvmc? - - # Weak CPUs may actually be too weak to run rrdtool without causing problems. -# if (get_CPU_strength() <= $rrd_threshold) { -# disable_rrdtool(); -# } - } - case "medium" { - change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; - change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance - #change_or_make_setting('PreferredMPEG2Decoder', 'libmpeg2') || exit -1; # Least CPU usage, lowest quality - #change_or_make_entry("displayprofiles", [["pref_decoder", "libmpeg2"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Least CPU usage, lowest quality - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU+') || exit -1; # best playback defaults for average hardware - # ??? when to use xvmc? - } - case "high" { - change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; - # ??? Interacts with screen aspect ratio - change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance - #change_or_make_entry("displayprofiles", [["pref_decoder", "ffmpeg"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Most CPU usage, best quality - #change_or_make_setting('PreferredMPEG2Decoder', 'ffmpeg') || exit -1; # Most CPU usage, best quality - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU++') || exit -1; # best playback defaults for powerful hardware - # ??? when to use xvmc? - } - } - change_or_make_setting('UseXvMcVld', '0') || exit -1; - #change_or_make_entry("displayprofiles", [["pref_deint0", "onefield"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Most CPU usage, best quality - change_or_make_setting('OSDTheme', 'blootube-osd') || exit -1; - change_or_make_setting('PlayBoxShading', '0') || exit -1; - change_or_make_setting('PlaybackExitPrompt', '2') || exit -1; - #edit_mplayer_conf(); # This was found to cause temporary picture freezing when skipping forward through playback, followed by out-of-sync audio and video - } else { - exit -1; - } - disconnect_from_db(); -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - - threshold_test($option, get_CPU_strength(), "CPU", $low_threshold, $medium_threshold, $high_threshold); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_dragon.pl b/abs/core/tweaker/bin/twk_dragon.pl deleted file mode 100755 index 21a9dc7..0000000 --- a/abs/core/tweaker/bin/twk_dragon.pl +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2008-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -# List all the options that this script supports. Make sure it matches what's in -# the corresponding .tcf entry. -set_known_options( 'all' ); - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - my $logger = get_logger('tweaker.script'); - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # Overrides SQL changes made in twk_tuners.pl - # WARNING: Very big harccoded hack that chooses ATSC tuning over QAM. - do_query("UPDATE cardinput SET sourceid='10' WHERE sourceid='20'") || return -1; - - # Use the most beautiful theme - change_or_make_setting('Theme', 'blootube-wide') || exit -1; - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: Unable to connect to mythconverg database"); - $logger->error("ERROR: Unable to implement option $option."); - exit -1; - } - disconnect_from_db(); -} - -# Poll the system to see what recommendationlevel the given option has on the system. -sub poll_options { - my($option) = @_; - recommendation_level("recommended", "These tweaks benefit all Dragon users."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_fingerprint_hardware.sh b/abs/core/tweaker/bin/twk_fingerprint_hardware.sh deleted file mode 100755 index 25111dd..0000000 --- a/abs/core/tweaker/bin/twk_fingerprint_hardware.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -# Copyright 2007, 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -# This script will grab USB and PCI data and dump it to a file for the -# user to post. - -output_file=/tmp/fingerprint.txt -maintainer="Human" -thread="" - -Usage() { - echo "USAGE:" - echo `basename $0` " [-a]" - echo "-a: advanced mode" - echo - echo "EXAMPLE: $0" - exit 3 -} - -while getopts "a" FLAG ; do - case "$FLAG" in - a) ADVANCED_MODE=1;; - *) Usage;; - esac -done - -check_for_root() { - if [ `whoami` != "root" ]; then - echo -n `basename $0` - echo " must be run as root. Exiting."; - exit; - fi -} - -poll_PCI() { - echo \ -"##### -# lspci -vv -#####" >> $output_file - lspci -vv >> $output_file - echo "" >> $output_file - - echo \ -"##### -# lspci -mn -#####" >> $output_file - lspci -mn >> $output_file - echo "" >> $output_file -} - -poll_USB() { - echo \ -"##### -# /proc/bus/usb/devices -#####" >> $output_file -cat /proc/bus/usb/devices >> $output_file -} - -instruct() { - echo "Your hardware fingerprint is in $output_file" - echo -n "Please PM it to $maintainer" - if [ "$thread" != "" ]; then - echo " or post it to" - echo -n "$thread" - fi - echo "." - echo "It should be accompanied by a list of changes that you made to the baseline -installation in order to improve MythTV on your hardware." - - echo "If you feel up to the task, feel free to prune out any entries that are for -very low-level devices like memory controllers, USB subsystems, etc. before -sending the fingerprint." -} - -main() { - check_for_root - > $output_file - poll_PCI - poll_USB - instruct -} - -main - diff --git a/abs/core/tweaker/bin/twk_general.pl b/abs/core/tweaker/bin/twk_general.pl deleted file mode 100755 index f89912c..0000000 --- a/abs/core/tweaker/bin/twk_general.pl +++ /dev/null @@ -1,590 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'all' ); - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - # KnoppMyth-centric file-level tweaks - sub file_tweaks { - my($option) = @_; - - my @commands = ( - # keymap tweaks - "twk_keymap.sh" - ); - - foreach my $command (@commands) { - if (my $error = execute_shell_command($command)) { - my $logger = get_logger('tweaker.script'); - $logger->error("$error"); - $logger->error("Unable to implement option $option with command $command."); - } - } - return 1; - } - - # Enhance the default MythTV SQL - sub SQL_tweaks { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # ??? This also exists in mkmythdir - it should be centralized - my $SQL_DirData="/myth"; # Top level dir. of structure, - my $SQL_DirTV="$SQL_DirData/tv"; # TV Recordings, - my $SQL_DirMusic="$SQL_DirData/music/"; # Music storage, - my $SQL_DirGames="$SQL_DirData/games"; # Games dir, - my $SQL_DirPics="$SQL_DirData/gallery"; # Pictures directory. - my $SQL_DirTmp="$SQL_DirData/tmp"; # DVD temp - my $SQL_DirVideo="$SQL_DirData/video"; # videos - - # ??? Eventually, put these into a text file so that 1) people can contribute without having to code, and 2) the data - # stays separate from the code and can be re-used by other (non-Perl) implementations - - # - # keybindings - # - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "Gallery"], ["action","PLAY"]]); - change_or_make_entry("keybindings", [["keylist", ">"]], [["context", "Music"], ["action","FFWD"]]); - change_or_make_entry("keybindings", [["keylist", "<"]], [["context", "Music"], ["action","RWND"]]); - change_or_make_entry("keybindings", [["keylist", "PgDown,.,Z,End"]], [["context", "Music"], ["action","NEXTTTRACK"]]); - change_or_make_entry("keybindings", [["keylist", "PgUp,Q,Home"]], [["context", "Music"], ["action","PREVTRACK"]]); - change_or_make_entry("keybindings", [["keylist", "P,l"]], [["context", "Music"], ["action","PAUSE"]]); - - change_or_make_entry("keybindings", [["keylist", ">"]], [["context", "Stream"], ["action","FORWARD"]]); - change_or_make_entry("keybindings", [["keylist", "<"]], [["context", "Stream"], ["action","REWIND"]]); - change_or_make_entry("keybindings", [["keylist", "F"]], [["context", "Stream"], ["action","FULLSCREEN"]]); - change_or_make_entry("keybindings", [["keylist", "|,\\,F9,Volume Mute"]], [["context", "Stream"], ["action","MUTE"]]); - change_or_make_entry("keybindings", [["keylist", "Y"]], [["context", "Stream"], ["action","STOREMARKED"]]); - - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "TV Frontend"], ["action","PLAYBACK"]]); - - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "TV Playback"], ["action","PLAY"]]); - change_or_make_entry("keybindings", [["keylist", "P"]], [["context", "TV Playback"], ["action","PAUSE"]]); # default, but here for completeness - - # - # better awareness of different video extensions - # - foreach my $video_ext ("mp2", "tp", "ts", "m2p", "nuv", "mkv", "ogg", "theora") { - change_or_make_entry("videotypes", [["playcommand", "Default"], ["f_ignore", "0"], ["use_default", "1"]], [["extension", $video_ext]]); - } - foreach my $non_video_ext ("jpg", "par2", "php") { - change_or_make_entry("videotypes", [["f_ignore", "1"]], [["extension", $non_video_ext]]); - } - - # - # games, game players, and emulators - # - my @players = ( - [ 'SDLMAME', '/myth/games/xmame/roms', '/myth/games/xmame/screenshots', '/usr/games/mame -rp /myth/games/xmame/roms %s', 'MAME' ], - [ 'ZSNES','/myth/games/snes/roms','/myth/games/snes/screens','/usr/bin/zsnes','SNES' ], - [ 'FCEU','/myth/games/nes/roms','/myth/games/nes/screens','/usr/games/fceu','NES' ], - [ 'Frozen Bubble', '', '', '/usr/games/frozen-bubble --fullscreen','PC' ] - ); - - foreach my $player (@players) { - # These INSERTs will fail if the playername is already present, but we don't error out if it happens. - do_query("INSERT INTO gameplayers (playername, rompath, screenshots, commandline, gametype) VALUES ('".join("','",@$player)."');"); - } - # somewhat hardwired, but make sure Frozen Bubble shows up in the list of playable games. - do_query("INSERT INTO gamemetadata (system, romname, gamename, genre, year, publisher, rompath, gametype) VALUES ('". - join("','",($players[3][0], $players[3][3], $players[3][0], "action/puzzle", "2006", "Frozen Bubble Team", "/usr/games", $players[3][4]))."');"); - - # - # smart music playlists - # - # categoryid, name - change_or_make_entry("music_smartplaylist_categories", [["name", "Decades"]], [["categoryid", 1]]); - change_or_make_entry("music_smartplaylist_categories", [["name", "Favorite Tracks"]], [["categoryid", 2]]); - change_or_make_entry("music_smartplaylist_categories", [["name", "New Tracks"]], [["categoryid", 3]]); - - foreach my $decade (60, 70, 80, 90, 100) { - my $id = ($decade / 10) - 5; - my $query = "INSERT INTO music_smartplaylist_items (smartplaylistid, field, operator, value1, value2) VALUES ($id, 'Year', 'is between'," . ($decade+1900) . "," . ($decade+1909) . ");"; - do_query($query); - $query = "INSERT INTO music_smartplaylists (name, categoryid, matchtype, orderby, limitto) VALUES ('". ($decade+1900) . "\\'s', 1, 'All', 'Artist (A)', 0);"; - do_query($query); - } - - my @other_lists = ( - [ - ( 'Rating', 'is greater than', '7', 'Favorite Tracks', 2, 'Artist (A), Album (A)', 0 ), - ( 'Play Count', 'is greater than', '0', '100 Most Played Tracks', 2, 'Play Count (D)', 100 ), - ( 'Play Count', 'is equal to', '0', 'Never Played Tracks', 3, 'Artist (A), Album (A)', 0 ) - ]); - - my $id=6; - foreach my $other_list (@other_lists) { - change_or_make_entry("music_smartplaylist_items", [["field", @$other_list[0]], ["operator", @$other_list[1]], ["value1", @$other_list[2]]], [["smartplaylistid", $id]]); - change_or_make_entry("music_smartplaylists", [["name", @$other_list[3]], ["categoryid", @$other_list[4]], ["matchtype", "All"], ["orderby", @$other_list[5]], ["limitto", @$other_list[6]]], [["smartplaylistid", $id]]); - $id++; - } - - # - # default playgroup with time-related settings - # - change_or_make_entry("playgroup", [["skipahead", 10], ["skipback", 5], ["timestretch", 100], ["jump", 1]], [["name", "Default"]]); - - # - # useful recording profiles and transcoding options - # - change_or_make_entry("profilegroups", [["name", "Software Encoders (v4l based)"], ["cardtype", "V4L"], ["is_default", 1]], [["id", 1]]); - change_or_make_entry("profilegroups", [["name", "MPEG-2 Encoders (PVR-x50, PVR-500)"], ["cardtype", "MPEG"], ["is_default", 1]], [["id", 2]]); - change_or_make_entry("profilegroups", [["name", "Hardware MJPEG Encoders (Matrox G200-TV, Miro DC10, etc)"], ["cardtype", "MJPEG"], ["is_default", 1]], [["id", 3]]); - change_or_make_entry("profilegroups", [["name", "Hardware HDTV"], ["cardtype", "HDTV"], ["is_default", 1]], [["id", 4]]); - change_or_make_entry("profilegroups", [["name", "Hardware DVB Encoders"], ["cardtype", "DVB"], ["is_default", 1]], [["id", 5]]); - change_or_make_entry("profilegroups", [["name", "Transcoders"], ["cardtype", "TRANSCODE"], ["is_default", 1]], [["id", 6]]); - change_or_make_entry("profilegroups", [["name", "FireWire Input"], ["cardtype", "FIREWIRE"], ["is_default", 1]], [["id", 7]]); - change_or_make_entry("profilegroups", [["name", "USB Mpeg-4 Encoder (Plextor ConvertX, etc)"], ["cardtype", "GO7007"], ["is_default", 1]], [["id", 8]]); - change_or_make_entry("profilegroups", [["name", "DBOX2 Input"], ["cardtype", "DBOX2"], ["is_default", 1]], [["id", 9]]); - change_or_make_entry("profilegroups", [["name", "Freebox Input"], ["cardtype", "Freebox"], ["is_default", 1]], [["id", 10]]); - change_or_make_entry("profilegroups", [["name", "HDHomeRun Recorders"], ["cardtype", "HDHOMERUN"], ["is_default", 1]], [["id", 11]]); - change_or_make_entry("profilegroups", [["name", "CRC IP Recorders"], ["cardtype", "CRC_IP"], ["is_default", 1]], [["id", 12]]); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (27, 'transcodelossless', 1)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4bitrate', 1500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionvhq', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4option4mv', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'samplerate', 44100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mp3quality', 7)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'volume', 100)"); - - - # I don't know why we have so many of these. Only profilegroup 6 seems to matter. - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 1]], [["id", 1]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 1]], [["id", 2]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 1]], [["id", 3]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 1]], [["id", 4]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 2]], [["id", 5]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 2]], [["id", 6]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 2]], [["id", 7]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 2]], [["id", 8]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 3]], [["id", 9]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 3]], [["id", 10]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 3]], [["id", 11]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 3]], [["id", 12]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 4]], [["id", 13]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 4]], [["id", 14]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 4]], [["id", 15]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 4]], [["id", 16]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 5]], [["id", 17]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 5]], [["id", 18]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 5]], [["id", 19]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 5]], [["id", 20]]); - change_or_make_entry("recordingprofiles", [["name", 'RTjpeg/MPEG4'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 21]]); - change_or_make_entry("recordingprofiles", [["name", 'MPEG2'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 22]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 8]], [["id", 23]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 8]], [["id", 24]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 8]], [["id", 25]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 8]], [["id", 26]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 6]], [["id", 27]]); - change_or_make_entry("recordingprofiles", [["name", 'Medium Quality'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 28]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "MP3"]], [["id", 29]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 10]], [["id", 30]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 10]], [["id", 31]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 10]], [["id", 32]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 10]], [["id", 33]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 11]], [["id", 34]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 11]], [["id", 35]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 11]], [["id", 36]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 11]], [["id", 37]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 12]], [["id", 38]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 12]], [["id", 39]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 12]], [["id", 40]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 12]], [["id", 41]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 7]], [["id", 42]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 7]], [["id", 43]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 7]], [["id", 44]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 7]], [["id", 45]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 9]], [["id", 46]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 9]], [["id", 47]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 9]], [["id", 48]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 9]], [["id", 49]]); - - # - # settings - # - change_or_make_setting('AlwaysStreamFiles', '1'); # new in R6 - change_or_make_setting('AutoCommercialSkip', '1'); - change_or_make_setting('AutoExpireWatchedPriority', '1'); - change_or_make_setting('BackendServerPort', '6543'); - change_or_make_setting('BackendStatusPort', '6544'); - change_or_make_setting('CDWriterDevice', 'ATA:1,0,0'); -# change_or_make_setting('ChannelOrdering', 'chanid'); - change_or_make_setting('CommercialSkipMethod', '255'); - change_or_make_setting('DVDBookmarkPrompt', '1'); - change_or_make_setting('DVDRipLocation', $SQL_DirTmp); - change_or_make_setting('DefaultRipQuality', '1'); - change_or_make_setting('DefaultTranscoder', '28'); # change this number if you redefine the transcoders above - change_or_make_setting('Deinterlace', '1'); - change_or_make_setting('DeletesFollowLinks', '1'); - change_or_make_setting('DisableFirewireReset', '0'); - change_or_make_setting('EITCrawIdleStart','60'); - change_or_make_setting('EITIgnoresSource','0'); - change_or_make_setting('EITTimeOffset','Auto'); - change_or_make_setting('EITTransportTimeout','5'); - change_or_make_setting('EPGEnableJumpToChannel','1'); - change_or_make_setting('EPGFillType','12'); - change_or_make_setting('EnableDVDBookmark','1'); - change_or_make_setting('EndOfRecordingExitPrompt','1'); - change_or_make_setting('GalleryDir', $SQL_DirPics); - change_or_make_setting('GalleryRecursiveSlideshow', '1'); -#------------------------JM--------------------------- - change_or_make_setting('HaltCommand', 'sudo /sbin/halt'); -# change_or_make_setting('HostAudiotype','ALSA'); -# change_or_make_setting('HostMiro','1'); -# change_or_make_setting('HostXine','1'); -# change_or_make_setting('Hostpluginmythappletrailers','1'); -# change_or_make_setting('Hostpluginmytharchive','1'); -# change_or_make_setting('Hostpluginmythbrowser','1'); -# change_or_make_setting('Hostpluginmythcontrols','1'); -# change_or_make_setting('Hostpluginmythflix','1'); -# change_or_make_setting('Hostpluginmythgallery','1'); -# change_or_make_setting('Hostpluginmythgame','1'); -# change_or_make_setting('HostpluginmythgameFceu','1'); -# change_or_make_setting('HostpluginmythgameMame','1'); -# change_or_make_setting('HostpluginmythgameMame','1'); -# change_or_make_setting('HostpluginmythgameROMDB','1'); -# change_or_make_setting('HostpluginmythgameXE','1'); -# change_or_make_setting('HostpluginmythgameZsnes','1'); -# change_or_make_setting('HostpluginmythgameZsnes','1'); -# change_or_make_setting('Hostpluginmythmovietime','1'); -# change_or_make_setting('Hostpluginmythmusic','1'); -# change_or_make_setting('Hostpluginmythnews','1'); -# change_or_make_setting('Hostpluginmythphone','1'); -# change_or_make_setting('Hostpluginmythsmolt','1'); -# change_or_make_setting('Hostpluginmythstream','1'); -# change_or_make_setting('Hostpluginmythvideo','1'); -# change_or_make_setting('Hostpluginmythvideo_dvdcss','0'); -# change_or_make_setting('Hostpluginmythvideo_dvdcss','0'); -# change_or_make_setting('Hostpluginmythvodka','1'); -# change_or_make_setting('Hostpluginmythweather','1'); - change_or_make_setting('JobAllowCommFlag', '1'); - change_or_make_setting('JobAllowTranscode', '1'); - change_or_make_setting('JobAllowUserJob1', '1'); - change_or_make_setting('JobAllowUserJob2', '1'); - change_or_make_setting('JobAllowUserJob3', '1'); - change_or_make_setting('JobAllowUserJob4', '1'); - change_or_make_setting('JobQueueCPU','0'); - change_or_make_setting('JobQueueCheckFrequency','60'); - change_or_make_setting('JobQueueCommFlagCommand','mythcommflag'); - change_or_make_setting('JobQueueMaxSimultaneousJobs','1'); - change_or_make_setting('JobQueueTranscodeCommand','mythtranscode'); - change_or_make_setting('JobQueueWindowEnd','23:59'); - change_or_make_setting('JobQueueWindowStart','00:00'); - change_or_make_setting('JobsRunOnRecordHost','0'); - change_or_make_setting('LiveTVInAllPrograms','1'); - change_or_make_setting('MasterMixerVolume','100'); -# change_or_make_setting('MasterServerIP', '127.0.0.1'); -# change_or_make_setting('MasterServerPort', '6543'); - change_or_make_setting('MediaChangeEvents','1'); - change_or_make_setting('MonitorDrives', '1'); - change_or_make_setting('MusicLocation', $SQL_DirMusic); - change_or_make_setting('MythArchivePng2yuvCmd', 'png2yuv'); # ??? still used? - change_or_make_setting('MythArchiveShareDir','/myth/archive/'); - change_or_make_setting('MythArchiveTempDir', $SQL_DirTmp); - change_or_make_setting('MythFillDatabaseArgs', '--quiet'); - change_or_make_setting('MythFillDatabaseLog', '/var/log/mythtv/mythfilldatabase.log'); - change_or_make_setting('MythFillDatabasePath', '/usr/bin/nice -n 19 /usr/bin/mythfilldatabase'); - change_or_make_setting('MythFillEnabled', '1'); - change_or_make_setting('MythTVtv', $SQL_DirTV); - change_or_make_setting('NetworkControlEnabled', '1'); - change_or_make_setting('PCMMixerVolume', '50'); - change_or_make_setting('PVR350VideoDev', '/dev/video16'); - change_or_make_setting('PlayBoxShading', '0'); - change_or_make_setting('PlayMode', 'none'); - change_or_make_setting('PlaybackExitPrompt', '2'); - change_or_make_setting('PlaybackPreviewLowCPU', '1'); -# change_or_make_setting('PlaybackReturnPrompt', '1'); -# change_or_make_setting('PlaybackReturnPrompt', '2'); - change_or_make_setting('RebootCommand', 'sudo /sbin/reboot'); - change_or_make_setting('RecordFilePrefix',$SQL_DirTV); - change_or_make_setting('SelectChangesChannel', '1'); - change_or_make_setting('ServerHaltCommand', 'sudo /sbin/halt -p'); - change_or_make_setting('ShowWholeTree', '1'); - change_or_make_setting('SmartChannelChange', '1'); - change_or_make_setting('StartupSecsBeforeRecording', '120'); - change_or_make_setting('TruncateDeletesSlowly', '1'); - change_or_make_setting('UseOutputPictureControls', '1'); - change_or_make_setting('UserJob1', 'myth2ipod \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJob2', 'myt2xvid3 \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJob3', 'myth2x264 \"%DIR%/%FILE%\" \"%TITLE% - %SUBTITLE%\" \"%CHANID%\" \"%STARTTIME%\" \"%JOBID%\"'); - change_or_make_setting('UserJob4', 'removecommercials.sh \"%DIR%\" \"%FILE%\" \"%CHANID%\" \"%STARTTIME%\" \"%JOBID%\"'); - change_or_make_setting('UserJobDesc1', 'Transcode for iPod'); - change_or_make_setting('UserJobDesc2', 'Transcode to xvid'); - change_or_make_setting('UserJobDesc3', 'Transcode to h264'); - change_or_make_setting('UserJobDesc4', 'Remove Commercials'); - change_or_make_setting('UseOutputPictureControls','0'); # If this is set to '1' it can swap blue for red (and vice versa) on some nVidia GPUs - change_or_make_setting('VCDPlayerCommand', 'mplayer-wrapper.pl vcd:\/\/ -cdrom-device %d -fs -zoom'); - change_or_make_setting('VideoArtworkDir', "$SQL_DirVideo/.covers"); - change_or_make_setting('VideoBrowserNoDB', '1'); - change_or_make_setting('VideoDefaultPlayer', 'mplayer-wrapper.pl -fs -zoom %s'); - change_or_make_setting('VideoGalleryNoDB', '1'); - change_or_make_setting('VideoStartupDir', $SQL_DirVideo); - change_or_make_setting('VideoTreeNoDB', '1'); - change_or_make_setting('VisualMode','BumpScope;Gears;Goom;MonoScope;Squares;StereoScope;Synaesthesia;LibVisual-bumpscope;LibVisual-corona;LibVisual-infinite;AlbumArt'); - change_or_make_setting('weatherbackgroundfetch', '1'); - change_or_make_setting('WebBrowserCommand','/usr/bin/mythbrowser'); - change_or_make_setting('WebBrowserHideScrollbars','0'); - change_or_make_setting('WebBrowserScrollMode','1'); - change_or_make_setting('WebBrowserScrollSpeed','4'); - change_or_make_setting('WebBrowserZoomLevel','20'); - change_or_make_setting('WebcamDevice','/dev/video'); - change_or_make_setting('WOLbackendCommand',''); - change_or_make_setting('WOLbackendConnectRetry','5'); - change_or_make_setting('WOLslaveBackendsCommand',''); - change_or_make_setting('WakeupTimeFormat','hh:mm yyyy-MM-dd'); - change_or_make_setting('WatchTVGuide','0'); -# change_or_make_setting('WeatherDBSchemaVer','1000'); - change_or_make_setting('WebBrowserCommand','/usr/bin/mythbrowser'); - change_or_make_setting('WebBrowserHideScrollbars','0'); - change_or_make_setting('WebBrowserScrollMode','1'); - change_or_make_setting('WebBrowserScrollSpeed','4'); - change_or_make_setting('WebBrowserZoomLevel','20'); - change_or_make_setting('XineramaScreen','0'); - change_or_make_setting('blockSDWUwithoutClient','1'); - change_or_make_setting('idleWaitForRecordingTime','15'); - change_or_make_setting('mythdvd.DVDPlayerCommand', 'Internal'); - change_or_make_setting('mythvideo.VideoTreeRemember', '1'); - change_or_make_setting('mythfilldatabaseLastRunStart',''); - change_or_make_setting('mythfilldatabaseLastRunEnd',''); - change_or_make_setting('mythfilldatabaseLastRunStatus',''); - - # - # customexample table - # - change_or_make_entry("customexample", [["fromclause", ""], ["whereclause", "program.category_type = \"movie\" AND program.airdate >= YEAR(DATE_SUB(NOW(), INTERVAL 1 YEAR)) AND program.stars > 0.5 "], ["search", "1"]], [["rulename", "New Flix"]]); - -# # As much of MythWeather as we can automate for now - my $units = 0; - my $metric_units = do_query("SELECT * FROM settings WHERE value='SIUnits' AND data='YES'"); - if ($metric_units) { - $units=0; - } else { - $units=1; - } -# change_or_make_entry("weatherscreens", [["draworder", "0"], ["container", "Six Day Forecast"], ["units", $units]], [["screen_id", 1]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "6dlocation"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# for (my $increment=0; $increment < 6; $increment++) { -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "date-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "high-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "icon-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "low-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# } -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "updatetime"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# -# change_or_make_entry("weathersourcesettings", [["sourceid", "1"], ["source_name", "BBC-Current-XML"], ["update_timeout", "7200"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/bbccurrentxml.pl"], ["author", "Stuart Morgan"], ["version", "0.1"], ["email", "stuart\@tase.co.uk"], ["types", "cclocation,station_id,copyright,observation_time,weather,temp,relative_humidity,wind_dir,pressure,visibility,weather_icon,appt,wind_spdgst"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "2"], ["source_name", "BBC-3day-XML"], ["update_timeout", "21600"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/bbcthreedayxml.pl"], ["author", "Stuart Morgan"], ["version", "0.1"], ["email", "stuart\@tase.co.uk"], ["types", "3dlocation,station_id,copyright,weather_icon,date-0,icon-0,low-0,high-0,date-1,icon-1,low-1,high-1,date-2,icon-2,low-2,high-2,updatetime"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "3"], ["source_name", "ENVCAN"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ca_envcan/envcan.pl"], ["author", "Joe Ripley"], ["version", "0.4"], ["email", "vitaminjoe\@gmail.com"], ["types", "cclocation,station_id,copyright,observation_time,observation_time_rfc822,weather,temp,relative_humidity,wind_dir,wind_degrees,wind_speed,wind_gust,pressure,dewpoint,heat_index,windchill,visibility,weather_icon,appt,wind_spdgst,3dlocation,6dlocation,date-0,icon-0,low-0,high-0,date-1,icon-1,low-1,high-1,date-2,icon-2,low-2,high-2,updatetime,date-3,icon-3,low-3,high-3,date-4,icon-4,low-4,high-4,date-5,icon-5,low-5,high-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "4"], ["source_name", "NDFD-6_day"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ndfd.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "3dlocation,6dlocation,updatetime,high-0,high-1,high-2,high-3,high-4,high-5,low-0,low-1,low-2,low-3,low-4,low-5,icon-0,icon-1,icon-2,icon-3,icon-4,icon-5,date-0,date-1,date-2,date-3,date-4,date-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "5"], ["source_name", "NDFD-18_hour"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ndfd18.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "18hrlocation,updatetime,temp-0,temp-1,temp-2,temp-3,temp-4,temp-5,18icon-0,18icon-1,18icon-2,18icon-3,18icon-4,18icon-5,pop-0,pop-1,pop-2,pop-3,pop-4,pop-5,time-0,time-1,time-2,time-3,time-4,time-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "6"], ["source_name", "NWS-Alerts"], ["update_timeout", "600"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/nws-alert.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "swlocation,updatetime,alerts"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "7"], ["source_name", "NWS-XML"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/nwsxml.pl"], ["author", "Lucien Dunning"], ["version", "0.2"], ["email", "ldunning\@gmail.com"], ["types", "cclocation,station_id,latitude,longitude,observation_time,observation_time_rfc822,weather,temperature_string,temp,relative_humidity,wind_string,wind_dir,wind_degrees,wind_speed,wind_gust,pressure_string,pressure,dewpoint_string,dewpoint,heat_index_string,heat_index,windchill_string,windchill,visibility,weather_icon,appt,wind_spdgst"]]); - - my $ipaddress = execute_shell_command("ifconfig | grep inet.addr | head -1"); - $ipaddress =~ s/.*inet addr:(\d+.\d+.\d+.\d+)\s.*/$1/g; - - - - - - -#-------------------jm -# # Change from the generic IP address to the real one. -# do_query("UPDATE settings SET data='$ipaddress' where data='127.0.0.1'"); -# do_query("UPDATE settings SET data='$ipaddress' where data='MythTVip'"); # ??? needed? - - my $hostname = execute_shell_command("hostname") || "localhost"; - # one table at a time, replace hostname with our actual hostname - # ??? can this be done all at once in MySQL? - foreach my $table ("capturecard", "inuseprograms", "jobqueue", "jumppoints", "keybindings", "music_playlists", - "musicplaylist", "recorded", "settings", "weatherscreens") { - do_query("UPDATE $table SET hostname='$hostname'"); - } - - # Some entries in 'settings' should stay NULL: http://www.mythtv.org/wiki/index.php/Settings_table - # There are fewer entries that stay NULL than there are that should have the hostname set, so while - # it duplicates some effort to change them from NULL to the hostname and them back to NULL, it's - # easier to maintain and more future-proof. - - foreach my $entry ("mythfilldatabaseLastRunStart", "mythfilldatabaseLastRunEnd", "mythfilldatabaseLastRunStatus", - "DataDirectMessage", "HaveRepeats", "DBSchemaVer", "DefaultTranscoder", "MythFillSuggestedRunTime", - "MythFillGrabberSuggestsTime", "MasterServerIP", "MasterServerPort", "TVFormat", "VbiFormat", "FreqTable", - "TimeOffset", "MasterBackendOverride", "DeletesFollowLinks", "HDRingbufferSize", "EITTransportTimeout", - "EITIgnoresSource", "EITCrawIdleStart", "startupCommand", "blockSDWUwithoutClient", "idleWaitForRecordingTime", - "StartupSecsBeforeRecording", "WakeupTimeFormat", "SetWakeuptimeCommand", "ServerHaltCommand", "preSDWUCheckCommand", - "WOLbackendConnectRetry", "WOLbackendCommand", "WOLslaveBackendsCommand", "JobsRunOnRecordHost", - "AutoCommflagWhileRecording", "JobQueueCommFlagCommand", "JobQueueTranscodeCommand", - "AutoTranscodeBeforeAutoCommflag", "SaveTranscoding", "UserJobDesc1", "UserJob1", "UserJobDesc2", "UserJob2", - "UserJobDesc3", "UserJob3", "UserJobDesc4", "UserJob4", "PreviewPixmapOffset", "AllRecGroupPassword", - "MaximumCommercialSkip", "CommSkipAllBlanks", "LastFreeCard", "LiveTVPriority", "AutoExpireMethod", - "AutoExpireDefault", "RerecordWatched", "AutoExpireWatchedPriority", "AutoExpireLiveTVMaxAge", - "AutoExpireDayPriority", "AutoExpireExtraSpace", "AutoExpireInsteadOfDelete", "DeletedFifoOrder", - "CommercialSkipMethod", "AggressiveCommDetect", "AutoCommercialFlag", "AutoTranscode", "AutoRunUserJob1", - "AutoRunUserJob2", "AutoRunUserJob3", "AutoRunUserJob4", "OverTimeCategory", "CategoryOverTime", - "EPGEnableJumpToChannel", "LogEnabled", "MythFillEnabled", "MythFillDatabasePath", "MythFillDatabaseArgs", - "MythFillDatabaseLog", "MythFillPeriod", "MythFillMinHour", "MythFillMaxHour", "SchedMoveHigher", "SchedOpenEnd", - "ComplexPriority", "PrefInputPriority", "SingleRecordRecPriority", "FindOneRecordRecPriority", "ArchiveDBSchemaVer", - "FlixDBSchemaVer", "GalleryDBSchemaVer", "GameDBSchemaVer", "MusicDBSchemaVer", "PhoneDBSchemaVer", - "mythvideo.DBSchemaVer", "WeatherDBSchemaVer") { - do_query("UPDATE settings SET hostname=NULL WHERE value='$entry'"); - } - - change_or_make_setting('MasterBackendOverride','1'); # I don't remember why, but making the hostname NULL is important here - do_query("UPDATE settings SET hostname=NULL WHERE value='MasterBackendOverride'"); - - # storagegroup - change_or_make_entry("storagegroup", [["groupname", "Default"], ["hostname", $hostname], ["dirname", $SQL_DirTV]], [["id", 1]]); - - # - # Websites for mythbrowser - # - #change_or_make_entry("websites", [["grp", "LinHeS"], ["dsc", ""], ["updated", ""]], [["url", "http://knoppmyth.net"]]); - #change_or_make_entry("websites", [["grp", "LinHeS"], ["dsc", ""], ["updated", ""]], [["url", "http://knoppmythwiki.org"]]); - - disconnect_from_db(); - - # Fix hostname for iPod feed URLs - $command = "sed -i \"s/hostname\\//$hostname\\//g\" /usr/local/bin/myth2ipod"; - execute_shell_command($command); - - # Fix hostname for XViD feed URLs - $command = "sed -i \"s/192.168.0.222\\//$hostname\\//g\" /usr/local/bin/myt2xvid3"; - execute_shell_command($command); - - # Customize default MythTV library.xml to reflect KnoppMyth's wider selection of - # online stream options. - #$command = "sed -i \"/<type>STREAM<\\/type>\$/{N; N; N; N; s/text>.*<\\/text/text>Online Streams<\\/text/; s/action>.*<\\/action/action>MENU is.xml<\\/action/; s/<depends.*depends>//; }\" /usr/share/mythtv/library.xml"; - $command = "/bin/cp /usr/share/mythtv/library.xml.km /usr/share/mythtv/library.xml"; - execute_shell_command($command); - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("Unable to connect to mythconverg database"); - $logger->error("Unable to implement option $option."); - return -1; - } - return 1; - } - - file_tweaks($option) || exit -1; - SQL_tweaks($option) || exit -1; -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - recommendation_level("recommended", "These tweaks benefit all users."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_general.pl.orig b/abs/core/tweaker/bin/twk_general.pl.orig deleted file mode 100755 index 0255852..0000000 --- a/abs/core/tweaker/bin/twk_general.pl.orig +++ /dev/null @@ -1,579 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'all' ); - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - # KnoppMyth-centric file-level tweaks - sub file_tweaks { - my($option) = @_; - - my @commands = ( - # keymap tweaks - "twk_keymap.sh" - ); - - foreach my $command (@commands) { - if (my $error = execute_shell_command($command)) { - my $logger = get_logger('tweaker.script'); - $logger->error("$error"); - $logger->error("Unable to implement option $option with command $command."); - } - } - return 1; - } - - # Enhance the default MythTV SQL - sub SQL_tweaks { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # ??? This also exists in mkmythdir - it should be centralized - my $SQL_DirData="/myth"; # Top level dir. of structure, - my $SQL_DirTV="$SQL_DirData/tv"; # TV Recordings, - my $SQL_DirMusic="$SQL_DirData/music/"; # Music storage, - my $SQL_DirGames="$SQL_DirData/games"; # Games dir, - my $SQL_DirPics="$SQL_DirData/gallery"; # Pictures directory. - my $SQL_DirTmp="$SQL_DirData/tmp"; # DVD temp - my $SQL_DirVideo="$SQL_DirData/video"; # videos - - # ??? Eventually, put these into a text file so that 1) people can contribute without having to code, and 2) the data - # stays separate from the code and can be re-used by other (non-Perl) implementations - - # - # keybindings - # - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "Gallery"], ["action","PLAY"]]); - change_or_make_entry("keybindings", [["keylist", ">"]], [["context", "Music"], ["action","FFWD"]]); - change_or_make_entry("keybindings", [["keylist", "<"]], [["context", "Music"], ["action","RWND"]]); - change_or_make_entry("keybindings", [["keylist", "PgDown,.,Z,End"]], [["context", "Music"], ["action","NEXTTTRACK"]]); - change_or_make_entry("keybindings", [["keylist", "PgUp,Q,Home"]], [["context", "Music"], ["action","PREVTRACK"]]); - change_or_make_entry("keybindings", [["keylist", "P,l"]], [["context", "Music"], ["action","PAUSE"]]); - - change_or_make_entry("keybindings", [["keylist", ">"]], [["context", "Stream"], ["action","FORWARD"]]); - change_or_make_entry("keybindings", [["keylist", "<"]], [["context", "Stream"], ["action","REWIND"]]); - change_or_make_entry("keybindings", [["keylist", "F"]], [["context", "Stream"], ["action","FULLSCREEN"]]); - change_or_make_entry("keybindings", [["keylist", "|,\\,F9,Volume Mute"]], [["context", "Stream"], ["action","MUTE"]]); - change_or_make_entry("keybindings", [["keylist", "Y"]], [["context", "Stream"], ["action","STOREMARKED"]]); - - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "TV Frontend"], ["action","PLAYBACK"]]); - - change_or_make_entry("keybindings", [["keylist", "l"]], [["context", "TV Playback"], ["action","PLAY"]]); - change_or_make_entry("keybindings", [["keylist", "P"]], [["context", "TV Playback"], ["action","PAUSE"]]); # default, but here for completeness - - # - # better awareness of different video extensions - # - change_or_make_entry("videotypes", [["playcommand", "mplayer-resumer.pl -fs -zoom -vc theora,fftheora, -vo xv %s"]], [["extension", "ogg"]]); - change_or_make_entry("videotypes", [["playcommand", "mplayer-resumer.pl -fs -zoom -vc theora,fftheora, -vo xv %s"]], [["extension", "theora"]]); - foreach my $video_ext ("mp2", "tp", "ts", "m2p", "nuv", "mkv") { - change_or_make_entry("videotypes", [["playcommand", "Internal"], ["f_ignore", "0"], ["use_default", "1"]], [["extension", $video_ext]]); - } - foreach my $non_video_ext ("jpg", "par2") { - change_or_make_entry("videotypes", [["f_ignore", "1"]], [["extension", $non_video_ext]]); - } - - # - # games, game players, and emulators - # - my @players = ( - [ 'SDLMAME', '/myth/games/xmame/roms', '/myth/games/xmame/screenshots', '/usr/games/mame -rp /myth/games/xmame/roms %s', 'MAME' ], - [ 'ZSNES','/myth/games/snes/roms','/myth/games/snes/screens','/usr/bin/zsnes','SNES' ], - [ 'FCEU','/myth/games/nes/roms','/myth/games/nes/screens','/usr/games/fceu','NES' ], - [ 'Frozen Bubble', '', '', '/usr/games/frozen-bubble --fullscreen','PC' ] - ); - - foreach my $player (@players) { - # These INSERTs will fail if the playername is already present, but we don't error out if it happens. - do_query("INSERT INTO gameplayers (playername, rompath, screenshots, commandline, gametype) VALUES ('".join("','",@$player)."');"); - } - # somewhat hardwired, but make sure Frozen Bubble shows up in the list of playable games. - do_query("INSERT INTO gamemetadata (system, romname, gamename, genre, year, publisher, rompath, gametype) VALUES ('". - join("','",($players[3][0], $players[3][3], $players[3][0], "action/puzzle", "2006", "Frozen Bubble Team", "/usr/games", $players[3][4]))."');"); - - # - # smart music playlists - # - # categoryid, name - change_or_make_entry("music_smartplaylist_categories", [["name", "Decades"]], [["categoryid", 1]]); - change_or_make_entry("music_smartplaylist_categories", [["name", "Favorite Tracks"]], [["categoryid", 2]]); - change_or_make_entry("music_smartplaylist_categories", [["name", "New Tracks"]], [["categoryid", 3]]); - - foreach my $decade (60, 70, 80, 90, 100) { - my $id = ($decade / 10) - 5; - my $query = "INSERT INTO music_smartplaylist_items (smartplaylistid, field, operator, value1, value2) VALUES ($id, 'Year', 'is between'," . ($decade+1900) . "," . ($decade+1909) . ");"; - do_query($query); - $query = "INSERT INTO music_smartplaylists (name, categoryid, matchtype, orderby, limitto) VALUES ('". ($decade+1900) . "\\'s', 1, 'All', 'Artist (A)', 0);"; - do_query($query); - } - - my @other_lists = ( - [ - ( 'Rating', 'is greater than', '7', 'Favorite Tracks', 2, 'Artist (A), Album (A)', 0 ), - ( 'Play Count', 'is greater than', '0', '100 Most Played Tracks', 2, 'Play Count (D)', 100 ), - ( 'Play Count', 'is equal to', '0', 'Never Played Tracks', 3, 'Artist (A), Album (A)', 0 ) - ]); - - my $id=6; - foreach my $other_list (@other_lists) { - change_or_make_entry("music_smartplaylist_items", [["field", @$other_list[0]], ["operator", @$other_list[1]], ["value1", @$other_list[2]]], [["smartplaylistid", $id]]); - change_or_make_entry("music_smartplaylists", [["name", @$other_list[3]], ["categoryid", @$other_list[4]], ["matchtype", "All"], ["orderby", @$other_list[5]], ["limitto", @$other_list[6]]], [["smartplaylistid", $id]]); - $id++; - } - - # - # default playgroup with time-related settings - # - change_or_make_entry("playgroup", [["skipahead", 10], ["skipback", 5], ["timestretch", 100], ["jump", 1]], [["name", "Default"]]); - - # - # useful recording profiles and transcoding options - # - change_or_make_entry("profilegroups", [["name", "Software Encoders (v4l based)"], ["cardtype", "V4L"], ["is_default", 1]], [["id", 1]]); - change_or_make_entry("profilegroups", [["name", "MPEG-2 Encoders (PVR-x50, PVR-500)"], ["cardtype", "MPEG"], ["is_default", 1]], [["id", 2]]); - change_or_make_entry("profilegroups", [["name", "Hardware MJPEG Encoders (Matrox G200-TV, Miro DC10, etc)"], ["cardtype", "MJPEG"], ["is_default", 1]], [["id", 3]]); - change_or_make_entry("profilegroups", [["name", "Hardware HDTV"], ["cardtype", "HDTV"], ["is_default", 1]], [["id", 4]]); - change_or_make_entry("profilegroups", [["name", "Hardware DVB Encoders"], ["cardtype", "DVB"], ["is_default", 1]], [["id", 5]]); - change_or_make_entry("profilegroups", [["name", "Transcoders"], ["cardtype", "TRANSCODE"], ["is_default", 1]], [["id", 6]]); - change_or_make_entry("profilegroups", [["name", "FireWire Input"], ["cardtype", "FIREWIRE"], ["is_default", 1]], [["id", 7]]); - change_or_make_entry("profilegroups", [["name", "USB Mpeg-4 Encoder (Plextor ConvertX, etc)"], ["cardtype", "GO7007"], ["is_default", 1]], [["id", 8]]); - change_or_make_entry("profilegroups", [["name", "DBOX2 Input"], ["cardtype", "DBOX2"], ["is_default", 1]], [["id", 9]]); - change_or_make_entry("profilegroups", [["name", "Freebox Input"], ["cardtype", "Freebox"], ["is_default", 1]], [["id", 10]]); - change_or_make_entry("profilegroups", [["name", "HDHomeRun Recorders"], ["cardtype", "HDHOMERUN"], ["is_default", 1]], [["id", 11]]); - change_or_make_entry("profilegroups", [["name", "CRC IP Recorders"], ["cardtype", "CRC_IP"], ["is_default", 1]], [["id", 12]]); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (21, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (22, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (27, 'transcodelossless', 1)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4bitrate', 2200)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionvhq', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4option4mv', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'samplerate', 48000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (28, 'volume', 100)"); - - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'transcodelossless', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'transcoderesize', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4bitrate', 1500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4maxquality', 2)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4minquality', 15)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4qualdiff', 3)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'scalebitrate', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionvhq', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4option4mv', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionidct', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg4optionime', 0)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'encodingthreadcount', 1)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2bitrate', 4500)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpegquality', 100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpeghdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'hardwaremjpegvdecimation', 4)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2streamtype', 'MPEG-2 PS')"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mpeg2maxbitrate', 6000)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'samplerate', 44100)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'mp3quality', 7)"); - do_query("INSERT INTO codecparams (profile, name, value) VALUES (29, 'volume', 100)"); - - - # I don't know why we have so many of these. Only profilegroup 6 seems to matter. - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 1]], [["id", 1]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 1]], [["id", 2]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 1]], [["id", 3]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 1]], [["id", 4]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 2]], [["id", 5]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 2]], [["id", 6]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 2]], [["id", 7]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 2]], [["id", 8]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 3]], [["id", 9]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 3]], [["id", 10]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 3]], [["id", 11]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 3]], [["id", 12]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 4]], [["id", 13]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 4]], [["id", 14]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 4]], [["id", 15]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 4]], [["id", 16]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 5]], [["id", 17]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 5]], [["id", 18]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 5]], [["id", 19]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 5]], [["id", 20]]); - change_or_make_entry("recordingprofiles", [["name", 'RTjpeg/MPEG4'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 21]]); - change_or_make_entry("recordingprofiles", [["name", 'MPEG2'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 22]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 8]], [["id", 23]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 8]], [["id", 24]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 8]], [["id", 25]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 8]], [["id", 26]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 6]], [["id", 27]]); - change_or_make_entry("recordingprofiles", [["name", 'Medium Quality'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "Uncompressed"]], [["id", 28]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 6], ["videocodec", "MPEG-4"], ["audiocodec", "MP3"]], [["id", 29]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 10]], [["id", 30]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 10]], [["id", 31]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 10]], [["id", 32]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 10]], [["id", 33]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 11]], [["id", 34]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 11]], [["id", 35]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 11]], [["id", 36]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 11]], [["id", 37]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 12]], [["id", 38]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 12]], [["id", 39]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 12]], [["id", 40]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 12]], [["id", 41]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 7]], [["id", 42]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 7]], [["id", 43]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 7]], [["id", 44]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 7]], [["id", 45]]); - change_or_make_entry("recordingprofiles", [["name", 'Default'], ["profilegroup", 9]], [["id", 46]]); - change_or_make_entry("recordingprofiles", [["name", 'Live TV'], ["profilegroup", 9]], [["id", 47]]); - change_or_make_entry("recordingprofiles", [["name", 'High Quality'], ["profilegroup", 9]], [["id", 48]]); - change_or_make_entry("recordingprofiles", [["name", 'Low Quality'], ["profilegroup", 9]], [["id", 49]]); - - # - # settings - # - change_or_make_setting('AlwaysStreamFiles', '1'); # new in R6 - change_or_make_setting('AutoCommercialSkip', '1'); - change_or_make_setting('AutoExpireWatchedPriority', '1'); - change_or_make_setting('BackendServerPort', '6543'); - change_or_make_setting('BackendStatusPort', '6544'); - change_or_make_setting('CDWriterDevice', 'ATA:1,0,0'); -# change_or_make_setting('ChannelOrdering', 'chanid'); - change_or_make_setting('CommercialSkipMethod', '255'); - change_or_make_setting('DVDBookmarkPrompt', '1'); - change_or_make_setting('DVDRipLocation', $SQL_DirTmp); - change_or_make_setting('DefaultRipQuality', '1'); - change_or_make_setting('DefaultTranscoder', '28'); # change this number if you redefine the transcoders above - change_or_make_setting('Deinterlace', '1'); - change_or_make_setting('DeletesFollowLinks', '1'); - change_or_make_setting('DisableFirewireReset', '0'); - change_or_make_setting('EITCrawIdleStart','60'); - change_or_make_setting('EITIgnoresSource','0'); - change_or_make_setting('EITTimeOffset','Auto'); - change_or_make_setting('EITTransportTimeout','5'); - change_or_make_setting('EPGEnableJumpToChannel','1'); - change_or_make_setting('EPGFillType','12'); - change_or_make_setting('EnableDVDBookmark','1'); - change_or_make_setting('EndOfRecordingExitPrompt','1'); - change_or_make_setting('GalleryDir', $SQL_DirPics); - change_or_make_setting('GalleryRecursiveSlideshow', '1'); - change_or_make_setting('HaltCommand', 'sudo /sbin/halt'); - change_or_make_setting('HostAudiotype','ALSA'); - change_or_make_setting('HostMiro','1'); - change_or_make_setting('HostXine','1'); - change_or_make_setting('Hostpluginmythappletrailers','1'); - change_or_make_setting('Hostpluginmytharchive','1'); - change_or_make_setting('Hostpluginmythbrowser','1'); - change_or_make_setting('Hostpluginmythcontrols','1'); - change_or_make_setting('Hostpluginmythflix','1'); - change_or_make_setting('Hostpluginmythgallery','1'); - change_or_make_setting('Hostpluginmythgame','1'); - change_or_make_setting('HostpluginmythgameFceu','1'); - change_or_make_setting('HostpluginmythgameMame','1'); - change_or_make_setting('HostpluginmythgameMame','1'); - change_or_make_setting('HostpluginmythgameROMDB','1'); - change_or_make_setting('HostpluginmythgameXE','1'); - change_or_make_setting('HostpluginmythgameZsnes','1'); - change_or_make_setting('HostpluginmythgameZsnes','1'); - change_or_make_setting('Hostpluginmythmovietime','1'); - change_or_make_setting('Hostpluginmythmusic','1'); - change_or_make_setting('Hostpluginmythnews','1'); - change_or_make_setting('Hostpluginmythphone','1'); - change_or_make_setting('Hostpluginmythsmolt','1'); - change_or_make_setting('Hostpluginmythstream','1'); - change_or_make_setting('Hostpluginmythvideo','1'); - change_or_make_setting('Hostpluginmythvideo_dvdcss','0'); - change_or_make_setting('Hostpluginmythvideo_dvdcss','0'); - change_or_make_setting('Hostpluginmythvodka','1'); - change_or_make_setting('Hostpluginmythweather','1'); - change_or_make_setting('JobAllowCommFlag', '1'); - change_or_make_setting('JobAllowTranscode', '1'); - change_or_make_setting('JobAllowUserJob1', '1'); - change_or_make_setting('JobAllowUserJob2', '2'); - change_or_make_setting('JobQueueCPU','0'); - change_or_make_setting('JobQueueCheckFrequency','60'); - change_or_make_setting('JobQueueCommFlagCommand','mythcommflag'); - change_or_make_setting('JobQueueMaxSimultaneousJobs','1'); - change_or_make_setting('JobQueueTranscodeCommand','mythtranscode'); - change_or_make_setting('JobQueueWindowEnd','23:59'); - change_or_make_setting('JobQueueWindowStart','00:00'); - change_or_make_setting('JobsRunOnRecordHost','0'); - change_or_make_setting('LiveTVInAllPrograms','1'); - change_or_make_setting('MasterMixerVolume','100'); - change_or_make_setting('MasterServerIP', '127.0.0.1'); - change_or_make_setting('MasterServerPort', '6543'); - change_or_make_setting('MediaChangeEvents','1'); - change_or_make_setting('MonitorDrives', '1'); - change_or_make_setting('MusicLocation', $SQL_DirMusic); - change_or_make_setting('MythArchivePng2yuvCmd', 'png2yuv'); # ??? still used? - change_or_make_setting('MythArchiveShareDir','/myth/archive/'); - change_or_make_setting('MythArchiveTempDir', $SQL_DirTmp); - change_or_make_setting('MythFillDatabaseArgs', '--quiet'); - change_or_make_setting('MythFillDatabaseLog', '/var/log/mythtv/mythfilldatabase.log'); - change_or_make_setting('MythFillDatabasePath', '/usr/bin/nice -n 19 /usr/bin/mythfilldatabase'); - change_or_make_setting('MythFillEnabled', '1'); - change_or_make_setting('MythTVtv', $SQL_DirTV); - change_or_make_setting('NetworkControlEnabled', '1'); - change_or_make_setting('PCMMixerVolume', '50'); - change_or_make_setting('PVR350VideoDev', '/dev/video16'); - change_or_make_setting('PlayBoxShading', '0'); - change_or_make_setting('PlayMode', 'none'); - change_or_make_setting('PlaybackExitPrompt', '2'); - change_or_make_setting('PlaybackPreviewLowCPU', '1'); -# change_or_make_setting('PlaybackReturnPrompt', '1'); -# change_or_make_setting('PlaybackReturnPrompt', '2'); - change_or_make_setting('RebootCommand', 'sudo /sbin/reboot'); - change_or_make_setting('RecordFilePrefix',$SQL_DirTV); - change_or_make_setting('SelectChangesChannel', '1'); - change_or_make_setting('ServerHaltCommand', 'sudo /sbin/halt -p'); - change_or_make_setting('ShowWholeTree', '1'); - change_or_make_setting('SmartChannelChange', '1'); - change_or_make_setting('StartupSecsBeforeRecording', '120'); - change_or_make_setting('TruncateDeletesSlowly', '1'); - change_or_make_setting('UseOutputPictureControls', '1'); - change_or_make_setting('UserJob1', 'myth2ipod -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJob2', 'myt2xvid3 -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJobDesc1', 'Encode for iPod'); - change_or_make_setting('UserJobDesc2', 'Transcode to XviD'); - change_or_make_setting('UserJobDesc3', 'User Job #3'); - change_or_make_setting('UserJobDesc4', 'User Job #4'); - change_or_make_setting('VCDPlayerCommand', 'mplayer vcd:\/\/ -cdrom-device %d -fs -zoom -vo xv -vf pp=lb'); - change_or_make_setting('VideoArtworkDir', "$SQL_DirVideo/.covers"); - change_or_make_setting('VideoBrowserNoDB', '1'); - change_or_make_setting('VideoDefaultPlayer', 'mplayer-resumer.pl -fs -zoom -vo xv %s'); - change_or_make_setting('VideoGalleryNoDB', '1'); - change_or_make_setting('VideoStartupDir', $SQL_DirVideo); - change_or_make_setting('VideoTreeNoDB', '1'); - change_or_make_setting('VisualMode','BumpScope;Gears;Goom;MonoScope;Squares;StereoScope;Synaesthesia;LibVisual-bumpscope;LibVisual-corona;LibVisual-infinite;AlbumArt'); - change_or_make_setting('weatherbackgroundfetch', '1'); - change_or_make_setting('WebBrowserCommand','/usr/bin/mythbrowser'); - change_or_make_setting('WebBrowserHideScrollbars','0'); - change_or_make_setting('WebBrowserScrollMode','1'); - change_or_make_setting('WebBrowserScrollSpeed','4'); - change_or_make_setting('WebBrowserZoomLevel','20'); - change_or_make_setting('WebcamDevice','/dev/video'); - change_or_make_setting('WOLbackendCommand',''); - change_or_make_setting('WOLbackendConnectRetry','5'); - change_or_make_setting('WOLslaveBackendsCommand',''); - change_or_make_setting('WakeupTimeFormat','hh:mm yyyy-MM-dd'); - change_or_make_setting('WatchTVGuide','0'); - change_or_make_setting('WeatherDBSchemaVer','1000'); - change_or_make_setting('WebBrowserCommand','/usr/bin/mythbrowser'); - change_or_make_setting('WebBrowserHideScrollbars','0'); - change_or_make_setting('WebBrowserScrollMode','1'); - change_or_make_setting('WebBrowserScrollSpeed','4'); - change_or_make_setting('WebBrowserZoomLevel','20'); - change_or_make_setting('XineramaScreen','0'); - change_or_make_setting('blockSDWUwithoutClient','1'); - change_or_make_setting('idleWaitForRecordingTime','15'); - change_or_make_setting('mythdvd.DVDPlayerCommand', 'Internal'); - change_or_make_setting('mythvideo.VideoTreeRemember', '1'); - change_or_make_setting('mythfilldatabaseLastRunStart',''); - change_or_make_setting('mythfilldatabaseLastRunEnd',''); - change_or_make_setting('mythfilldatabaseLastRunStatus',''); - - # - # customexample table - # - change_or_make_entry("customexample", [["fromclause", ""], ["whereclause", "program.category_type = \"movie\" AND program.airdate >= YEAR(DATE_SUB(NOW(), INTERVAL 1 YEAR)) AND program.stars > 0.5 "], ["search", "1"]], [["rulename", "New Flix"]]); - -# # As much of MythWeather as we can automate for now - my $units = 0; - my $metric_units = do_query("SELECT * FROM settings WHERE value='SIUnits' AND data='YES'"); - if ($metric_units) { - $units=0; - } else { - $units=1; - } -# change_or_make_entry("weatherscreens", [["draworder", "0"], ["container", "Six Day Forecast"], ["units", $units]], [["screen_id", 1]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "6dlocation"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# for (my $increment=0; $increment < 6; $increment++) { -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "date-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "high-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "icon-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "low-$increment"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# } -# change_or_make_entry("weatherdatalayout", [["location", "0"], ["dataitem", "updatetime"], ["weatherscreens_screen_id", 1]], [["weathersourcesettings_sourceid", 4]]); -# -# change_or_make_entry("weathersourcesettings", [["sourceid", "1"], ["source_name", "BBC-Current-XML"], ["update_timeout", "7200"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/bbccurrentxml.pl"], ["author", "Stuart Morgan"], ["version", "0.1"], ["email", "stuart\@tase.co.uk"], ["types", "cclocation,station_id,copyright,observation_time,weather,temp,relative_humidity,wind_dir,pressure,visibility,weather_icon,appt,wind_spdgst"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "2"], ["source_name", "BBC-3day-XML"], ["update_timeout", "21600"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/bbcthreedayxml.pl"], ["author", "Stuart Morgan"], ["version", "0.1"], ["email", "stuart\@tase.co.uk"], ["types", "3dlocation,station_id,copyright,weather_icon,date-0,icon-0,low-0,high-0,date-1,icon-1,low-1,high-1,date-2,icon-2,low-2,high-2,updatetime"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "3"], ["source_name", "ENVCAN"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ca_envcan/envcan.pl"], ["author", "Joe Ripley"], ["version", "0.4"], ["email", "vitaminjoe\@gmail.com"], ["types", "cclocation,station_id,copyright,observation_time,observation_time_rfc822,weather,temp,relative_humidity,wind_dir,wind_degrees,wind_speed,wind_gust,pressure,dewpoint,heat_index,windchill,visibility,weather_icon,appt,wind_spdgst,3dlocation,6dlocation,date-0,icon-0,low-0,high-0,date-1,icon-1,low-1,high-1,date-2,icon-2,low-2,high-2,updatetime,date-3,icon-3,low-3,high-3,date-4,icon-4,low-4,high-4,date-5,icon-5,low-5,high-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "4"], ["source_name", "NDFD-6_day"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ndfd.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "3dlocation,6dlocation,updatetime,high-0,high-1,high-2,high-3,high-4,high-5,low-0,low-1,low-2,low-3,low-4,low-5,icon-0,icon-1,icon-2,icon-3,icon-4,icon-5,date-0,date-1,date-2,date-3,date-4,date-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "5"], ["source_name", "NDFD-18_hour"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/ndfd18.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "18hrlocation,updatetime,temp-0,temp-1,temp-2,temp-3,temp-4,temp-5,18icon-0,18icon-1,18icon-2,18icon-3,18icon-4,18icon-5,pop-0,pop-1,pop-2,pop-3,pop-4,pop-5,time-0,time-1,time-2,time-3,time-4,time-5"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "6"], ["source_name", "NWS-Alerts"], ["update_timeout", "600"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/nws-alert.pl"], ["author", "Lucien Dunning"], ["version", "0.1"], ["email", "ldunning\@gmail.com"], ["types", "swlocation,updatetime,alerts"]]); -# change_or_make_entry("weathersourcesettings", [["sourceid", "7"], ["source_name", "NWS-XML"], ["update_timeout", "900"], ["retrieve_timeout", "30"], ["path", "/usr/share/mythtv/mythweather/scripts/nwsxml.pl"], ["author", "Lucien Dunning"], ["version", "0.2"], ["email", "ldunning\@gmail.com"], ["types", "cclocation,station_id,latitude,longitude,observation_time,observation_time_rfc822,weather,temperature_string,temp,relative_humidity,wind_string,wind_dir,wind_degrees,wind_speed,wind_gust,pressure_string,pressure,dewpoint_string,dewpoint,heat_index_string,heat_index,windchill_string,windchill,visibility,weather_icon,appt,wind_spdgst"]]); - - my $ipaddress = execute_shell_command("ifconfig | grep inet.addr | head -1"); - $ipaddress =~ s/.*inet addr:(\d+.\d+.\d+.\d+)\s.*/$1/g; - - # Change from the generic IP address to the real one. - do_query("UPDATE settings SET data='$ipaddress' where data='127.0.0.1'"); - do_query("UPDATE settings SET data='$ipaddress' where data='MythTVip'"); # ??? needed? - - my $hostname = execute_shell_command("hostname") || "localhost"; - # one table at a time, replace hostname with our actual hostname - # ??? can this be done all at once in MySQL? - foreach my $table ("capturecard", "inuseprograms", "jobqueue", "jumppoints", "keybindings", "music_playlists", - "musicplaylist", "recorded", "settings", "weatherscreens") { - do_query("UPDATE $table SET hostname='$hostname'"); - } - - # Some entries in 'settings' should stay NULL: http://www.mythtv.org/wiki/index.php/Settings_table - # There are fewer entries that stay NULL than there are that should have the hostname set, so while - # it duplicates some effort to change them from NULL to the hostname and them back to NULL, it's - # easier to maintain and more future-proof. - foreach my $entry ("mythfilldatabaseLastRunStart", "mythfilldatabaseLastRunEnd", "mythfilldatabaseLastRunStatus", - "DataDirectMessage", "HaveRepeats", "DBSchemaVer", "DefaultTranscoder", "MythFillSuggestedRunTime", - "MythFillGrabberSuggestsTime", "MasterServerIP", "MasterServerPort", "TVFormat", "VbiFormat", "FreqTable", - "TimeOffset", "MasterBackendOverride", "DeletesFollowLinks", "HDRingbufferSize", "EITTransportTimeout", - "EITIgnoresSource", "EITCrawIdleStart", "startupCommand", "blockSDWUwithoutClient", "idleWaitForRecordingTime", - "StartupSecsBeforeRecording", "WakeupTimeFormat", "SetWakeuptimeCommand", "ServerHaltCommand", "preSDWUCheckCommand", - "WOLbackendConnectRetry", "WOLbackendCommand", "WOLslaveBackendsCommand", "JobsRunOnRecordHost", - "AutoCommflagWhileRecording", "JobQueueCommFlagCommand", "JobQueueTranscodeCommand", - "AutoTranscodeBeforeAutoCommflag", "SaveTranscoding", "UserJobDesc1", "UserJob1", "UserJobDesc2", "UserJob2", - "UserJobDesc3", "UserJob3", "UserJobDesc4", "UserJob4", "PreviewPixmapOffset", "AllRecGroupPassword", - "MaximumCommercialSkip", "CommSkipAllBlanks", "LastFreeCard", "LiveTVPriority", "AutoExpireMethod", - "AutoExpireDefault", "RerecordWatched", "AutoExpireWatchedPriority", "AutoExpireLiveTVMaxAge", - "AutoExpireDayPriority", "AutoExpireExtraSpace", "AutoExpireInsteadOfDelete", "DeletedFifoOrder", - "CommercialSkipMethod", "AggressiveCommDetect", "AutoCommercialFlag", "AutoTranscode", "AutoRunUserJob1", - "AutoRunUserJob2", "AutoRunUserJob3", "AutoRunUserJob4", "OverTimeCategory", "CategoryOverTime", - "EPGEnableJumpToChannel", "LogEnabled", "MythFillEnabled", "MythFillDatabasePath", "MythFillDatabaseArgs", - "MythFillDatabaseLog", "MythFillPeriod", "MythFillMinHour", "MythFillMaxHour", "SchedMoveHigher", "SchedOpenEnd", - "ComplexPriority", "PrefInputPriority", "SingleRecordRecPriority", "FindOneRecordRecPriority", "ArchiveDBSchemaVer", - "FlixDBSchemaVer", "GalleryDBSchemaVer", "GameDBSchemaVer", "MusicDBSchemaVer", "PhoneDBSchemaVer", - "mythvideo.DBSchemaVer", "WeatherDBSchemaVer") { - do_query("UPDATE settings SET hostname=NULL WHERE value='$entry'"); - } - - change_or_make_setting('MasterBackendOverride','1'); # I don't remember why, but making the hostname NULL is important here - do_query("UPDATE settings SET hostname=NULL WHERE value='MasterBackendOverride'"); - - # storagegroup - change_or_make_entry("storagegroup", [["groupname", "Default"], ["hostname", $hostname], ["dirname", $SQL_DirTV]], [["id", 1]]); - - # - # Websites for mythbrowser - # - #change_or_make_entry("websites", [["grp", "LinHeS"], ["dsc", ""], ["updated", ""]], [["url", "http://knoppmyth.net"]]); - #change_or_make_entry("websites", [["grp", "LinHeS"], ["dsc", ""], ["updated", ""]], [["url", "http://knoppmythwiki.org"]]); - - disconnect_from_db(); - - # Fix hostname for iPod feed URLs - $command = "sed -i \"s/hostname\\//$hostname\\//g\" /usr/local/bin/myth2ipod"; - execute_shell_command($command); - - # Fix hostname for XViD feed URLs - $command = "sed -i \"s/192.168.0.222\\//$hostname\\//g\" /usr/local/bin/myt2xvid3"; - execute_shell_command($command); - - # Customize default MythTV library.xml to reflect KnoppMyth's wider selection of - # online stream options. - #$command = "sed -i \"/<type>STREAM<\\/type>\$/{N; N; N; N; s/text>.*<\\/text/text>Online Streams<\\/text/; s/action>.*<\\/action/action>MENU is.xml<\\/action/; s/<depends.*depends>//; }\" /usr/share/mythtv/library.xml"; - $command = "/bin/cp /usr/share/mythtv/library.xml.km /usr/share/mythtv/library.xml"; - execute_shell_command($command); - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("Unable to connect to mythconverg database"); - $logger->error("Unable to implement option $option."); - return -1; - } - return 1; - } - - file_tweaks($option) || exit -1; - SQL_tweaks($option) || exit -1; -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - recommendation_level("recommended", "These tweaks benefit all users."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_graphics.pl b/abs/core/tweaker/bin/twk_graphics.pl deleted file mode 100755 index 22b6688..0000000 --- a/abs/core/tweaker/bin/twk_graphics.pl +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -# List all the options that this script supports. Make sure it matches what's in -# the corresponding .tcf entry. -set_known_options( 'low', 'medium', 'high' ); - -sub check_for_GL() { - # ??? Need to make this update a class variable instead of a temp file. - my $fps = execute_shell_command("[ -e /tmp/fps ] && cat /tmp/fps") || -1; - - # We think that any nVidia cards at or below NV25 are not well-supported - # for GL. Newer cards are NV34 or above, or have a different starting letter. - my $generation = execute_shell_command("lspci -v | grep \"nVidia Corporation\" | grep VGA | awk -FCorporation '{ print \$2 }' | awk '{ print \$1 }'"); - my $letters = substr($generation,0,2); - if (("$letters" eq "NV") && ("$generation" lt "NV24")) { - $fps = 0; - } - - if ($fps == -1) { - my $result = execute_shell_command("glxinfo | grep 'direct rendering'"); - if ($result =~ m/direct rendering: Yes/) { - my $logger = get_logger('tweaker.script'); - $logger->info("Hardware OpenGL rendering ability detected."); - # Now poll the strength, returning the FPS from glxgears, run at the default resolution. - # I would love to be able to poll this in a way that 1) doesn't pop up a GUI window and - # 2) doesn't rely on manually making a database that maps video cards to performance levels. - $result = execute_shell_command("script -q -c \"glxgears -fullscreen & sleep 11 ; pkill -15 glxgears\" | grep FPS | tail -1"); - if ($result =~ m/ (\d+)\.\d+ FPS/) { - $fps = $1; - execute_shell_command("echo $fps > /tmp/fps"); - } - } else { - $fps = 0; - execute_shell_command("echo $fps > /tmp/fps"); - } - } - return $fps; -} - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - switch ($option) { - # List all the options that this script supports. You can have as many as you like. - case "low" { - change_or_make_setting('ThemePainter', 'Qt') || exit -1; - change_or_make_setting('SlideshowUseOpenGL', '0') || exit -1; - change_or_make_setting('SlideshowOpenGLTransition', 'none') || exit -1; - change_or_make_setting('SlideshowTransition', 'none') || exit -1; - } - case "medium" { - change_or_make_setting('ThemePainter', 'Qt') || exit -1; - change_or_make_setting('SlideshowUseOpenGL', '1') || exit -1; - change_or_make_setting('SlideshowOpenGLTransition', 'random (gl)') || exit -1; - change_or_make_setting('SlideshowTransition', 'random') || exit -1; - } - case "high" { - change_or_make_setting('ThemePainter', 'opengl') || exit -1; - change_or_make_setting('SlideshowUseOpenGL', '1') || exit -1; - change_or_make_setting('SlideshowOpenGLTransition', 'random (gl)') || exit -1; - change_or_make_setting('SlideshowTransition', 'random') || exit -1; - } - - # In all cases, do the following: - - # enable anti-aliased fonts - my $qtrc="/home/mythtv/.qt/qtrc"; - # clean out old Xft settings - my $command = "sed -i 's/.*Xft=.*//g' $qtrc"; - - if (my $error = execute_shell_command($command)) { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } else { - # Add Xft settings - my $command = "sed -i 's/embedFonts=true/embedFonts=true\nenableXft=true\nuseXft=true/g' $qtrc"; - if (my $error = execute_shell_command($command)) { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } else { - # Make sure to use an AA-capable font - my $command = "sed -i 's/font=.*/font=Sans Serif,12,-1,5,50,0,0,0,0,0/g' $qtrc"; - if (my $error = execute_shell_command($command)) { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: $error"); - $logger->error("ERROR: Unable to implement option $option."); - exit(-1); - } - } - } - } - } else { - exit -1; - } - disconnect_from_db(); -} - -# Poll the system to see what recommendationlevel the given option has on the system. -sub poll_options { - my($option) = @_; - - # These are somewhat arbitrary at this point. Note that they correspond to - # _full screen_ glxgears results in Frames Per Second (FPS), since GL is used - # at full screen resolution in MythTV. - my $low_threshold = 350; # at or below $low_threshold FPS, GL is not considered good enough to use in MythTV - my $medium_threshold = 425; # GL is pretty usable here - my $high_threshold = 500; - - threshold_test($option, check_for_GL(), "video card", $low_threshold, $medium_threshold, $high_threshold); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_keymap.sh b/abs/core/tweaker/bin/twk_keymap.sh deleted file mode 100755 index c7f4093..0000000 --- a/abs/core/tweaker/bin/twk_keymap.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -# This script is called from twk_general.pl to implement keymap standardization in KnoppMyth - -#KNOPPMYTH_SHARE=/usr/local/share/knoppmyth - -#################### -# Unify key mappings -#################### - -# Universal keybindings: -# Function Remote Key Keyboard Key -# ------------------------------------------ -# Skip Back << PgUp -# Skip Forward >> PgDn -# Play |> l -# Pause || p -# Stop [] ESC - -#Make mplayer use keymappings that are compatible with other media player keymappings. -#NOTE: PGUP is PageUp and PGDWN is PageDown -MPLAYER_CONF=/etc/mplayer/input.conf -if [[ -f $MPLAYER_CONF ]]; then - sed -i "s/^PGUP .*/PGUP seek -60/" $MPLAYER_CONF - sed -i "s/^PGDWN .*/PGDWN seek +60/" $MPLAYER_CONF - sed -i "s/^p .*/p pause/" $MPLAYER_CONF - sed -i "s/^l .*/l pause/" $MPLAYER_CONF -else - echo "ERROR: $MPLAYER_CONF is missing, which is unexpected." - exit -1 -fi - -#Do the same for smplayer -SMPLAYER_CONF=/home/mythtv/.config/smplayer/smplayer.ini -if [[ -f $SMPLAYER_CONF ]]; then - echo "INFO: $SMPLAYER_CONF found; tweaking now" -else - echo "INFO: $SMPLAYER_CONF is missing; installing full version, then (re-)tweaking" - sudo -u mythtv mkdir -p /home/mythtv/.config/smplayer/ - /bin/cp $TWEAKER_ROOT/fs$SMPLAYER_CONF $SMPLAYER_CONF -fi -sed -i "s/rewind3=.*/rewind3=PgUp/" $SMPLAYER_CONF -sed -i "s/forward3=.*/forward3=PgDown/" $SMPLAYER_CONF -sed -i "s/quit=.*/quit=Esc/" $SMPLAYER_CONF -sed -i "s/pause=.*/pause=P/" $SMPLAYER_CONF -sed -i "s/play=.*/play=L/" $SMPLAYER_CONF -# Remove conflicting keybindings -sed -i "s/stop=.*/stop=/" $SMPLAYER_CONF -sed -i "s/play_or_pause=.*/play_or_pause=/" $SMPLAYER_CONF -sed -i "s/exit_fullscreen=.*/exit_fullscreen=/" $SMPLAYER_CONF -sed -i "s/pl_play=.*/pl_play=/" $SMPLAYER_CONF diff --git a/abs/core/tweaker/bin/twk_localization.pl b/abs/core/tweaker/bin/twk_localization.pl deleted file mode 100755 index fc84440..0000000 --- a/abs/core/tweaker/bin/twk_localization.pl +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'US_English', 'GB_English' ); # Should eventually expand to handle all translations available for MythTV. - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # The entire planet except the US uses metric measurements. - change_or_make_setting('SIUnits', 'YES') || exit -1; - switch ($option) { - case "US_English" { - # Uses Imperial measurements for things like weather. - change_or_make_setting('SIUnits', 'NO') || exit -1; - change_or_make_setting('Language', 'EN') || exit -1; - change_or_make_setting('ISO639Language0', 'eng') || exit -1; - change_or_make_setting('ISO639Language1', 'eng') || exit -1; - change_or_make_setting('MythArchiveVideoFormat', 'NTSC') || exit -1; - } - case "GB_English" { - change_or_make_setting('Language', 'EN_GB') || exit -1; - change_or_make_setting('ISO639Language0', 'eng') || exit -1; - change_or_make_setting('ISO639Language1', 'eng') || exit -1; - change_or_make_setting('MythArchiveVideoFormat', 'PAL') || exit -1; - } - } - } else { - exit -1; - } - disconnect_from_db(); -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - - recommendation_level("optional", "We don't yet have any way to know what your preferred language is. This option is as valid as any other."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_misc.pl b/abs/core/tweaker/bin/twk_misc.pl deleted file mode 100755 index 96771a6..0000000 --- a/abs/core/tweaker/bin/twk_misc.pl +++ /dev/null @@ -1,13 +0,0 @@ -# Placeholder for tweaks not yet implemented - -# Screen size / viewing distance -change_or_make_setting('chanPerPage', '4') || exit -1; -change_or_make_setting('timePerPage', '3') || exit -1; - -# Disk space / sound quality / compatibility -change_or_make_setting('DefaultRipQuality', '2') || exit -1; -change_or_make_setting('Mp3UseVBR', '1') || exit -1; - -# Localization / tuner type -# N. America -change_or_make_setting('VbiFormat', 'NTSC Closed Caption') || exit -1; diff --git a/abs/core/tweaker/bin/twk_scrub_sql.pl b/abs/core/tweaker/bin/twk_scrub_sql.pl deleted file mode 100755 index c1de20b..0000000 --- a/abs/core/tweaker/bin/twk_scrub_sql.pl +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2008-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -# List all the options that this script supports. Make sure it matches what's in -# the corresponding .tcf entry. -set_known_options( 'scrub', 'protect' ); -my $beginning_of_user_index=65; - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - - my @table_list = ( - [ 'capturecard', 'cardid' ], # tuner-related - [ 'cardinput', 'cardinputid' ], # tuner-related - [ 'videosource', 'sourceid' ], # tuner-related - - [ 'dvdinput', 'intid' ], - [ 'dvdtranscode', 'intid' ], - [ 'gameplayers', 'gameplayerid' ], - [ 'music_smartplaylist_categories', 'categoryid' ], - [ 'music_smartplaylist_items', 'smartplaylistitemid' ], - [ 'music_smartplaylists', 'smartplaylistid' ], - [ 'phonedirectory', 'intid' ], - [ 'profilegroups', 'id' ], - [ 'recordingprofiles', 'id' ], - [ 'storagegroup', 'id' ], - [ 'videotypes', 'intid' ], - ); - - switch ($option) { - case "scrub" { # delete the rows from the table - foreach my $table (@table_list) { - do_query("DELETE FROM @$table[0] WHERE @$table[1] < $beginning_of_user_index;"); - do_query("ALTER TABLE @$table[0] AUTO_INCREMENT = 0;"); - } - } - case "protect" { - foreach my $table (@table_list) { - do_query("ALTER TABLE @$table[0] AUTO_INCREMENT = $beginning_of_user_index;"); - } - } - } - } else { - exit -1; - } - disconnect_from_db(); -} - -sub poll_options { - my($option) = @_; - switch ($option) { - case "scrub" { - recommendation_level("recommended", "This is required to ensure that other KnoppMyth SQL Tweaks work."); - } - case "protect" { - recommendation_level("recommended", "This is required to ensure that other KnoppMyth SQL Tweaks do not clobber user-made changes."); - } - } -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; - - diff --git a/abs/core/tweaker/bin/twk_tuners.pl b/abs/core/tweaker/bin/twk_tuners.pl deleted file mode 100755 index 22c6a23..0000000 --- a/abs/core/tweaker/bin/twk_tuners.pl +++ /dev/null @@ -1,491 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'all' ); # When Tweaker handles multiple instances of a script, this will be expanded to -# handle options for a given card, based on what it supports, e.g. ATSC, QAM, NTSC-coax, NTSC-Svideo, etc. -# The current version of this script will run once and set up defaults for all detected cards, choosing -# a default configuration based on some assumptions of common usage. Modes in this array should be listed -# from least desirable to most desirable. E.g. ["NTSC", "ATSC", "QAM"] - -my @capture_card_patterns = ( - # DIGITAL - # ------- - # ATSC-only devices - [ "pcHDTV hd-2000", [".*0400.*109e.*036e.*r11.*7063.*2000.*"], - ["DVB", ["ATSC"]]], -# [ "BBTI Air2PC v2", [".*0280.*13d0.*2103.*r02.*13d0.*2103.*"], # ??? dupe 1; mihanson -# ["DVB", ["ATSC"]]], - - # DVB-T devices - [ "DViCO FusionHDTV DVB-T Lite", [".*0400.*109e.*036e.*r11.*18ac.*db10.*"], - # secondary device "0480" "109e" "0878" -r11 "18ac" "d500" - ["DVB", ["DVB-T"]]], - [ "DViCO FusionHDTV DVB-T1", [".*0400.*14f1.*8800.*18ac.*db00.*"], - ["DVB", ["DVB-T"]]], # also has composite and S-Video in for frame grabbing - [ "DViCO FusionHDTV DVB-T Plus", [".*0400.*14f1.*8800.*8800.*db10.*"], - ["DVB", ["DVB-T"]]], - [ "DViCO FusionHDTV dual Express", [".*0400.*14f1.*8852.*18ac.*db78.*"], - ["DVB", ["DVB-T"]]], - [ "Twinhan VisionPlus DVB-T", [".*0400.*109e.*036e.*r11.*1822.*0001.*"], # ??? dupe 2; jbman, Girkers - ["DVB", ["DVB-T"]]], -# [ "EU Hauppauge PVR-500 (DVB-T)", [".*0400.*4444.*0016.*0070.*e807.*"], -# ["DVB", ["DVB-T"]]], - [ "Avermedia A777", [".*0480.*1131.*7133.*1461.*2c05.*", ".*0480.*1131.*7134.*1461.*2c05.*"], - ["DVB", ["DVB-T"]]], - [ "Compro T300", [".*0480.*1131.*7134.*185b.*c900.*", ".*0480.*1131.*7134.*7134.*c900.*"], - ["DVB", ["DVB-T"]]], - - # DVB-C devices - [ "Siemens DVB-C", [".*0480.*1131.*7146.*110a.*0000.*"], - ["DVB", ["DVB-C"]]], - - # DVB-S devices - [ "VisionPlus 1020A", [".*0480.*109e.*0878.*1822.*0001.*"], - ["DVB", ["DVB-S"]]], -# [ "Technisat Skystar2", [".*0280.*13d0.*2103.*r01.*13d0.*2103.*"], # ??? dupe 1; nbdwt73, neutron68 -# ["DVB", ["DVB-S"]]], - [ "Twinhan 102g", [".*0400.*109e.*036e.*r11.*1822.*0001.*"], # ??? dupe 2; neutron68 - # secondary device "0480" "109e" "0878" -r11 "1822" "0001" - ["DVB", ["DVB-S"]]], - - # ATSC/QAM devices - [ "Kworld ATSC-110", [".*0480.*1131.*7133.*17de.*"], - ["DVB", ["ATSC", "QAM"]]], - [ "pcHDTV hd-3000", [".*0400.*14f1.*8800.*3000.*"], - ["DVB", ["ATSC", "QAM"]]], # the hd-3000 has several sub-devices; this pattern matches the digital tuner - [ "BBTI HD5000AV / AirStar 2 TV", [".*0280.*13d0.*2103.*r02.*13d0.*2103.*"], # ??? dupe 1; manicmike - ["DVB", ["ATSC", "QAM", "DVB-T"]]], - [ "pcHDTV hd-5500", [".*0400.*14f1.*8800.*7063.*5500.*"], - ["DVB", ["ATSC", "QAM"]]], - [ "Hauppauge WinTV-HVR-1800", [".*0400.*14f1.*8880.*0070.*7801.*"], - ["DVB", ["ATSC", "QAM"]]], - [ "DViCO Fusion Express", [".*0400.*14f1.*8852.*r02.*18ac.*d500.*"], - ["DVB", ["ATSC", "QAM"]]], - - # card has one sub-device; this pattern matches the primary device - [ "DViCO Fusion HDTV5 Lite", [".*0400.*109e.*036e.*r11.*18ac.*d500.*"], - # secondary device "0480" "109e" "0878" -r11 "18ac" "d500" - ["DVB", ["ATSC", "QAM"]]], - - # ANALOG - # ------- - # NTSC cards - # MPEG-2 type - [ "Hauppauge PVR-150", [".*0400.*4444.*0016.*0070.*8003.*", ".*0400.*4444.*0016.*0070.*8801.*"], - ["MPEG", ["NTSC"]]], - [ "Hauppauge PVR-250", [".*0200.*10ec.*8139.*1799.*5000.*", ".*0400.*4444.*0016.*0070.*4009.*", ".*0400.*4444.*0016.*0070.*f7f9.*"], - ["MPEG", ["NTSC"]]], - [ "Hauppauge PVR-350", [".*0400.*4444.*0803.*0070.*4000.*"], - ["MPEG", ["NTSC"]]], - - # NTSC/PAL cards - # MPEG-2 type - [ "Hauppauge PVR-500", [".*0400.*4444.*0016.*0070.*e817.*", ".*0400.*4444.*0016.*0070.*e807.*"], # look for each of two devices on the card, since it's dual-tuner - ["MPEG", ["NTSC"]]], - - # Frame grabbers -# [ "bt878-based frame grabbers", [".*0400.*109e.*036e.*", ".*0480.*109e.*0878.*"], -# ["V4L", ["NTSC"]]], - - # USB patterns - - [ "Dvico Dual Digital 4 rev2", [".* 0fe9:db98 .*"], - ["DVB", ["DVB-T"]]], - ); - -# "Hauppauge Nova-T 500 Dual DVB-T" - -#T: Bus=08 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 -#D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 -#P: Vendor=2040 ProdID=9941 Rev= 1.00 -#S: Manufacturer=Hauppauge -#S: Product=WinTV Nova-DT -#S: SerialNumber=4027351140 -#C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=500mA -#I:* If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=00 Prot=00 Driver=dvb_usb_dib0700 -#E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us -#E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms -#E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms -#E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms - -# "Hauppauge Nova-T-500" - -#T: Bus=08 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 -#D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 -#P: Vendor=2040 ProdID=9950 Rev= 1.00 -#S: Manufacturer=Hauppauge -#S: Product=WinTV Nova-DT -#S: SerialNumber=4027353863 -#C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA -#I: If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=00 Prot=00 Driver=dvb_usb_dib0700 -#E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us -#E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms -#E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms -#E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - my $logger = get_logger('tweaker.script'); - - # Get a list of all PCI and USB devices for later processing - my @device_list = split('\n', execute_shell_command("lspci -mn ; lsusb")); - - # Iterate through the list of known tuner cards, then the list of known network tuners. - # For each known tuner, configure a safe default for it if it's found. Set up - # well-named video sources for any mode supported by any tuner, and pick a default. - - # Determine the recording priority for a given device using the following priority rules, - # from top to bottom, the top being the most significant, and the bottom being the least - # significant - - # Input types in order of decreasing priority: - # Digital cable, digital satellite, digital OTA, analog cable, analog line-in, analog OTA - - # Device types in order of decreasing priority: - # local device, remote device - - # Capture types in order of decreasing priority: - # MPEG-2 creators (or passthrough of MPEG-2), MPEG-4 creators, frame grabbers - - # For example, if device1 supports a better input type than device2, device1 is always preferred. - # Ties are broken by the next level down. For example, if device1 and device2 both support the - # same input type, the tie is broken based on whether it's a local or remote device. Finally, - # ties of input type and device type are broken by the output of the device. It should be - # noted that it's possible to tie in all categories, and MythTV will break ties based on the - # order in which the devices are defined. - - - # For the following subroutines, $relative_device_count represents which device this is in - # the context of the total devices of its type. $global_device_count represents which device - # this is amongst all capture devices. Each returns a list of row names and values - # for the capturecard table, appropriate for the relevant type of device. - - # Create an entry in the capturecard table for the given tuner. - sub make_capturecard_SQL { - my($global_device_count, $relative_device_count, $cardtype, $tuner_number)=@_; - # $tuner_number is only used for HDHomeRuns - my $defaultinput=""; - my $hostname = execute_shell_command("hostname") || "localhost"; - my $checkfields = [["cardid", "$global_device_count"], - ["hostname", "$hostname"], - ["cardtype", "$cardtype"]]; - my $setfields; - my $logger = get_logger('tweaker.script'); - - # Because other devices use the /dev/video* and /dev/vbi* device - # files, the "device count" is used to determine which number follows the base - # device file name, e.g. /dev/video1, /dev/vbi1 - sub make_V4L_capturecard_SQL { - my($relative_device_count)=@_; # 0-indexed - - return [["videodevice", "/dev/video$relative_device_count"], - ["audiodevice", "/dev/dsp"], - ["vbidevice", "/dev/vbi$relative_device_count"], - ["audioratelimit", "0"]]; - } - - # Because other devices use the /dev/video* and /dev/vbi* device - # files, the "device count" is used to determine which number follows the base - # device file name, e.g. /dev/video1, /dev/vbi1 - sub make_MPEG_capturecard_SQL { - my($relative_device_count, $defaultinput)=@_; # 0-indexed - - return [["videodevice", "/dev/video$relative_device_count"], - ["defaultinput", $defaultinput]]; - } - - sub make_DVB_capturecard_SQL { - my($relative_device_count, # 0-indexed - $defaultinput)=@_; - my $logger = get_logger('tweaker.script'); - - $logger->debug("DEFAULTINPUT: $defaultinput"); - - return [["videodevice", "$relative_device_count"], # Rather than being a device file, it's a 0-indexed value indicating - # which of the N available DVB devices this is. Since a card can have more than one DVB device on it, there may - # be more DVB "videodevice"s on a system than there are distinct "cardid"s. - ["defaultinput", $defaultinput], - ["dvb_on_demand", "1"]]; - } - - # special case of DVB device - sub make_HDHOMERUN_capturecard_SQL { - my($hdhr_hex_id, $tuner_number, $defaultinput)=@_; - - return [["videodevice", "$hdhr_hex_id"], - ["defaultinput", $defaultinput], - ["dvb_on_demand", "0"], - ["dbox2_port", $tuner_number] # 0 or 1 - ]; - } - - $logger->debug("CARD TYPE: $cardtype"); - switch($cardtype) { - case "V4L" { - $setfields = make_V4L_capturecard_SQL($relative_device_count); - } - case "DVB" { - $defaultinput = "DVBInput"; - $setfields = make_DVB_capturecard_SQL($relative_device_count, $defaultinput); - } - case "HDHOMERUN" { - $defaultinput = "MPEG2TS"; - $setfields = make_HDHOMERUN_capturecard_SQL($relative_device_count, $tuner_number, $defaultinput); - } - case "MPEG" { - $defaultinput = "Tuner 1"; - $setfields = make_MPEG_capturecard_SQL($relative_device_count, $defaultinput); - } - } - - change_or_make_entry("capturecard", $setfields, $checkfields); - return $defaultinput; - } - - # Create an entry in videosource corresponding to the sub-type of input this device takes - # Return the sourceid for the entry we just made, which is a rough metric of desirability. - sub verify_or_make_videosource_SQL { - # sub-types are NTSC, PAL, ATSC, QAM, DVB-S, DVB-T, DVB-C, etc. - my($sub_type)=@_; - my $logger = get_logger('tweaker.script'); - - $logger->debug("\t\t\tUpdating or adding videosource for sub-type: $sub_type"); - - switch($sub_type) { - # North American options, from least desirable to most desirable (this is slightly arbitrary) - case "NTSC" { - change_or_make_entry("videosource", [["name", "analog_broadcast"], ["freqtable", "try-all"]], [["sourceid", 1]]); - # This is one of two cases where a sub_type can be used in two ways. Both videosources are made, but the preferred one is - # cable, the most common option. - change_or_make_entry("videosource", [["name", "analog_cable"], ["freqtable", "try-all"]], [["sourceid", 5]]); - return 5; - } - case "ATSC" { - change_or_make_entry("videosource", [["name", "digital_broadcast"], ["freqtable", "try-all"]], [["sourceid", 10]]); - return 10; - } - case "QAM" { - change_or_make_entry("videosource", [["name", "digital_cable"], ["freqtable", "try-all"]], [["sourceid", 20]]); - return 20; - } - - # Options for the rest of the planet - case "PAL" { - change_or_make_entry("videosource", [["name", "analog_broadcast"], ["freqtable", "try-all"]], [["sourceid", 1]]); - # This is one of two cases where a sub_type can be used in two ways. Both videosources are made, but the preferred one is - # cable, the most common option. - change_or_make_entry("videosource", [["name", "analog_cable"], ["freqtable", "try-all"]], [["sourceid", 5]]); - return 5; - } - case "DVB-T" { - change_or_make_entry("videosource", [["name", "digital_broadcast"], ["freqtable", "try-all"]], [["sourceid", 10]]); - return 10; - } - case "DVB-C" { - change_or_make_entry("videosource", [["name", "digital_cable"], ["freqtable", "try-all"]], [["sourceid", 20]]); - return 20; - } - - # Planet-wide options - case "DVB-S" { - change_or_make_entry("videosource", [["name", "digital_satellite"], ["freqtable", "try-all"]], [["sourceid", 15]]); - return 15; - } - } - } - - sub make_cardinput_SQL { - my($tuner_card_number, $sourceid, $inputname, $priority_modifier)=@_; - - change_or_make_entry("cardinput", [["sourceid", $sourceid], ["cardid", $tuner_card_number], - ["inputname", $inputname], ["preference", $sourceid], ["tunechan", ""], - ["startchan", "Please add"], ["freetoaironly", "1"], - ["recpriority", $sourceid+$priority_modifier]], - [["cardinputid", $tuner_card_number]]); - } - - sub max { - my($a, $b)=@_; - if ($a > $b) { - return $a; - } else { - return $b; - } - } - - my $global_device_count=0; - - # Configure each supported tuner/capture device detected on the system. - - # built-in, PCI, PCI Express, or USB - $logger->debug("Processing built-in, PCI, PCI Express or USB devices..."); - for my $a_device (@device_list) { - $logger->debug("DEVICE: $a_device"); - my $match=0; - - for my $device_data (@capture_card_patterns) { - $logger->debug("\tIs there a @$device_data[0] at this location?"); - - for my $patterns (@$device_data[1]) { - for my $pattern (@$patterns) { - if ($match) { - next; - } else { - $logger->debug("\t\tPATTERN: $pattern"); - $match += ($a_device =~ m/$pattern/i); - if ($match) { - $global_device_count++; # 1-indexed - - $logger->debug("\t\tfound one!"); - # Each device has a device type (e.g. MPEG, DVB, V4L) that it supports, and a - # list of sub_types (e.g. PAL, NTSC, DVB-S, DVB-T, DVB-C, ATSC, QAM). - # The device type is used to configure the capturecard table and the cardinput table. - # The sub_types are used to populate the videosource table. - # The device type and "best" sub_type are used to set the 'sourceid' field of the cardinput table. - - for my $typeblock (@$device_data[2]) { - my $device_type = @$typeblock[0]; - $logger->debug("\t\tDEVICE TYPE: $device_type"); # e.g. "DVB", "MPEG", etc. - $cardtypes{$device_type}++; - my $sourceid = -1; - for my $sub_types (@$typeblock[1]) { - for my $sub_type (@$sub_types) { - $logger->debug("\t\tSUB-TYPE: $sub_type\n"); # e.g. "DVB-S", "QAM", etc. - # ensure that the videosource table has an entry for each sub_type - # that this device supports; use the "best" one for the device by - # default - - # - # POPULATE videosource table - # - $sourceid = max(verify_or_make_videosource_SQL($sub_type), $sourceid); - } - } - $logger->debug("\t\t\"BEST\" SOURCE ID: $sourceid\n"); - - # - # POPULATE capturecard table - # - my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$device_type}-1, $device_type, -1); - - # - # POPULATE cardinput table - # - make_cardinput_SQL($global_device_count, $sourceid, $defaultinput, 0); - } - } - } - } - } - } - } - - # network tuner devices - $logger->debug("Processing network devices..."); - - # get our IP address - my $ip_address; - open(SHELL, "ifconfig | grep \"inet addr\" | grep -v 127 |"); - while(<SHELL>) { - my @line = split(/:| +/); - $ip_address = $line[3]; - } - close(SHELL); - - # ??? eventually, just add LocalIPCheck.pl's code to Tweaker/Script.pm and avoid bizarre perl-to-shell-to-perl calls at this level - my $ip_class = execute_shell_command("echo $ip_address | LocalIPCheck.pl; echo \$?"); - - if ($ip_class > 0) { # we're on a LAN, not the internet - # Look for HDHomeRun, a DVB ATSC/QAM device - $sourceid=0; - $logger->debug("\tLooking for SiliconDust HDHomeRun..."); - open(SHELL2, "hdhomerun_config discover |"); - while(<SHELL2>) { - if (m/\d+\.\d+\.\d+\.\d+/) { - my @line = split(/ /); - my $hdhr_hex_id = $line[2]; - - $logger->debug("\tfound $hdhr_hex_id"); - $global_device_count++; # 1-indexed - $cardtypes{"DVB"}++; - # - # POPULATE videosource table - # - for my $sub_type ("ATSC", "QAM") { - $sourceid = max(verify_or_make_videosource_SQL($sub_type), $sourceid); - } - $logger->debug("\t\t\"BEST\" SOURCE ID: $sourceid\n"); - - # - # POPULATE capturecard table - # - - # there are two tuners per HDHomeRun - for (my $sub_tuner_count = 0; $sub_tuner_count < 2; $sub_tuner_count++) { - my $defaultinput = make_capturecard_SQL($global_device_count+$sub_tuner_count, $hdhr_hex_id, "HDHOMERUN", $sub_tuner_count); - # - # POPULATE cardinput table - # - make_cardinput_SQL($global_device_count+$sub_tuner_count, $sourceid, $defaultinput, -4); # the -4 is to make it less desirable - # than a local device - } - $global_device_count++; - - } - } - close(SHELL2); - } # else: don't scan the internet! - - # Filesystem Tweaks for tuners - # This only works with the Nova-T-500 card, but it doesn't hurt any other cards - execute_shell_command("echo \"#switch on onboard amplifier on Nova-T-500 card\" > /etc/modprobe.d/dvb-usb-dib0700"); - execute_shell_command("echo \"options dvb-usb-dib0700 force_lna_activation=1\" >> /etc/modprobe.d/dvb-usb-dib0700"); - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("Unable to connect to mythconverg database"); - $logger->error("Unable to implement option $option."); - return -1; - } -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - - recommendation_level("recommended", "Everyone should scan for tuners to autoconfigure."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_tuners_notes.txt b/abs/core/tweaker/bin/twk_tuners_notes.txt deleted file mode 100644 index 1f2e283..0000000 --- a/abs/core/tweaker/bin/twk_tuners_notes.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Some PCI devices have the same lspci -mn fingerprint, yet users are identifying them as having different functions. The example below is reported as an ATSC(DVB-T) card by one user and as a DVB-S card by two other users. lspci -vvxxx provides more fingerprint data, and I'm trying to see if there's a definitive way to tell the cards apart from it. - - [ "BBTI Air2PC v2", [".*0280.*13d0.*2103.*r02.*13d0.*2103.*"], # ??? dupe 1; mihanson - ["DVB", ["ATSC"]]], - # mihanson lspci -vvxxx info: - -#00: d0 13 03 21 07 01 00 04 02 00 80 02 00 40 00 00 -#10: 00 00 64 ed 81 70 00 00 00 00 00 00 00 00 00 00 -#20: 00 00 00 00 00 00 00 00 00 00 00 00 d0 13 03 21 -#30: 00 00 00 00 00 00 00 00 00 00 00 00 0c 01 00 00 - -#00: d0 13 03 21 07 01 00 04 02 00 80 02 00 40 00 00 -#10: 00 00 65 ed a1 70 00 00 00 00 00 00 00 00 00 00 -#20: 00 00 00 00 00 00 00 00 00 00 00 00 d0 13 03 21 -#30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00 - -#00: d0 13 03 21 07 01 00 04 02 00 80 02 00 40 00 00 -#10: 00 00 66 ed c1 70 00 00 00 00 00 00 00 00 00 00 -#20: 00 00 00 00 00 00 00 00 00 00 00 00 d0 13 03 21 -#30: 00 00 00 00 00 00 00 00 00 00 00 00 0a 01 00 00 - -#00: d0 13 03 21 07 01 00 04 02 00 80 02 00 40 00 00 -#10: 00 00 67 ed e1 70 00 00 00 00 00 00 00 00 00 00 -#20: 00 00 00 00 00 00 00 00 00 00 00 00 d0 13 03 21 -#30: 00 00 00 00 00 00 00 00 00 00 00 00 0c 01 00 00 - -# Among the above, there are only three sections that -# differ, shown by XX: -#10: -- -- XX -- XX -- -- -- -- -- -- -- -- -- -- -- -#30: -- -- -- -- -- -- -- -- -- -- -- -- XX -- -- -- - - - [ "Technisat Skystar2", [".*0280.*13d0.*2103.*r01.*13d0.*2103.*"], # ??? dupe 1; nbdwt73, neutron68 - ["DVB", ["DVB-S"]]], - # Neutron68 lspci -vvxxx info: -#00: d0 13 03 21 07 01 00 04 01 00 80 02 00 40 00 00 -#10: 00 00 ae fa 81 c8 00 00 00 00 00 00 00 00 00 00 -#20: 00 00 00 00 00 00 00 00 00 00 00 00 d0 13 03 21 -#30: 00 00 00 00 00 00 00 00 00 00 00 00 05 01 00 00 - -# when compared with mihanson's blocks, these entries differ: -#00: -- -- -- -- -- -- -- -- -- -- -- XX -- -- -- -- -#10: -- -- XX XX XX XX XX -- -- -- -- -- -- -- -- -- -#20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -#30: -- -- -- -- -- -- -- -- -- -- -- -- XX -- -- -- - -# eliminating the entries that even differ among mihanson's devices, we get: -#00: -- -- -- -- -- -- -- -- -- -- -- XX -- -- -- -- -#10: -- -- -- XX -- XX XX -- -- -- -- -- -- -- -- -- -#20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -#30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# Without more feedback, it's not clear whether or not this pattern is representative -# of the differences between the DVB-S and ATSC versions of this device. - diff --git a/abs/core/tweaker/bin/twk_upgrade.pl b/abs/core/tweaker/bin/twk_upgrade.pl deleted file mode 100755 index b5d09b6..0000000 --- a/abs/core/tweaker/bin/twk_upgrade.pl +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - -# -# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE -# -# Tweaker 0.7 is not interactive, so these post-upgrade changes are a stopgap -# measure to make sure people upgrading from R5F27 get sensible settings -# for things that MythTV 0.21 doesn't know how to handle properly. This file -# should shrink or disappear entirely once Tweaker becomes interactive. -# -# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE -# - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'all' ); - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # use poll results from twk_cpu.pl to set playback decoder options - my @levels = ("low", "medium", "high"); - foreach my $level (@levels) { - my @results = split(/\|/, execute_shell_command("twk_cpu.pl --poll $level")); - foreach my $result (@results) { - if ($result eq "recommended") { - if ("$level" eq "low") { - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU--') || exit -1; # best playback defaults for weak hardware - } elsif ("$level" eq "medium") { - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU+') || exit -1; # best playback defaults for average hardware - } elsif ("$level" eq "high") { - change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU++') || exit -1; # best playback defaults for powerful hardware - } - } - } - } - - # Update visualization modes for 0.21 - change_or_make_setting('VisualMode','BumpScope;Gears;Goom;MonoScope;Squares;StereoScope;Synaesthesia;LibVisual-bumpscope;LibVisual-corona;LibVisual-infinite;LibVisual-jakdaw;LibVisual-jess;AlbumArt'); - - # Remove possibly obsolete and conflicting theme cache entries. - execute_shell_command("/bin/rm -rf /home/mythtv/.mythtv/themecache/"); - - # Fix bizarre ownership of files: - execute_shell_command("chown -f root: /usr/bin/get_dual.sh"); - execute_shell_command("chown -fR root: /usr/lib/krp"); - execute_shell_command("chown -fR root: /usr/local/bin"); - execute_shell_command("chown -f root: /usr/share/man/man1/tv_grab_au.1.gz"); - execute_shell_command("chown -f root: /usr/share/xmltv/tv_grab_au/channel_ids"); - execute_shell_command("chown -fR root:src /usr/src/"); - - # Fix video problems for some nVidia users - execute_shell_command("grep nvidia /etc/X11/xorg.conf && sed -i -e 's/^[ \t]*Option.*\"XvmcUsesTextures\".*/#REMOVEME/g' -e 's/^[ \t]*Option.*\"UseEvents\".*/#REMOVEME/g' /etc/X11/xorg.conf"); # clear out old entries, if present - execute_shell_command("grep nvidia /etc/X11/xorg.conf && sed -i -n '1h;2,\$H;\${g;s/#REMOVEME\\n//g;p}' /etc/X11/xorg.conf"); # clear out old entries, if present - execute_shell_command("grep nvidia /etc/X11/xorg.conf && sed -i 's/\\(^[ \t]*Driver.*\"nvidia\".*\\)/\\1\\n\tOption \"XvmcUsesTextures\" \"false\"\\n\tOption \"UseEvents\" \"true\"/g' /etc/X11/xorg.conf"); - execute_shell_command("if [ -e /home/mythtv/.nvidia-settings-rc ] ; then sed -i -e \"s'.*XVideoTextureSyncToVBlank.*'#REMOVEME'g\" -e \"s'.*XVideoBlitterSyncToVBlank.*'#REMOVEME'g\" /home/mythtv/.nvidia-settings-rc; fi"); - execute_shell_command("grep nvidia /etc/X11/xorg.conf && echo 0/XVideoTextureSyncToVBlank=0 >> /home/mythtv/.nvidia-settings-rc && echo 0/XVideoBlitterSyncToVBlank=0 >> /home/mythtv/.nvidia-settings-rc && sed -i -n '1h;2,\$H;\${g;s/#REMOVEME\\n//g;p}' /home/mythtv/.nvidia-settings-rc"); - - - # Enable any digital audio out device we can. - my $command = "amixer scontrols | grep IEC958"; - my @results = split('\n', execute_shell_command($command)); - foreach my $line (@results) { - if ($line =~ /Simple mixer control (.*),.*/i) { - $command = "su - mythtv -c \"amixer set $1 on\""; # Tries to set all IEC958 devices to 'on' - # but some are just placeholders and can't be turned 'on', therefore don't error out if we fail - execute_shell_command($command); - } - } - execute_shell_command("alsactl store"); # persist the above change(s) - - # The Chaintech AV-710 was generally configured for digital audio in R5F27 in a way that worked - # great there but which is failing utterly in R5.5. Try to detect this old configuration, and if - # it's present, implement the new settings which seem to work for all digital audio devices. - # This may only match 80% of the AV-710 users, but the rest of them can just run the necessary - # tweaker command by hand to get the same result. - if (execute_shell_command('lspci -mn | grep -e ".*0401.*1412.*1724.*1412.*1724"')) { - # found an AV-710, now see if it's configured for digital audio - if (do_query("SELECT * FROM settings WHERE value='AudioOutputDevice' AND data='/dev/adsp'")) { - # The user was using this AV-710's spdif output, so give them the new good digital configuration - execute_shell_command("twk_audio.pl --implement digital"); - } - } - change_or_make_setting('MixerDevice', 'ALSA:default') || exit -1; - - # Undo obsolete mplayer workaround for aspect ratio - execute_shell_command("sed -i 's/.*monitoraspect.*//g' /home/mythtv/.mplayer/config"); - - my $hostname = execute_shell_command("hostname") || "localhost"; - # one table at a time, replace hostname with our actual hostname - # ??? can this be done all at once in MySQL? - foreach my $table ("capturecard", "inuseprograms", "jobqueue", "jumppoints", "keybindings", "music_playlists", - "musicplaylist", "recorded", "settings", "weatherscreens") { - do_query("UPDATE $table SET hostname='$hostname'"); - } - - # Some entries in 'settings' should stay NULL: http://www.mythtv.org/wiki/index.php/Settings_table - # There are fewer entries that stay NULL than there are that should have the hostname set, so while - # it duplicates some effort to change them from NULL to the hostname and them back to NULL, it's - # easier to maintain and more future-proof. - foreach my $entry ("mythfilldatabaseLastRunStart", "mythfilldatabaseLastRunEnd", "mythfilldatabaseLastRunStatus", - "DataDirectMessage", "HaveRepeats", "DBSchemaVer", "DefaultTranscoder", "MythFillSuggestedRunTime", - "MythFillGrabberSuggestsTime", "MasterServerIP", "MasterServerPort", "TVFormat", "VbiFormat", "FreqTable", - "TimeOffset", "MasterBackendOverride", "DeletesFollowLinks", "HDRingbufferSize", "EITTransportTimeout", - "EITIgnoresSource", "EITCrawIdleStart", "startupCommand", "blockSDWUwithoutClient", "idleWaitForRecordingTime", - "StartupSecsBeforeRecording", "WakeupTimeFormat", "SetWakeuptimeCommand", "ServerHaltCommand", "preSDWUCheckCommand", - "WOLbackendConnectRetry", "WOLbackendCommand", "WOLslaveBackendsCommand", "JobsRunOnRecordHost", - "AutoCommflagWhileRecording", "JobQueueCommFlagCommand", "JobQueueTranscodeCommand", - "AutoTranscodeBeforeAutoCommflag", "SaveTranscoding", "UserJobDesc1", "UserJob1", "UserJobDesc2", "UserJob2", - "UserJobDesc3", "UserJob3", "UserJobDesc4", "UserJob4", "PreviewPixmapOffset", "AllRecGroupPassword", - "MaximumCommercialSkip", "CommSkipAllBlanks", "LastFreeCard", "LiveTVPriority", "AutoExpireMethod", - "AutoExpireDefault", "RerecordWatched", "AutoExpireWatchedPriority", "AutoExpireLiveTVMaxAge", - "AutoExpireDayPriority", "AutoExpireExtraSpace", "AutoExpireInsteadOfDelete", "DeletedFifoOrder", - "CommercialSkipMethod", "AggressiveCommDetect", "AutoCommercialFlag", "AutoTranscode", "AutoRunUserJob1", - "AutoRunUserJob2", "AutoRunUserJob3", "AutoRunUserJob4", "OverTimeCategory", "CategoryOverTime", - "EPGEnableJumpToChannel", "LogEnabled", "MythFillEnabled", "MythFillDatabasePath", "MythFillDatabaseArgs", - "MythFillDatabaseLog", "MythFillPeriod", "MythFillMinHour", "MythFillMaxHour", "SchedMoveHigher", "SchedOpenEnd", - "ComplexPriority", "PrefInputPriority", "SingleRecordRecPriority", "FindOneRecordRecPriority", "ArchiveDBSchemaVer", - "FlixDBSchemaVer", "GalleryDBSchemaVer", "GameDBSchemaVer", "MusicDBSchemaVer", "PhoneDBSchemaVer", - "mythvideo.DBSchemaVer", "WeatherDBSchemaVer") { - do_query("UPDATE settings SET hostname=NULL WHERE value='$entry'"); - } - - change_or_make_setting('MythFillDatabaseLog', '/var/log/mythtv/mythfilldatabase.log'); - change_or_make_setting('MasterBackendOverride','1'); # I don't remember why, but making the hostname NULL is important here - do_query("UPDATE settings SET hostname=NULL WHERE value='MasterBackendOverride'"); - - disconnect_from_db(); - - # Fix hostname for iPod feed URLs - $command = "sed -i \"s/hostname\\//$hostname\\//g\" /usr/local/bin/myth2ipod"; - execute_shell_command($command); - - # Fix hostname for XViD feed URLs - $command = "sed -i \"s/192.168.0.222\\//$hostname\\//g\" /usr/local/bin/myt2xvid3"; - execute_shell_command($command); - - # Customize default MythTV library.xml to reflect KnoppMyth's wider selection of - # online stream options. - #$command = "sed -i \"/<type>STREAM<\\/type>\$/{N; N; N; N; s/text>.*<\\/text/text>Online Streams<\\/text/; s/action>.*<\\/action/action>MENU is.xml<\\/action/; s/<depends.*depends>//; }\" /usr/share/mythtv/library.xml"; - $command = "/bin/cp /usr/share/mythtv/library.xml.km /usr/share/mythtv/library.xml"; - execute_shell_command($command); - - } else { - my $logger = get_logger('tweaker.script'); - $logger->error("ERROR: Unable to connect to mythconverg database"); - $logger->error("ERROR: Unable to implement option $option."); - exit -1; - } - disconnect_from_db(); -} - -# Try to get a Recommendation Level for $option. -sub poll_options { - my($option) = @_; - recommendation_level("recommended", "These tweaks benefit all users."); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; diff --git a/abs/core/tweaker/bin/twk_what_has_changed.sh b/abs/core/tweaker/bin/twk_what_has_changed.sh deleted file mode 100755 index deff7cf..0000000 --- a/abs/core/tweaker/bin/twk_what_has_changed.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/bash - -# Copyright 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv -# and Tom Culliton of <affiliation>. Most of restore_baseline_SQL taken from -# KnoppMyth R5F27's /usr/local/bin/KnoppMyth-run script (multiple authors) -# -# 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>. - - -#---------------------------------------------------------------------------- -. /usr/local/bin/backupcommon || { - echo "Can not find common settings!" - exit 1 -} -#---------------------------------------------------------------------------- - -# Target output file for our results -DIFF_RESULTS=/tmp/database_changes.txt -LOGFILE=/var/log/twk_what_has_changed.log -WORKING_DIR=/tmp/ - -# Restore the SQL to the way it would have been after R5F27 was installed -# and before the user made any changes to MythTV settings. -# This is KnoppMyth-centric and does not apply to general MythTV distros, -# however it is possible to generalize this to apply to any MythTV distro -# including generic Linux distros in which MythTV has been installed. -# -# Preconditions: MySQL daemon is running -# -# Postconditions: 'mythconverg' is deleted and re-created, just as it -# would be during the course of a normal installation. -restore_baseline_SQL() { - echo "restoring baseline SQL" >> $LOGFILE - KRP_RESULT=-1 - KRPAutoDetect.pl &> /dev/null # be quiet - KRP_RESULT=$?; - - # Parts from R5F27's KnoppMyth-run - KNOPPMYTH_SQL_FILE="/usr/local/share/knoppmyth/KnoppMyth.sql" - - # Try to detect and configure settings for various tuner - # and capture devices. - /usr/local/bin/TunerConfig.sh $KNOPPMYTH_SQL_FILE >> /dev/null - /usr/local/bin/ren_host.sh - GlobalSQLtweaker.sh $KNOPPMYTH_SQL_FILE - - if [[ ($KRP_RESULT != 1) && ($KRP_RESULT != 2) && ($KRP_RESULT != 3) && ($KRP_RESULT != 10) && (-n "$IS_AUS") ]]; then # not Dragon - /usr/local/bin/epia_sql.sh - fi - - # General MythTV SQL settings for all boxes - if [ -f "/usr/local/bin/MythTV-sql" ]; then - # Interject platform-specific SQL settings before we populate the SQL - # database. - if [[ ($KRP_RESULT == 1) || ($KRP_RESULT == 2) || ($KRP_RESULT == 3) || ($KRP_RESULT == 10) ]]; then # Dragon - DragonSQLtweaker.sh $KNOPPMYTH_SQL_FILE - fi - # Now use the (possibly modified) KnoppMyth.sql to populate initial - # MythTV settings. - - # This wipes out the current mythconverg and replaces it with what's in $KNOPPMYTH_SQL_FILE - sh /usr/local/bin/MythTV-sql $KNOPPMYTH_SQL_FILE - fi - - echo \ - "MythTV will re-launch in a tiny window. If it asks you about -upgrading the schema, agree. When the schema upgrade is complete, -exit MythTV. -You can exit MythTV immediately if you aren't asked to do a schema -upgrade." - echo "###" - echo "Press ENTER to re-launch MythTV." - read CONTINUE; - restart_mythtv "--geometry 640x480" -} - -# Call mysql and only dump the requested data in tab seperated columns -get_data () { - mysql mythconverg -u root -sNBe "$*" -} - -# Compares $MYTHTV_EXPECTED_DB_NAME to $USERS_DB_NAME -compare_databases() { - echo "comparing databases" >> $LOGFILE - tables_to_compare="capturecard cardinput codecparams displayprofilegroups displayprofiles dtv_multiplex keybindings playgroups profilegroups recordingprofiles settings videotypes weatherdatalayout weatherscreens weathersourcesettings" - hostnames=$(get_data "select distinct hostname from settings where hostname is not null") - - /etc/init.d/mysql start >> $LOGFILE - # Do some MySQL magic to compare $tables_to_compare between - # $MYTHTV_EXPECTED_DB_NAME (baseline) and $USERS_DB_NAME (user's version) - # ??? -} - -# This is somewhat KnoppMyth-centric, though minor modification would -# make it work generally. -function restart_mythtv { - echo "restarting MythTV" >> $LOGFILE - EXTRA_PARAMETERS=$1 ; shift - /etc/init.d/mythtv-backend start >> $LOGFILE - killall mythfrontend - # re-launches the frontend and gives the user a chance to upgrade to latest schema - su - mythtv -c "export DISPLAY=:0.0 ; mythfrontend --logfile /var/log/mythtv/mythfrontend.log $EXTRA_PARAMETERS" >> $LOGFILE -} - -function rename_database { - db_source=$1 ; shift - db_target=$1 ; shift - - echo "renaming database $db_source to $db_target" >> $LOGFILE - - # Exit the frontend before messing with the SQL - killall mythfrontend - # If we stop MySQL before stopping the MythTV backend, we'll probably trigger badness - /etc/init.d/mythtv-backend stop >> $LOGFILE - # MySQL needs to stop before we do this. - /etc/init.d/mysql stop >> $LOGFILE - /bin/mv $db_source $db_target -} - -main() { - echo -n "$0 started running: " >> $LOGFILE - date >> $LOGFILE - - echo "STEP 0..." - echo "STEP 0" >> $LOGFILE - # 0) acquire system settings - MYTHTV_EXPECTED_DB_NAME=`grep DBName /etc/mythtv/mysql.txt | awk -F= '{ print $2 }'` - USERS_DB_NAME="mythconverg-copy" - /etc/init.d/mysql start >> $LOGFILE - # MySQL needs to be running or mysqladmin won't return anything - SQL_HOME=`mysqladmin variables | grep datadir | awk -F\| '{ print $3 }' | sed 's/ //g'` - - echo "STEP 1..." - echo "STEP 1" >> $LOGFILE - # 1) rename the current MythTV MySQL database - rename_database $SQL_HOME$MYTHTV_EXPECTED_DB_NAME $WORKING_DIR$USERS_DB_NAME - - echo "STEP 2..." - echo "STEP 2" >> $LOGFILE - # 2) re-create the R5F27 baseline SQL. - /etc/init.d/mysql start >> $LOGFILE - restore_baseline_SQL - - echo "STEP 3..." - echo "STEP 3" >> $LOGFILE - # 3) compare the fresh baseline DB with the user's modified DB, and save the - # diffs to a text file - # ??? - - echo "STEP 4..." - echo "STEP 4" >> $LOGFILE - # 4) restore the user's database - rename_database $WORKING_DIR$USERS_DB_NAME $SQL_HOME$MYTHTV_EXPECTED_DB_NAME - /etc/init.d/mysql start >> $LOGFILE - - echo "STEP 5..." - echo "STEP 5" >> $LOGFILE - # 5) Tell them the comparison is done, tell them where to find the results, - # and prompt them to restart MythTV. - echo "Your results are in $DIFF_RESULTS" - echo "###" - echo "Press ENTER to re-launch MythTV." - read CONTINUE; - - restart_mythtv "&" - echo "DONE" - echo -n "$0 stopped running: " >> $LOGFILE - date >> $LOGFILE -} - -main - |