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

playlist_index ignores playlist-items #10591

Closed
lesmana opened this issue Sep 8, 2016 · 1 comment
Closed

playlist_index ignores playlist-items #10591

lesmana opened this issue Sep 8, 2016 · 1 comment
Labels
bug

Comments

@lesmana
Copy link

@lesmana lesmana commented Sep 8, 2016

  • I've verified and I assure that I'm running youtube-dl 2016.09.04.1
  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Bug report (encountered problems with youtube-dl)

When using --playlist-items and -o '...%(playlist_index)s...' then playlist_index will not take the numbers from --playlist-items. It will always start from 1 instead. I expect playlist_index to take over the numbers from --playlist_items.

In contrast: when using --playlist-start and --playlist-end then playlist_index will correctly take over the numbers.

Example for --playlist-items:

youtube-dl $playlisturl --playlist-items 5,7 -o '%(playlist_index)s-%(id)s.%(ext)s'

This will download item 5 and 7 from playlist but will name the files 1-$id.ext and 2-$id.ext. I expect the files to be named 5-$id.ext and 7-$id.ext.

Example for --playlist-start and --playlist-end:

youtube-dl $playlisturl --playlist-start 5 --playlist-end 7 -o '%(playlist_index)s-%(id)s.%(ext)s'

This will download item 5,6 and 7 from playlist and will name the files 5-$id.ext and 6-$id.ext and 7-$id.ext

I have only tested this on youtube.


The verbose output for an actual download using --playlist-items:

$ youtube-dl -v -fworst https://www.youtube.com/playlist?list=PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi --playlist-items 5,7 -o '%(playlist_index)s-%(id)s-%(title)s.f%(format_id)s.%(ext)s'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '-fworst', 'https://www.youtube.com/playlist?list=PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi', '--playlist-items', '5,7', '-o', '%(playlist_index)s-%(id)s-%(title)s.f%(format_id)s.%(ext)s']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.09.04.1
[debug] Python version 3.5.2 - Linux-4.7.2-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.1.3, ffprobe 3.1.3, rtmpdump 2.4
[debug] Proxy map: {}
[youtube:playlist] PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi: Downloading webpage
[download] Downloading playlist: Sandmann - Unser Sandmännchen
[youtube:playlist] playlist Sandmann - Unser Sandmännchen: Downloading 2 videos
[download] Downloading video 1 of 2
[youtube] v5Ao7w0ARtA: Downloading webpage
[youtube] v5Ao7w0ARtA: Downloading video info webpage
[youtube] v5Ao7w0ARtA: Extracting video information
[youtube] v5Ao7w0ARtA: Downloading MPD manifest
[debug] Invoking downloader on 'https://r5---sn-uxax4vopj5qx-4g5e.googlevideo.com/videoplayback?itag=17&sver=3&upn=os4Z4S-yKuM&expire=1473315901&key=yt6&signature=9B22192330DB2695FFCB7109ABB2563CBE94003B.AF733B186E345F3D86162732DF4B424CB25C102D&lmt=1432233146713131&source=youtube&dur=489.012&requiressl=yes&initcwndbps=1472500&ipbits=0&mime=video%2F3gpp&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AB4pFNuYkM_T5tx5--D-zE0CyWSdGbGvLpspxPLCY5K-&mm=31&mn=sn-uxax4vopj5qx-4g5e&ei=3a_QV5PdL6mniQa-waywCQ&ms=au&mt=1473293770&mv=m&pl=23&ip=78.53.210.96&ratebypass=yes'
[download] Destination: 1-v5Ao7w0ARtA-Sandmann kommt mit einem Elefant - Folge mit Pittiplatsch, Schnatterinchen und Moppi.f17.3gp
[download] 100% of 4.76MiB in 00:06
[download] Downloading video 2 of 2
[youtube] 7vJH5-rSyG4: Downloading webpage
[youtube] 7vJH5-rSyG4: Downloading video info webpage
[youtube] 7vJH5-rSyG4: Extracting video information
[youtube] 7vJH5-rSyG4: Downloading MPD manifest
[debug] Invoking downloader on 'https://r7---sn-uxax4vopj5qx-4g5e.googlevideo.com/videoplayback?itag=17&mt=1473293770&sver=3&requiressl=yes&expire=1473315909&key=yt6&mime=video%2F3gpp&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&lmt=1432231242999593&dur=543.857&mv=m&ip=78.53.210.96&ms=au&signature=7FF6B34D8DB2E1E598270B8BFE388DAFBB8F94A6.AC70FC53F61AAC183801855FC7FD1A7E2267A32A&source=youtube&initcwndbps=1472500&mn=sn-uxax4vopj5qx-4g5e&mm=31&id=o-AIyt8MeQkFoYb9nCpkZJwSNA0W2-VPuBmDMSDCjh5bVm&upn=A2e0NAhGd1o&ipbits=0&ei=5a_QV5zPIqSljAafiYBA&pl=23&ratebypass=yes'
[download] Destination: 2-7vJH5-rSyG4-Sandmann kommt mit Tracktor mit Schneeschieber - Folge mit Pittiplatsch, Schnatterinchen und Moppi.f17.3gp
[download] 100% of 5.28MiB in 00:05
[download] Finished downloading playlist: Sandmann - Unser Sandmännchen

