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