cc-4105: added event packing to event objects
This commit is contained in:
parent
be00cc6990
commit
3422eb3cc0
5 changed files with 26 additions and 4 deletions
|
@ -35,7 +35,24 @@ class BaseEvent(object):
|
|||
|
||||
class OrganizeFile(BaseEvent, HasMetaData):
|
||||
def __init__(self, *args, **kwargs): super(OrganizeFile, self).__init__(*args, **kwargs)
|
||||
def pack(self):
|
||||
raise AttributeError("What the hell are you doing? You can't send organize events to airtime!!!")
|
||||
|
||||
class NewFile(BaseEvent, HasMetaData):
|
||||
def __init__(self, *args, **kwargs): super(NewFile, self).__init__(*args, **kwargs)
|
||||
def pack(self):
|
||||
"""
|
||||
packs turns an event into a media monitor request
|
||||
"""
|
||||
req_dict = self.metadata.extract()
|
||||
req_dict['mode'] = 'create'
|
||||
req_dict['MDATA_KEY_FILEPATH'] = self.path
|
||||
return req_dict
|
||||
|
||||
class DeleteFile(BaseEvent):
|
||||
def __init__(self, *args, **kwargs): super(DeleteFile, self).__init__(*args, **kwargs)
|
||||
def pack(self):
|
||||
req_dict = {}
|
||||
req_dict['mode'] = 'delete'
|
||||
req_dict['MDATA_KEY_FILEPATH'] = self.path
|
||||
return req_dict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue