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

Auto Number #16

Closed
wants to merge 4 commits into from
Closed

Auto Number #16

wants to merge 4 commits into from

Conversation

v01d-cypher
Copy link

Hi,

Me again. Here's another feature I use quite often actually. See if you'd like to include it.
It allows for auto numbering downloads and can be quite useful for preserving the order of playlist items and the order of URLs specified in the batch file.

I'm not too sure how it will work if you pull from me now as it lists 4 commits where I would have expected only 2. Either way git will probably sort that out (or you manually I guess ;-)

Regards,
Nevar

Nevar Angelo and others added 4 commits November 4, 2010 22:52
Added code and commentary for the playlist-end option.
Removed check > 0 on playlist-start in favor of using slice on video-ids.
This allows for numbering URLs to preserve download order.
eg. Will preserve order of playlist items.
eg. Will preserve order of URLs in file specified by -a or --batch-file.
@rg3
Copy link
Collaborator

rg3 commented Nov 6, 2010

Hi again,

Can you explain me what's the essential difference between that and using %(ord)s in the output template? "ord" is supposed to cover that case.

Thanks in advance.

@v01d-cypher
Copy link
Author

Oh dear, I'm an idiot. I looked at %(ord)s and it didn't even register. Forgive my sillly mistake :-|. Is there a way for the user (i.e. not by looking at the source) to see what options are available for use in an output template?

How do you feel about my implemenation of auto_number in FileDownloader vs. in each InfoExtractor? Also with switch -A instead of just in output template? Although of course why change working code especially if it's such a minor thing :-).

Hope I'm not coming across as arrogant. Thank you so much for all the work you and the other developers have put in to create this tool!

@rg3
Copy link
Collaborator

rg3 commented Nov 6, 2010

No problem. The list of options in the output template can be found in the program's webpage: http://rg3.github.com/youtube-dl/.

I think the idea of having an option to turn on autonumbering is very nice because it saves the user from having to write the output template by themselves. I may also cherry-pick your change about allowing comments in the batch file.

Having "ord" in the file downloader and not in each InfoExtractor is what I did when I first implemented the feature, but some people complained about the resulting behavior and I recall changing the code. If my memory serves me right, I recall it had to do with temporary problems while downloading playlists. I think if you put the increment inside the FileDownloader code every time it attempts to download a file, and there is a problem accessing the webpage for a playlist video, the number is skipped.

For example, the playlist could have 3 videos that should be numbered 1, 2 and 3. The second video gives you problems at the InfoExtractor level and you end up only downloading videos 1 and 3, but they would be numbered 1 and 2. If you then used option -c to attempt again to download the playlist completely, you would get two videos with number 2 and the third video would be downloaded twice due to the file name difference. By letting the InfoExtractors control the video numbering, you get consistent numbering between runs independently of the problems that may arise downloading specific videos.

Finally, thanks for your support! You are not coming as arrogant at all!

One last note: be sure to rebase your changes on my tree from time to time (git rebase as opposed to git merge), or simply re-creating your fork. If I pull changes from you from time to time, that will keep the trees much more similar and simplify pulling changes in the long run.

Cheers!

@v01d-cypher
Copy link
Author

I guess the tool was so well designed and easy to use, I never read the usage instructions on the website ;-p

Ah I see @ ord in InfoExtractor. I was thinking that if a download fails, it should still increment to indicate the missing file, but as I'm not aware of all the complexities in the code I didn't realise that putting it in the InfoExtractor caters for that exact problem.

Ok I will rebase. I was following the github fork guide which says to fetch/merge, but rebase would be a lot cleaner/neater. I will refork it and recommit the 'comments' code and perhaps see if I can work an implementation of auto_number with the code you already have. That's assuming you like the option being called -A and --auto-number :-)

Keep well.

@rg3
Copy link
Collaborator

rg3 commented Nov 6, 2010

Yes, no problem. And if I change my mind I can always change the name later.

@rg3
Copy link
Collaborator

rg3 commented Nov 6, 2010

Oh, BTW, I'll close this pull request. Issue a new one after the rebase. Thanks in advance.

CaptainPatate referenced this pull request in CaptainPatate/youtube-dl Sep 14, 2011
@ghost ghost mentioned this pull request Aug 17, 2018
5 tasks
@FelixChery FelixChery mentioned this pull request Apr 24, 2019
joedborg referenced this pull request in joedborg/youtube-dl Nov 17, 2020
[pull] master from rg3:master
tsukumijima pushed a commit to tsukumijima/youtube-dl that referenced this pull request Dec 2, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants