From 2eaa5abe1f850dd66728fd669d74d4c978d1607c Mon Sep 17 00:00:00 2001 From: Bob Igo Date: Tue, 17 Feb 2009 13:04:51 -0500 Subject: Adapted Tweaker scripts for R6. --- abs/core-testing/tweaker/bin/twk_RAM.pl | 2 +- abs/core-testing/tweaker/bin/twk_audio.pl | 12 +++---- abs/core-testing/tweaker/bin/twk_audio_RP.pl | 27 +++++++++------- abs/core-testing/tweaker/bin/twk_dragon.pl | 6 ++-- abs/core-testing/tweaker/bin/twk_general.pl | 27 ++-------------- abs/core-testing/tweaker/bin/twk_keymap.sh | 46 +++++++++++++-------------- abs/core-testing/tweaker/tcf/tweaker-core.tcf | 2 +- 7 files changed, 53 insertions(+), 69 deletions(-) diff --git a/abs/core-testing/tweaker/bin/twk_RAM.pl b/abs/core-testing/tweaker/bin/twk_RAM.pl index 79fe938..2eea598 100755 --- a/abs/core-testing/tweaker/bin/twk_RAM.pl +++ b/abs/core-testing/tweaker/bin/twk_RAM.pl @@ -47,7 +47,7 @@ sub implement_option { # 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("sed -i 's/cache.*=.*/cache=$cachesize/g' /etc/mplayer/mplayer.conf") || exit -1; + 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 diff --git a/abs/core-testing/tweaker/bin/twk_audio.pl b/abs/core-testing/tweaker/bin/twk_audio.pl index b3bdd89..37b2201 100755 --- a/abs/core-testing/tweaker/bin/twk_audio.pl +++ b/abs/core-testing/tweaker/bin/twk_audio.pl @@ -83,7 +83,7 @@ sub implement_option { # output. $command1 = "/bin/cp \$TWEAKER_ROOT/fs$asound_conf /etc/"; if (($card >= 0) && ($device >= 0)) { - $command2 = "sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf"; + $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."); @@ -110,9 +110,9 @@ sub implement_option { sub edit_mplayer_conf { my($option) = @_; # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf"; + my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf"; # comment out old entries that some other process may have made - my $comment_out_external_edits = "sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf"; + my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf"; my $command1; my $command2=""; ($card, $device) = poll_for_digital_output_device; @@ -143,7 +143,7 @@ sub implement_option { my @digital_audio_device_patterns = ( [ # Asus T3-M2NC51PV onboard audio - ".*0403.*10de.*026c.*1043.*821f", "T3-M2NC51PV", "sed -i 's/plughw.* #TWEAKER/spdif #TWEAKER/g' $mplayer_conf" + ".*0403.*10de.*026c.*1043.*821f", "T3-M2NC51PV", "[ -e $mplayer_conf ] && sed -i 's/plughw.* #TWEAKER/spdif #TWEAKER/g' $mplayer_conf" ] ); @@ -166,9 +166,9 @@ sub implement_option { sub edit_xine_conf { my($option)=@_; # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf"; + 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 = "sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf"; + 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")) { diff --git a/abs/core-testing/tweaker/bin/twk_audio_RP.pl b/abs/core-testing/tweaker/bin/twk_audio_RP.pl index 5b30bd8..9d06493 100755 --- a/abs/core-testing/tweaker/bin/twk_audio_RP.pl +++ b/abs/core-testing/tweaker/bin/twk_audio_RP.pl @@ -30,11 +30,16 @@ sub poll_for_digital_output_device { my @digital_matches = ( "digital", "IEC958" ); my $results = execute_shell_command($poll_command); - foreach my $digital_match (@digital_matches) { - if ($results =~ /card (\d):.*device (\d).*$digital_match.*/i) { - $card = $1; - $device = $2; + 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); } @@ -64,9 +69,9 @@ sub implement_option { $command1 = "[ -e $asound_conf ] && /bin/cp $asound_conf $asound_conf-TWEAKERBACKUP"; # Assumption: The proper analog device is always device 0. if ($card >= 0) { - $command2 = "sed -i 's/hw:.,./hw:$card,0/g' $asound_conf"; + $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:$card,0/g' $asound_conf"; } else { - $command2 = "sed -i 's/hw:.,./hw:0,0/g' $asound_conf"; + $command2 = "[ -e $asound_conf ] && sed -i 's/hw:.,./hw:0,0/g' $asound_conf"; } } case "analogsurround" { @@ -78,7 +83,7 @@ sub implement_option { # output. $command1 = "/bin/cp \$TWEAKER_ROOT/fs$asound_conf /etc/"; if (($card >= 0) && ($device >= 0)) { - $command2 = "sed -i 's/hw:.,./hw:$card,$device/g' $asound_conf"; + $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."); @@ -105,9 +110,9 @@ sub implement_option { sub edit_mplayer_conf { my($option) = @_; # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf"; + my $delete_old_tweaker_edits = "[ -e $mplayer_conf ] && sed -i '/^.*a[o,c].*=.*#TWEAKER/d' $mplayer_conf"; # comment out old entries that some other process may have made - my $comment_out_external_edits = "sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf"; + my $comment_out_external_edits = "[ -e $mplayer_conf ] && sed -i 's/^\\(a[o,c].*=.*\\)/#\\1/g' $mplayer_conf"; my $command1; my $command2=""; my $logger = get_logger('tweaker.script'); @@ -141,9 +146,9 @@ sub implement_option { sub edit_xine_conf { my($option)=@_; # delete any old entries that Tweaker made, relevant to this particular edit - my $delete_old_tweaker_edits = "sed -i -e '/^.*audio.output.speaker_arrangement.*#TWEAKER/d' -e '/^.*audio.synchronization.passthrough_offset.*#TWEAKER/d' $xine_conf"; + 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 = "sed -i -e 's/^\\(audio.output.speaker_arrangement.*\\)/#\\1/g' -e 's/^\\(audio.synchronization.passthrough_offset.*\\)/#\\1/g' $xine_conf"; + 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")) { diff --git a/abs/core-testing/tweaker/bin/twk_dragon.pl b/abs/core-testing/tweaker/bin/twk_dragon.pl index f5ad5b7..314c299 100755 --- a/abs/core-testing/tweaker/bin/twk_dragon.pl +++ b/abs/core-testing/tweaker/bin/twk_dragon.pl @@ -32,11 +32,11 @@ sub implement_option { if (connect_to_db("DBI:mysql:$dbconnectionstring")) { # Overrides SQL changes made in twk_general.pl - change_or_make_setting('DVDPlayerCommand', 'mplayer dvd:\/\/ -dvd-device %d -fs -zoom -vc mpeg12,ffmpeg12-vo xv -vf pp=lb') || return -1; + change_or_make_setting('mythdvd.DVDPlayerCommand', 'mplayer dvd:\/\/ -dvd-device %d -fs -zoom -vc mpeg12,ffmpeg12-vo xv -vf pp=lb') || return -1; change_or_make_setting('VCDPlayerCommand', 'mplayer vcd:\/\/ -cdrom-device %d -fs -zoom -vo xv -vf pp=lb') || return -1; # Overrides SQL changes made in twk_tuners.pl - # WARNING: Very big harccoded hack. + # WARNING: Very big harccoded hack that chooses ATSC tuning over QAM. do_query("UPDATE cardinput SET sourceid='10' WHERE sourceid='20'") || return -1; } else { my $logger = get_logger('tweaker.script'); @@ -50,7 +50,7 @@ sub implement_option { # 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 users."); + recommendation_level("recommended", "These tweaks benefit all Dragon users."); } # Unimplemented in 0.7 diff --git a/abs/core-testing/tweaker/bin/twk_general.pl b/abs/core-testing/tweaker/bin/twk_general.pl index 9b01480..89e75a6 100755 --- a/abs/core-testing/tweaker/bin/twk_general.pl +++ b/abs/core-testing/tweaker/bin/twk_general.pl @@ -31,30 +31,10 @@ sub implement_option { my @commands = ( # keymap tweaks - "twk_keymap.sh", - # fix distro name in various html - "fix_index", - # fix 'motion' index to use our hostname - "sed -i 's/MythTVhost/`hostname`/g' /var/www/motion/index.html", + "twk_keymap.sh" # # These may or may not be necessary after GF21 # - - # Change from "sid" to "stable" repository - "sed -i \"s/sid/stable/g\" /etc/apt/sources.list", - - # Fix bizarre ownership of files: - "chown -f root: /usr/bin/get_dual.sh", - "chown -fR root: /usr/lib/krp", - "chown -fR root: /usr/local/bin", - "chown -f root: /usr/share/man/man1/tv_grab_au.1.gz", - "chown -f root: /usr/share/xmltv/tv_grab_au/channel_ids", - "chown -fR root:src /usr/src/", - - # Install extra software - #"apt-get update && apt-get -y -q=2 install frozen-bubble &", - # prevent fluxbox toolbar from appearing - "fix_toolbar.sh" ); foreach my $command (@commands) { @@ -337,7 +317,6 @@ sub implement_option { # change_or_make_setting('ChannelOrdering', 'chanid'); change_or_make_setting('CommercialSkipMethod', '255'); change_or_make_setting('DVDBookmarkPrompt', '1'); - change_or_make_setting('DVDPlayerCommand', 'xine -pfhq --no-splash dvd:\/\/'); 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 @@ -395,7 +374,7 @@ sub implement_option { 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', 'xine -pfhq --no-splash vcd://'); + 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'); @@ -411,7 +390,7 @@ sub implement_option { change_or_make_setting('WebBrowserZoomLevel','20'); change_or_make_setting('WebcamDevice','/dev/video'); change_or_make_setting('blockSDWUwithoutClient','1'); - change_or_make_setting('mythdvd.DVDPlayerCommand', 'xine -pfhq --no-splash dvd://'); + change_or_make_setting('mythdvd.DVDPlayerCommand', 'Internal'); change_or_make_setting('mythvideo.VideoTreeRemember', '1'); change_or_make_setting('mythfilldatabaseLastRunStart',''); change_or_make_setting('mythfilldatabaseLastRunEnd',''); diff --git a/abs/core-testing/tweaker/bin/twk_keymap.sh b/abs/core-testing/tweaker/bin/twk_keymap.sh index 885594d..7e4ef8b 100755 --- a/abs/core-testing/tweaker/bin/twk_keymap.sh +++ b/abs/core-testing/tweaker/bin/twk_keymap.sh @@ -17,7 +17,7 @@ # This script is called from twk_general.pl to implement keymap standardization in KnoppMyth -KNOPPMYTH_SHARE=/usr/local/share/knoppmyth +#KNOPPMYTH_SHARE=/usr/local/share/knoppmyth #################### # Unify key mappings @@ -34,28 +34,28 @@ KNOPPMYTH_SHARE=/usr/local/share/knoppmyth #Make xine use keymappings that get along with mplayer, MythMusic, and ATI remote button mappings. #NOTE: "Prior" is PageUp and "Next" is PageDown -if [[ -f $MYTH_HOME/.xine/keymap ]]; then - sed -i "/Mute {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/MrlBrowser {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/NextMrl {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/PriorMrl {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/AudioVideoDecay+ {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/ToggleLoopMode {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/PlaylistStop {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap - sed -i "/Mute {$/{N; N; s/modifier = .*/modifier = none/; }" $MYTH_HOME/.xine/keymap - sed -i "/Quit {$/{N; s/key = .*/key = Escape/; }" $MYTH_HOME/.xine/keymap - sed -i "/^Menu {$/{N; s/key = .*/key = m/; }" $MYTH_HOME/.xine/keymap - sed -i "/Play {$/{N; s/key = .*/key = l/; }" $MYTH_HOME/.xine/keymap - sed -i "/Pause {$/{N; s/key = .*/key = p/; }" $MYTH_HOME/.xine/keymap - sed -i "/SeekRelative+60 {$/{N; s/key = .*/key = Next/; }" $MYTH_HOME/.xine/keymap - sed -i "/SeekRelative-60 {$/{N; s/key = .*/key = Prior/; }" $MYTH_HOME/.xine/keymap - sed -i "/Volume+ {$/{N; s/key = .*/key = ]/; }" $MYTH_HOME/.xine/keymap - sed -i "/Volume- {$/{N; s/key = .*/key = [/; }" $MYTH_HOME/.xine/keymap -else - mkdir -p $MYTH_HOME/.xine/ - /bin/cp $KNOPPMYTH_SHARE/xine_keymap $MYTH_HOME/.xine/keymap -fi -chown -fR mythtv:mythtv $MYTH_HOME/.xine +#if [[ -f $MYTH_HOME/.xine/keymap ]]; then +# sed -i "/Mute {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/MrlBrowser {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/NextMrl {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/PriorMrl {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/AudioVideoDecay+ {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/ToggleLoopMode {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/PlaylistStop {$/{N; s/key = .*/key = VOID/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Mute {$/{N; N; s/modifier = .*/modifier = none/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Quit {$/{N; s/key = .*/key = Escape/; }" $MYTH_HOME/.xine/keymap +# sed -i "/^Menu {$/{N; s/key = .*/key = m/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Play {$/{N; s/key = .*/key = l/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Pause {$/{N; s/key = .*/key = p/; }" $MYTH_HOME/.xine/keymap +# sed -i "/SeekRelative+60 {$/{N; s/key = .*/key = Next/; }" $MYTH_HOME/.xine/keymap +# sed -i "/SeekRelative-60 {$/{N; s/key = .*/key = Prior/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Volume+ {$/{N; s/key = .*/key = ]/; }" $MYTH_HOME/.xine/keymap +# sed -i "/Volume- {$/{N; s/key = .*/key = [/; }" $MYTH_HOME/.xine/keymap +#else +# mkdir -p $MYTH_HOME/.xine/ +# /bin/cp $KNOPPMYTH_SHARE/xine_keymap $MYTH_HOME/.xine/keymap +#fi +#chown -fR mythtv:mythtv $MYTH_HOME/.xine #Make mplayer use keymappings that get along with xine, MythMusic, and ATI remote button mappings. diff --git a/abs/core-testing/tweaker/tcf/tweaker-core.tcf b/abs/core-testing/tweaker/tcf/tweaker-core.tcf index d9c4bb6..88d8608 100644 --- a/abs/core-testing/tweaker/tcf/tweaker-core.tcf +++ b/abs/core-testing/tweaker/tcf/tweaker-core.tcf @@ -1,6 +1,6 @@ + -- cgit v0.12