Podty API is a application that its divided in basically two parts:
- podcast aggregator - collects all podcasts and episodes from the world inside a centralized storage
- user aggregator - centralize all podcasts that a user listen, tracks which episodes they're already listen to, favorites, friends, and much more
For start, we need to populate the database with podcasts, there's an endpoint for that, but its also possible to use any other kind of script that auto-populates (like a crawler for the itunes library).
After we already have the xml feeds inside the database, the only thing needed is to run cron commands to periodically look for new episodes of those feeds. This command will look for new episodes and then add to the database, and to the users that follows those podcasts (to receive the fresh new episodes).
To run this, just set the follow crontab config:
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
$ php artisan queue:work --daemon --sleep 120 --tries 3 -q &
And there's also a queue the takes care of heavy process, as the search for new episodes and updates that don't require immediate response for the services to work.
$ cp .env.example.env
# then, fill out your environment information
$ vim .env
$ php artisan migrate
$ php artisan serve
Besides all the background work, this application also offers an extensive API to manage podcasts and their listeners Its possible to see all routes registered inside the routes file:
https://github.com/brnbp/podty-api/blob/master/routes/v1/api.php
but there's also a postman collection to have a more user friendly view:
https://github.com/brnbp/podty-api/blob/master/podcast-api.postman_collection.json