This file is indexed.

/var/lib/liguidsoap/output.py is in liguidsoap 1.1.1-7.2ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk
import gobject

from client import LiqClient
from widgets import View

class LiqOutput(gtk.VBox):

  def delete_event(self, widget, event, data=None):
    return False

  def destroy(self, widget, data=None):
    gtk.main_quit()

  def __init__(self,host='localhost',port=1234,op='root'):
    gtk.VBox.__init__(self)

    # Connect to liquidsoap
    self.op = op
    self.tel = LiqClient(host,port)

    # Fast metadata view: short metadata, right click to see more (TODO)
    a=self.tel.metadata(self.op+".metadata")
    self.list = View([['rid'        , 40],
                      ['artist'     ,'120'],
                      ['title'      ,'120'],
                      # Right-align URI because the end is more informative
                      # than the beginning
                      ['initial_uri','300', {'xalign':1.0}],
                      ['on_air','50']], a)
    scroll = gtk.ScrolledWindow()
    scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
    scroll.add(self.list)
    scroll.show()
    self.pack_start(scroll,padding=10)

    # an hbox containing : remaining / start-stop / skip
    self.hbox = gtk.HBox()
    self.pack_start(self.hbox,False,False)

    self.remaining = gtk.Label("...")
    self.hbox.pack_start(self.remaining)
    gobject.timeout_add(1000,self.update)

    self.skip = gtk.Button("skip")
    self.skip.connect("clicked", self.do_skip, None)
    self.hbox.pack_start(self.skip,False,False)

    self.onoff = gtk.ToggleButton("on/off")
    self.onoff.set_active(self.tel.command(self.op+".status")=="on")
    self.onoff.connect("clicked", self.do_onoff, None)
    self.hbox.pack_start(self.onoff,False,False)

    # Show everything...
    self.list.show()
    self.remaining.show()
    self.onoff.show()
    self.skip.show()
    self.show()
    self.hbox.show()

  def update(self):
    remaining = self.tel.command(self.op+".remaining")
    if remaining!="(undef)":
      remaining=float(remaining)
      self.remaining.set_label("Remaining: %02d:%02d" %
                               (remaining/60,remaining%60))
    else:
      self.remaining.set_label("Remaining: (undef)")
    self.list.setModel(self.tel.metadata(self.op+".metadata"))
    if self.tel.command(self.op+".status")=="on":
      if not self.onoff.get_active():
        self.onoff.set_active(True)
    else:
      if self.onoff.get_active():
        self.onoff.set_active(False)
    return 1

  def do_skip(self,widget,data=None):
    self.tel.command(self.op+".skip")

  def do_onoff(self,widget,data=None):
    # The state we get is the one *after* the click
    if self.onoff.get_active():
      self.tel.command(self.op+".start")
    else:
      self.tel.command(self.op+".stop")

  def main(self):
    gtk.main()

import getopt
import sys

if __name__ == "__main__":
  opts, args = getopt.gnu_getopt(sys.argv[1:],"h:p:o:",
                                 ['host=','port=','operator='])
  op='root'
  host='localhost'
  port=1234
  for o , a in opts:
    if o in ('-p', '--port'):
      port=int(a)
    if o in ('-o', '--operator'):
      op=a
    if o in ('-h', '--host'):
      host=a
  win = gtk.Window()
  win.set_border_width(10)
  win.connect("delete_event", lambda w,e: False)
  win.connect("destroy", lambda w: gtk.main_quit ())
  win.set_title(host+':'+str(port)+' -- Output '+op)
  win.resize(700,300)
  win.add(LiqOutput(host,port,op))
  win.show()
  gtk.main()