This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository mteleplayer. commit e02d8dd0b3ecb326598d0679028a9b6ade0d1e0d Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sun Sep 14 21:49:01 2014 +0200 whitespace cleanup --- .../mteleplayer/bin/mteleplayer_clientside | 204 ++++++++++---------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside index 8971cf8..344c732 100755 --- a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside +++ b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside @@ -1,34 +1,34 @@ #!/usr/bin/perl -T ################################################################################################################# # -# mTelePlayer - A situation aware mediaplayer for the X2Go Terminal System. -# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. -# +# mTelePlayer - A situation aware mediaplayer for the X2Go Terminal System. +# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. +# # 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 2 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, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# -# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. +# +# +# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. # Guangzhou Nianguan Electronics Technology Co.Ltd. -# Jin Fu Building , #90 QiFuRoad, +# Jin Fu Building , #90 QiFuRoad, # Guangzhou, Guangdong, # People's Republic of China -# +# # Web: http://opensource.gznianguan.com/ # E-mail: <opensource@gznianguan.com> -# +# ################################################################################################################# # # Hopefully this code will give you some basic idea on how to write Telekinesis enabled applications. @@ -41,11 +41,11 @@ $ENV{'LANG'} = "C"; our $TEKIAPPDEBUG = 1; our $APPNAME = "mteleplayer"; our $APPVER = "0.0.3.0"; -use Glib qw/TRUE FALSE/; +use Glib qw/TRUE FALSE/; use IO::Socket::UNIX qw( SOCK_STREAM ); use Time::HiRes qw( usleep gettimeofday tv_interval clock_gettime clock_getres clock_nanosleep clock stat ); use X2Go::Telekinesis::Apps::AppCore qw(getTeKiPaths tkappDie appDBugLog getCmdFlags getBasicClientsideInfo epicFailPOP); -use X2Go::Telekinesis::CommonCore qw(tcDie sanitizer dbugPrint checkPID sanitizeFilePath sanitizeDirPath genRandSID clups); +use X2Go::Telekinesis::CommonCore qw(tcDie sanitizer dbugPrint checkPID sanitizeFilePath sanitizeDirPath genRandSID clups); use Gtk2; use Gtk2::Helper; use FileHandle; @@ -62,7 +62,7 @@ our $theLIBDIR = sanitizeDirPath("$TeKiPaths{'LIB'}/client/applications/mtelep ######################################################################################################## my $mpFH = FileHandle->new; -our %CmdFlags = getCmdFlags(@ARGV); +our %CmdFlags = getCmdFlags(@ARGV); our ($UserName,$UserHome,$X2GoSID,$X2GoSesHome,$X2GoTKSHome,$TeKiLSockPath) = getBasicClientsideInfo($CmdFlags{'X2GOSID'}); appDBugLog("-------------------------------------------\nStarting....."); @@ -127,9 +127,9 @@ my $mpCacheMinimum = 20.0; my $LocalSocket; if (-S $TeKiLSockPath) { - # We used to do connection stuff here... we still may want to do something here.... who knows... + # We used to do connection stuff here... we still may want to do something here.... who knows... } else { - appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); + appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); } my %mpState; @@ -142,7 +142,7 @@ $mpState{'paused'} = 0; $mpState{'noshow'} = 1; $mpState{'mute'} = 0; $mpState{'volume'} = 0;# Change this to get from server side! -$mpState{'osd'} = 0; +$mpState{'osd'} = 0; $mpState{'LASTINPUT'} = ""; $mpState{'prevSecond'} = 0; ###########################33 @@ -154,7 +154,7 @@ setMediaInfo(0); $sstatusi{'lastCOMtime'} = (time()+5);# Initiate "lastCOMtime" so we dont crash and burn before we ever get started... $sstatusi{'runState'} = "R"; ##################################### ##################################### ##################################### ##################################### -# The Main Gtk2 event loop +# The Main Gtk2 event loop Gtk2->init; my $window = Gtk2::Window->new('popup'); @@ -167,9 +167,9 @@ $ebox->modify_bg('normal',Gtk2::Gdk::Color->new(0x0000, 0x0000, 0x0000)); $vbox->pack_start($ebox, TRUE, TRUE, 0); $window->add($vbox); $vbox->set_border_width(0); -$window->set_decorated(0); -$window->set_keep_above(1); -$window->signal_connect(event => \&windowEvent); +$window->set_decorated(0); +$window->set_keep_above(1); +$window->signal_connect(event => \&windowEvent); $window->set_focus_on_map(FALSE); $window->set_accept_focus(FALSE); $window->show_all(); @@ -184,7 +184,7 @@ while ($X2GoCliWinID < 1) { my ($tmpSwXid,undef) = <SWXID>; close(SWXID); if ($tmpSwXid =~ /ID:(\d*)/) { - dbugPrint("session.window file OK ($1)"); + dbugPrint("session.window file OK ($1)"); my $gdkwin = $window->window; my $ourXid= $gdkwin->XWINDOW; $mTPWin = Gtk2::Gdk::Window->foreign_new($ourXid); @@ -194,7 +194,7 @@ while ($X2GoCliWinID < 1) { $mTPWin->set_accept_focus(0); } } else { - usleep(10000); + usleep(10000); } } @@ -205,9 +205,9 @@ $TnW{'timeoutRound'} = Glib::Timeout->add (1000, sub {appCOM("YO!");if ($sstatus $TnW{'transglitcpresistance'} = Glib::Timeout->add(100, \&connectionPresistance); $TnW{'mouseDeDodger'} = Glib::Timeout->add(100, sub {if ($olMagic{'dodgeMouse'} eq 1) {doOverlayMagic('dodgemouse',0);}1;}); -Gtk2->main; -# The Main Gtk2 event loop -##################################### ##################################### ##################################### ##################################### +Gtk2->main; +# The Main Gtk2 event loop +##################################### ##################################### ##################################### ##################################### appDBugLog("Execution came to a natural end..."); # Nothing but SUBS past this point.... @@ -222,53 +222,53 @@ sub connectionPresistance { my $time = time(); if ($sstatusi{'startTime'} < ($time-5) and ($sstatusi{'sockState'} ne 3)) { appDBugLog("Its been too long and we still dont have a connection?\nTime to give up!"); - doSelfTerminate(); + doSelfTerminate(); } - if (($sstatusi{'runState'} eq "R") and ($sstatusi{'sockState'} eq 0)) { + if (($sstatusi{'runState'} eq "R") and ($sstatusi{'sockState'} eq 0)) { if (($sstatusi{'sockState'} eq 0) and ( ! defined $LocalSocket)) { $sstatusi{'sockState'} = 1; appDBugLog("Attempting to initiate local socket connection..."); - if ($sstatusi{'sockRetryCnt'} > 0) {# If ther a momentary glitch we'd want to tolerate that but if thers a major problem.... - if ($sstatusi{'sockRetryCnt'} > 10) {# This is a silly attempt at avoiding endless loops when nothing is likely to ever change.. + if ($sstatusi{'sockRetryCnt'} > 0) {# If ther a momentary glitch we'd want to tolerate that but if thers a major problem.... + if ($sstatusi{'sockRetryCnt'} > 10) {# This is a silly attempt at avoiding endless loops when nothing is likely to ever change. appDBugLog("Too many retry attemps at opening the socket connection...\nThere is a problem bigger than just a sporadic glitch..."); - doSelfTerminate(); - } else { # And if thers a problem why not give it some time to hopefully recover - my $sleepTime = (($sstatusi{'sockRetryCnt'}*100000)*2);# For every attempt we wait a bit longer.... + doSelfTerminate(); + } else { # And if thers a problem why not give it some time to hopefully recover + my $sleepTime = (($sstatusi{'sockRetryCnt'}*100000)*2);# For every attempt we wait a bit longer... appDBugLog("Sleeping for: $sleepTime u"); usleep($sleepTime); } } - $sstatusi{'sockRetryCnt'}++; + $sstatusi{'sockRetryCnt'}++; - if (-S $TeKiLSockPath) { + if (-S $TeKiLSockPath) { $LocalSocket= IO::Socket::UNIX->new( Peer => $TeKiLSockPath, Type => SOCK_STREAM, Timeout => 10 ); } else { - appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); + appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); } - if (defined $LocalSocket) { + if (defined $LocalSocket) { $sstatusi{'sockRetryCnt'} = 0; $sstatusi{'sockState'} = 1; - appDBugLog("Connected to local socket!"); + appDBugLog("Connected to local socket!"); $TnW{'LocalSocketWatcher'} = Glib::IO->add_watch( fileno($LocalSocket), [qw/in hup err/], \&handleTheLocalSocket, $LocalSocket); print $LocalSocket "APP|INITC|mteleplayer|$selfSID|$slaveToken|\n"; } else { $sstatusi{'sockState'} = 0; appDBugLog("ERROR: Can't connect to local socket\nTrying to reconnect in a bit..."); - } + } - } + } } return 1; - } + } } ################################################################################################################################# -# Handle incomming stuff from the localsocket +# Handle incomming stuff from the localsocket sub handleTheLocalSocket { my ( $fd, $condition, $fh ) = @_; @@ -315,7 +315,7 @@ sub handleTheLocalSocket { if ($1 =~ /^XPOSTAT\|(\-?\d*)\|(\-?\d*)\|(\d*)\|(\d*)\|(\d)\|.*/) { doOverlayMagic('ssappwin',$1,$2,$3,$4,$5); } - + if ($1 =~ /^MPCMD\|PLAYMEDIA\|([0-9a-zA-Z]{24,64})\|([A-Z]{3,4})\|(\d*)\|(\d*)\|.*/) { @@ -337,16 +337,16 @@ sub handleTheLocalSocket { mpCMD("loadfile $theMediaFilePath"); if ($mpState{'FakeFS'} ne 1) {mpCMD("osd 0");} mpCMD("volume $mpState{'volume'} 1"); - mpCMD("pausing pause");# Load into a paused state + mpCMD("pausing pause");# Load into a paused state if ($StartSeek > 0) { mpCMD("seek $StartSeek 2"); } if ($StartPaused ne 1) { mpCMD("pause");# Unpause - } + } } - } - # elsif ($2 =~ /URL/) {$Type = "url";} + } + # elsif ($2 =~ /URL/) {$Type = "url";} } elsif ($1 =~ /^MPCMD\|FRAMESTEP\|/) { mpCMD("frame_step"); @@ -384,7 +384,7 @@ sub handleTheLocalSocket { appDBugLog($vmessage); doSelfTerminate(); } - appDBugLog("RMX:$saneData"); + appDBugLog("RMX:$saneData"); } } @@ -395,15 +395,15 @@ sub handleTheLocalSocket { $fh = undef; $sstatusi{'sockState'} = 0; return 0; - } + } } - + if ($fh) { return TRUE; } else { appDBugLog("The connection is closed!\n"); return FALSE; - } + } } @@ -421,8 +421,8 @@ sub do_mplayer{ $TnW{'mplayerIOwatcher'} = Gtk2::Helper->add_watch( $mpFH->fileno, 'in', sub {watch_mplayerOutput( $mpFH,$TnW{'mplayerIOwatcher'} );}); } -sub inList2Play { - appDBugLog("Do stuff at end of file or at next or prev button press"); +sub inList2Play { + appDBugLog("Do stuff at end of file or at next or prev button press"); mpCMD("pausing seek 0 2"); # Currently we're only supporting one file so just seek to 0 and pause.... return 1; } @@ -439,17 +439,17 @@ sub doPauseStuff { appDBugLog("UN-PAUSED"); $mpState{'paused'} = 0; appCOM("PAUSED|0|"); - } + } } return 1; -} +} sub doReportTimePos { my $currentTime = $_[0]; - my $lengthTime = $_[1]; + my $lengthTime = $_[1]; $currentTime =~ s/\.[\d]*$//g;$lengthTime =~ s/\.[\d]*$//g; appCOM("UPDATE|TIME|$currentTime|$lengthTime"); -} +} sub watch_mplayerOutput { my ($fh,$tag) = @_; @@ -465,7 +465,7 @@ sub watch_mplayerOutput { # ANSWERS if ($line =~ /^ID/) { ############################# - # GET MEDIA INFO + # GET MEDIA INFO if ($mediaINFO{'MEDIAINFOSET'} ne 1) { if ($line =~ /^ID_VIDEO_FORMAT\=(.*)$/) { $mediaINFO{'VIDEOFORMAT'} = $1; @@ -473,15 +473,15 @@ sub watch_mplayerOutput { $mediaINFO{'AUDIOFORMAT'} = $1; } elsif ($line =~ /^ID_LENGTH\=([\.\d]*)$/) { $mediaINFO{'LENGTH'} = $1; - } elsif ($line =~ /^ID_SEEKABLE\=1$/) { + } elsif ($line =~ /^ID_SEEKABLE\=1$/) { $mediaINFO{'SEEKABLE'} = 1; - } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { + } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { $mediaINFO{'FILENAME'} = $1; } } # GET MEDIA INFO ############################# - } elsif ($line =~ /^Playing(.*)$/) { + } elsif ($line =~ /^Playing(.*)$/) { appDBugLog("Playing: $1"); } elsif (($line =~ /======================================/) or ($line =~ /Starting playback\.\.\./)) { if ($mediaINFO{'MEDIAINFOSET'} ne 1) { @@ -499,11 +499,11 @@ sub watch_mplayerOutput { my $cacheB = $2;$cacheB =~ s/\D//g; appCOM("CACHING|$cacheP|$cacheB|"); } elsif ($line =~ /===== PAUSE =====/) { - doPauseStuff("pause"); + doPauseStuff("pause"); } elsif (($line =~ /^A:/) or ($line =~ /^V:/)) { - doPauseStuff("unpause"); + doPauseStuff("unpause"); if ($line =~ /^A:[\ \.\d]*V:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} - elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} + elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} elsif ($line =~ /^V:[\ ]*([\.\d]*[\ ]*)/) {$mpState{'mediaPos'} = $1;} # $mpState{'mediaPos'} =~ s/\ //g; my ($newSecond,undef) = split(/\./,$mpState{'mediaPos'}); @@ -515,13 +515,13 @@ sub watch_mplayerOutput { if ($mpState{'mediaLength'} > 0) { if (($mpState{'mediaLength'}-1) <= $mpState{'mediaPos'}) { appDBugLog("LOADPOINT 1! $mpState{'mediaLength'} $mpState{'mediaPos'}"); - mpCMD("pausing frame_step"); - inList2Play("next"); + mpCMD("pausing frame_step"); + inList2Play("next"); } - } + } } } elsif ($line =~ /^Failed to open LIRC support/) {#DO NOTHING!! - } elsif (($line =~ /^Failed\ to\ open.*/) or ($line =~ /^File\ not\ found.*/)) { + } elsif (($line =~ /^Failed\ to\ open.*/) or ($line =~ /^File\ not\ found.*/)) { appDBugLog("NOT A FILE!\n $line"); # Do something HERE? } elsif ($line =~ /^Failed\ to\ recognize\ file\ format.*/) { @@ -558,7 +558,7 @@ sub setMediaInfo { foreach my $key (keys %mediaINFO) { appDBugLog("SET\t$key $mediaINFO{$key}"); } - + if ($mediaINFO{'VIDEOFORMAT'} eq 0) { $mediaINFO{'ONLYAUDIO'} = 1; appCOM("ONLYAUDIO|1|"); @@ -584,7 +584,7 @@ sub setMediaInfo { sub doOverlayMagic { my $doWHAT = lc($_[0]); my $changeVis = 0; - my $reTogVis = 0; + my $reTogVis = 0; my $changePos = 0; if ($doWHAT eq "init") { @@ -618,7 +618,7 @@ sub doOverlayMagic { } elsif ($doWHAT eq "csseswin") { appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); - if ($olMagic{'CsSesWin_FS'} ne $_[1]) { + if ($olMagic{'CsSesWin_FS'} ne $_[1]) { if ($_[1] eq 1) { $olMagic{'CsSesWin_FS'} = 1; $reTogVis = 1; @@ -628,9 +628,9 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[1]' for CsSesWin_FS!"); } - } - - if ($olMagic{'CsSesWin_Vis'} ne $_[2]) { + } + + if ($olMagic{'CsSesWin_Vis'} ne $_[2]) { if ($_[2] eq 1) { $olMagic{'CsSesWin_Vis'} = 1; } elsif ($_[2] eq 0) { @@ -638,7 +638,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[2]' for CsSesWin_Vis!"); } - } + } if (($olMagic{'CsSesWin_aX'} ne $_[3]) or ($olMagic{'CsSesWin_aY'} ne $_[4])) { $olMagic{'CsSesWin_aX'} = $_[3]; @@ -665,7 +665,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); $changePos = 1; } - if ($olMagic{'SsAppWin_Vis'} ne $_[5]) { + if ($olMagic{'SsAppWin_Vis'} ne $_[5]) { if ($_[5] eq 1) { $olMagic{'SsAppWin_Vis'} = 1; } elsif ($_[5] eq 0) { @@ -673,14 +673,14 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[5]' for SsAppWin_Vis!"); } - } + } } elsif ($doWHAT eq "onlyaudio") { if ($_[1] eq 1) { $olMagic{'onlyaudio'} = 1; } else { $olMagic{'onlyaudio'} = 0; } - } + } @@ -688,20 +688,20 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); if (($olMagic{'SsAppWin_Vis'} eq 1) and ($olMagic{'CsSesWin_Vis'} eq 1)) { if ($olMagic{'visible'} eq 0) { - $olMagic{'visible'} = 1; + $olMagic{'visible'} = 1; $changeVis = 1; } } else { if ($olMagic{'visible'} eq 1) { - $olMagic{'visible'} = 0; + $olMagic{'visible'} = 0; $changeVis = 1; - } + } } } else { if ($olMagic{'visible'} eq 1) { - $olMagic{'visible'} = 0; + $olMagic{'visible'} = 0; $changeVis = 1; } @@ -722,7 +722,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); if ($mpState{'paused'} eq 1) { $window->resize($olMagic{'SsAppWin_Wdt'},($olMagic{'SsAppWin_Hgt'}-1)); } - $window->show_all; + $window->show_all; $window->resize($olMagic{'SsAppWin_Wdt'},$olMagic{'SsAppWin_Hgt'}); $changePos = 1; @@ -747,27 +747,27 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); my (undef, undef, $x2goWidth, $x2goHeight, undef) = $X2GoCliWin->get_geometry; if ($mpState{'ZoomFS'} eq 1) { $tmpHeight = $tmpWidth; - $tmpY = (($x2goHeight - $tmpWidth)/2); + $tmpY = (($x2goHeight - $tmpWidth)/2); } elsif ($mpState{'ZoomFS'} eq 2) { $tmpWidth = ($tmpWidth * 2); $tmpX = (($x2goWidth - $tmpWidth)/2); } $window->move($tmpX,$tmpY); $window->resize($tmpWidth,$tmpHeight); - } + } } # OVERLAY MAGIC ###################################################################### # Window Event stuff.... just in case we'd want to add more stuff... -sub windowEvent { - my ($mw, $event) = @_; - if ($event->state =~ /button\d\-mask/) { +sub windowEvent { + my ($mw, $event) = @_; + if ($event->state =~ /button\d\-mask/) { doOverlayMagic('dodgemouse',1); } elsif ($event->type =~ /key.*/) { my $type = $event->type; - my $keyval = $event->keyval(); + my $keyval = $event->keyval(); appDBugLog("=== === KEY EVENT: $type ($keyval) === ==="); sendKeyToWin($X2GoCliWinID,$keyval,$type); } @@ -777,14 +777,14 @@ sub sendKeyToWin { my $X11 = X11::Protocol->new; my $X11K = X11::Keyboard->new($X11); my $toWin = $_[0]; - my $theKey = $_[1]; - my $type = "KeyPress"; - if ($_[2] eq "key-release") { + my $theKey = $_[1]; + my $type = "KeyPress"; + if ($_[2] eq "key-release") { $type = "KeyRelease"; - } + } my $keyCode = $X11K->KeysymToKeycode($theKey); print "$theKey $keyCode\n"; - + my $event = $X11->pack_event( name => $type, detail => $keyCode, @@ -802,12 +802,12 @@ sub sendKeyToWin { ################################################################################################################################# # This sub, supposedly try to do a clean termination of the application... -sub doSelfTerminate { +sub doSelfTerminate { $window->hide_all; $runSTATE = "T"; appDBugLog("Self Terminating............\n"); - mpCMD("quit"); - usleep(100000); + mpCMD("quit"); + usleep(100000); if ($TnW{'timeoutRound'}) { Glib::Source->remove($TnW{'timeoutRound'}); @@ -822,7 +822,7 @@ sub doSelfTerminate { appDBugLog("Trying to kill PID: $cleanPID\n"); kill("KILL",$cleanPID); } - } + } } close(PS); @@ -831,10 +831,10 @@ sub doSelfTerminate { $LocalSocket = undef; } - Gtk2->main_quit; - exit; - return FALSE; + Gtk2->main_quit; + exit; + return FALSE; -} +} # And this should be the very end of everything!? ############################################################################################################################################## -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git