winterbird-code / adbb

Object Oriented UDP Client Library for AniDB
GNU General Public License v3.0
17 stars 4 forks source link

Can't get mylist_filestate for a generic file? #4

Closed Andy2244 closed 6 years ago

Andy2244 commented 7 years ago

The NetIO has, the 11 filestate set, yet the generated entry has no mylist_filestate ?

log:

NetIO < b'T001 221 MYLIST\n75665807|586025|102236|6239|0|1255223235|0|1255223235||||11\n'
>> Adding mylist info: {'is_generic': True, 'mylist_other': None, 'lid': 75665807, 'eid': 102236, 'mylist_viewed': True, 'mylist_storage': None, 'mylist_viewdate': datetime.datetime(2009, 10, 11, 3, 7, 15), 'aid': 6239, 'mylist_source': None, 'mylist_state': 'unknown', 'gid': 0, 'fid': 586025}
>> Listening on socket with 20.0s timeout
>> Object saved to database: <FileTable(pk=5, path=None, mylist_state=unknown, mylist_viewed=True, updated=2016-12-21 12:44:56.956589)>
Andy2244 commented 7 years ago

Ah i see this is not in mylist_map_converters, how do those work anyway? I see this in the wiki:

{int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}

Yet the date between gid-[date]-state is missing in the mylist_map_converters? How is data counted and why does this even work if there is a hole in it? I was under the impression the bitmask need to perfectly match the interpreted range or data might be corrupted?

mylist_map_converters = {
    'lid': int,
    'fid': int,
    'eid': int,
    'aid': int,
    'gid': int,
    'mylist_state': lambda x: mylist_state_map[x] if x else None,
    'mylist_viewdate': lambda x: datetime.datetime.fromtimestamp(int(x)) if x and int(x) else None,
    'mylist_storage': lambda x: x or None,
    'mylist_source': lambda x: x or None,
    'mylist_other': lambda x: x or None
}
Andy2244 commented 7 years ago

Oki found it, the actual bit-map is this:

self.codestr = 'MYLIST'
        self.codehead = ()
        self.codetail = (
            'lid',
            'fid',
            'eid',
            'aid',
            'gid',
            'date',
            'mylist_state',
            'mylist_viewdate',
            'mylist_storage',
            'mylist_source',
            'mylist_other')

So there is just filestatemissing at the end. So is it enough to add it there and in the mylist_map_converters? Will this be than also correctly handled by the db?

winterbird-code commented 7 years ago

hmm, no I think we will have to alter the DB-table as well, not sure why I didn't add it from the start...