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

[bug] archive file not being created when initially using youtube-dl library #10114

Closed
vxbinaca opened this issue Jul 18, 2016 · 1 comment
Closed

Comments

@vxbinaca
Copy link
Contributor

@vxbinaca vxbinaca commented Jul 18, 2016

  • I've verified and I assure that I'm running youtube-dl 2016.07.17
  • 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)

I maintain tubeup, which uses youtube-dl to upload videos to the Internet Archive.

I've specified a location for the download file and video output location:

    ydl_opts = {
        'outtmpl': '~/.tubeup/downloads/%(title)s-%(id)s.%(ext)s',
        'download_archive': '~/.tubeup/downloads/.ytdlarchive',

This is the result:

tubeup https://www.youtube.com/watch?v=6VKyQj0UAsg
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.07.16
[debug] Python version 3.5.1+ - Linux-4.4.0-31-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 2.8.6-1ubuntu2, avprobe 2.8.6-1ubuntu2, ffmpeg 2.8.6-1ubuntu2, ffprobe 2.8.6-1ubuntu2
[debug] Proxy map: {}
{'downloaded_bytes': 8911347, '_total_bytes_str': '8.50MiB', 'elapsed': 1.9620885848999023, 'filename': '/home/vxbinaca/.tubeup/downloads/YTPMV_Sourcegore-6VKyQj0UAsg.f134.mp4', '_elapsed_str': '00:01', 'status': 'finished', 'total_bytes': 8911347}
:: Downloaded: /home/vxbinaca/.tubeup/downloads/YTPMV_Sourcegore-6VKyQj0UAsg.f134.mp4...
{'downloaded_bytes': 2790717, '_total_bytes_str': '2.66MiB', 'elapsed': 0.7879514694213867, 'filename': '/home/vxbinaca/.tubeup/downloads/YTPMV_Sourcegore-6VKyQj0UAsg.f251.webm', '_elapsed_str': '00:00', 'status': 'finished', 'total_bytes': 2790717}
:: Downloaded: /home/vxbinaca/.tubeup/downloads/YTPMV_Sourcegore-6VKyQj0UAsg.f251.webm...
Traceback (most recent call last):
  File "tubeup", line 238, in <module>
    main()
  File "tubeup", line 223, in main
    download(URLs, proxy_url)
  File "tubeup", line 98, in download
    ydl.download(URLs)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 1775, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 693, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 739, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 1421, in process_video_result
    self.process_info(new_info)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 1761, in process_info
    self.record_download_archive(info_dict)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 1868, in record_download_archive
    with locked_file(fn, 'a', encoding='utf-8') as archive_file:
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/utils.py", line 1408, in __init__
    self.f = io.open(filename, mode, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '~/.tubeup/downloads/.ytdlarchive'

The folders exist to it, but the file doesn't exist and isn't created by youtube-dl when initially run using the library, but the script creates it if I recall. Youtube-dl also makes the folder for downloads if there isn't one. But for some reason, the archive file must pre-exist for it to write to it and won't be created if there is none.

What I'm looking for is a rule where: If theres no archive file in the specified location, create one. If there is one, append to it.

I'd just like the library to create a file is there isn't one already in place is all.

Edit:

It also doesn't use it when I create it.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 18, 2016

Python doesn't automatically transform ~ into /home/xyz. You need os.path.expanduser.

@yan12125 yan12125 closed this Jul 18, 2016
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
2 participants
You can’t perform that action at this time.