Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pad %(playlist_index)s with zeroes #4157

Closed
clampak opened this issue Nov 11, 2014 · 6 comments
Closed

Pad %(playlist_index)s with zeroes #4157

clampak opened this issue Nov 11, 2014 · 6 comments

Comments

@clampak
Copy link

@clampak clampak commented Nov 11, 2014

It would be a useful feature to be able to pad the numbering in the output filenames like --autonumber-size, but using the playlist index number instead. Currently there is no way to do this, unless it's undocumented. Perhaps an option --pad-playlist-index or --playlist-index-size?

@phihag
Copy link
Contributor

@phihag phihag commented Dec 15, 2014

Currently, the playlist index should be padded automatically to the size of the playlist. Unfortunately, that prevents the user from using custom format codes. Can you describe the context where you want a different padding than provided?

@clampak
Copy link
Author

@clampak clampak commented Dec 15, 2014

Trying it again now, it seems to do what I was asking for. I thought I had run into a situation where it wasn't padding... if it happens again I'll re-visit this. Thanks.

@clampak clampak closed this Dec 15, 2014
@Romain-Revel
Copy link

@Romain-Revel Romain-Revel commented Mar 9, 2015

Here is a context where a padding would be useful:
I want to download this playlist https://www.youtube.com/playlist?list=PLE30F9d9cZayucP7UqdO37kjo3gtf989s
composed of 121 vidéos at the moment. So I start downloading it with a filename containing %(playlist_index)s. So this program creates the files 001, 002 ... Then there is an error, or the time is too long so I have to stop the download and restart it later with --playlist-start NUMBER. But if I use --playlist-start 22 or more, then there are less than 99 épisodes to download, so the %(playlist_index)s is written on 2 digits.
The first problem is that there is no coherence between the name of the first episodes and the last ones.
The second problem is that as I stopped the first download, it most probably stopped in the middle of the download of one episode, so when it restarts it doesn't find the .part file and starts the download of the current episode from the beginning.

It might be useful to be able to give the format in the --playlist-start in the following way:
--playlist-start 1 => file 1, 2 ... 10 ... 222 ... 99999
--playlist-start 01 => file 01, 02 ... 10 ... 222 ... 99999
--playlist-start 001 => file 001, 002 ... 010 ... 222 ... 99999

It might also be useful to provide a switch --playlist-index-format NUMBER_OF_DIGITS

@etnoy
Copy link

@etnoy etnoy commented Apr 18, 2016

I have a question related to this issue as I've run in to an issue where the original request applies. I use cron scripts to auto-download playlists on my Linux server every night. These playlists can be small to begin with, but grow with time, and new episodes will be downloaded via cron.

For example, I just added a three-item playlist to the queue which was downloaded with playlist_index as 1, 2 and 3. However, I know that this playlist will grow, possibly to three digits long, so youtube-dl will switch to 01, 02, 03 and possibly 001, 002, 003 as it passes 10 and 100.

It would be useful to specify a playlist_index padding (like in C where you use %05d) that I can force from youtube-dl.conf. For instance, like %(playlist_index)05d. In that way I don't have to worry about this, and Plex will not complain.

@clampak clampak reopened this May 6, 2016
@iMrQuake
Copy link

@iMrQuake iMrQuake commented May 15, 2018

Hi,
Another but very similar context: you start download elements of a playlist and some time you get the error message: too many request, and never able to downloaf all playlist, but you can manually.
So when forcing with --playlist-items, the number use for naming the file will start to 1 instead of the current playlist index, for instance, you resume the 22th element, you expect to have a named file with 22 and not 1.
I have tried to add the start and end index, but sale results, sae with chapter_number, chapter_id is a string :(

Anyway, this tool is very GREAT !!! thanks

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 12, 2018

%(playlist_index)05d is available for a long time already.

@dstftw dstftw closed this Jun 12, 2018
@ytdl-org ytdl-org locked as resolved and limited conversation to collaborators Jun 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.