This file is indexed.

/usr/share/mythbuntu/plugins/python/plugins.py is in mythbuntu-common 0.67.

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

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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
## -*- coding: utf-8 -*-
#
# «plugins» - MCC & MythTV Plugin enablement plugin
#
# Copyright (C) 2009, Mario Limonciello, for Mythbuntu
#
#
# Mythbuntu 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 application; if not, write to the Free Software Foundation, Inc., 51
# Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
##################################################################################

from MythbuntuControlCentre.plugin import MCCPlugin
from gtk import SENSITIVE
import os
import string
import logging
import ConfigParser

from mythbuntu_common.dictionaries import *

class MythPluginsPlugin(MCCPlugin):
    """A tool for enabling different MythTV plugins"""

    CONFIGFILE = "/etc/default/mythweb"

    def __init__(self):
        #Initialize parent class
        information = {}
        information["name"] = "Plugins"
        information["icon"] = "gtk-add"
        information["ui"] = "tab_plugins"
        self.config = ConfigParser.ConfigParser()
        MCCPlugin.__init__(self,information)


    def captureState(self):
        """Determines the state of the items on managed by this plugin
           and stores it into the plugin's own internal structures"""
        #Dictionaries
        self.dictionary_state={}
        for list in get_frontend_plugin_dictionary(self), \
                    get_backend_plugin_dictionary(self):
            for item in list:
                self.dictionary_state[list[item]]=self.query_installed(item)

        #Mythweb auth
        self.mythweb_auth={}
        found_cfg=False
        if os.path.exists(self.CONFIGFILE):
            self.config.read(self.CONFIGFILE)
            try:
                self.mythweb_auth['enable'] = self.config.getboolean("cfg", "enable")
                self.mythweb_auth['user'] = self.config.getboolean("cfg", "username")
                self.mythweb_auth['pass'] = self.config.getboolean("cfg", "password")
                found_cfg=True
            except Exception:
                pass
        if not found_cfg:
            self.mythweb_auth['enable'] = os.path.exists('/etc/mythtv/mythweb-digest')
            self.mythweb_auth['user'] = ""
            self.mythweb_auth['pass'] = ""

    def applyStateToGUI(self):
        """Takes the current state information and sets the GUI
           for this plugin"""

        #Load the detected dictionary
        for item in self.dictionary_state:
            item.set_active(self.dictionary_state[item])

        #Mythweb auth
        self.password_table.hide()
        self.mythweb_username.set_text("")
        self.mythweb_password.set_text("")
        self.mythweb_password_combobox.remove_text(2)
        if self.mythweb_auth['enable']:
            self.mythweb_password_combobox.set_active(1)
            self.mythweb_password_combobox.append_text("Reconfigure")
        else:
            self.mythweb_password_combobox.set_active(0)

        self.toggle_plugins(self.mythweb_checkbox)

    def compareState(self):
        """Determines what items have been modified on this plugin"""
        #Prepare for state capturing
        MCCPlugin.clearParentState(self)

        #Installable items
        for list in get_frontend_plugin_dictionary(self), \
                    get_backend_plugin_dictionary(self):
            for item in list:
                if list[item].get_active() != self.dictionary_state[list[item]]:
                    if list[item].get_active():
                        self._markInstall(item)
                    else:
                        self._markRemove(item)

        #Mythweb auth
        if self.mythweb_password_combobox.get_active() != self.mythweb_auth['enable']:
            self._markReconfigureRoot("mythweb_auth",self.mythweb_password_combobox.get_active() > 0)
        if self.mythweb_password_combobox.get_active():
            if self.mythweb_username.get_text() != self.mythweb_auth['user']:
                self._markReconfigureRoot("mythweb_user",self.mythweb_username.get_text())
            if self.mythweb_password.get_text() != self.mythweb_auth['pass']:
                self._markReconfigureRoot("mythweb_password",self.mythweb_password.get_text())

    def toggle_plugins(self,widget):
        if widget is not None:
            if widget.get_name() == 'selectall_plugins_checkbox':
                toggle=widget.get_active()
                for list in get_frontend_plugin_dictionary(self), get_backend_plugin_dictionary(self):
                    for item in list:
                        if list[item].flags() & SENSITIVE:
                            list[item].set_active(toggle)

            elif widget.get_name() == "mythweb_checkbox":
                self.mythweb_password_combobox.set_sensitive(widget.get_active())
                if not widget.get_active():
                    self.mythweb_password_combobox.set_active(0)

            elif widget.get_name() == "mythweb_username" or \
                 widget.get_name() == "mythweb_password":
                username = self.mythweb_username.get_text().split(' ')[0]
                password = self.mythweb_password.get_text().split(' ')[0]
                if self.mythweb_password_combobox.get_active() != 2 or \
                   (len(username) > 0 and len(password) > 0):
                    self._incomplete=False
                else:
                    self._incomplete=True

            elif widget.get_name() == "mythweb_password_combobox":
                iteration=1
                if self.mythweb_auth['enable']:
                    iteration = 2
                if widget.get_active() == iteration:
                    self.password_table.show()
                    self._incomplete=True
                else:
                    self.mythweb_username.set_text("")
                    self.mythweb_password.set_text("")
                    self.password_table.hide()
                    self._incomplete=False

    def root_scripted_changes(self,reconfigure):
        """System-wide changes that need root access to be applied.
           This function is ran by the dbus backend"""

        found_cfg = False
        if os.path.exists(self.CONFIGFILE):
            try:
                self.config.read(self.CONFIGFILE)
                found_cfg = True
            except Exception:
                pass
        if not found_cfg:
            self.config.add_section("cfg")
            self.config.set("cfg", "enable", "false")
            self.config.set("cfg", "only", "false")
            self.config.set("cfg", "username", "")
            self.config.set("cfg", "password", "")

        for item in reconfigure:
            if item == "mythweb_auth":
                if not reconfigure[item]:
                    if os.path.exists('/etc/mythtv/mythweb-digest'):
                        os.remove('/etc/mythtv/mythweb-digest')
                    self.config.set("cfg", "enable", "false")
                else:
                    self.config.set("cfg", "enable", "true")
            elif item == "mythweb_user":
                self.config.set("cfg", "username", reconfigure[item])
            elif item == "mythweb_password":
                self.config.set("cfg", "password", reconfigure[item])

        with open(self.CONFIGFILE, 'wb') as configfile:
            self.config.write(configfile)
        os.system("dpkg-reconfigure -fnoninteractive mythweb")