mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
25 lines
735 B
Python
25 lines
735 B
Python
from updater import DEFAULT_PAGE_SIZE, get_updates, get_format
|
|
|
|
|
|
# AWS Lambda entry point
|
|
def handler(event, context):
|
|
url = event.get('url', None)
|
|
start = event.get('start', 1)
|
|
count = event.get('count', DEFAULT_PAGE_SIZE)
|
|
|
|
# Last seen video ID
|
|
last_id = event.get('last_id', None)
|
|
|
|
# Detect item format
|
|
fmt = event.get('format', 'video')
|
|
quality = event.get('quality', 'high')
|
|
ytdl_fmt = get_format(fmt, quality)
|
|
|
|
print('Getting updates for %s (start=%d, count=%d, fmt: %s, last id: %s)' % (url, start, count, ytdl_fmt, last_id))
|
|
_, episodes, new_last_id = get_updates(start, count, url, ytdl_fmt, last_id)
|
|
|
|
return {
|
|
'last_id': new_last_id,
|
|
'episodes': episodes,
|
|
}
|