This file is indexed.

/usr/bin/mythbuntu-lircrc-generator is in mythbuntu-lirc-generator 0.26-0ubuntu2.

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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# «mythbuntu-lircrc-generator» - Mythbuntu Lirc Generator
#
# Copyright (C) 2007-2008, 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 3 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
##################################################################################

import sys
import os
import getopt
import shutil

from MythbuntuLircGenerator.mythtvhandler import MythTVHandler
from MythbuntuLircGenerator.mplayerhandler import MPlayerHandler
from MythbuntuLircGenerator.xinehandler import XineHandler
from MythbuntuLircGenerator.vlchandler import VLCHandler
from MythbuntuLircGenerator.totemhandler import TotemHandler
from MythbuntuLircGenerator.elisahandler import ElisaHandler
from MythbuntuLircGenerator.xmamehandler import XMAMEHandler
from MythbuntuLircGenerator.xmesshandler import XMESSHandler
from MythbuntuLircGenerator.customhandler import CustomHandler
from MythbuntuLircGenerator.irexechandler import IRExecHandler

def display_help():
    """Shows the help for this application"""
    print ""
    print "mythbuntu-lirc-generator is used to create and run a basic lircrc for "
    print "use in Mythbuntu and Ubuntu systems."
    print ""
    print "mythbuntu-lirc-generator [-h|--help] [-d] [-l|--lircrc FILE] [-L|--lircd FILE] [--mythtv 0|1] [--mplayer 0|1] [--totem 0|1] [--elisa 0|1] [--xine 0|1] [--vlc 0|1] [--xmame 0|1] [-xmess [0|1] [--repeat <number>] [ --delay <number> ]"
    print ""
    print "By default, a configuration will be generated for all possible applications"
    print "This can be overridden as described below"
    print ""
    print "-h, --help"
    print "        This help screen."
    print "-d"
    print "        Debug mode.  Useful for determining troubles when parsing"
    print "-l, --lircrc FILE"
    print "        The file that you will be writing the lircrc out to."
    print "-L, --lircd FILE"
    print "        The file you will be reading the remote configuration from."
    print "--mythtv 0|1"
    print "        By default, mythtv configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--mplayer 0|1"
    print "        By default, mplayer configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--totem 0|1"
    print "        By default, totem configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--elisa 0|1"
    print "        By default, elisa configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--xine 0|1"
    print "        By default, xine configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--vlc 0|1"
    print "        By default, vlc configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--xmame 0|1"
    print "        By default, xmame configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--xmess 0|1"
    print "        By default, xmess configuration is generated, pass 0 to disable"
    print "        this behavior."
    print "--irexec 0|1"
    print "        By default, irexec configuration is NOT generated, pass 1 to enable"
    print "        this behavior."
    print "--repeat <number>"
    print "         Default is \"0\". Modifies the repeat= directive in .lircrc."
    print "         Quote from LIRC documentation:"
    print "         \"tells the program what shall happen if a key is repeated. "
    print "         A value of zero tells the program to ignore repeated keys."
    print "         Any other positive value 'n' tells the program to pass the"
    print "         config string every 'n'-th time to the according"
    print "         application, when a key is repeated. "
    print "         The default for repeat is zero.\" "
    print "--delay <number>"
    print "        Default is \"0\". Modifies the delay= directive in .lircrc."
    print "        Quote from LIRC documentation:"
    print "        \"tells the program to ignore the specified number of key"
    print "        repeats before using the \"repeat\" configuration directive"
    print "        above. This is used to prevent double triggers of events "
    print "        when using a fast repeat rate. A value of zero, which also "
    print "        is the default, will disable the delay function. \""
    print "--include <Custom Name>"
    print "        Create a custom include file for Other applications or uses"
    print "        not currently supported by Mythbuntu Lirc Generator."
    print ""
    print ""
    print " Example: mythbuntu-lircrc-generator --include some_lircrc_app"
    print " This will generate an include and file for ~/.lirc/some_lircrc_app"
    print ""


def main(argv):
    lircd = '/etc/lirc/lircd.conf'
    lircrc = os.getenv('HOME') + '/.lircrc'
    mythtv="1"
    mythtv_lircrc="1"
    mplayer="1"
    totem="1"
    elisa="1"
    xine="1"
    vlc="1"
    xmame="1"
    xmess="1"
    irexec="0"
# According to LIRC documentation, delay and repeat default to "0"
    delay="0"
    repeat="0"
    debug = False
