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

update mtime file if it already exist #11417

Closed
crazyiop opened this issue Dec 11, 2016 · 4 comments
Closed

update mtime file if it already exist #11417

crazyiop opened this issue Dec 11, 2016 · 4 comments

Comments

@crazyiop
Copy link

@crazyiop crazyiop commented Dec 11, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.12.09. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.12.09

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Description of your issue, suggested solution and other information

When I donwload a file that has already been downloaded with the --no-mtime option, the mtime of the file is not updated.
The file is not downloaded again, wich is the correct behaviour, but I think the mtime should be updated (like a touch).

It would be better to have a filesystem state indepedent of the pre-existence of the file. This will make scripting more coherent and reproduceable.

use case exemple

I have a little app that get video link from users to download them. Later, another program play the videos ordered from the last submited. In the current state, if a video has already been downloaded, I have to treat that edge case to make it goes to the top of the list. With the requested change, a simple date ordering from the file will always be the correct order.

corollary

Alternatively if I first download a file with --no-mtime option and then again without it. It also makes sense to update the file date to the server upload date instead of keeping the first download date. This will solve #10038 in a more consistent manner.

@crazyiop crazyiop changed the title update mtime file wtih --no-mtime if it already exist update mtime file if it already exist Dec 11, 2016
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 11, 2016

Sorry, but that's impossible. mtime value is from HTTP's Last-Modified header, which is a supplementary information during the download. There's no way to get server information without actual downloading.

By the way, as CDNs are popular nowadays, the same video may return different URLs each time and have different Last-Modified values. It's not a good idea to update a previous downloaded file with information from possibly different links.

@yan12125 yan12125 closed this Dec 11, 2016
@crazyiop
Copy link
Author

@crazyiop crazyiop commented Dec 11, 2016

ok for the corollary part then, but my main point, is still feasible : if I run a download several time with --no-mtime it should update an existing file's mtime to the current PC date.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 11, 2016

The semantic of mtime is "the last modified time of the corresponding file on the server". For your purpose, --exec is useful. You may need to write a custom post-processor to detect whether the file is already downloaded or not, see #11231 (comment)

@crazyiop
Copy link
Author

@crazyiop crazyiop commented Dec 11, 2016

thanks ! didn't knew of that options.
for reference --exec "touch {}" actually does the job.

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.