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

Autonumber and --download-archive #9224

Open
ghost opened this issue Apr 17, 2016 · 6 comments
Open

Autonumber and --download-archive #9224

ghost opened this issue Apr 17, 2016 · 6 comments

Comments

@ghost
Copy link

@ghost ghost commented Apr 17, 2016

Autonumber doesn't work as expected with --download-archive. Not sure whether this should be considered a bug or a feature request, but it is kind of similar to the issue described in #461.

On each run of youtube-dl with --download-archive and %(autonumber)s set, youtube-dl will skip over all previously downloaded videos (as expected), but when it reaches a video it hasn't downloaded, it will starting numbering from 00001 again. Essentially this means autonumber is more-or-less useless when using download-archive as each time it is run the numbering will again start from 00001.

Moreover, if --download-archive is used on a channel, youtube-dl will download videos from newest to oldest (as expected, nothing particularly wrong with downloading in this order), but it does mean that the latest video will be labelled 00001, while the oldest video will be labelled 00100 (for example, given a 100 video channel). This means if we run youtube-dl later when another video is added, there is no numbering that makes sense for this new video, labelling it as 00101 would put it after the oldest video, and obviously it can't be labelled higher than 00001, the newest video from the previous run. In order for this to be truly "fixed", autonumbering would also have to be reversed when --download-archive is used on a channel.

@glinkot
Copy link

@glinkot glinkot commented Nov 10, 2016

I've just encountered this myself. My download of the 00007 file failed while using the archive option. On rerun, it successfully skips the existing videos, but then starts the next one at 00000 again. Ideally it would still increment the numbering when skipping files.

@ghost
Copy link
Author

@ghost ghost commented Nov 11, 2016

Hey glinkot, the issue obviously still hasn't been resolved, but a couple of suggestions that might be useful to you:

  • If you're archiving a channel as a one off, you may have better mileage by adding the -i flag so youtube-dl will skip failed files and continue downloading (and therefore continue autonumbering correctly)
  • Alternatively, if you're using autonumbering simply as a sorting mechanism, you may achieve similar results by putting %(date)s at the beginning of the file name. The only disadvantage (I can see) of this method compared to a properly implemented autonumbering system is that if an old video is moved from unlisted or privated to public, when it is grabbed by --download-archive, it will be slotted in according to its original publish date rather than its download date, meaning you may not realise a "new" video has been downloaded.
@glinkot
Copy link

@glinkot glinkot commented Nov 11, 2016

Thanks for that Jackson, much appreciated. I already have the -i flag in
use. Right now my workaround is just to get the existing files, put them
in a 'part1' folder, then resume. At least that way the order is
preserved.

On Fri, Nov 11, 2016 at 11:06 AM, Jackson Edmonds notifications@github.com
wrote:

Hey glinkot, the issue obviously still hasn't been resolved, but a couple
of suggestions that might be useful to you:

  • If you're archiving a channel as a one off, you may have better
    mileage by adding the -i flag so youtube-dl will skip failed files and
    continue downloading (and therefore continue autonumbering correctly)
  • Alternatively, if you're using autonumbering simply as a sorting
    mechanism, you may achieve similar results by putting %(date)s at the
    beginning of the file name. The only disadvantage (I can see) of this
    method compared to a properly implemented autonumbering system is that if
    an old video is moved from unlisted or privated to public, when it is
    grabbed by --download-archive, it will be slotted in according to its
    original publish date rather than its download date, meaning you may not
    realise a "new" video has been downloaded.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#9224 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANAj84zB9q1ucAKpYWDm6X3htfo-n2gFks5q87F-gaJpZM4IJHXw
.

@nil0bject
Copy link

@nil0bject nil0bject commented Mar 22, 2017

there's an option to start the autonumbering at a value
--autonumber-start NUMBER

@glinkot
Copy link

@glinkot glinkot commented Mar 22, 2017

Fantastic! Thanks nilObject.

@whyicantusemyemailasusername

I found the following apprach acceptable:

TOTAL_TRACKS=$(wc -l < "$OUT_DIR/archive.txt")
NUM_START=$(($TOTAL_TRACKS + 1))
youtube-dl --autonumber-start $NUM_START --download-archive "$OUT_DIR/archive.txt" ...

In this way new episodes get a number that is total_episodes_downloaded + 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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