basic support for downloading an entire podcast

This commit is contained in:
logykk 2021-10-24 17:20:41 +13:00
parent 959a162d3c
commit c41fc10bc2
2 changed files with 50 additions and 4 deletions

40
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,40 @@
# Introduction
### Thank you for contributing
Without people like you this project wouldn't be anywhere near as polished and feature-rich as it is now.
### Guidelines
Following these guidelines helps show that you respect the the time and effort spent by the developers and your fellow contributors making this project.
### What we are looking for
ZSpotify is a community-driven project. There are many different ways to contribute. From providing tutorials and examples to help new users, reporting bugs, requesting new features, writing new code that can be added to the project, or even writing documentation.
### What we aren't looking for
Please don't use the issues section to request help installing or setting up the project. It should be reserved for bugs when running the code, and feature requqests. Instead use the support channel in either our Discord or Matrix server.
# Ground rules
### Expectations
* Ensure all code is linted with pylint before pushing.
* Ensure all code passes the [testing criteria](#testing-criteria).
* If you're planning on contributing a new feature, join the Discord or Matrix and discuss it with the Dev Team.
* Please don't commit multiple new features at once.
* Follow the [Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/)
# Your first contribution
Unsure where to start? Have a look for any issues tagged "good first issue". They should be minor bugs that only require a few lines to fix.
Here are a couple of friendly tutorials on making pull requests: http://makeapullrequest.com/ and http://www.firsttimersonly.com/
# Code review process
The dev team looks at Pull Requests around once per day. After feedback has been given we expect responses within one week. After a week we may close the pull request if it isn't showing any activity.
> ZSpotify updates very frequently, often multiple times per day. If a maintainer asks you to "rebase" your PR, they're saying that a lot of code has changed, and that you need to update your branch so it's easier to merge.
# Community
Come and chat with us on Discord or Matrix. Devs try to respond to mentions at least once per day.

View File

@ -8,6 +8,7 @@ from const import NAME, ERROR, SHOW, ITEMS, ID, ROOT_PODCAST_PATH, CHUNK_SIZE
from utils import sanitize_data, create_download_directory, MusicFormat from utils import sanitize_data, create_download_directory, MusicFormat
from zspotify import ZSpotify from zspotify import ZSpotify
EPISODE_INFO_URL = 'https://api.spotify.com/v1/episodes' EPISODE_INFO_URL = 'https://api.spotify.com/v1/episodes'
SHOWS_URL = 'https://api.spotify.com/v1/shows' SHOWS_URL = 'https://api.spotify.com/v1/shows'
@ -21,11 +22,16 @@ def get_episode_info(episode_id_str) -> tuple[Optional[str], Optional[str]]:
def get_show_episodes(show_id_str) -> list: def get_show_episodes(show_id_str) -> list:
episodes = [] episodes = []
offset = 0
limit = 50
resp = ZSpotify.invoke_url(f'{SHOWS_URL}/{show_id_str}/episodes') while True:
resp = ZSpotify.invoke_url_with_params(f'{SHOWS_URL}/{show_id_str}/episodes', limit=limit, offset=offset)
offset += limit
for episode in resp[ITEMS]: for episode in resp[ITEMS]:
episodes.append(episode[ID]) episodes.append(episode[ID])
if len(resp[ITEMS]) < limit:
break
return episodes return episodes