The verbose output for an actual download using --playlist-start and --playlist-end:

$ youtube-dl -v -fworst https://www.youtube.com/playlist?list=PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi --playlist-start 5 --playlist-end 7 -o '%(playlist_index)s-%(id)s-%(title)s.f%(format_id)s.%(ext)s'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '-fworst', 'https://www.youtube.com/playlist?list=PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi', '--playlist-start', '5', '--playlist-end', '7', '-o', '%(playlist_index)s-%(id)s-%(title)s.f%(format_id)s.%(ext)s']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.09.04.1
[debug] Python version 3.5.2 - Linux-4.7.2-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.1.3, ffprobe 3.1.3, rtmpdump 2.4
[debug] Proxy map: {}
[youtube:playlist] PLPIsy4S-Z54tGA3egackNGwSTakXe7Ixi: Downloading webpage
[download] Downloading playlist: Sandmann - Unser Sandmännchen
[youtube:playlist] playlist Sandmann - Unser Sandmännchen: Downloading 3 videos
[download] Downloading video 1 of 3
[youtube] v5Ao7w0ARtA: Downloading webpage
[youtube] v5Ao7w0ARtA: Downloading video info webpage
[youtube] v5Ao7w0ARtA: Extracting video information
[youtube] v5Ao7w0ARtA: Downloading MPD manifest
[debug] Invoking downloader on 'https://r5---sn-uxax4vopj5qx-4g5e.googlevideo.com/videoplayback?mm=31&mn=sn-uxax4vopj5qx-4g5e&id=o-AIj3Tm34Pmi9xO-_1l0axdNeKIYYbkIiAirJ4M2hrXdz&pl=23&ip=78.53.210.96&requiressl=yes&mt=1473294091&mv=m&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&ms=au&ipbits=0&dur=489.012&sver=3&expire=1473315934&lmt=1432233146713131&signature=4F25A9E1185018D8A79F0F246A2441156AFF8DBA.2636150E3FD0DC8DB80F4289B07808163EFF4161&itag=17&mime=video%2F3gpp&key=yt6&ei=_q_QV_PKG8eciQblsbXoBg&initcwndbps=1447500&source=youtube&upn=n0pTbnQdXlc&ratebypass=yes'
[download] Destination: 5-v5Ao7w0ARtA-Sandmann kommt mit einem Elefant - Folge mit Pittiplatsch, Schnatterinchen und Moppi.f17.3gp
[download] 100% of 4.76MiB in 00:04
[download] Downloading video 2 of 3
[youtube] L1hblPqUigE: Downloading webpage
[youtube] L1hblPqUigE: Downloading video info webpage
[youtube] L1hblPqUigE: Extracting video information
[youtube] L1hblPqUigE: Downloading MPD manifest
[debug] Invoking downloader on 'https://r8---sn-uxax4vopj5qx-4g5e.googlevideo.com/videoplayback?initcwndbps=1447500&signature=943EF7CCD69045212EADC78DE75B902663C7F6E7.77D8DD682637A22D4F1A9E2DFA982C3F2DD23352&pl=23&source=youtube&upn=myzdV3jCAXw&mime=video%2F3gpp&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AMbfEzHJ3swB-D2zA9PAKlxuepenfSV4EW17vMOcBUC7&itag=17&ip=78.53.210.96&key=yt6&dur=520.916&lmt=1432232838935277&ei=BLDQV4nHI6WriAaHipz4Cw&ms=au&mt=1473294091&mv=m&expire=1473315940&sver=3&requiressl=yes&ipbits=0&mm=31&mn=sn-uxax4vopj5qx-4g5e&ratebypass=yes'
[download] Destination: 6-L1hblPqUigE-Sandmann kommt mit einem Kanu - Folge mit Pittiplatsch, Schnatterinchen und Moppi.f17.3gp
[download] 100% of 5.07MiB in 00:07
[download] Downloading video 3 of 3
[youtube] 7vJH5-rSyG4: Downloading webpage
[youtube] 7vJH5-rSyG4: Downloading video info webpage
[youtube] 7vJH5-rSyG4: Extracting video information
[youtube] 7vJH5-rSyG4: Downloading MPD manifest
[debug] Invoking downloader on 'https://r7---sn-uxax4vopj5qx-4g5e.googlevideo.com/videoplayback?mm=31&pl=23&mn=sn-uxax4vopj5qx-4g5e&key=yt6&ip=78.53.210.96&dur=543.857&sver=3&source=youtube&lmt=1432231242999593&id=o-ALZJBPV_USVB5deiCTrEB3RW4BPI7_RJ0yLn9ZF7N3DP&ei=DrDQV_6WJoX9iAbil7_oAQ&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&ms=au&mt=1473294091&mv=m&initcwndbps=1447500&ipbits=0&requiressl=yes&mime=video%2F3gpp&expire=1473315950&signature=E36F5F3D7C4F76D8D1B05BD49CEEF8CE9BA421E9.7D539E033548FB1AA4A316AB0A91A3F93827AB2D&upn=LVuZ3X-m6Cg&itag=17&ratebypass=yes'
[download] Destination: 7-7vJH5-rSyG4-Sandmann kommt mit Tracktor mit Schneeschieber - Folge mit Pittiplatsch, Schnatterinchen und Moppi.f17.3gp
[download] 100% of 5.28MiB in 00:05
[download] Finished downloading playlist: Sandmann - Unser Sandmännchen
@lesmana lesmana changed the title youtube-dl playlist_index ignores playlist-items playlist_index ignores playlist-items Sep 8, 2016
@lesmana
Copy link
Author

