2019-10-19 17:14:11 +01:00
|
|
|
from music import app
|
2020-02-03 09:44:33 +00:00
|
|
|
from music.tasks.update_tag import update_tag as do_update_tag
|
2019-07-26 11:05:27 +01:00
|
|
|
|
|
|
|
app = app
|
|
|
|
|
2020-02-03 09:44:33 +00:00
|
|
|
|
|
|
|
def update_tag(event, context):
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logger = logging.getLogger('music')
|
|
|
|
|
2020-02-03 11:51:46 +00:00
|
|
|
if event.get('attributes'):
|
|
|
|
if 'username' in event['attributes'] and 'tag_id' in event['attributes']:
|
|
|
|
do_update_tag(username=event['attributes']['username'], tag_id=event['attributes']["tag_id"])
|
|
|
|
else:
|
|
|
|
logger.error('no parameters in event attributes')
|
2020-02-03 09:44:33 +00:00
|
|
|
else:
|
2020-02-03 11:51:46 +00:00
|
|
|
logger.error('no attributes in event')
|
2020-02-03 09:44:33 +00:00
|
|
|
|
|
|
|
|
2019-07-26 11:05:27 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(host='127.0.0.1', port=8080, debug=True)
|