Changeset 953

Show
Ignore:
Timestamp:
09/05/08 10:55:55 (3 months ago)
Author:
mariodebian
Message:

tcosmonitor (0.2.16~rc6)

  • Create more extensions:
    • viewproc.py videolan.py sendfiles.py wakeonlan.py
    • Delete some old code from TcosActions?.py
Location:
trunk/tcosmonitor
Files:
4 added
10 modified

Legend:

Unmodified
Added
Removed
  • trunk/tcosmonitor/TcosActions.py

    r951 r953  
    3939COL_HOST, COL_IP, COL_USERNAME, COL_ACTIVE, COL_LOGGED, COL_BLOCKED, COL_PROCESS, COL_TIME, COL_SEL, COL_SEL_ST = range(10) 
    4040import shared 
    41 import WakeOnLan 
     41#import WakeOnLan 
    4242 
    4343def print_debug(txt): 
     
    8484#            shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
    8585 
    86     def on_kill_button_click(self, widget, pid, username): 
    87         print_debug ( "on_kill_button_click() pid=%s username=%s" %(pid, username) ) 
    88         if shared.ask_msg ( _("Are you sure you want to stop this process?") ): 
    89             print_debug ( "KILL KILL KILL" ) 
    90             if username.find(":") != -1 : 
    91                 usern, ip = username.split(":") 
    92                 self.main.xmlrpc.newhost(ip) 
    93                 self.main.xmlrpc.DBus("kill", str(pid) ) 
    94             else: 
    95                 result = self.main.dbus_action.do_kill( [username] , str(pid) ) 
    96                 if not result: 
    97                     shared.error_msg ( _("Error while killing app:\nReason: %s") %( self.main.dbus_action.get_error_msg() ) ) 
    98                 else: 
    99                     print_debug ( "on_kill_button_click() KILLED ;)" ) 
    100             self.get_user_processes(self.main.selected_ip)   
    101  
    102     def on_another_screenshot_button_click(self, widget, ip): 
    103         print_debug ( "on_another_screenshot_button_click() __init__ ip=%s" %(ip) ) 
    104         self.main.worker=shared.Workers(self.main, target=self.get_screenshot, args=[ip]) 
    105         self.main.worker.start() 
     86#    def on_kill_button_click(self, widget, pid, username): 
     87#        print_debug ( "on_kill_button_click() pid=%s username=%s" %(pid, username) ) 
     88#        if shared.ask_msg ( _("Are you sure you want to stop this process?") ): 
     89#            print_debug ( "KILL KILL KILL" ) 
     90#            if username.find(":") != -1 : 
     91#                usern, ip = username.split(":") 
     92#                self.main.xmlrpc.newhost(ip) 
     93#                self.main.xmlrpc.DBus("kill", str(pid) ) 
     94#            else: 
     95#                result = self.main.dbus_action.do_kill( [username] , str(pid) ) 
     96#                if not result: 
     97#                    shared.error_msg ( _("Error while killing app:\nReason: %s") %( self.main.dbus_action.get_error_msg() ) ) 
     98#                else: 
     99#                    print_debug ( "on_kill_button_click() KILLED ;)" ) 
     100#            self.get_user_processes(self.main.selected_ip)   
     101 
     102#    def on_another_screenshot_button_click(self, widget, ip): 
     103#        print_debug ( "on_another_screenshot_button_click() __init__ ip=%s" %(ip) ) 
     104#        self.main.worker=shared.Workers(self.main, target=self.get_screenshot, args=[ip]) 
     105#        self.main.worker.start() 
    106106 
    107107    def on_allhostbutton_click(self, widget): 
     
    129129            self.main.fullscreenbutton.set_stock_id("gtk-leave-fullscreen") 
    130130 
    131     """ 
     131     
    132132#    def on_downloadallmodules_click(self, widget): 
    133         print_debug ( "on_downloadallmodules_click() ################" ) 
    134         if self.main.selected_ip != None: 
    135             print_debug( "on_downloadallmodules_click() downloading modules for %s" %(self.main.selected_ip) ) 
    136             # download allmodules.squashfs and mount it 
    137             self.main.xmlrpc.Exe("useallmodules.sh") 
    138         pass 
    139     """ 
     133#        print_debug ( "on_downloadallmodules_click() ################" ) 
     134#        if self.main.selected_ip != None: 
     135#            print_debug( "on_downloadallmodules_click() downloading modules for %s" %(self.main.selected_ip) ) 
     136#            # download allmodules.squashfs and mount it 
     137#            self.main.xmlrpc.Exe("useallmodules.sh") 
     138#        pass 
     139     
    140140     
    141141    def on_progressbutton_click(self, widget): 
     
    921921#        return False 
    922922 
    923     """ 
     923#     
    924924#    def slider_value_changed(self, widget, adjustment, event, channel, ip): 
    925         value=widget.get_value() 
    926         print_debug ( "slider_value_changed() ip=%s channel=%s value=%s" %(ip, channel, value) ) 
    927          
    928         self.main.write_into_statusbar( \ 
    929         _("Changing value of %(channel)s channel, to %(value)s%%..." )\ 
    930          %{"channel":channel, "value":value} ) 
    931          
    932         tmp=self.main.xmlrpc.SetSound(ip, channel, str(value)+"%") 
    933         newvalue="%2d%%"%int(tmp['level']) 
    934          
    935         self.main.write_into_statusbar( \ 
    936         _("Changed value of %(channel)s channel, to %(value)s" ) \ 
    937         %{"channel":channel, "value":newvalue} ) 
    938      
     925#        value=widget.get_value() 
     926#        print_debug ( "slider_value_changed() ip=%s channel=%s value=%s" %(ip, channel, value) ) 
     927#         
     928#        self.main.write_into_statusbar( \ 
     929#        _("Changing value of %(channel)s channel, to %(value)s%%..." )\ 
     930#         %{"channel":channel, "value":value} ) 
     931#         
     932#        tmp=self.main.xmlrpc.SetSound(ip, channel, str(value)+"%") 
     933#        newvalue="%2d%%"%int(tmp['level']) 
     934#         
     935#        self.main.write_into_statusbar( \ 
     936#        _("Changed value of %(channel)s channel, to %(value)s" ) \ 
     937#        %{"channel":channel, "value":newvalue} ) 
     938#     
    939939#    def checkbox_value_changed(self, widget, channel, ip): 
    940         value=widget.get_active() 
    941         if not value: 
    942             value="off" 
    943             self.main.write_into_statusbar( _("Unmuting %s channel..."  ) %(channel) ) 
    944             tmp=self.main.xmlrpc.SetSound(ip, channel, value="", mode="--setunmute") 
    945             newvalue=tmp['mute'] 
    946         else: 
    947             value="on" 
    948             self.main.write_into_statusbar( _("Muting %s channel..."  ) %(channel) ) 
    949             tmp=self.main.xmlrpc.SetSound(ip, channel, value="", mode="--setmute") 
    950             newvalue=tmp['mute'] 
    951         self.main.write_into_statusbar( _("Status of %(channel)s channel, is \"%(newvalue)s\""  )\ 
    952          %{"channel":channel, "newvalue":newvalue} ) 
    953     """ 
     940#        value=widget.get_active() 
     941#        if not value: 
     942#            value="off" 
     943#            self.main.write_into_statusbar( _("Unmuting %s channel..."  ) %(channel) ) 
     944#            tmp=self.main.xmlrpc.SetSound(ip, channel, value="", mode="--setunmute") 
     945#            newvalue=tmp['mute'] 
     946#        else: 
     947#            value="on" 
     948#            self.main.write_into_statusbar( _("Muting %s channel..."  ) %(channel) ) 
     949#            tmp=self.main.xmlrpc.SetSound(ip, channel, value="", mode="--setmute") 
     950#            newvalue=tmp['mute'] 
     951#        self.main.write_into_statusbar( _("Status of %(channel)s channel, is \"%(newvalue)s\""  )\ 
     952#         %{"channel":channel, "newvalue":newvalue} ) 
     953#     
    954954     
    955955    def populate_hostlist(self, clients): 
     
    11921192            allclients_logged.append(self.main.selected_ip) 
    11931193         
    1194         if action == 0: 
    1195             # refresh terminal 
    1196             # call to read remote info 
    1197             #self.main.xmlrpc.newhost(self.main.selected_ip) 
    1198             self.main.xmlrpc.ip=self.main.selected_ip 
    1199              
    1200             self.main.worker=shared.Workers( self.main,\ 
    1201                      target=self.populate_datatxt, args=([self.main.selected_ip]) ).start() 
    1202              
    1203              
     1194#        if action == 0: 
     1195#            # refresh terminal 
     1196#            # call to read remote info 
     1197#            #self.main.xmlrpc.newhost(self.main.selected_ip) 
     1198#            self.main.xmlrpc.ip=self.main.selected_ip 
     1199#             
     1200#            self.main.worker=shared.Workers( self.main,\ 
     1201#                     target=self.populate_datatxt, args=([self.main.selected_ip]) ).start() 
     1202#             
     1203#             
    12041204#        if action == 1: 
    12051205#            # clean datatxtbuffer 
     
    13361336#                shared.info_msg( _("%s is not supported to restart Xorg!") %(client_type) ) 
    13371337         
    1338         if action == 13: 
    1339             # exec app 
    1340             if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
    1341                 shared.error_msg ( _("Can't exec application, user is not logged") ) 
    1342                 return 
    1343             self.askfor(mode="exec", users=connected_users) 
     1338#        if action == 13: 
     1339#            # exec app 
     1340#            if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
     1341#                shared.error_msg ( _("Can't exec application, user is not logged") ) 
     1342#                return 
     1343#            self.askfor(mode="exec", users=connected_users) 
     1344#             
     1345#        if action == 14: 
     1346#            # send message 
     1347#            if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
     1348#                shared.error_msg ( _("Can't send message, user is not logged") ) 
     1349#                return 
     1350#            self.askfor(mode="mess", users=connected_users) 
    13441351             
    1345         if action == 14: 
    1346             # send message 
    1347             if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
    1348                 shared.error_msg ( _("Can't send message, user is not logged") ) 
    1349                 return 
    1350             self.askfor(mode="mess", users=connected_users) 
    1351              
    1352         if action == 15: 
    1353             if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
    1354                 shared.error_msg ( _("Can't show runnings apps, user is not logged") ) 
    1355                 return 
    1356             print_debug ("menu_event_one() show running apps" ) 
    1357             self.get_user_processes(self.main.selected_ip) 
     1352#        if action == 15: 
     1353#            if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
     1354#                shared.error_msg ( _("Can't show runnings apps, user is not logged") ) 
     1355#                return 
     1356#            print_debug ("menu_event_one() show running apps" ) 
     1357#            self.get_user_processes(self.main.selected_ip) 
    13581358             
    13591359             
    1360         if action == 16: 
    1361             # action sent by vidal_joshur at gva dot es 
    1362             # start video broadcast mode 
    1363             # Stream to single client unicast 
    1364             eth=self.main.config.GetVar("network_interface") 
    1365              
    1366             if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
    1367                 shared.error_msg ( _("Can't send video broadcast, user is not logged") ) 
    1368                 return 
    1369                          
    1370             str_scapes=[" ", "(", ")", "*", "!", "?", "\"", "`", "[", "]", "{", "}", ";", ":", ",", "=", "$"] 
    1371             lock="disable" 
    1372             volume="85" 
    1373              
    1374             if self.main.pref_vlc_method_send.get_active() == 0: 
    1375                 vcodec=shared.vcodecs[0] 
    1376                 venc=shared.vencs[0] 
    1377                 acodec=shared.acodecs[0] 
    1378                 aenc=shared.aencs[0] 
    1379                 access=shared.accesss[0] 
    1380                 mux=shared.muxs[0] 
    1381             elif self.main.pref_vlc_method_send.get_active() == 1: 
    1382                 vcodec=shared.vcodecs[1] 
    1383                 venc=shared.vencs[0] 
    1384                 acodec=shared.acodecs[0] 
    1385                 aenc=shared.aencs[0] 
    1386                 access=shared.accesss[0] 
    1387                 mux=shared.muxs[0] 
    1388             elif self.main.pref_vlc_method_send.get_active() == 2: 
    1389                 vcodec=shared.vcodecs[2] 
    1390                 venc=shared.vencs[1] 
    1391                 acodec=shared.acodecs[0] 
    1392                 aenc=shared.aencs[0] 
    1393                 access=shared.accesss[0] 
    1394                 mux=shared.muxs[0] 
    1395             elif self.main.pref_vlc_method_send.get_active() == 3: 
    1396                 vcodec=shared.vcodecs[3] 
    1397                 venc=shared.vencs[2] 
    1398                 acodec=shared.acodecs[1] 
    1399                 aenc=shared.aencs[1] 
    1400                 access=shared.accesss[1] 
    1401                 mux=shared.muxs[1] 
    1402             elif self.main.pref_vlc_method_send.get_active() == 4: 
    1403                 vcodec=shared.vcodecs[1] 
    1404                 venc=shared.vencs[0] 
    1405                 acodec=shared.acodecs[1] 
    1406                 aenc=shared.aencs[1] 
    1407                 access=shared.accesss[1] 
    1408                 mux=shared.muxs[1] 
    1409              
    1410              
    1411             if access == "udp":  
    1412                 if client_type == "tcos": 
    1413                     max_uip=255 
    1414                     uip=0 
    1415                     while uip <= max_uip: 
    1416                         uip_cmd="239.255.%s.0" %(uip) 
    1417                         cmd=("LC_ALL=C LC_MESSAGES=C netstat -putan 2>/dev/null | grep -c %s" %(uip_cmd) ) 
    1418                         print_debug("Check broadcast ip %s." %(uip_cmd) ) 
    1419                         output=self.main.common.exe_cmd(cmd) 
    1420                         uip+=1 
    1421                         if output == "0": 
    1422                             print_debug("Broadcast ip found: %s" %(uip_cmd)) 
    1423                             ip_unicast="%s:1234" %uip_cmd 
    1424                             break 
    1425                         elif uip == max_uip: 
    1426                             print_debug("Not found an available broadcast ip") 
    1427                             return 
    1428                     remote_cmd="vlc udp://@%s --udp-caching=1000 --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --aspect-ratio=4:3" %(ip_unicast) 
    1429                 else: 
    1430                     ip_unicast="%s:1234" %self.main.selected_ip 
    1431                     remote_cmd="vlc udp://@:1234 --udp-caching=1000 --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --fullscreen --aspect-ratio=4:3" 
    1432             else: 
    1433                 max_uip=50255 
    1434                 uip=50000 
    1435                 while uip <= max_uip: 
    1436                     uip_cmd=":%s" %(uip) 
    1437                     cmd=("LC_ALL=C LC_MESSAGES=C netstat -putan 2>/dev/null | grep -c %s" %(uip_cmd) ) 
    1438                     print_debug("Check broadcast ip %s." %(uip_cmd) ) 
    1439                     output=self.main.common.exe_cmd(cmd) 
    1440                     uip+=1 
    1441                     if output == "0": 
    1442                         print_debug("Broadcast ip found: %s" %(uip_cmd)) 
    1443                         ip_unicast=uip_cmd 
    1444                         break 
    1445                     elif uip == max_uip: 
    1446                         print_debug("Not found an available broadcast ip") 
    1447                         return 
    1448                 if client_type == "tcos": 
    1449                     remote_cmd="vlc http://localhost%s --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --aspect-ratio=4:3" %(ip_unicast) 
    1450              
    1451             dialog = gtk.FileChooserDialog(_("Select audio/video file.."), 
    1452                                None, 
    1453                                gtk.FILE_CHOOSER_ACTION_OPEN, 
    1454                                (_("Play DVD"), 1, 
    1455                                 _("Play SVCD/VCD"), 2, 
    1456                                 _("Play AudioCD"), 3, 
    1457                                 gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, 
    1458                                 gtk.STOCK_OPEN, gtk.RESPONSE_OK)) 
    1459             dialog.set_default_response(gtk.RESPONSE_OK) 
    1460             self.folder = self._folder = os.environ['HOME'] 
    1461             dialog.set_current_folder(self.folder) 
    1462             filter = gtk.FileFilter() 
    1463             filter.set_name("Media Files ( *.avi, *.mpg, *.mpeg, *.mp3, *.wav, etc.. )") 
    1464             file_types=["*.avi", "*.mpg", "*.mpeg", "*.ogg", "*.ogm", "*.asf", "*.divx",  
    1465                         "*.wmv", "*.vob", "*.m2v", "*.m4v", "*.mp2", "*.mp4", "*.ac3",  
    1466                         "*.ogg", "*.mp1", "*.mp2", "*.mp3", "*.wav", "*.wma"] 
    1467             for elem in file_types: 
    1468                 filter.add_pattern( elem ) 
    1469              
    1470             dialog.add_filter(filter) 
    1471              
    1472             filter = gtk.FileFilter() 
    1473             filter.set_name("All Files") 
    1474             filter.add_pattern("*.*") 
    1475             dialog.add_filter(filter) 
    1476             response = dialog.run() 
    1477             if response == gtk.RESPONSE_OK or response == 1 or response == 2 or response == 3: 
    1478                  
    1479                 filename=dialog.get_filename() 
    1480                 dialog.destroy() 
    1481                  
    1482                 if filename.find(" ") != -1: 
    1483                     msg=_("Not allowed white spaces in \"%s\".\nPlease rename it." %os.path.basename(filename) ) 
    1484                     shared.info_msg( msg ) 
    1485                     return 
    1486                  
    1487                 for scape in str_scapes: 
    1488                     filename=filename.replace("%s" %scape, "\%s" %scape) 
    1489                  
    1490                 if response == gtk.RESPONSE_OK: 
    1491                     p=subprocess.Popen(["vlc", "file://%s" %filename, "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
    1492                 elif response == 1: 
    1493                     p=subprocess.Popen(["vlc", "dvd://", "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--loop", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
    1494                 elif response == 2: 
    1495                     p=subprocess.Popen(["vlc", "vcd://", "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
    1496                 elif response == 3: 
    1497                     p=subprocess.Popen(["vlc", "cdda:///dev/cdrom", "--sout=#duplicate{dst=display,dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=200,ab=112,channels=2}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
    1498                 # exec this app on client 
    1499                  
    1500                 self.main.write_into_statusbar( _("Waiting for start video transmission...") ) 
    1501                  
    1502                 msg=_("First select the DVD chapter or play movie\nthen press enter to send clients..." ) 
    1503                 shared.info_msg( msg ) 
    1504                  
    1505                 # check if vlc is running or fail like check ping in demo mode 
    1506                 running = p.poll() is None 
    1507                 if not running: 
    1508                     self.main.write_into_statusbar( _("Error while exec app")) 
    1509                     return 
    1510                  
    1511                 msg=_( "Lock keyboard and mouse on client?" ) 
    1512                 if shared.ask_msg ( msg ): 
    1513                     lock="enable" 
    1514                  
    1515                 newusernames=[] 
    1516  
    1517                 for user in connected_users: 
    1518                     if user.find(":") != -1: 
    1519                         # we have a standalone user... 
    1520                         if access == "http": 
    1521                             server=self.main.xmlrpc.GetStandalone("get_server") 
    1522                             remote_cmd="vlc http://%s%s --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --fullscreen --aspect-ratio=4:3" %(server, ip_unicast) 
    1523                         self.main.xmlrpc.DBus("exec", remote_cmd ) 
    1524                     else: 
    1525                         newusernames.append(user) 
    1526                          
    1527                 result = self.main.dbus_action.do_exec( newusernames ,remote_cmd ) 
    1528                  
    1529                 if not result: 
    1530                     shared.error_msg ( _("Error while exec remote app:\nReason:%s") %( self.main.dbus_action.get_error_msg() ) ) 
    1531                  
    1532                 self.main.xmlrpc.vlc( self.main.selected_ip, volume, lock ) 
    1533                  
    1534                 self.main.write_into_statusbar( _("Running in broadcast video transmission.") ) 
    1535                 # new mode to Stop Button 
    1536                 self.add_progressbox( {"target": "vlc", "pid":p.pid, "lock":lock, "allclients":newallclients}, _("Running in broadcast video transmission to host %s") %(host)) 
    1537             else: 
    1538                 dialog.destroy() 
     1360#        if action == 16: 
     1361#            # action sent by vidal_joshur at gva dot es 
     1362#            # start video broadcast mode 
     1363#            # Stream to single client unicast 
     1364#            eth=self.main.config.GetVar("network_interface") 
     1365#             
     1366#            if len(connected_users) == 0 or connected_users[0] == shared.NO_LOGIN_MSG: 
     1367#                shared.error_msg ( _("Can't send video broadcast, user is not logged") ) 
     1368#                return 
     1369#                         
     1370#            str_scapes=[" ", "(", ")", "*", "!", "?", "\"", "`", "[", "]", "{", "}", ";", ":", ",", "=", "$"] 
     1371#            lock="disable" 
     1372#            volume="85" 
     1373#             
     1374#            if self.main.pref_vlc_method_send.get_active() == 0: 
     1375#                vcodec=shared.vcodecs[0] 
     1376#                venc=shared.vencs[0] 
     1377#                acodec=shared.acodecs[0] 
     1378#                aenc=shared.aencs[0] 
     1379#                access=shared.accesss[0] 
     1380#                mux=shared.muxs[0] 
     1381#            elif self.main.pref_vlc_method_send.get_active() == 1: 
     1382#                vcodec=shared.vcodecs[1] 
     1383#                venc=shared.vencs[0] 
     1384#                acodec=shared.acodecs[0] 
     1385#                aenc=shared.aencs[0] 
     1386#                access=shared.accesss[0] 
     1387#                mux=shared.muxs[0] 
     1388#            elif self.main.pref_vlc_method_send.get_active() == 2: 
     1389#                vcodec=shared.vcodecs[2] 
     1390#                venc=shared.vencs[1] 
     1391#                acodec=shared.acodecs[0] 
     1392#                aenc=shared.aencs[0] 
     1393#                access=shared.accesss[0] 
     1394#                mux=shared.muxs[0] 
     1395#            elif self.main.pref_vlc_method_send.get_active() == 3: 
     1396#                vcodec=shared.vcodecs[3] 
     1397#                venc=shared.vencs[2] 
     1398#                acodec=shared.acodecs[1] 
     1399#                aenc=shared.aencs[1] 
     1400#                access=shared.accesss[1] 
     1401#                mux=shared.muxs[1] 
     1402#            elif self.main.pref_vlc_method_send.get_active() == 4: 
     1403#                vcodec=shared.vcodecs[1] 
     1404#                venc=shared.vencs[0] 
     1405#                acodec=shared.acodecs[1] 
     1406#                aenc=shared.aencs[1] 
     1407#                access=shared.accesss[1] 
     1408#                mux=shared.muxs[1] 
     1409#             
     1410#             
     1411#            if access == "udp":  
     1412#                if client_type == "tcos": 
     1413#                    max_uip=255 
     1414#                    uip=0 
     1415#                    while uip <= max_uip: 
     1416#                        uip_cmd="239.255.%s.0" %(uip) 
     1417#                        cmd=("LC_ALL=C LC_MESSAGES=C netstat -putan 2>/dev/null | grep -c %s" %(uip_cmd) ) 
     1418#                        print_debug("Check broadcast ip %s." %(uip_cmd) ) 
     1419#                        output=self.main.common.exe_cmd(cmd) 
     1420#                        uip+=1 
     1421#                        if output == "0": 
     1422#                            print_debug("Broadcast ip found: %s" %(uip_cmd)) 
     1423#                            ip_unicast="%s:1234" %uip_cmd 
     1424#                            break 
     1425#                        elif uip == max_uip: 
     1426#                            print_debug("Not found an available broadcast ip") 
     1427#                            return 
     1428#                    remote_cmd="vlc udp://@%s --udp-caching=1000 --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --aspect-ratio=4:3" %(ip_unicast) 
     1429#                else: 
     1430#                    ip_unicast="%s:1234" %self.main.selected_ip 
     1431#                    remote_cmd="vlc udp://@:1234 --udp-caching=1000 --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --fullscreen --aspect-ratio=4:3" 
     1432#            else: 
     1433#                max_uip=50255 
     1434#                uip=50000 
     1435#                while uip <= max_uip: 
     1436#                    uip_cmd=":%s" %(uip) 
     1437#                    cmd=("LC_ALL=C LC_MESSAGES=C netstat -putan 2>/dev/null | grep -c %s" %(uip_cmd) ) 
     1438#                    print_debug("Check broadcast ip %s." %(uip_cmd) ) 
     1439#                    output=self.main.common.exe_cmd(cmd) 
     1440#                    uip+=1 
     1441#                    if output == "0": 
     1442#                        print_debug("Broadcast ip found: %s" %(uip_cmd)) 
     1443#                        ip_unicast=uip_cmd 
     1444#                        break 
     1445#                    elif uip == max_uip: 
     1446#                        print_debug("Not found an available broadcast ip") 
     1447#                        return 
     1448#                if client_type == "tcos": 
     1449#                    remote_cmd="vlc http://localhost%s --aout=alsa --brightness=2.000000 --no-x11-shm --no-xvideo-shm --volume=300 --aspect-ratio=4:3" %(ip_unicast) 
     1450#             
     1451#            dialog = gtk.FileChooserDialog(_("Select audio/video file.."), 
     1452#                               None, 
     1453#                               gtk.FILE_CHOOSER_ACTION_OPEN, 
     1454#                               (_("Play DVD"), 1, 
     1455#                                _("Play SVCD/VCD"), 2, 
     1456#                                _("Play AudioCD"), 3, 
     1457#                                gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, 
     1458#                                gtk.STOCK_OPEN, gtk.RESPONSE_OK)) 
     1459#            dialog.set_default_response(gtk.RESPONSE_OK) 
     1460#            self.folder = self._folder = os.environ['HOME'] 
     1461#            dialog.set_current_folder(self.folder) 
     1462#            filter = gtk.FileFilter() 
     1463#            filter.set_name("Media Files ( *.avi, *.mpg, *.mpeg, *.mp3, *.wav, etc.. )") 
     1464#            file_types=["*.avi", "*.mpg", "*.mpeg", "*.ogg", "*.ogm", "*.asf", "*.divx",  
     1465#                        "*.wmv", "*.vob", "*.m2v", "*.m4v", "*.mp2", "*.mp4", "*.ac3",  
     1466#                        "*.ogg", "*.mp1", "*.mp2", "*.mp3", "*.wav", "*.wma"] 
     1467#            for elem in file_types: 
     1468#                filter.add_pattern( elem ) 
     1469#             
     1470#            dialog.add_filter(filter) 
     1471#             
     1472#            filter = gtk.FileFilter() 
     1473#            filter.set_name("All Files") 
     1474#            filter.add_pattern("*.*") 
     1475#            dialog.add_filter(filter) 
     1476#            response = dialog.run() 
     1477#            if response == gtk.RESPONSE_OK or response == 1 or response == 2 or response == 3: 
     1478#                 
     1479#                filename=dialog.get_filename() 
     1480#                dialog.destroy() 
     1481#                 
     1482#                if filename.find(" ") != -1: 
     1483#                    msg=_("Not allowed white spaces in \"%s\".\nPlease rename it." %os.path.basename(filename) ) 
     1484#                    shared.info_msg( msg ) 
     1485#                    return 
     1486#                 
     1487#                for scape in str_scapes: 
     1488#                    filename=filename.replace("%s" %scape, "\%s" %scape) 
     1489#                 
     1490#                if response == gtk.RESPONSE_OK: 
     1491#                    p=subprocess.Popen(["vlc", "file://%s" %filename, "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
     1492#                elif response == 1: 
     1493#                    p=subprocess.Popen(["vlc", "dvd://", "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--loop", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
     1494#                elif response == 2: 
     1495#                    p=subprocess.Popen(["vlc", "vcd://", "--sout=#duplicate{dst=display{delay=1000},dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=800,ab=112,channels=2,soverlay}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--brightness=2.000000", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
     1496#                elif response == 3: 
     1497#                    p=subprocess.Popen(["vlc", "cdda:///dev/cdrom", "--sout=#duplicate{dst=display,dst=\"transcode{vcodec=%s,venc=%s,acodec=%s,aenc=%s,vb=200,ab=112,channels=2}:standard{access=%s,mux=%s,dst=%s}\"}" %(vcodec, venc, acodec, aenc, access, mux, ip_unicast), "--miface=%s" %eth, "--ttl=12", "--no-x11-shm", "--no-xvideo-shm"], shell=False, bufsize=0, close_fds=True) 
     1498#                # exec this app on client 
     1499#                 
     1500#                self.main.write_into_statusbar( _("Waiting for start video transmission...") ) 
     1501#                 
     1502#                msg=_("First select the DVD chapter or play movie\nthen press enter to send clients..." ) 
     1503#                shared.info_msg( msg ) 
     1504#                 
     1505#                # check if vlc is running or fail like check ping in demo mode 
     1506#                running = p.poll() is None 
     1507#                if not running: 
     1508#                    self.main.write_into_statusbar( _("Error while exec app")) 
     1509#                    return 
     1510#                 
     1511#                msg=_( "Lock keyboard and mouse on client?" ) 
     1512#                if shared.ask_msg ( msg ): 
     1513#                    lock="enable" 
     1514#                 
     1515#<