@lesmana lesmana commented Sep 11, 2016

I think I have found the bug. It is in a loop over all entries in the file youtube_dl/YoutubeDL.py in line 842

for i, entry in enumerate(entries, 1):
    self.to_screen('[download] Downloading video %s of %s' % (i, n_entries))
    extra = {
        'n_entries': n_entries,
        'playlist': playlist,
        'playlist_id': ie_result.get('id'),
        'playlist_title': ie_result.get('title'),
        'playlist_index': i + playliststart, # <<<<<<<<< here is the bug <<<<<<<<<
        'extractor': ie_result['extractor'],
        'webpage_url': ie_result['webpage_url'],
        'webpage_url_basename': url_basename(ie_result['webpage_url']),
        'extractor_key': ie_result['extractor_key'],
    }

playliststart, if not given on command line, is initialized to 0 (line 781).

this works well when --playlist-start is used. but when --playlist-items is used then playlist_index will always start at 1.

as far as I understand an ideal solution would be something like this:

        'playlist_index': entry['index'],

the idea is that entryknows about it's position in the playlist. but that information is not available in entry. at least not that I know of.

the best place to add index to entry would be in the extractors. but I fear that means to modify all extractors.

the information about the position of an entry in the playlist is implicit by the index of the entry in the iterable object which represents the playlist. once the entries are extracted from the playlist that implicit information is lost.

so the second best place to add index to entry would be in or after the block of code where the entries are picked based on the values of playlistitems or playliststart (and playlistend). the block begins at line 801. this block of code comes immediately before the loop mentioned above.

@yan12125 yan12125 mentioned this issue Dec 9, 2016
0 of 4 tasks complete
@yan12125 yan12125 added the bug label Dec 9, 2016
@ytdl-org ytdl-org locked and limited conversation to collaborators Jun 13, 2018
@ytdl-org ytdl-org deleted a comment from Parth1999 Jun 13, 2018
@ytdl-org ytdl-org deleted a comment from ddawson Jun 13, 2018
@ytdl-org ytdl-org deleted a comment from LanceNorskog Jun 13, 2018
@dstftw dstftw closed this in de1121d Feb 14, 2020
bbepis referenced this issue in animelover1984/youtube-dl Feb 27, 2020
… #10591, closes #10622)
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.

2 participants
You can’t perform that action at this time.