MythTV  master
main.py
Go to the documentation of this file.
1 # smolt - Fedora hardware profiler
2 #
3 # Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
4 # Copyright (C) 2011 James Meyer <james.meyer@operamail.com>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20 import os
21 from distros.distro import Distro
22 import distros.shared.html as html
23 
24 
25 
26 class _Mythtv(Distro):
27  def key(self):
28  return 'mythtv'
29 
30  def detected(self, debug=False):
31 
32  #return False
33  return True
34 
35 
36  def gather(self, gate, debug=False):
37  def _stage(text):
38  print('Processing %s' % (text))
39  from distros.mythtv_data.data_mythtv import create_mythtv_data
40 
41  _stage('MythTV Data')
42  features = create_mythtv_data(gate)
43 
44  machine_data = {}
45  html_lines = []
46  rst_lines = []
47  metrics_dict = {}
48 
49  rst_lines.append('MythTV data')
50  rst_lines.append('=================================')
51  machine_data['protocol'] = '1.2'
52 
53 
54  machine_data['features'] = features.serialize()
55  features.dump_rst(rst_lines)
56  rst_lines.append('')
57 
58  excerpt_lines = []
59  excerpt_lines.append('...')
60 
61  self._data = machine_data
62  self._html = '\n'.join(html_lines)
63  self._rst = '\n'.join(rst_lines)
64  self._excerpt = '\n'.join(excerpt_lines)
65 
66  def data(self):
67  return self._data
68 
69  def html(self):
70  return self._html
71 
72  def rst(self):
73  return self._rst
74 
75  def rst_excerpt(self):
76  return self._excerpt
77 
78 
80  return _Mythtv()
81 
82 
83 if __name__ == '__main__':
84  # Enable auto-flushing for stdout
85  import sys
86  sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
87 
88  from gate import create_passing_gate
89  mythtv = create_mythtv()
90  mythtv.gather(create_passing_gate(), debug=True)
91 
92  print(mythtv.rst())
hardwareprofile.distros.mythtv_data.main._Mythtv._data
_data
Definition: main.py:61
hardwareprofile.distros.mythtv_data.main._Mythtv._html
_html
Definition: main.py:62
hardwareprofile.distros.mythtv_data.main._Mythtv.rst
def rst(self)
Definition: main.py:72
hardwareprofile.gate.create_passing_gate
def create_passing_gate()
Definition: gate.py:91
hardwareprofile.distros.mythtv_data.main._Mythtv.data
def data(self)
Definition: main.py:66
print
static void print(const QList< uint > &raw_minimas, const QList< uint > &raw_maximas, const QList< float > &minimas, const QList< float > &maximas)
Definition: vbi608extractor.cpp:29
hardwareprofile.distros.mythtv_data.main._Mythtv._rst
_rst
Definition: main.py:63
hardwareprofile.distros.mythtv_data.main._Mythtv.html
def html(self)
Definition: main.py:69
hardwareprofile.distros.mythtv_data.data_mythtv.create_mythtv_data
def create_mythtv_data(gate)
Definition: data_mythtv.py:551
hardwareprofile.distros.mythtv_data.main._Mythtv._excerpt
_excerpt
Definition: main.py:64
hardwareprofile.distros.mythtv_data.main._Mythtv.gather
def gather(self, gate, debug=False)
Definition: main.py:36
hardwareprofile.distros.mythtv_data.main.create_mythtv
def create_mythtv()
Definition: main.py:79
hardwareprofile.distros.distro.Distro
Definition: distro.py:20
hardwareprofile.distros.mythtv_data.main._Mythtv.detected
def detected(self, debug=False)
Definition: main.py:30
hardwareprofile.distros.mythtv_data.main._Mythtv
Definition: main.py:26
hardwareprofile.distros.mythtv_data.main._Mythtv.rst_excerpt
def rst_excerpt(self)
Definition: main.py:75
hardwareprofile.distros.mythtv_data.main._Mythtv.key
def key(self)
Definition: main.py:27