Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
178
Issues
178
List
Boards
Labels
Milestones
Merge Requests
52
Merge Requests
52
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
9e7f2a93
Commit
9e7f2a93
authored
Dec 17, 2013
by
Florent Fourcot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First implementation of boobsize
parent
9db428ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
0 deletions
+165
-0
scripts/boobsize
scripts/boobsize
+27
-0
weboob/applications/boobsize/__init__.py
weboob/applications/boobsize/__init__.py
+23
-0
weboob/applications/boobsize/boobsize.py
weboob/applications/boobsize/boobsize.py
+115
-0
No files found.
scripts/boobsize
0 → 100755
View file @
9e7f2a93
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
# Copyright(C) 2013 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from
weboob.applications.boobsize
import
Boobsize
if
__name__
==
'__main__'
:
Boobsize
.
run
()
weboob/applications/boobsize/__init__.py
0 → 100644
View file @
9e7f2a93
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from
.boobsize
import
Boobsize
__all__
=
[
'Boobsize'
]
weboob/applications/boobsize/boobsize.py
0 → 100644
View file @
9e7f2a93
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from
weboob.capabilities.gauge
import
ICapGauge
,
SensorNotFound
from
weboob.tools.application.repl
import
ReplApplication
,
defaultcount
from
weboob.tools.application.formatters.iformatter
import
IFormatter
,
PrettyFormatter
import
sys
__all__
=
[
'Boobsize'
]
class
CitiesFormatter
(
PrettyFormatter
):
MANDATORY_FIELDS
=
(
'id'
,
'name'
)
def
get_title
(
self
,
obj
):
return
obj
.
name
class
Boobsize
(
ReplApplication
):
APPNAME
=
'Boosize'
VERSION
=
'0.h'
COPYRIGHT
=
'Copyright(C) 2013 Florent Fourcot'
DESCRIPTION
=
"Console application allowing to display various sensors and gauges values."
SHORT_DESCRIPTION
=
"display sensors and gauges values"
CAPS
=
(
ICapGauge
)
DEFAULT_FORMATTER
=
'table'
def
main
(
self
,
argv
):
self
.
load_config
()
return
ReplApplication
.
main
(
self
,
argv
)
def
bcall_error_handler
(
self
,
backend
,
error
,
backtrace
):
if
isinstance
(
error
,
SensorNotFound
):
msg
=
unicode
(
error
)
or
'Sensor not found (hint: try sensors command)'
print
>>
sys
.
stderr
,
'Error(
%
s):
%
s'
%
(
backend
.
name
,
msg
)
else
:
return
ReplApplication
.
bcall_error_handler
(
self
,
backend
,
error
,
backtrace
)
def
do_search
(
self
,
pattern
):
"""
search [PATTERN]
Display all gauges. If PATTERN is specified, search on a pattern.
"""
self
.
change_path
([
u'gauges'
])
self
.
start_format
()
for
backend
,
gauge
in
self
.
do
(
'iter_gauges'
,
pattern
or
None
,
caps
=
ICapGauge
):
self
.
cached_format
(
gauge
)
def
complete_search
(
self
,
text
,
line
,
*
ignored
):
args
=
line
.
split
(
' '
)
if
len
(
args
)
==
2
:
return
self
.
_complete_object
()
def
do_details
(
self
,
line
):
"""
details GAUGE_ID
Display details of all sensors of the gauge.
"""
gauge
,
pattern
=
self
.
parse_command_args
(
line
,
2
,
1
)
_id
,
backend_name
=
self
.
parse_id
(
gauge
)
self
.
start_format
()
for
backend
,
sensor
in
self
.
do
(
'iter_sensors'
,
_id
,
pattern
=
pattern
,
backends
=
backend_name
,
caps
=
ICapGauge
):
self
.
format
(
sensor
)
def
do_history
(
self
,
line
):
"""
history SENSOR_ID
Get history of a specific sensor (use 'search' to find a gauge, and sensors GAUGE_ID to list sensors attached to the gauge).
"""
gauge
,
=
self
.
parse_command_args
(
line
,
1
,
1
)
_id
,
backend_name
=
self
.
parse_id
(
gauge
)
self
.
start_format
()
for
backend
,
measure
in
self
.
do
(
'iter_gauge_history'
,
_id
,
backends
=
backend_name
,
caps
=
ICapGauge
):
self
.
format
(
measure
)
def
complete_last_sensor_measure
(
self
,
text
,
line
,
*
ignored
):
args
=
line
.
split
(
' '
)
if
len
(
args
)
==
2
:
return
self
.
_complete_object
()
def
do_last_sensor_measure
(
self
,
line
):
"""
last_sensor_measure SENSOR_ID
Get last measure of a sensor.
"""
gauge
,
=
self
.
parse_command_args
(
line
,
1
,
1
)
_id
,
backend_name
=
self
.
parse_id
(
gauge
)
self
.
start_format
()
for
backend
,
measure
in
self
.
do
(
'get_last_measure'
,
_id
,
backends
=
backend_name
,
caps
=
ICapGauge
):
self
.
format
(
measure
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment