This file is indexed.

/usr/share/avant-window-navigator/applets/pandora/pandora.py is in awn-applet-pandora 0.4.1~bzr1507-0ubuntu7.

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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/python
"""
Copyright 2008 Sharkbaitbobby <sharkbaitbobby+awn@gmail.com>

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, see <http://www.gnu.org/licenses/>.
"""


import os
import htmllib, formatter
import urllib2
import gtk
import pygtk
import awn
from awn.extras import awnlib

# workaround for weirdness with regards to Ubuntu + gtkmozembed
if os.path.exists('/etc/issue'):
  import re
  fp = open('/etc/issue')
  os_version = fp.read()
  fp.close()
  if re.search(r'7\.(?:04|10)', os_version): # feisty or gutsy
    os.putenv('LD_LIBRARY_PATH', '/usr/lib/firefox')
    os.putenv('MOZILLA_FIVE_HOME', '/usr/lib/firefox')

try:
  import gtkmozembed
except ImportError:
  print '       #####################################'
  print 'Gtkmozembed is needed to run Pandora, please install.'
  print ' * On Debian or Ubuntu based systems, install python-gnome2-extras'
  print ' * On Gentoo based systems, install dev-python/gnome-python-extras'
  print ' * On Fedora based systems, install gnome-python2-gtkmozembed'
  print ' * On SUSE based systems, install python-gnome-extras'
  print ' * On Mandriva based systems, install gnome-python-gtkmozembed'
  print 'See: http://wiki.awn-project.org/Awn_Extras:Dependency_Matrix'
  print '       #####################################'

# Add pop up if gtkmozembed isn't found
awn.check_dependencies(globals(), 'gtkmozembed')

applet_name = "Pandora"
applet_version = "0.3.3"
applet_description = "Listen to Pandora from Awn"
applet_theme_logo = "pandora"

class GetPandoraUrl(htmllib.HTMLParser):
    def __init__(self, formatterinit) :
        htmllib.HTMLParser.__init__(self, formatterinit)
        self.values = []

    def start_param(self, attrs) :
        if len(attrs) > 0 :
            for attr in attrs :
                if attr[0] == "value" :
                    self.values.append(attr[1])

    def get_values(self) :
        return self.values

class PandoraApplet:
    """ Listens to Pandora from Awn """
    def __init__(self, applet):
        self.applet = applet
        
        applet.tooltip.set("Pandora")
        
        self.dialog = applet.dialog.new("main")
        
        self.moz = gtkmozembed.MozEmbed()
        try:
            pandurl=self.applet.settings["url"]
        except:
            pandurl=self.returnurl()
            self.applet.settings["url"] = pandurl
        self.moz.set_size_request(640, 250)
        try:
            site = urllib2.urlopen(pandurl)
            meta=site.info()
            if meta['Content-Type'] == 'application/x-shockwave-flash':
                self.moz.load_url(pandurl)
            else:
                return Error
        except:
            pandurl=self.returnurl()
            self.applet.settings["url"] = pandurl
            self.moz.load_url(pandurl)
        self.dialog.add(self.moz)

        self.setup_context_menu()

        applet.connect("button-press-event", self.button_press_event_cb)

    def setup_context_menu(self):
        menu = self.applet.dialog.menu
        self.play = gtk.ImageMenuItem(stock_id=gtk.STOCK_MEDIA_PLAY)
        self.play.connect("activate", self.playMusic)
        menu.insert(self.play, 3)
        self.stop = gtk.ImageMenuItem(stock_id=gtk.STOCK_STOP)
        self.stop.connect("activate", self.stopMusic)
        menu.insert(self.stop, 4)

    def stopMusic(self,inp):
       self.moz.load_url("about:blank")

    def playMusic(self,inp):
       self.moz.go_back()

    def returnurl(self):
        try:
            page=urllib2.urlopen('http://www.pandora.com/?cmd=mini')
            format = formatter.NullFormatter()
            paramvalues = GetPandoraUrl(format)
            paramvalues.feed(page.read())
            paramvalues.close()
            urlvalues=paramvalues.get_values()
            panurl=urlvalues[0]
            return panurl
        except urllib2.URLError:
            print 'Pandora Applet: No network connection'
            self.pandurl=self.applet.settings["url"]
            return self.pandurl

    def button_press_event_cb(self, widget, event):
        if event.button == 1:
            if self.moz.get_location() == 'about:blank':
                self.moz.go_back()

if __name__ == "__main__":
    awnlib.init_start(PandoraApplet, {"name": applet_name,
        "short": "pandora",
        "version": applet_version,
        "description": applet_description,
        "theme": applet_theme_logo,
        "author": "Sharkbaitbobby",
        "copyright-year": "2008, 2009",
        "authors": ["Sharkbaitbobby <sharkbaitbobby+awn@gmail.com>"]})