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

Movie folder timestamp is updated to the current date when a movie is scraped #1688

Open
2 of 5 tasks
doublehelix opened this issue Dec 7, 2023 · 4 comments
Open
2 of 5 tasks
Labels
bug: unexpected behavior Not a bug but unexpected and therefore an issue

Comments

@doublehelix
Copy link

Describe the bug
When scraping movies, the folder for the movie is updated to the current timestamp.
This causes media libraries/apps to recognize my entire library as "Recently Added".
Ordinarily, when i add a new movie to my collection, recently added includes only those which are actually recently added, not just recently scraped.

I made the mistake of scraping my entire library.... now I have no history of what's new and what's old.

At the least, there should be an option to DISABLE the timestamp being changed if the user wishes to maintain the existing historical timestamps. (For comparison, EmberMediaManager does not change timestamps when scraping)

To Reproduce
Steps to reproduce the behavior:

  1. Scrape any movie

Expected behavior

  • .nfo files may be updated
  • Images may be downloaded
  • The timestamp of the parent folder should NOT change.

Screenshots
If applicable, add screenshots to help explain your problem.

MediaElch Version:

  • 2.10.7-dev (nightly)
  • 2.10.6 (stable)

Operating System:

  • Windows
  • macOS
  • Linux (distribution: .)

Additional context
Storage device is a QNAP NAS.
As a comparison, Ember Media manager does not alter folder timestamps when scraping.

@bugwelle
Copy link
Collaborator

bugwelle commented Dec 9, 2023

Hi,

thank you for bringing this up. It was never something that occurred to me as an issue.

Just a few notes:

  1. the movie's timestamp shouldn't be changed, correct (i.e. the mp4, mov, ... file)
  2. the containing folder's timestamp is updated
  3. the NFO file's timestamp is updated (or the file is created for the first time)

And you'd like (2) to not happen: Even if a file inside was changed, the modification date should stay the same. Did I get that correctly? 😄

I never thought about this. I didn't even know that was an option. (note to self: see e.g. https://doc.qt.io/qt-5/qfiledevice.html#setFileTime ).

Regards,
Andre

@bugwelle bugwelle added the bug: unexpected behavior Not a bug but unexpected and therefore an issue label Dec 9, 2023
@doublehelix
Copy link
Author

Hi, sorry for the delayed response. Was just updating my folders again today.

Yes... item 2 is definitely a problem for some software.

Unfortunately Plex, Kodi, and Infuse (on iOS), all seem to use the timestamp of the folder to determine "recently added" movies and shows. (it ignores the timestamp of the media file and nfo itself)

"Recently Added" is how we see "new" stuff regardless of the release date of the movie itself.

@bugwelle
Copy link
Collaborator

Hi, sorry for the delayed response.

Don't worry. I'm a bit slow with my responses, too. See #1710


Regarding your issue:

Linux

At least on Linux, it appears to be on purpose that the directory's "last modified date" is changed when a movie is scraped, because we add files and add new subdirectories. To quote from StackOverflow:

The mtime (modification time) on the directory itself changes when a file or a subdirectory is added, removed or renamed.

Modifying the contents of a file within the directory does not change the directory itself, nor does updating the modified times of a file or a subdirectory. Additionally, adding, removing or renaming files/directories in subdirectories does not propagate up to the directory. If you change the permissions on the directory, the ctime changes but the mtime does not.

If we don't want to change the directory's date, we'd have to first save the date in a variable, change all files, and then reset the directory's "last modified"-date.

Windows

On Windows with NTFS, the rules seem to be described in https://stackoverflow.com/a/46428666/1603627 .
They look similar to Linux's rules.


In short: MediaElch adds files when first scraping a movie. Those files include the NFO file, but also the .actors subdirectory. These newly added files lead to the "last modified date" being updated.

If MediaElch were to reset these dates (assuming that's even possible), then we'd work around a filesystem feature. I'm hesitant to change that behavior. But even if we were to reset the date: We would probably need to handle all parent directories up to the root.

But it may be that I'm missing something obvious. I'm not a Windows user myself. I'll have to look at https://github.com/DanCooper/Ember-MM-Newscraper/ and see how they do it.

If there is a user who knows more about this topic, feel free to ping me or reply. :)

Regards,
Andre

@doublehelix
Copy link
Author

Thanks for the feedback. This makes total sense (especially when the files are on linux/nas storage)
It's potentially even something these apps need to make an option (folder vs. media file timestamp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: unexpected behavior Not a bug but unexpected and therefore an issue
Projects
None yet
Development

No branches or pull requests

2 participants