File: source_mpd.py

package info (click to toggle)
mpd 0.19.21-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,500 kB
  • ctags: 8,666
  • sloc: cpp: 56,137; xml: 5,744; sh: 4,371; makefile: 1,951; ansic: 830; python: 375; java: 66; ruby: 37
file content (31 lines) | stat: -rw-r--r-- 1,031 bytes parent folder | download | duplicates (8)
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
'''
apport package hook for Music Player Deamon

Author: Ronny Cardona <rcart19@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.  See http://www.gnu.org/copyleft/gpl.html for
the full text of the license.
'''

from apport.hookutils import *
import os

# Reference for this function: http://pastebin.ubuntu.com/263396/
def _my_files(report, filename, keyname):
    if not (os.path.exists(filename)):
            return
    key = keyname 
    report[key] = ""
    for line in read_file(filename).split('\n'):
        try:
            if 'password' in line.split('"')[0]:
                line = "%s \"@@APPORTREPLACED@@\" " % (line.split('"')[0])
            report[key] += line + '\n'
        except IndexError:
            continue

def add_info(report):
       _my_files(report, os.path.expanduser('~/.mpdconf'), 'UserMpdConf')