From 9a558c3b5a39dc26ad093ca2cddc3d930601a321 Mon Sep 17 00:00:00 2001 From: GZNGET FOSS Team Date: Wed, 6 Sep 2017 08:59:12 +0200 Subject: Hybrid version --- bin/arctica-mediaplayer | 68 ++++++++++++------------------------ bin/arctica-mediaplayer-lighttpd | 63 ---------------------------------- bin/arctica-mediaplayer-overlay | 74 ++++++++++++++++++++-------------------- 3 files changed, 59 insertions(+), 146 deletions(-) delete mode 100755 bin/arctica-mediaplayer-lighttpd (limited to 'bin') diff --git a/bin/arctica-mediaplayer b/bin/arctica-mediaplayer index b0866ce..9da9614 100755 --- a/bin/arctica-mediaplayer +++ b/bin/arctica-mediaplayer @@ -1,5 +1,4 @@ #!/usr/bin/perl -X -T - ################################################################################ # _____ _ # |_ _| |_ ___ @@ -65,19 +64,8 @@ my $ACO = Arctica::Core::eventInit->new({ app_class =>'tekiapp', app_version=>'0.0.0.1'}); -my $fullpath = abs_path(@ARGV[0]); -my $link_id; -if (-f $fullpath) { - print "FP: $fullpath\n"; - if ($fullpath =~ /(.*)/) { - $fullpath = $1; - } - $link_id = time(); - symlink($fullpath,"/var/lib/arctica-mediaplayer/www/private/$link_id.lnk"); -} else { - print "PLAY WHAT?!!\n\n";die; -} -print "FUP:\t$fullpath\nLID:\t$link_id\n"; + +#print "FUP:\t$fullpath\nLID:\t$link_id\n"; #die; my $TeKiGtk3 = Arctica::Telekinesis::Application::Gtk3->new($ACO,{ services => { @@ -90,12 +78,28 @@ my $TeKiGtk3 = Arctica::Telekinesis::Application::Gtk3->new($ACO,{ }); LoadCSS(); + +my $fullpath = abs_path(@ARGV[0]); +my $link_id; +if (-f $fullpath) { +# print "FP: $fullpath\n"; + if ($fullpath =~ /(.*)/) { + $fullpath = $1; + } else { + die; + } +# $link_id = time(); +# symlink($fullpath,"/var/lib/arctica-mediaplayer/www/private/$link_id.lnk"); +} else { + print "PLAY WHAT?!!\n\n";die; +} + my $main_window = Gtk3::Window->new('toplevel'); -$main_window->set_title('TEST WINDOW'); +$main_window->set_title('aTelePlayer'); my $window_id = $TeKiGtk3->add_window($main_window); -my $target_id = $TeKiGtk3->new_target($window_id,"multimedia"); -$TeKiGtk3->{'targets'}{$target_id}{'tmplnkid'} = $link_id;#TMP GARBAGE +my $target_id = $TeKiGtk3->new_target($window_id,"multimedia",$fullpath); +$TeKiGtk3->{'targets'}{$target_id}{'tmplnkid'} = $TeKiGtk3->req_file_forwarding($fullpath);#TMP GARBAGE #my $box = Gtk3::Box->new( 'horizontal', 0 ); @@ -107,36 +111,8 @@ my $vBox = Gtk3::Box->new( 'vertical', 0 ); $main_window->add($vBox); $vBox->show(); -my $menubar = Gtk3::MenuBar->new; -$vBox->pack_start($menubar, 0, 1, 0 ); + $vBox->pack_start($TeKiGtk3->get_widget($target_id), 1, 1, 0 ); -$menubar->show(); -#my $menu = create_menu(1); -my $menuitem = Gtk3::MenuItem->new_with_label("File"); -#$menuitem->set_submenu($menu); -$menubar->append($menuitem); -$menuitem->show(); - -my $menuitem = Gtk3::MenuItem->new_with_label("Settings"); -#$menuitem->set_submenu($menu); -$menubar->append($menuitem); -$menuitem->show(); - -my $menuitem = Gtk3::MenuItem->new_with_label("Help"); -#$menuitem->set_submenu($menu); -$menubar->append($menuitem); -$menuitem->show(); - -my $hBox = Gtk3::Box->new( 'horizontal', 10 ); -$vBox->pack_start( $hBox, 0, 1, 0 ); -$hBox->show(); -my $flip_button = Gtk3::Button->new_with_label('Play/Pause'); -$hBox->pack_start( $flip_button, 0, 1, 0 ); -$flip_button->show(); - -my $close_button = Gtk3::Button->new_with_label('Fullscreen'); -$hBox->pack_start( $close_button, 0, 1, 0 ); -$close_button->show(); $main_window->set_border_width(0); $main_window->resize(600,300); diff --git a/bin/arctica-mediaplayer-lighttpd b/bin/arctica-mediaplayer-lighttpd deleted file mode 100755 index dcecf8d..0000000 --- a/bin/arctica-mediaplayer-lighttpd +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -################################################################################ -# _____ _ -# |_ _| |_ ___ -# | | | ' \/ -_) -# |_| |_||_\___| -# _ _ ____ _ _ -# / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ -# / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| -# / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ -# /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| -# |__/ -# The Arctica Modular Remote Computing Framework -# -################################################################################ -# -# Copyright (C) 2015-2016 The Arctica Project -# http://http://arctica-project.org/ -# -# This code is dual licensed: strictly GPL-2 or AGPL-3+ -# -# GPL-2 -# ----- -# 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; version 2 of the License. -# -# 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. -# -# AGPL-3+ -# ------- -# This programm is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This programm 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero 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) 2015-2016 Guangzhou Nianguan Electronics Technology Co.Ltd. -# -# Copyright (C) 2015-2016 Mike Gabriel -# -################################################################################ - -lighttpd -f /usr/share/arctica-mediaplayer/lighttpd/lighttpd.conf diff --git a/bin/arctica-mediaplayer-overlay b/bin/arctica-mediaplayer-overlay index 669eee5..309e07f 100755 --- a/bin/arctica-mediaplayer-overlay +++ b/bin/arctica-mediaplayer-overlay @@ -73,12 +73,11 @@ Glib::Object::Introspection->setup( version => "3.0", package => "Gtk3::Gdk"); -my $MPVO = "x11"; -#my $MPVO = "gl"; - -my $gnx_xid = `/usr/bin/xwininfo -root -all|/bin/grep NXAgent`; -if ($gnx_xid =~ /^\s*(0x[0-9a-f]*)\s.*/) { - $gnx_xid = $1; +#my $MPVO = "x11"; +my $MPVO = "gl"; +my $fmedia_port; +if ($ENV{'TEKI_FMEDIA_PORT'} =~ /^(\d{1,5})$/) { + $fmedia_port = $1; } else { die; } @@ -95,7 +94,7 @@ my $app_id = @ARGV[0]; my $ttid = @ARGV[1]; my $sock_id; my $tmplnkid; - +my $rwid; if (@ARGV[2] =~ /^([a-zA-Z0-9]*)$/) { $sock_id = $1; BugOUT(8,"SOC:\t$sock_id"); @@ -105,10 +104,14 @@ if (@ARGV[3] =~ /^([a-zA-Z0-9]*)$/) { $tmplnkid = $1; BugOUT(8,"TMPLNKID:\t$tmplnkid"); } else {die("YOU SOCK!");} -print "YAY WE GOT IT: $tmplnkid\n"; + +if (@ARGV[4] =~ /^([a-zA-Z0-9]{5,})$/) { + $rwid = $1; + BugOUT(8,"TMPLNKID:\t$tmplnkid"); +} else {die("YOU SOCK!");} +#print "YAY WE GOT IT: $tmplnkid\n"; my $TeKi; -my $window = Gtk3::Window->new('popup'); $TeKi = Arctica::Core::JABus::Socket->new($ACO,{ type => "unix", destination => "local", # FIX ME (change to remote!!!) @@ -125,11 +128,23 @@ $TeKi = Arctica::Core::JABus::Socket->new($ACO,{ }, }); -print "THEDUMP:\t\n",Dumper($TeKi); +#print "THEDUMP:\t\n",Dumper($TeKi); + my $time = time(); + my $SlaveFIFO = "/tmp/mpslave_$time.fifo"; + if (-e $SlaveFIFO) { + unlink($SlaveFIFO); + } + mkfifo($SlaveFIFO, 0700); + unless (-x '/usr/bin/mplayer') {die('NO /usr/bin/mplayer ?!');} + +my $pid = open(my $mpFH,"-|",'/usr/bin/mplayer','-slave','-input' ,"file=$SlaveFIFO", '-vo',$MPVO,'-zoom','-framedrop','-fs','-wid',$rwid,'-volume','100', '-identify','-idle','-nolirc','-ss','1', "http://localhost:$fmedia_port/$tmplnkid.lnk","2>&1"); +# my $pid = open(my $mpFH,"-|",'/usr/bin/mplayer','-slave','-input' ,"file=$SlaveFIFO", '-vo',$MPVO,'-zoom','-framedrop','-fs','-wid',$rwid,'-volume','100', '-identify','-idle','-nolirc','-ss','1', "/tmp/test.mp4","2>&1"); + my $TnW = Glib::IO->add_watch( $mpFH->fileno, 'in', sub {watch_mplayerOutput( $mpFH);}); + -my $timeout = Glib::Timeout->add(1000, sub { -print "\tTime:\t",time,"\n\tLast:\t$lastcontact\n"; - if ($lastcontact < (time-60)) { +my $timeout = Glib::Timeout->add(250, sub { +#print "\tTime:\t",time,"\n\tLast:\t$lastcontact\n"; + if ($lastcontact < (time-1)) { die("We're an orphan?"); } return 1; @@ -137,51 +152,36 @@ print "\tTime:\t",time,"\n\tLast:\t$lastcontact\n"; -$window->set_title('OVERLAY'); -$window->set_border_width(0); -$window->resize(600,300); -my $socket = new Gtk3::Socket; -$window->add($socket); -my $xid = $socket->get_id; -my $xid2 = $window->get_window->get_xid; -warn("WINXID:\t$xid2"); -system("/usr/bin/xdotool","windowreparent",$xid2,$gnx_xid); -$window->show_all(); -$window->unmap(); -my $time = time(); -my $SlaveFIFO = "/tmp/mpslave_$time.fifo"; -if (-e $SlaveFIFO) { - unlink($SlaveFIFO); -} -mkfifo($SlaveFIFO, 0700); -my $pid = open(my $mpFH,"-|",'/usr/bin/mplayer','-slave','-input' ,"file=$SlaveFIFO", '-vo',$MPVO,'-zoom','-framedrop','-fs','-wid',$xid,'-volume','100', '-identify','-idle','-nolirc','-ss','1', "http://username:password\@localhost:9199/thedir/$tmplnkid.lnk","2>&1"); -my $TnW = Glib::IO->add_watch( $mpFH->fileno, 'in', sub {watch_mplayerOutput( $mpFH);}); + #print "MP:$pid\n"; $ACO->{'Glib'}{'MainLoop'}->run; + + sub watch_mplayerOutput { my ($fh,undef) = @_; my $buffer; sysread($fh, $buffer, 4096); - print "YALLA:\t$buffer\n"; +# print "YALLA:\t$buffer\n"; } sub chtargetstate { + $lastcontact = time; my $data = $_[0]; warn(Dumper($data)); my $x = $data->{'apx'}; my $y = $data->{'apy'}; if ($x and $y) { - $window->move($x,$y); - $window->resize($data->{'w'},$data->{'h'}); +# $window->move($x,$y); +# $window->resize($data->{'w'},$data->{'h'}); } if ($data->{'visible'} eq 1) { if ($x ne 0) {#remove this - $window->map(); +# $window->map(); } } else { - $window->unmap(); +# $window->unmap(); } } -- cgit v1.2.3