# Adding support for includes based on the Lirc Documentation
    custom_lircrc = "none"
    home = os.getenv('HOME')
    try:
        opts, args = getopt.getopt(argv, "hL:l:d", ["help", "lircd=", "lircrc=", "mythtv=", "mythtv_lircrc=", "mplayer=", "totem=", "elisa=", "xine=", "vlc=", "xmame=", "xmess=", "irexec=", "repeat=", "delay=", "include="])
    except getopt.GetoptError:
        display_help()
        sys.exit(2)

    for opt, arg in opts:
        if opt in ("-h", "--help"):
            display_help()
            sys.exit()
        elif opt in ("-d"):
            debug = True
        elif opt in ("-L", "--lircd"):
            lircd = arg
        elif opt in ("-l", "--lircrc"):
            lircrc = arg
        elif opt in ("--mythtv"):
            mythtv = arg
        elif opt in ("--mplayer"):
            mplayer = arg
        elif opt in ("--totem"):
            totem = arg
        elif opt in ("--elisa"):
            elisa = arg
        elif opt in ("--xine"):
            xine = arg
        elif opt in ("--vlc"):
            vlc = arg
        elif opt in ("--xmame"):
            xmame = arg
        elif opt in ("--xmess"):
            xmess = arg
        elif opt in ("--irexec"):
            irexec = arg
        elif opt in ("--repeat"):
            repeat = arg
        elif opt in ("--delay"):
            delay = arg
        elif opt in ("--include"):
            custom_lircrc = arg

    if os.path.exists(lircrc):
        shutil.move(lircrc,lircrc + '.old')
    if not os.path.exists(home + '/.lirc'):
        os.mkdir(home + '/.lirc')

    out_f = open(lircrc,'a')
    out_f.write("#Custom lircrc generated via mythbuntu-lirc-generator\n")
    out_f.write("#All application specific lircrc files are within ~/.lirc\n")
    if not custom_lircrc == "none":
        out_f.write("include ~/.lirc/" + custom_lircrc + "\n")
        custom_lircrc = home + '/.lirc/' + custom_lircrc
        if os.path.exists(home + '/.lirc/' + custom_lircrc):
            shutil.move(home + '/.lirc/' + custom_lircrc, home + '/.lirc/' + custom_lircrc +' .old')
            generation_station = CustomHandler(lircd,custom_lircrc,repeat,delay)
            generation_station.generate()
        if debug:
            generation_station.debug()
    if mythtv == "1":
        out_f.write("include ~/.lirc/mythtv \n")
        myth_lircrc = home + '/.lirc/mythtv'
        if os.path.exists(home + '/.lirc/mythtv'):
            shutil.move(home + '/.lirc/mythtv', home + '/.lirc/mythtv.old')
        generation_station = MythTVHandler(lircd,myth_lircrc,repeat,delay)
        generation_station.generate()
        if not os.path.exists(home + '/.mythtv'):
            os.mkdir(home + '/.mythtv')
        if os.path.exists(home + '/.mythtv/lircrc'):
            shutil.copy(home + '/.mythtv/lircrc', home + '/.mythtv/lircrc.old')
            os.remove(home + '/.mythtv/lircrc')
        try:
            os.symlink('../.lirc/mythtv', home + '/.mythtv/lircrc')
        except OSError:
            print "Warning: unable to make symlink to ../.lirc/mythtv, you may have undefined results"
        if debug:
            generation_station.debug()
    if mplayer == "1":
        out_f.write("include ~/.lirc/mplayer \n")
        mplayer_lircrc = home + '/.lirc/mplayer'
        if os.path.exists(home + '/.lirc/mplayer'):
            shutil.move(home + '/.lirc/mplayer', home + '/.lirc/mplayer.old')
        generation_station = MPlayerHandler(lircd,mplayer_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if xine == "1":
        out_f.write("include ~/.lirc/xine \n")
        xine_lircrc = home + '/.lirc/xine'
        if os.path.exists(home + '/.lirc/xine'):
            shutil.move(home + '/.lirc/xine', home + '/.lirc/xine.old')
        generation_station = XineHandler(lircd,xine_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if vlc == "1":
        out_f.write("include ~/.lirc/vlc \n")
        vlc_lircrc = home + '/.lirc/vlc'
        if os.path.exists(home + '/.lirc/vlc'):
            shutil.move(home + '/.lirc/vlc', home + '/.lirc/vlc.old')
        generation_station = VLCHandler(lircd,vlc_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if xmame == "1":
        out_f.write("include ~/.lirc/xmame \n")
        xmame_lircrc = home + '/.lirc/xmame'
        if os.path.exists(home + '/.lirc/xmame'):
            shutil.move(home + '/.lirc/xmame', home + '/.lirc/xmame.old')
        generation_station = XMAMEHandler(lircd,xmame_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if xmess == "1":
        out_f.write("include ~/.lirc/xmess \n")
        xmess_lircrc = home + '/.lirc/xmess'
        if os.path.exists(home + '/.lirc/xmess'):
            shutil.move(home + '/.lirc/xmess', home + '/.lirc/xmess.old')
        generation_station = XMESSHandler(lircd,xmess_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if totem == "1":
        out_f.write("include ~/.lirc/totem \n")
        totem_lircrc = home + '/.lirc/totem'
        if os.path.exists(home + '/.lirc/totem'):
            shutil.move(home + '/.lirc/totem', home + '/.lirc/totem.old')
        generation_station = TotemHandler(lircd,totem_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if elisa == "1":
        out_f.write("include ~/.lirc/elisa \n")
        elisa_lircrc = home + '/.lirc/elisa'
        if os.path.exists(home + '/.lirc/elisa'):
            shutil.move(home + '/.lirc/elisa', home + '/.lirc/elisa.old')
        generation_station = ElisaHandler(lircd,elisa_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    if irexec == "1":
        out_f.write("include ~/.lirc/irexec \n")
        irexec_lircrc = home + '/.lirc/irexec'
        if os.path.exists(home + '/.lirc/irexec'):
            shutil.move(home + '/.lirc/irexec', home + '/.lirc/irexec.old')
        generation_station = IRExecHandler(lircd,irexec_lircrc,repeat,delay)
        generation_station.generate()
        if debug:
            generation_station.debug()
    out_f.close()
    if not debug:
        print "You should now have a .lircrc file generated in " + lircrc
        print "All application specific lircrc files are in " + home + "/.lirc"
    sys.exit()

if __name__ == '__main__':
    main(sys.argv[1:])