This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository mteleplayer. from 8aa50b6 Media area GFX changes depending on state and media type. new b6de670 Total rewrite of the overlay visibility and location handling + cleanup new 987038a Test basic Id3v2 Album Art support audio files...(needs quite a bit more work) new 634daaf mTPAArtExtractor: Add license header. new 06c7719 move libAArtExtractor to lib/ rather then bin/ The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: .../mteleplayer/bin/mteleplayer_clientside | 1078 ++++++++++---------- serverside/bin/mteleplayer | 17 +- .../applications/mteleplayer/mTPAArtExtractor | 45 + 3 files changed, 625 insertions(+), 515 deletions(-) create mode 100755 serverside/lib/telekinesis/server/applications/mteleplayer/mTPAArtExtractor -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository mteleplayer. commit b6de67024e511f8ecfdbf0cc758dd51f18249dd9 Author: gznget <opensource@gznianguan.com> Date: Fri Jul 4 03:54:05 2014 +0200 Total rewrite of the overlay visibility and location handling + cleanup --- .../mteleplayer/bin/mteleplayer_clientside | 1078 ++++++++++---------- 1 file changed, 565 insertions(+), 513 deletions(-) diff --git a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside index 8594ee0..0ddb134 100755 --- a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside +++ b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside @@ -60,94 +60,115 @@ our $theLIBDIR = sanitizeDirPath("$TeKiPaths{'LIB'}/client/applications/mtelep my $mpFH = FileHandle->new; our %CmdFlags = getCmdFlags(@ARGV); -our ($UserName,$UserHome,$X2GoSID,$X2GoSesHome,$X2GoTKSHome,$TeKiLSockPath) = getBasicClientsideInfo($CmdFlags{'X2GOSID'}); +our ($UserName,$UserHome,$X2GoSID,$X2GoSesHome,$X2GoTKSHome,$TeKiLSockPath) = getBasicClientsideInfo($CmdFlags{'X2GOSID'}); + appDBugLog("-------------------------------------------\nStarting....."); + my $selfSID; -if (clups($CmdFlags{'OWNSID'}) =~ /^([a-zA-Z0-9]{3,32})$/) {$selfSID = $1;} else {appDBugLog("My own SID is invalid?");doSelfTerminate();} +if (clups($CmdFlags{'OWNSID'}) =~ /^([a-zA-Z0-9]{3,32})$/) { + $selfSID = $1; +} else { + appDBugLog("My own SID is invalid?"); + doSelfTerminate(); +} my $slaveToken; -if (clups($CmdFlags{'SLAVETOKEN'}) =~ /^([a-zA-Z0-9]{3,32})$/) {$slaveToken = $1;} -else {appDBugLog("Slave token is invalid is invalid?");doSelfTerminate();} +if (clups($CmdFlags{'SLAVETOKEN'}) =~ /^([a-zA-Z0-9]{3,32})$/) { + $slaveToken = $1; +} else { + appDBugLog("Slave token is invalid is invalid?"); + doSelfTerminate(); +} our %TnW; our %sstatusi; -$sstatusi{'sockState'} = 0;$sstatusi{'sockRetryCnt'} = 0;$sstatusi{'runState'} = "I";$sstatusi{'linkState'} = 0;$sstatusi{'dodgeMouse'} = 0; -$sstatusi{'startTime'} = time();$sstatusi{'xposX'} = 10;$sstatusi{'xposY'} = 10;$sstatusi{'xposH'} = 0;$sstatusi{'xposW'} = 0;$sstatusi{'xposV'} = 0; -$sstatusi{'X2GoWFullScreen'} = 1;$sstatusi{'X2GoWVisible'} = 1;$sstatusi{'X2GoWax'} = 0;$sstatusi{'X2GoWay'} = 0;$sstatusi{'X2GoWh'} = 0;$sstatusi{'X2GoWw'} = 0; -$sstatusi{'FinalPosX'} = 0;$sstatusi{'FinalPosY'} = 0;$sstatusi{'FinalPosH'} = 10;$sstatusi{'FinalPosW'} = 10;$sstatusi{'FinalPosV'} = 0; +our %olMagic; + +$sstatusi{'sockState'} = 0; +$sstatusi{'sockRetryCnt'} = 0; +$sstatusi{'runState'} = "I"; +$sstatusi{'linkState'} = 0; +$sstatusi{'startTime'} = time(); my $RemoteAppDataDIR = sanitizeDirPath("$X2GoTKSHome/remote/appData/mteleplayer_$selfSID"); -unless (-d "$X2GoTKSHome/local/appData") {mkdir("$X2GoTKSHome/local/appData");} -unless (-d "$X2GoTKSHome/local/appData/mteleplayer_$selfSID") {mkdir("$X2GoTKSHome/local/appData/mteleplayer_$selfSID");} + +unless (-d "$X2GoTKSHome/local/appData") { + mkdir("$X2GoTKSHome/local/appData"); +} + +unless (-d "$X2GoTKSHome/local/appData/mteleplayer_$selfSID") { + mkdir("$X2GoTKSHome/local/appData/mteleplayer_$selfSID"); +} + my $LocalAppDataDIR = sanitizeDirPath("$X2GoTKSHome/local/appData/mteleplayer_$selfSID"); + my $SlaveFIFO = "$LocalAppDataDIR/mpslave.fifo"; if (-e $SlaveFIFO) { - unlink($SlaveFIFO); + unlink($SlaveFIFO); } mkfifo($SlaveFIFO, 0700); -unless (-p $SlaveFIFO) {appDBugLog("$SlaveFIFO No FIFO pipe form mplayer slave?");doSelfTerminate();} +unless (-p $SlaveFIFO) { + appDBugLog("$SlaveFIFO No FIFO pipe form mplayer slave?"); + doSelfTerminate(); +} + my $mPlayerPath = "/usr/bin/mplayer"; if (-x "/usr/bin/mplayer2") { - $mPlayerPath = "/usr/bin/mplayer2"; + $mPlayerPath = "/usr/bin/mplayer2"; } -appDBugLog("MPS FIFO: $SlaveFIFO"); -$ENV{'MPSLAVEFIFOPATH'} = $SlaveFIFO; -$ENV{'MTPSES_LOCALDATA'} = $LocalAppDataDIR; -$ENV{'MTPC_SHAREPATH'} = $theSHAREDIR; -my $myHomeDir = $ENV{'MTPC_HOMEPATH'}; - 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(); } - -$sstatusi{'runState'} = "R"; -##################################### ##################################### ##################################### ##################################### -# The Main Gtk2 event loop -my %mpState;$mpState{'MediaERROR'} = 0;$mpState{'FakeFS'} = 0;$mpState{'mediaPos'} = 0; $mpState{'mediaLength'} = 0;$mpState{'paused'} = 0; +my %mpState; +$mpState{'MediaERROR'} = 0; +$mpState{'FakeFS'} = 0; +$mpState{'mediaPos'} = 0; +$mpState{'mediaLength'} = 0; +$mpState{'paused'} = 0; $mpState{'noshow'} = 1; $mpState{'mute'} = 0; $mpState{'volume'} = 0;# Change this to get from server side! $mpState{'osd'} = 0; -$mpState{'LASTINPUT'} = "";$mpState{'prevSecond'} = 0; +$mpState{'LASTINPUT'} = ""; +$mpState{'prevSecond'} = 0; ###########################33 # INIT MEDIA INFO my %MediaINFO; setMediaInfo(0); # INIT MEDIA INFO ########################## -$sstatusi{'lastCOMtime'} = (time()+2); -$TnW{'timeoutRound'} = Glib::Timeout->add (1000, sub {appCOM("YO!");if ($sstatusi{'lastCOMtime'} < (time()-2)) {&doSelfTerminate;}1;}); -#$TnW{'overlaystatechange'} = Glib::Timeout->add (250, \&overlayStateChange); -connectionPresistance(); +$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 Gtk2->init; my $window = Gtk2::Window->new('popup'); -$window->set_title('Telekinesis/Teleplay'); +$window->set_title('mTelePlayer OVERLAY'); $window->set_border_width(0); -$window->set_size_request($sstatusi{'FinalPosW'},$sstatusi{'FinalPosH'}); my $vbox = Gtk2::VBox->new( FALSE, 0 ); my $ebox = Gtk2::EventBox->new; $ebox->modify_bg('normal',Gtk2::Gdk::Color->new(0x0000, 0x0000, 0x0000)); $vbox->pack_start($ebox, TRUE, TRUE, 0); $window->add($vbox); -#$window->set_position ('center-always'); $vbox->set_border_width(0); - $window->set_decorated(0); $window->set_keep_above(1); $window->signal_connect(event => \&windowEvent); $window->show_all(); -do_mplayer(); -$window->hide_all(); -$TnW{'transglitcpresistance'} = Glib::Timeout->add (100, \&connectionPresistance); +&do_mplayer; +doOverlayMagic('init'); + +$TnW{'timeoutRound'} = Glib::Timeout->add (1000, sub {appCOM("YO!");if ($sstatusi{'lastCOMtime'} < (time()-2)) {&doSelfTerminate;}1;}); +$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 @@ -155,534 +176,565 @@ Gtk2->main; appDBugLog("Execution came to a natural end..."); # Nothing but SUBS past this point.... -############################################################################################################################################## -############################################################################################################################################ ################################################################################################################################# # HERE IS WHERE WE PUT ALL THE SUBS FOR THIS APP + + ################################################################################################################################# # Basic Socket Stuff sub connectionPresistance { - unless ($ENV{'EPICFAIL'} or $EPICFAIL) { - my $time = time(); - - if (($sstatusi{'dodgeMouse'} ne 0) ){ -# print " MOUSE DODGE detected! ($sstatusi{'dodgeMouse'} $sstatusi{'xposV'})\n"; - $sstatusi{'dodgeMouse'} = 0; - if ($sstatusi{'xposV'} eq 1) { -# print "Re displaying window\n"; - $window->show_all(); - $window->resize($sstatusi{'FinalPosW'},$sstatusi{'FinalPosH'}); - $window->move($sstatusi{'FinalPosX'},$sstatusi{'FinalPosY'}); - } - } - -# appDBugLog("LOOP $time $sstatusi{'sockState'}"); - 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(); - } - 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.. - 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.... - appDBugLog("Sleeping for: $sleepTime u"); - usleep($sleepTime); - } - } - $sstatusi{'sockRetryCnt'}++; - 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(); - } - if (defined $LocalSocket){ - $sstatusi{'sockRetryCnt'} = 0; - $sstatusi{'sockState'} = 1; - 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; - } + unless ($ENV{'EPICFAIL'} or $EPICFAIL) { + 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(); + } + 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.. + 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.... + appDBugLog("Sleeping for: $sleepTime u"); + usleep($sleepTime); + } + } + $sstatusi{'sockRetryCnt'}++; + + 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(); + } + + if (defined $LocalSocket) { + $sstatusi{'sockRetryCnt'} = 0; + $sstatusi{'sockState'} = 1; + 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 sub handleTheLocalSocket { - my ( $fd, $condition, $fh ) = @_; - if ( $condition >= 'hup' or $condition >= 'err' ) { - $sstatusi{'sockState'} = 0; - $LocalSocket->close; - $LocalSocket = undef; - return 0; - } - if ( $condition >= 'in' ) { - my $bytes = sysread($fh,my $data,4096); - if ( length $data ) { - foreach my $dataLine (split(/\n/,$data)) {if (length(clups($dataLine)) > 0) { - # Do something smarter in the future - my $saneData = sanitizer("anumazcsdausdotspipe","$dataLine"); - -# if ($sstatusi{'sockState'} eq 1) {} - if ($saneData =~ /^APPCOM\|(.*)$/) { - $sstatusi{'lastCOMtime'} = time(); - if ($1 =~ /^HELLO/) { - $sstatusi{'sockState'} = 3; - print $LocalSocket "CORE|LOCALSERVICES|mteleplayer|$selfSID|StateOfX2GoCliWin|\n"; - } elsif ($1 =~ /^TERMINATE/) { - doSelfTerminate(); - } - if ($1 =~ /^SET\|AUDIOVOLUME\|(\d{1,3})\|.*/) { - my $newVol = $1; - if (($newVol >= 0) and ($newVol <= 100)) { - $mpState{'volume'} = $newVol; - mpCMD("volume $mpState{'volume'} 1"); - } - } - if ($1 =~ /^XPOSTAT\|(\d*)\|(\d*)\|(\d*)\|(\d*)\|(\d)\|/) { - $sstatusi{'xposX'} = $1; - $sstatusi{'xposY'} = $2; - $sstatusi{'xposH'} = $3; - $sstatusi{'xposW'} = $4; - $sstatusi{'xposV'} = $5; - overlayStateChange(); - } + my ( $fd, $condition, $fh ) = @_; + + if ( $condition >= 'hup' or $condition >= 'err' ) { + $sstatusi{'sockState'} = 0; + $LocalSocket->close; + $LocalSocket = undef; + return 0; + } + + if ( $condition >= 'in' ) { + my $bytes = sysread($fh,my $data,4096); + if (length($data) > 0) { + foreach my $dataLine (split(/\n/,$data)) { + if (length(clups($dataLine)) > 0) { + my $saneData = sanitizer("anumazcsdausdotspipe","$dataLine"); + + if ($saneData =~ /^APPCOM\|(.*)$/) { + $sstatusi{'lastCOMtime'} = time(); + if ($1 =~ /^HELLO/) { + $sstatusi{'sockState'} = 3; + print $LocalSocket "CORE|LOCALSERVICES|mteleplayer|$selfSID|StateOfX2GoCliWin|\n"; + } elsif ($1 =~ /^TERMINATE/) { + doSelfTerminate(); + } + if ($1 =~ /^SET\|AUDIOVOLUME\|(\d{1,3})\|.*/) { + my $newVol = $1; + if (($newVol >= 0) and ($newVol <= 100)) { + $mpState{'volume'} = $newVol; + mpCMD("volume $mpState{'volume'} 1"); + } + } + 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*)\|.*/) { - my $Type = 0; - my $StartSeek = 0; - my $StartPaused = 0; - if ($3 > 0) { - $StartSeek = $3; + if ($1 =~ /^MPCMD\|PLAYMEDIA\|([0-9a-zA-Z]{24,64})\|([A-Z]{3,4})\|(\d*)\|(\d*)\|.*/) { + my $Type = 0; + my $StartSeek = 0; + my $StartPaused = 0; + if ($3 > 0) { + $StartSeek = $3; + } + if ($4 eq 1) {$StartPaused = 1;} + appDBugLog("GOT PLAY COMMAND: 1:$1 2:$2 3:$3"); + if ($2 eq "FILE") { + my $theMediaFilePath = "$RemoteAppDataDIR/$1.file";# SANETIZE THIS MAYBE? + appDBugLog(" FILE:$theMediaFilePath"); + if (-e $theMediaFilePath) { + appDBugLog("THAT FILE EXISTS!!"); + doOverlayMagic('onlyaudio',1);# Just abusing the "onlyaudio" function to hide overlay while caching... + setMediaInfo(0); + mpCMD("loadfile $theMediaFilePath"); + if ($mpState{'FakeFS'} ne 1) {mpCMD("osd 0");} + mpCMD("volume $mpState{'volume'} 1"); + 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 ($1 =~ /^MPCMD\|FRAMESTEP\|/) { + mpCMD("frame_step"); + } elsif ($1 =~ /^MPCMD\|PAUSE\|/) { + mpCMD("pausing pause"); + } elsif ($1 =~ /^MPCMD\|PLAY\|/) { + mpCMD("pausing pause"); + mpCMD("pause"); + } elsif ($1 =~ /^MPCMD\|SEEK\|(\d*)\|/) { + if ($1 <= $mpState{'mediaLength'}) { + mpCMD("seek $1 2"); + } + } elsif ($1 =~ /^MPCMD\|KEYSEEK\|(\-?\d*)\|/) { + my $newPos = ($mpState{'mediaPos'}+$1); + if ($newPos < 0) {$newPos = 0;} + if ($newPos > ($mpState{'mediaLength'}-1)) { + mpCMD("pausing frame_step"); + inList2Play("next"); + } else { + mpCMD("seek $newPos 2"); + } + } + + } elsif ($saneData =~ /^CORE\|SERVICES\|X2GOWINDOWSTATE\|(\d)\|(\d)\|(\-?\d*)\|(\-?\d*)\|(\d*)\|(\d*)\|/) { + doOverlayMagic('csseswin',$1,$2,$3,$4,$5,$6); + } elsif ($saneData =~ /^TERMINATE\|([\w\_]*)\|$/) { + my $vmessage; + if ($1 =~ /NO_PAIR1/) { + $vmessage = "Client and server dont seem to be on the same page....\n\nIncompatible versions of mTelePlayer on the cliet side..."; + } elsif ($1 =~ /NO_PAIR2/) { + $vmessage = "Client and server dont seem to be on the same page....\n\nThe client side do not have mTelePlayer installed!?"; + } elsif ($1 =~ /DUPLICATE/) { + $vmessage = "Killed in the name of duplicate termination!"; + } + appDBugLog($vmessage); + doSelfTerminate(); + } + appDBugLog("RMX:$saneData"); + } + } + + } else { + appDBugLog("Closing local socket.."); + $LocalSocket->close; + $fh->close; + $fh = undef; + $sstatusi{'sockState'} = 0; + return 0; + } + } - } - if ($4 eq 1) {$StartPaused = 1;} - appDBugLog("GOT PLAY COMMAND: 1:$1 2:$2 3:$3"); - if ($2 eq "FILE") { - my $theMediaFilePath = "$RemoteAppDataDIR/$1.file";# SANETIZE THIS MAYBE? - appDBugLog(" FILE:$theMediaFilePath"); - if (-e $theMediaFilePath) { - appDBugLog(" THAT FILE EXISTS!!"); - setMediaInfo(0); - $mpState{'noshow'} = 1; - overlayStateChange(); - mpCMD("loadfile $theMediaFilePath"); - if ($mpState{'FakeFS'} ne 1) {mpCMD("osd 0");} - mpCMD("volume $mpState{'volume'} 1"); - 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";} - - $window->show_all(); - $window->resize($sstatusi{'FinalPosW'},$sstatusi{'FinalPosH'}); - $window->move($sstatusi{'FinalPosX'},$sstatusi{'FinalPosY'}); - overlayStateChange(); -} elsif ($1 =~ /^MPCMD\|FRAMESTEP\|/) { - mpCMD("frame_step"); -} elsif ($1 =~ /^MPCMD\|PAUSE\|/) { - mpCMD("pausing pause"); -} elsif ($1 =~ /^MPCMD\|PLAY\|/) { - mpCMD("pausing pause"); - mpCMD("pause"); -} elsif ($1 =~ /^MPCMD\|SEEK\|(\d*)\|/) { - if ($1 <= $mpState{'mediaLength'}) { - mpCMD("seek $1 2"); - } -} elsif ($1 =~ /^MPCMD\|KEYSEEK\|(\-?\d*)\|/) { - my $newPos = ($mpState{'mediaPos'}+$1); - if ($newPos < 0) {$newPos = 0;} - if ($newPos > ($mpState{'mediaLength'}-1)) { - mpCMD("pausing frame_step"); - inList2Play("next"); - } else { - mpCMD("seek $newPos 2"); - } -} - - -#if ($1 =~ /^MPCMD\|STOP\|/) { -# mpCMD("pausing loadfile $theSHAREDIR/blk.mpg"); -# mpCMD("pause"); -# $window->hide_all(); -#} - } elsif ($saneData =~ /^CORE\|SERVICES\|X2GOWINDOWSTATE\|(\d)\|(\d)\|(\d*)\|(\d*)\|(\d*)\|(\d*)\|/) { -#print "CORE CHANGE $1\n"; - my $retogglevis = 0; - if ($sstatusi{'X2GoWFullScreen'} ne $1) {$retogglevis = 1;} -# if (($sstatusi{'X2GoWh'} ne $5) or ($sstatusi{'X2GoWw'} ne $6)) { -#print "REQUESTING UPDATED XPOS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"; -# appCOM("GET|XPOS|1"); -# } - $sstatusi{'X2GoWFullScreen'} = $1; - $sstatusi{'X2GoWVisible'} = $2; - $sstatusi{'X2GoWax'} = $3; - $sstatusi{'X2GoWay'} = $4; - $sstatusi{'X2GoWh'} = $5; - $sstatusi{'X2GoWw'} = $6; - overlayStateChange(); - if ($retogglevis eq 1) { - $window->hide_all(); - - $window->show_all(); - $window->resize($sstatusi{'FinalPosW'},$sstatusi{'FinalPosH'}); - $window->move($sstatusi{'FinalPosX'},$sstatusi{'FinalPosY'}); - } - - } elsif ($saneData =~ /^TERMINATE\|([\w\_]*)\|$/) { - my $vmessage; - if ($1 =~ /NO_PAIR1/) {$vmessage = "Client and server dont seem to be on the same page....\n\nIncompatible versions of mTelePlayer on the cliet side...";} - elsif ($1 =~ /NO_PAIR2/) {$vmessage = "Client and server dont seem to be on the same page....\n\nThe client side do not have mTelePlayer installed!?";} - elsif ($1 =~ /DUPLICATE/) {$vmessage = "Killed in the name of duplicate termination!";} - - appDBugLog($vmessage);doSelfTerminate(); - } - - appDBugLog("RMX:$saneData"); - - - }} - } else{ - # close socket as there is no data - appDBugLog("Closing local socket.."); - $LocalSocket->close; - $fh->close; - $fh = undef; - $sstatusi{'sockState'} = 0; - Gtk2->main_iteration while Gtk2->events_pending; - return 0; - - } - } - - if ($fh) {# the file handle is still open, so return TRUE possibly have a "connection alive" indicator# print "still connected\n"; - return TRUE; - } else { # we're finished with this job. start another one, if there are any, and uninstall ourselves. - appDBugLog("The connection is closed!\n"); - return FALSE; - } + if ($fh) { + return TRUE; + } else { + appDBugLog("The connection is closed!\n"); + return FALSE; + } } sub appCOM { - my $ComData = sanitizer("anumazcsdausdotspipe",$_[0]); - print $LocalSocket "\nAPPCOM|mteleplayer|$selfSID|$ComData|\n"; -} - - - -sub overlayStateChange { - my %newXPos; - - if ($sstatusi{'X2GoWFullScreen'} eq 1) { - $sstatusi{'X2GoWVisible'} = 1; - $newXPos{'X'} = $sstatusi{'xposX'}; - $newXPos{'Y'} = $sstatusi{'xposY'}; - } else { - $newXPos{'X'} = $sstatusi{'xposX'} + $sstatusi{'X2GoWax'}; - $newXPos{'Y'} = $sstatusi{'xposY'} + $sstatusi{'X2GoWay'}; - } - - $newXPos{'W'} = $sstatusi{'xposW'}; - $newXPos{'H'} = $sstatusi{'xposH'}; - - if (($sstatusi{'X2GoWVisible'} eq 1) and ($sstatusi{'xposV'} eq 1)) { - if ($mpState{'noshow'} eq 1) { - $newXPos{'V'} = 0; - } else { - $newXPos{'V'} = 1; - } - } else { - $newXPos{'V'} = 0; - } - - - if (($newXPos{'X'} ne $sstatusi{'FinalPosX'}) or ($newXPos{'Y'} ne $sstatusi{'FinalPosY'})) { - $sstatusi{'FinalPosX'} = $newXPos{'X'}; - $sstatusi{'FinalPosY'} = $newXPos{'Y'}; -# print "MOVE: $newXPos{'X'},$newXPos{'Y'}\n"; - $window->move($newXPos{'X'},$newXPos{'Y'}); -#$window->set_position($sstatusi{'xposX'},$sstatusi{'xposY'}); - } - - if (($newXPos{'H'} ne $sstatusi{'FinalPosH'}) or ($newXPos{'W'} ne $sstatusi{'FinalPosW'})) { - $sstatusi{'FinalPosH'} = $newXPos{'H'}; - $sstatusi{'FinalPosW'} = $newXPos{'W'}; - $window->resize($newXPos{'W'},$newXPos{'H'}); - } - - - if (($newXPos{'V'} ne $sstatusi{'FinalPosV'}) or ($mpState{'noshow'} eq 1)) { - $sstatusi{'FinalPosV'} = $newXPos{'V'}; - if ($newXPos{'V'} eq 1) { - $window->show_all(); - $window->resize($sstatusi{'FinalPosW'},$sstatusi{'FinalPosH'}); - $window->move($sstatusi{'FinalPosX'},$sstatusi{'FinalPosY'}); - } else { - $window->hide_all(); - } - } - - return 1; - + my $ComData = sanitizer("anumazcsdausdotspipe",$_[0]); + print $LocalSocket "\nAPPCOM|mteleplayer|$selfSID|$ComData|\n"; } ##################################################################3 # MPLAYER STUFF sub do_mplayer{ - my $gdkwindow1 = $ebox->window; - my $xid= $gdkwindow1->XWINDOW; - my $pid = open($mpFH,"-|",$mPlayerPath,'-slave','-input' ,"file=$SlaveFIFO", '-vo','gl','-framedrop','-fs','-wid',$xid,'-volume','0', '-identify','-idle','-nolirc','-cache','4096'); - $TnW{'mplayerIOwatcher'} = Gtk2::Helper->add_watch( $mpFH->fileno, 'in', sub {watch_mplayerOutput( $mpFH,$TnW{'mplayerIOwatcher'} );}); + my $gdkwindow1 = $ebox->window; + my $xid= $gdkwindow1->XWINDOW; + my $pid = open($mpFH,"-|",$mPlayerPath,'-slave','-input' ,"file=$SlaveFIFO", '-vo','gl','-framedrop','-fs','-wid',$xid,'-volume','0', '-identify','-idle','-nolirc','-cache','4096'); + $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"); - mpCMD("pausing seek 0 2"); # Currently we're only supporting one file so just seek to 0 and pause.... - return 1; + 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; } sub doPauseStuff { - if ($_[0] eq "pause") { - unless ($mpState{'paused'} eq 1) { appDBugLog(">>>> PAUSED <<<<"); - $mpState{'paused'} = 1; - appCOM("PAUSED|1|"); - } - } else { - if ($mpState{'paused'} eq 1) { appDBugLog("UN-PAUSED"); - $mpState{'paused'} = 0; - appCOM("PAUSED|0|"); - } - } - return 1; + if ($_[0] eq "pause") { + unless ($mpState{'paused'} eq 1) { + appDBugLog(">>>> PAUSED <<<<"); + $mpState{'paused'} = 1; + appCOM("PAUSED|1|"); + } + } else { + if ($mpState{'paused'} eq 1) { + appDBugLog("UN-PAUSED"); + $mpState{'paused'} = 0; + appCOM("PAUSED|0|"); + } + } + return 1; } sub doReportTimePos { - my $currentTime = $_[0]; - my $lengthTime = $_[1]; - $currentTime =~ s/\.[\d]*$//g;$lengthTime =~ s/\.[\d]*$//g; -# print "rtp2: $currentTime/$lengthTime\n\n"; - appCOM("UPDATE|TIME|$currentTime|$lengthTime"); + my $currentTime = $_[0]; + my $lengthTime = $_[1]; + $currentTime =~ s/\.[\d]*$//g;$lengthTime =~ s/\.[\d]*$//g; + appCOM("UPDATE|TIME|$currentTime|$lengthTime"); } - sub watch_mplayerOutput { - my ($fh,$tag) = @_; - my $buffer; - if ( not sysread($fh, $buffer, 4096) ) { - Gtk2::Helper->remove_watch ($tag) or die "couldn't remove watcher"; - close($fh); - return 1; - } - foreach my $line (split(/\n/,$buffer)) { - $line =~ s/[\n\r\t]//g; -############### -# Trigers... -# if ($line =~ /^Starting playback\.\.\./) {# mpCMD("get_file_name"); -# if ($mpState{'FakeFS'} ne 1) {mpCMD("osd 0");} -# mpCMD("get_time_length"); -# mpCMD("volume $mpState{'volume'} 1"); -# if ($mpState{'notInitial'} ne 1) { -# $mpState{'notInitial'} = 1; -# appCOM("GIVEMEFIRSTMEDIATOINIT"); -# } -# } -# Triggers -############### -# ANSWERS - if ($line =~ /^ID/) { - ############################# - # GET MEDIA INFO - if ($mediaINFO{'MEDIAINFOSET'} ne 1) { - if ($line =~ /^ID_VIDEO_FORMAT\=(.*)$/) { - $mediaINFO{'VIDEOFORMAT'} = $1; - } elsif ($line =~ /^ID_AUDIO_FORMAT\=(.*)$/) { - $mediaINFO{'AUDIOFORMAT'} = $1; - } elsif ($line =~ /^ID_LENGTH\=([\.\d]*)$/) { - $mediaINFO{'LENGHT'} = $1; - } elsif ($line =~ /^ID_SEEKABLE\=1$/) { - $mediaINFO{'SEEKABLE'} = 1; - } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { - $mediaINFO{'FILENAME'} = $1; - } - } - # GET MEDIA INFO - ############################# - } elsif ($line =~ /^Playing(.*)$/) { - appDBugLog("SET X:$1:X"); - } elsif (($line =~ /======================================/) and ($mediaINFO{'MEDIAINFOSET'} ne 1)) { - appDBugLog("SET STATUS!"); - setMediaInfo(1);# Trigger setMediaInfo DONE... - } elsif ($line =~ /^ANS\_FILENAME\=\'(.*)\'$/) { - $mpState{'mediaFileName'} = $1;# print "File: $1\n"; - } elsif ($line =~ /^ANS\_LENGTH\=([\d\.]*)$/) { -# $mpState{'mediaLength'} = $1; - } elsif ($line =~ /^Cache fill:([\ \d\.\%]*)\((\d*) bytes\)/) { - appDBugLog("Cache fill! [$1] [$2]"); - my $cacheP = $1;$cacheP =~ s/\ //g; - my $cacheB = $2;$cacheB =~ s/\D//g; - appCOM("CACHING|$cacheP|$cacheB|"); - } elsif ($line =~ /===== PAUSE =====/) { - doPauseStuff("pause"); - } elsif (($line =~ /^A:/) or ($line =~ /^V:/)) { - doPauseStuff("unpause"); - if ($line =~ /^A:[\ \.\d]*V:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} - elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} - elsif ($line =~ /^V:[\ ]*([\.\d]*[\ ]*)/) {$mpState{'mediaPos'} = $1;} - $mpState{'mediaPos'}++;$mpState{'mediaPos'}--; - my ($newSecond,undef) = split(/\./,$mpState{'mediaPos'}); - if ($newSecond ne $mpState{'prevSecond'}) { - $mpState{'prevSecond'} = $newSecond; - doReportTimePos($newSecond,$mpState{'mediaLength'}); - appDBugLog("MP: :$mpState{'mediaLength'}: :$mpState{'mediaPos'}:"); - if ($mpState{'mediaLength'} > 0) { - if (($mpState{'mediaLength'}-1) <= $mpState{'mediaPos'}) { - appDBugLog("LOADPOINT 1! $mpState{'mediaLength'} $mpState{'mediaPos'}"); - 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.*/)) { - appDBugLog("NOT A FILE!\n $line"); -# Do something HERE? - } elsif ($line =~ /^Failed\ to\ recognize\ file\ format.*/) { - appDBugLog("NOT A MEDIA FILE!\n $line\n"); -# DO SOMETHING HERE? - } else { - appDBugLog("UNCUAGHT:\n $line\n"); - } -# ANSWERS -############### - } - return 1; + my ($fh,$tag) = @_; + my $buffer; + if ( not sysread($fh, $buffer, 4096) ) { + Gtk2::Helper->remove_watch ($tag) or die "couldn't remove watcher"; + close($fh); + return 1; + } + foreach my $line (split(/\n/,$buffer)) { + $line =~ s/[\n\r\t]//g; + ############### + # ANSWERS + if ($line =~ /^ID/) { + ############################# + # GET MEDIA INFO + if ($mediaINFO{'MEDIAINFOSET'} ne 1) { + if ($line =~ /^ID_VIDEO_FORMAT\=(.*)$/) { + $mediaINFO{'VIDEOFORMAT'} = $1; + } elsif ($line =~ /^ID_AUDIO_FORMAT\=(.*)$/) { + $mediaINFO{'AUDIOFORMAT'} = $1; + } elsif ($line =~ /^ID_LENGTH\=([\.\d]*)$/) { + $mediaINFO{'LENGHT'} = $1; + } elsif ($line =~ /^ID_SEEKABLE\=1$/) { + $mediaINFO{'SEEKABLE'} = 1; + } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { + $mediaINFO{'FILENAME'} = $1; + } + } + # GET MEDIA INFO + ############################# + } elsif ($line =~ /^Playing(.*)$/) { + appDBugLog("Playing: $1"); + } elsif (($line =~ /======================================/) and ($mediaINFO{'MEDIAINFOSET'} ne 1)) { + appDBugLog("SET MEDIAINFO TRIG 1!"); + setMediaInfo(1);# Trigger setMediaInfo DONE... + } elsif ($line =~ /^ANS\_FILENAME\=\'(.*)\'$/) { + $mpState{'mediaFileName'} = $1; + } elsif ($line =~ /^Cache fill:([\ \d\.\%]*)\((\d*) bytes\)/) { + appDBugLog("Cache fill! [$1] [$2]"); + my $cacheP = $1;$cacheP =~ s/\ //g; + my $cacheB = $2;$cacheB =~ s/\D//g; + appCOM("CACHING|$cacheP|$cacheB|"); + } elsif ($line =~ /===== PAUSE =====/) { + doPauseStuff("pause"); + } elsif (($line =~ /^A:/) or ($line =~ /^V:/)) { + doPauseStuff("unpause"); + if ($line =~ /^A:[\ \.\d]*V:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} + elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} + elsif ($line =~ /^V:[\ ]*([\.\d]*[\ ]*)/) {$mpState{'mediaPos'} = $1;} + $mpState{'mediaPos'}++;$mpState{'mediaPos'}--; + my ($newSecond,undef) = split(/\./,$mpState{'mediaPos'}); + if ($newSecond ne $mpState{'prevSecond'}) { + $mpState{'prevSecond'} = $newSecond; + doReportTimePos($newSecond,$mpState{'mediaLength'}); + appDBugLog("MP: :$mpState{'mediaLength'}: :$mpState{'mediaPos'}:"); + if ($mpState{'mediaLength'} > 0) { + if (($mpState{'mediaLength'}-1) <= $mpState{'mediaPos'}) { + appDBugLog("LOADPOINT 1! $mpState{'mediaLength'} $mpState{'mediaPos'}"); + 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.*/)) { + appDBugLog("NOT A FILE!\n $line"); + # Do something HERE? + } elsif ($line =~ /^Failed\ to\ recognize\ file\ format.*/) { + appDBugLog("NOT A MEDIA FILE!\n $line\n"); + # DO SOMETHING HERE? + } else { + appDBugLog("UNCUAGHT:\n $line\n"); + } + # ANSWERS + ############### + } + return 1; } - - sub mpCMD { - open(CTRL,">$SlaveFIFO");print CTRL "$_[0]\n";close(CTRL); + open(CTRL,">$SlaveFIFO");print CTRL "$_[0]\n";close(CTRL); } - sub setMediaInfo { - appDBugLog("SET setMediaINFO :$_[0]:"); - if ($_[0] eq 0) { - $mediaINFO{'AUDIOFORMAT'} = 0; - $mediaINFO{'VIDEOFORMAT'} = 0; - $mediaINFO{'LENGHT'} = 0; - $mediaINFO{'SEEKABLE'} = 0; - $mediaINFO{'FILENAME'} = 0; - $mediaINFO{'ONLYAUDIO'} = 0; - $mediaINFO{'MEDIAINFOSET'} = 0; - } elsif ($_[0] eq 1) { - appDBugLog("SET setMediaINFO:"); - foreach my $key (keys %mediaINFO) { - appDBugLog("SET\t$key $mediaINFO{$key}"); - } + appDBugLog("SET setMediaINFO :$_[0]:"); + if ($_[0] eq 0) { + + $mediaINFO{'AUDIOFORMAT'} = 0; + $mediaINFO{'VIDEOFORMAT'} = 0; + $mediaINFO{'LENGHT'} = 0; + $mediaINFO{'SEEKABLE'} = 0; + $mediaINFO{'FILENAME'} = 0; + $mediaINFO{'ONLYAUDIO'} = 0; + $mediaINFO{'MEDIAINFOSET'} = 0; + + } elsif ($_[0] eq 1) { + + appDBugLog("SET setMediaINFO:"); + foreach my $key (keys %mediaINFO) { + appDBugLog("SET\t$key $mediaINFO{$key}"); + } - if ($mediaINFO{'VIDEOFORMAT'} eq 0) { - $mediaINFO{'ONLYAUDIO'} = 1; - appCOM("ONLYAUDIO|1|"); - $mpState{'noshow'} = 1; - } else { - appCOM("ONLYAUDIO|0|"); - $mpState{'noshow'} = 0; - } - $mpState{'mediaLength'} = $mediaINFO{'LENGHT'}; - doReportTimePos("0.00",$mpState{'mediaLength'}); - - $mediaINFO{'MEDIAINFOSET'} = 1; - - overlayStateChange(); - } elsif ((uc($_[0]) =~ /^([A-Z]{3,})$/) and (length($_[1]) > 0)) { - $mediaINFO{$1} = $_[1]; - } + if ($mediaINFO{'VIDEOFORMAT'} eq 0) { + $mediaINFO{'ONLYAUDIO'} = 1; + appCOM("ONLYAUDIO|1|"); + doOverlayMagic('onlyaudio',1); + } else { + appCOM("ONLYAUDIO|0|"); + doOverlayMagic('onlyaudio',0); + } + + $mpState{'mediaLength'} = $mediaINFO{'LENGHT'}; + doReportTimePos("0.00",$mpState{'mediaLength'}); + $mediaINFO{'MEDIAINFOSET'} = 1; + + } elsif ((uc($_[0]) =~ /^([A-Z]{3,})$/) and (length($_[1]) > 0)) { + $mediaINFO{$1} = $_[1]; + } + } # MPLAYER STUFF ###################################################################### -sub shouldWeBeVisible { - my $visible = 1; - if ($mpState{'noshow'} eq 1) {$visible = 0;} - - if ($visible eq 1) { - return 1; - } else { - return 0; - } +# OVERLAY MAGIC +sub doOverlayMagic { + my $doWHAT = lc($_[0]); + my $changeVis = 0; + my $reTogVis = 0; + my $changePos = 0; + if ($doWHAT eq "init") { + $olMagic{'CsSesWin_FS'} = 0; + $olMagic{'CsSesWin_Vis'} = 0; + $olMagic{'CsSesWin_aX'} = 0; + $olMagic{'CsSesWin_aY'} = 0; + $olMagic{'CsSesWin_Hgt'} = 0; + $olMagic{'CsSesWin_Wdt'} = 0; + + $olMagic{'SsAppWin_X'} = 0; + $olMagic{'SsAppWin_Y'} = 0; + $olMagic{'SsAppWin_Hgt'} = 0; + $olMagic{'SsAppWin_Wdt'} = 0; + $olMagic{'SsAppWin_Vis'} = 0; + + $olMagic{'overlay_X'} = 0; + $olMagic{'overlay_Y'} = 0; + $olMagic{'onlyaudio'} = 1;# Abusing this again... + $olMagic{'visible'} = 0; + $window->hide_all; + } elsif ($doWHAT eq "dodgemouse") { + + if ($_[1] eq 1) { + $olMagic{'dodgeMouse'} = 1; + appDBugLog("Dodging MOUSE"); + } else { + $olMagic{'dodgeMouse'} = 0; + appDBugLog("UnDodging MOUSE"); + } + + } elsif ($doWHAT eq "csseswin") { + + if ($olMagic{'CsSesWin_FS'} ne $_[1]) { + if ($_[1] eq 1) { + $olMagic{'CsSesWin_FS'} = 1; + $reTogVis = 1; + } elsif ($_[1] eq 0) { + $olMagic{'CsSesWin_FS'} = 0; + $reTogVis = 1; + } else { + appDBugLog("ERROR: Got wrong value '$_[1]' for CsSesWin_FS!"); + } + } + + if ($olMagic{'CsSesWin_Vis'} ne $_[2]) { + if ($_[2] eq 1) { + $olMagic{'CsSesWin_Vis'} = 1; + } elsif ($_[2] eq 0) { + $olMagic{'CsSesWin_Vis'} = 0; + } 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]; + $olMagic{'CsSesWin_aY'} = $_[4]; + $changePos = 1; + } + + if (($olMagic{'CsSesWin_Hgt'} ne $_[5]) or ($olMagic{'CsSesWin_Wdt'} ne $_[6])) { + $olMagic{'CsSesWin_Hgt'} = $_[5]; + $olMagic{'CsSesWin_Wdt'} = $_[6]; + } + + } elsif ($doWHAT eq "ssappwin") { + + if (($olMagic{'SsAppWin_X'} ne $_[1]) or ($olMagic{'SsAppWin_Y'} ne $_[2])) { + $olMagic{'SsAppWin_X'} = $_[1]; + $olMagic{'SsAppWin_Y'} = $_[2]; + $changePos = 1; + } + + if (($olMagic{'SsAppWin_Hgt'} ne $_[3]) or ($olMagic{'SsAppWin_Wdt'} ne $_[4])) { + $olMagic{'SsAppWin_Hgt'} = $_[3]; + $olMagic{'SsAppWin_Wdt'} = $_[4]; + $changePos = 1; + } + + if ($olMagic{'SsAppWin_Vis'} ne $_[5]) { + if ($_[5] eq 1) { + $olMagic{'SsAppWin_Vis'} = 1; + } elsif ($_[5] eq 0) { + $olMagic{'SsAppWin_Vis'} = 0; + } 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; + } + } + + + + if (($olMagic{'dodgeMouse'} ne 1) and ($olMagic{'onlyaudio'} ne 1)) { + + if (($olMagic{'SsAppWin_Vis'} eq 1) and ($olMagic{'CsSesWin_Vis'} eq 1)) { + if ($olMagic{'visible'} eq 0) { + $olMagic{'visible'} = 1; + $changeVis = 1; + } + } else { + if ($olMagic{'visible'} eq 1) { + $olMagic{'visible'} = 0; + $changeVis = 1; + } + } + + } else { + + if ($olMagic{'visible'} eq 1) { + $olMagic{'visible'} = 0; + $changeVis = 1; + } + + } + + + + + if (($changeVis eq 1) or ($reTogVis eq 1)) { + if ($olMagic{'visible'} eq 0) { + if ($window->visible) { + $window->hide_all; + } + } else { + if ($reTogVis eq 1) { + if ($window->visible) { + $window->hide_all; + } + } + unless ($window->visible) { + $window->move($olMagic{'overlay_X'},$olMagic{'overlay_Y'}); + $window->resize($olMagic{'SsAppWin_Wdt'},$olMagic{'SsAppWin_Hgt'}); + $window->show_all; + $changePos = 1; + } + } + } + + if ($changePos eq 1) { + if ($olMagic{'visible'} eq 1) { + $olMagic{'overlay_X'} = $olMagic{'CsSesWin_aX'}+$olMagic{'SsAppWin_X'}; + $olMagic{'overlay_Y'} = $olMagic{'CsSesWin_aY'}+$olMagic{'SsAppWin_Y'}; + $window->move($olMagic{'overlay_X'},$olMagic{'overlay_Y'}); + $window->resize($olMagic{'SsAppWin_Wdt'},$olMagic{'SsAppWin_Hgt'}); + } + } + + } +# OVERLAY MAGIC +###################################################################### +# Window Event stuff.... just in case we'd want to add more stuff... + sub windowEvent { - my ($mw, $event) = @_; -# print "E:",$event->type,":E\n"; -# print "S:",$event->state,":S\n"; -#if ($event->type eq "motion-notify") { -# print "S:",$event->state,":S\n"; - if ($event->state =~ /button\d\-mask/) { -# print "BUTTON DOWN LA!\n"; - $sstatusi{'dodgeMouse'} = time(); - $window->hide_all(); - } - # } + my ($mw, $event) = @_; + if ($event->state =~ /button\d\-mask/) { + doOverlayMagic('dodgemouse',1); + } } + ################################################################################################################################# # This sub, supposedly try to do a clean termination of the application... sub doSelfTerminate { - appDBugLog("Self Terminating............\n"); - if ($TnW{'timeoutRound'}) { - Glib::Source->remove($TnW{'timeoutRound'}); - } - $runSTATE = "T"; - mpCMD("quit"); - usleep(100000); - open(PS,"/bin/ps x --no-headers -o %u,%p,%n,%a|"); - while (my $psLine = <PS>) { - if (length($psLine) > 0) { - my ($user,$pid,$nice,$cmd) = split(/\,/,$psLine); - if ($cmd =~ /$SlaveFIFO/) { - appDBugLog("Trying to kill PID: $pid\n"); - kill("KILL",$pid); - } - } - } - close(PS); - - if (defined $LocalSocket){ - $LocalSocket->close; - $LocalSocket = undef; - } - - Gtk2->main_quit; - exit; - return FALSE; + $window->hide_all; + $runSTATE = "T"; + appDBugLog("Self Terminating............\n"); + mpCMD("quit"); + usleep(100000); + + if ($TnW{'timeoutRound'}) { + Glib::Source->remove($TnW{'timeoutRound'}); + } + + open(PS,"/bin/ps x --no-headers -o %u,%p,%n,%a|"); + while (my $psLine = <PS>) { + if (length($psLine) > 0) { + my ($user,$pid,$nice,$cmd) = split(/\,/,$psLine); + if ($cmd =~ /$SlaveFIFO/) { + my $cleanPID = sanitizer("num",$pid); + appDBugLog("Trying to kill PID: $cleanPID\n"); + kill("KILL",$cleanPID); + } + } + } + close(PS); + + if (defined $LocalSocket){ + $LocalSocket->close; + $LocalSocket = undef; + } + + 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository mteleplayer. commit 987038adee88564877f222b4322ef67283a2c540 Author: gznget <opensource@gznianguan.com> Date: Fri Jul 4 06:43:31 2014 +0200 Test basic Id3v2 Album Art support audio files...(needs quite a bit more work) --- serverside/bin/mTPAArtExtractor | 17 +++++++++++++++++ serverside/bin/mteleplayer | 16 ++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/serverside/bin/mTPAArtExtractor b/serverside/bin/mTPAArtExtractor new file mode 100755 index 0000000..f73d5cc --- /dev/null +++ b/serverside/bin/mTPAArtExtractor @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +my $inFile = @ARGV[0]; + +if (-f $inFile) { + my $pid = open(EXIF,"-|","/usr/bin/exiftool",'-PICTURE','-b',$inFile); + my @EXIF = <EXIF>; + close(EXIF); + + if (length("@EXIF") > 1000) { + my $outFile = $inFile; + $outFile =~ s/\.file\ *$//g; + open(CONV,"|-","/usr/bin/convert",'-','-resize','300x300',"$outFile.jpg"); + print CONV @EXIF; + close(CONV); + } +} diff --git a/serverside/bin/mteleplayer b/serverside/bin/mteleplayer index 586c73f..0262819 100755 --- a/serverside/bin/mteleplayer +++ b/serverside/bin/mteleplayer @@ -526,7 +526,16 @@ sub handleTheLocalSocket { if ($1 =~ /^ONLYAUDIO\|(\d)\|.*$/) { if ($1 eq 1) { $PlayerStatus{'OnylAudio'} = 1; - $GTKS{'MainMediaEBOXGFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'musicalNote'}); + my $remoteDir = sanitizeDirPath("$X2GoTKSHome/remote/appData/mteleplayer\_$selfSID"); +print "$remoteDir/$PlayerStatus{'currentMediaID'}.jpg\n"; + if (-f "$remoteDir/$PlayerStatus{'currentMediaID'}.jpg") { + my $AlbumArt = Gtk2::Gdk::Pixbuf->new_from_file("$remoteDir/$PlayerStatus{'currentMediaID'}.jpg") or appDBugLog("Unable to load '$remoteDir/$PlayerStatus{'currentMediaID'}.jpg' to PixBUF... Is it even a GFX file?"); + if ($AlbumArt) { + $GTKS{'MainMediaEBOXGFX'}->set_from_pixbuf($AlbumArt); + } + } else { + $GTKS{'MainMediaEBOXGFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'musicalNote'}); + } } else { $PlayerStatus{'OnylAudio'} = 0; $GTKS{'MainMediaEBOXGFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'eyesore'}); @@ -772,7 +781,10 @@ sub mtpTeKiRemoteFileSetup { unless (-l "$remoteDir/$uniqueFileID.file") { # And in the insanely unlikely event that it happends again.. fk it... symlink($AbsoluteMediaFilePath,"$remoteDir/$uniqueFileID.file"); # Later maybe create a <SAME_UNIQUEID>.info file that cointains Title and other stuff that can make the GUI info etc pre load and look smoother.... - if (-l "$remoteDir/$uniqueFileID.file") { + if (-l "$remoteDir/$uniqueFileID.file") { + if (($AorV eq "A") and (-x "/usr/bin/mTPAArtExtractor")) { + system("/usr/bin/mTPAArtExtractor $remoteDir/$uniqueFileID.file &"); + } return $uniqueFileID; } else {return 0;} } -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository mteleplayer. commit 634daaf15e19cf7504c27e185498accaef1bef1d Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Jul 4 09:42:11 2014 +0200 mTPAArtExtractor: Add license header. --- serverside/bin/mTPAArtExtractor | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/serverside/bin/mTPAArtExtractor b/serverside/bin/mTPAArtExtractor index f73d5cc..4443762 100755 --- a/serverside/bin/mTPAArtExtractor +++ b/serverside/bin/mTPAArtExtractor @@ -1,5 +1,33 @@ #!/usr/bin/perl +# 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. +# Guangzhou Nianguan Electronics Technology Co.Ltd. +# Jin Fu Building , #90 QiFuRoad, +# Guangzhou, Guangdong, +# People's Republic of China +# +# Web: http://opensource.gznianguan.com/ +# E-mail: <opensource@gznianguan.com> + my $inFile = @ARGV[0]; if (-f $inFile) { -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository mteleplayer. commit 06c771914df37f1e8452997ef209d4276bb48a21 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Jul 4 09:42:41 2014 +0200 move libAArtExtractor to lib/ rather then bin/ --- serverside/bin/mteleplayer | 5 +++-- .../applications/mteleplayer}/mTPAArtExtractor | 0 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/serverside/bin/mteleplayer b/serverside/bin/mteleplayer index 0262819..046f677 100755 --- a/serverside/bin/mteleplayer +++ b/serverside/bin/mteleplayer @@ -57,6 +57,7 @@ use Data::Dumper; # Do directory stuff here our %TeKiPaths = getTeKiPaths("S"); our $theSHAREDIR = sanitizeDirPath("$TeKiPaths{'SHARE'}/server/applications/mteleplayer") or die("NO SHARE DIR?"); +our $theLIBDIR = sanitizeDirPath("$TeKiPaths{'LIB'}/server/applications/mteleplayer") or die("NO LIB DIR?"); # Do directory stuff here ######################################################################################################## @@ -782,8 +783,8 @@ sub mtpTeKiRemoteFileSetup { symlink($AbsoluteMediaFilePath,"$remoteDir/$uniqueFileID.file"); # Later maybe create a <SAME_UNIQUEID>.info file that cointains Title and other stuff that can make the GUI info etc pre load and look smoother.... if (-l "$remoteDir/$uniqueFileID.file") { - if (($AorV eq "A") and (-x "/usr/bin/mTPAArtExtractor")) { - system("/usr/bin/mTPAArtExtractor $remoteDir/$uniqueFileID.file &"); + if (($AorV eq "A") and (-x "$theLIBDIR/mTPAArtExtractor")) { + system("$theLIBDIR/mTPAArtExtractor" $remoteDir/$uniqueFileID.file &"); } return $uniqueFileID; } else {return 0;} diff --git a/serverside/bin/mTPAArtExtractor b/serverside/lib/telekinesis/server/applications/mteleplayer/mTPAArtExtractor similarity index 100% rename from serverside/bin/mTPAArtExtractor rename to serverside/lib/telekinesis/server/applications/mteleplayer/mTPAArtExtractor -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git