diff options
author | GZNGET FOSS Team <opensource@gznianguan.com> | 2017-06-30 12:35:13 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-30 12:35:13 +0200 |
commit | 83c8e5b80d62b14e766fa7e7c8682562a018bd32 (patch) | |
tree | a3abccd1592dc196b3792a259fa7b331810504ab /bin | |
download | arctica-mediaplayer-83c8e5b80d62b14e766fa7e7c8682562a018bd32.tar.gz arctica-mediaplayer-83c8e5b80d62b14e766fa7e7c8682562a018bd32.tar.bz2 arctica-mediaplayer-83c8e5b80d62b14e766fa7e7c8682562a018bd32.zip |
initial commit dating 20161031
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/arctica-mediaplayer | 108 | ||||
-rwxr-xr-x | bin/arctica-mediaplayer-lighttpd | 2 | ||||
-rwxr-xr-x | bin/arctica-mediaplayer-overlay | 146 |
3 files changed, 256 insertions, 0 deletions
diff --git a/bin/arctica-mediaplayer b/bin/arctica-mediaplayer new file mode 100755 index 0000000..de2b43b --- /dev/null +++ b/bin/arctica-mediaplayer @@ -0,0 +1,108 @@ +#!/usr/bin/perl -X -T -I /tekitest/perlmodules +use strict; +use Data::Dumper; +use Cwd 'abs_path'; +use Arctica::Core::eventInit qw(genARandom BugOUT); +use Arctica::Telekinesis::Application::AppGtk3; + +my $ACO = Arctica::Core::eventInit->new({ + app_name=>'telekinesis-test-app', + app_class =>'tekiapp', + app_version=>'0.0.1.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/tmp/$link_id.lnk"); +} else { + print "PLAY WHAT?!!\n\n";die; +} +print "FUP:\t$fullpath\nLID:\t$link_id\n"; +#die; +my $TeKiGtk3 = Arctica::Telekinesis::Application::AppGtk3->new($ACO,{ + services => { + multimedia => { + conf => { + files_only => 1, + }, + }, + }, + }); + +LoadCSS(); +my $main_window = Gtk3::Window->new('toplevel'); +$main_window->set_title('TEST WINDOW'); + +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 $box = Gtk3::Box->new( 'horizontal', 0 ); +#$window->add($box); +#$box->show(); + +my $vBox = Gtk3::Box->new( 'vertical', 0 ); +#$box->add($box1); +$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); + +$main_window->show_all(); + +# We'll wan't to start this within the AppGtk3 thingie... but for now it can stay out here... +my $timeout = Glib::Timeout->add(50, sub {$TeKiGtk3->check_n_send();return 1;}); + + +$ACO->{'Glib'}{'MainLoop'}->run; + + +sub LoadCSS { + my $Gtk3_CSS_Provider = Gtk3::CssProvider->new; + my $Display = Gtk3::Gdk::Display::get_default(); + my $Screen = $Display->get_default_screen; + $Gtk3_CSS_Provider->load_from_data ([map ord, split //,"GtkSocket{ background-color: #000000;}"]); +# Make it easy to see not only TeKi overlay issues but also unavoidable +# Gtk3 issues that are most evident on slow systems or systems with artificially induced X latency +# $Gtk3_CSS_Provider->load_from_data ([map ord, split //,"GtkSocket{ background-color: #990000;}\nGtkWindow{background-color: #009900;}"]); + + Gtk3::StyleContext::add_provider_for_screen( $Screen, $Gtk3_CSS_Provider, Gtk3::STYLE_PROVIDER_PRIORITY_USER); +} diff --git a/bin/arctica-mediaplayer-lighttpd b/bin/arctica-mediaplayer-lighttpd new file mode 100755 index 0000000..39a5224 --- /dev/null +++ b/bin/arctica-mediaplayer-lighttpd @@ -0,0 +1,2 @@ +#!/bin/sh +lighttpd -f /usr/share/arctica-mediaplayer/lighttpd/lighttpd.conf diff --git a/bin/arctica-mediaplayer-overlay b/bin/arctica-mediaplayer-overlay new file mode 100755 index 0000000..7e8266b --- /dev/null +++ b/bin/arctica-mediaplayer-overlay @@ -0,0 +1,146 @@ +#!/usr/bin/perl -X -T -I /tekitest/perlmodules +use strict; +use Data::Dumper; +use Arctica::Core::eventInit qw(genARandom BugOUT); +use Arctica::Core::JABus::Socket; +use POSIX qw(mkfifo); +use Gtk3 -init; +use Glib; +use Glib::Object::Introspection; +Glib::Object::Introspection->setup( + basename => "GdkX11", + 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; +} else { + die; +} + + +my $lastcontact = time; + +my $ACO = Arctica::Core::eventInit->new({ + app_name=>'forked-overlay-test', + app_class =>'amoduletester', + app_version=>'0.0.1.1'}); + +my $app_id = @ARGV[0]; +my $ttid = @ARGV[1]; +my $sock_id; +my $tmplnkid; + +if (@ARGV[2] =~ /^([a-zA-Z0-9]*)$/) { + $sock_id = $1; + BugOUT(8,"SOC:\t$sock_id"); +} else {die("YOU SOCK!");} + +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"; + +my $TeKi; +my $window = Gtk3::Window->new('popup'); +$TeKi = Arctica::Core::JABus::Socket->new($ACO,{ + type => "unix", + destination => "local", # FIX ME (change to remote!!!) + is_client => 1, + connect_to => $sock_id, + handle_in_dispatch => { + chtstate => sub {\&chtargetstate(@_)}, +# srvcneg => sub {$TeKiClient->c2s_service_neg(@_)}, +# appctrl => \&teki_client2s_appctrl, + }, + hooks => { + on_ready => sub {my_ready($app_id,$ttid);}, + on_client_errhup => sub {die("\tLOST CONN!\n");}, + }, +}); + +print "THEDUMP:\t\n",Dumper($TeKi); + +my $timeout = Glib::Timeout->add(1000, sub { +print "\tTime:\t",time,"\n\tLast:\t$lastcontact\n"; + if ($lastcontact < (time-60)) { + die("We're an orphan?"); + } + return 1; +}); + + + +$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"; +} + +sub chtargetstate { + 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'}); + } + + if ($data->{'visible'} eq 1) { + if ($x ne 0) {#remove this + $window->map(); + } + } else { + $window->unmap(); + } +} + +sub my_ready { + BugOUT(8,"MY READY?"); + my $app_id = $_[0]; + my $ttid = $_[1]; + $TeKi->client_send('treg',{ + app_id => $app_id, + ttid => $ttid, + }); +} + +sub daemonize { + fork and exit; + POSIX::setsid(); + fork and exit; + umask 0; + chdir '/'; + close STDIN; + close STDOUT; + close STDERR; +} |