Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide User Interface to the MythTV's Services #198

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions mythtv/bindings/python/MythTV/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
'Frontend', 'MythDB', 'MythXML', 'MythMusic', \
'MythVideo']

__all_service__ = ['MythTVService']

__all__ = ['static', 'MSearch', 'MythLog', 'StorageGroup']\
+__all_exceptions__\
+__all_utility__\
+__all_system__\
+__all_proto__\
+__all_data__\
+__all_method__
+__all_method__\
+__all_service__

import sys
from . import static
from .exceptions import *
from .logging import *
Expand All @@ -40,7 +44,13 @@
from .mythproto import *
from .dataheap import *
from .methodheap import *

if sys.version_info[0] > 2:
from .mythservices import *
else:
import warnings
warnings.warn("MythTV deprecates the usage of Python2 "
"and will remove support in future releases.",
DeprecationWarning)

__version__ = OWN_VERSION
static.dbmodule = dbmodule.__version__
Expand Down
34 changes: 30 additions & 4 deletions mythtv/bindings/python/MythTV/altdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from MythTV.exceptions import MythError
from MythTV.utility import datetime
from MythTV.utility import eval_bool

from datetime import date
import locale
Expand Down Expand Up @@ -78,22 +79,47 @@ class DictData( OrdDict ):
"""
_field_order = None
_field_type = None

_trans = [ int,
locale.atof,
lambda x: bool(int(x)),
eval_bool,
lambda x: x,
lambda x: datetime.fromtimestamp(x if x != '4294967295' else '0', datetime.UTCTZ())\
.astimezone(datetime.localTZ()),
lambda x: date(*[int(y) for y in x.split('-')]),
lambda x: datetime.fromRfc(x, datetime.UTCTZ())\
.astimezone(datetime.localTZ())]
.astimezone(datetime.localTZ()),
lambda x: datetime.fromIso(x).astimezone(datetime.localTZ()),
lambda x: datetime.strptime(x, "%H:%M:%S.%f").time(),
list,
dict
]

_inv_trans = [ str,
lambda x: locale.format_string("%0.6f", x),
lambda x: str(int(x)),
lambda x: x,
lambda x: str(int(x.timestamp())),
lambda x: x.isoformat(),
lambda x: x.utcrfcformat()]
lambda x: x.utcrfcformat(),
lambda x: x.utcisoformat(),
lambda x: x.strftime("%H:%M:%S.%f"),
lambda x: x,
lambda x: list(x.items())
]

_defaults = [ 0,
0.0,
'0', ### XXX 'False'
'', ### XXX str
'', ### XXX fromtimestamp fill me in!
date(1900,1,1), ### XXX date
'', ### XXX fromRFC fill me in!
datetime(1900,1,1, tzinfo=datetime.UTCTZ()),
datetime(1900,1,1, tzinfo=datetime.UTCTZ()).time(),
[],
{}
]

def __setattr__(self, name, value):
if name in self._localvars:
Expand Down Expand Up @@ -139,7 +165,7 @@ def _process(self, data):
raise MythError('Incorrect raw input length to DictData()')
data = list(data)
for i,v in enumerate(data):
if v == '':
if (v == '') or (v is None):
data[i] = None
else:
data[i] = self._trans[self._field_type[i]](v)
Expand Down
1 change: 1 addition & 0 deletions mythtv/bindings/python/MythTV/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MythLog( LOGLEVEL, LOGMASK, LOGFACILITY ):
" channelscan " - Channel Scanning messages
" extra " - More detailed messages in selected levels
" timestamp " - Conditional data driven messages
" http " - HTTP messages to/from MythTV's http server
" none " - NO debug output

The default for this program appears to be: '-v "important,general" '
Expand Down
Loading