-
Notifications
You must be signed in to change notification settings - Fork 62
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
Reuse of EitSupport as standalone application #274
Comments
This is not matching our current code, there is a lot of wrong and obsolete code in your code. |
I in the process of refactoring and suggest using something like: class Event(object):
def __init__(self,name):
self.name=name
self.descriptor = []
self.descriptor_multi = []
self.codepage = None
def readDescription(self,data,pos,lenOfs,startOfs):
'''
read my description
'''
event_name_length = bord(data[pos+lenOfs])
self.description= Bytes()
for i in range (pos+startOfs,pos+startOfs+event_name_length):
try:
if str(bord(data[i]))=="10" or int(str(bord(data[i])))>31:
self.description.add(data[i])
except IndexError as e:
emcDebugOut("[META] Exception in readEitFile: " + str(e))
def readCodePage(self,data,pos,startOfs):
if not self.codepage:
try:
byte1 = str(bord(data[pos+startOfs]))
except:
byte1 = ''
if byte1=="1": self.codepage = 'iso-8859-5'
elif byte1=="2": self.codepage = 'iso-8859-6'
elif byte1=="3": self.codepage = 'iso-8859-7'
elif byte1=="4": self.codepage = 'iso-8859-8'
elif byte1=="5": self.codepage = 'iso-8859-9'
elif byte1=="6": self.codepage = 'iso-8859-10'
elif byte1=="7": self.codepage = 'iso-8859-11'
elif byte1=="9": self.codepage = 'iso-8859-13'
elif byte1=="10": self.codepage = 'iso-8859-14'
elif byte1=="11": self.codepage = 'iso-8859-15'
elif byte1=="21": self.codepage = 'utf-8'
if self.codepage:
emcDebugOut("[META] Found name_event encoding-type: " + self.codepage) please stay tuned for the next commit |
WolfgangFahl/eitparser@b72cc5e has a refactoring state that is close to what i am up to. It uses a Bytes and Event class and makes debugging simpler. |
https://pypi.org/project/eitparser/ version 0.0.1 is out now. It passes the testing against the 392 eit files from my Vu+ Duo² |
Thank you for your great software. I have been using an extract of your software for EIT parsing since 2016. I am now in the process of creating a standalone version and would love to make sure that the standalone version can stay in sync with your original code.
For python3 the byte handling seems to need to be modified. Please find my changes at:
https://github.com/WolfgangFahl/eitparser/blob/main/eit/eitparser.py
I'd appreciate some feedback whether the code could be changed to a common base class used by both projects. I'd like to avoid the dependencies
and for that only minor changes where necessary. I also added a main function and some static methods.
The text was updated successfully, but these errors were encountered: