jellyfin icon indicating copy to clipboard operation
jellyfin copied to clipboard

Sorting movies by recently added does not actually sort by most recently added

Open fuzxi opened this issue 4 years ago • 30 comments

Describe the bug

Sorting by date added, as well as the "Latest Movies" section on the home page, does not sort by date added. If I run ls -lt /data/media/movies to list my movies folder by date, the three most recent movies are Splice, Super, and Antichrist. If I sort my movie library by date, the first four movies are Cool Hand Luke, Splice, Memento, and Super. Antichrist is somewhere in the middle of my collection. Cool Hand Luke and Memento have creation dates in 2020. Cool Hand Luke is about the 30th most recent movie, Memento is about the 20th most recent.

Additionally, the Latest Movies section on the home page does not behave the same way. It shows none of these five movies. It instead shows an apparently random collection of somewhat recent movies which does not change when I add new movies.

This problem does not occur with my Series library which is hosted on the same remote mount; both the library view and Latest Series section are sorted as expected and identically.

Disabling external plugins and restarting did not have an effect on this issue.

System (please complete the following information):

  • OS: DietPi on RasPi4
  • Virtualization: Docker (jellyfin/jellyfin:latest)
  • Clients: Browser and Android client
  • Browser: Firefox 89.0
  • Jellyfin Version: 10.7.5
  • Playback: N/A
  • Installed Plugins: AudioDB, Bookshelf, MusicBrainz, OMDb, TMDb Box Search, TheTVDB
  • Reverse Proxy: None
  • Base URL: None
  • Networking: Docker bridge network
  • Storage: Cloud (GSuite/Google Drive) via read-only rclone mount

To Reproduce

  1. Open Movies library
  2. Click sort
  3. Select "Date Added"
  4. Observe that movies are not sorted by date added

Expected behavior

Library should be sorted by most recently added.

Server Logs

log.txt

FFmpeg Logs N/A

Browser Console Logs N/A Screenshots

N/A Additional context

N/A

fuzxi avatar Jun 13 '21 06:06 fuzxi

Could the issue be the GetDate method here. It returns DateTime.MinValue for non-folders, that are used for comparison?

https://github.com/jellyfin/jellyfin/blob/master/Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs

michael9dk avatar Jun 20 '21 18:06 michael9dk

@fuzxi Do you store the movies in subfolders inside /data/media/movies ?

michael9dk avatar Jun 20 '21 18:06 michael9dk

@fuzxi Do you store the movies in subfolders inside /data/media/movies ?

Yes. For example, Memento's path would be /data/media/movies/Memento (2000)/Memento (2000) Remux-1080p.mkv.

Same with series, they each have a subfolder for the show under /data/media/series, and then another layer of subfolders for individual seasons.

fuzxi avatar Jun 20 '21 21:06 fuzxi

So when i think my sorted videos are weird, it seems jellyfin not recursively check video in folder.

Folder A created on 15 Feb and a Video added today, it still use Folder A created date as sort date, not the file added in.

martadinata666 avatar Mar 18 '22 16:03 martadinata666

FYI I've noticed this behavior forever also. I'm running 10.7.something on a Synology NAS, and I have no idea how "Date added" sort is actually figured out.

PAHelper2 avatar Apr 07 '22 16:04 PAHelper2

I'm able to reproduce this behavior on Version: 10.8.11.

I did some research using the reports plugin, it seem importer is using file created date as the Date Added, instead of the actual date added to Jellyfin. This causes the recently added not to show as these files are dated in the past.

As a workaround I have added script to touch "$item_path" the file to update its creation date.

Edit: The proper way will be to change import settings on : Dashboard -> Libraries -> Display -> Date added behavior for new content

hcgonzalezpr avatar Oct 17 '23 04:10 hcgonzalezpr

Can reproduce in 10.8.12 Movie libraries when sorted by "Date Added" appear to be sorted (almost) by the release date of the media. While most are in release date order, there are quite a few ones that appear out of place. For other libraries, sorting by "Date Added" will sort them by the date that the media was added to the library.

psaintmalo avatar Nov 16 '23 13:11 psaintmalo

This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.

If you have any questions you can use one of several ways to contact us.

jellyfin-bot avatar Mar 16 '24 01:03 jellyfin-bot

This issue was closed due to inactivity.

jellyfin-bot avatar Apr 06 '24 01:04 jellyfin-bot

Please stop closing issue that unsolved or stale, due no response from developer.

martadinata666 avatar Apr 06 '24 02:04 martadinata666

@martadinata666 If you comment within 3 weeks after the first stalebot message, the four month stale timer get reset.

oddstr13 avatar Apr 06 '24 03:04 oddstr13

This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.

If you have any questions you can use one of several ways to contact us.

jellyfin-bot avatar Aug 05 '24 01:08 jellyfin-bot

up

martadinata666 avatar Aug 05 '24 02:08 martadinata666

I am experiencing this bug - always have. I store media in their own directories under the movies dir. Additionally, I use mergerfs to present multiple volumes as a single volume to my docker services. Not that I think that matters.

What I experience is that after every pull and restart via compose up -d, the date added sort changes. Some of my most recently added files look like they were added first and some of my first added media appear like I just added them.

This is particularly annoying when using a service like jellyseer that lets users request media, it completes, and then it doesnt show up when browsing jellyfin as recently added content.

patcfly avatar Aug 09 '24 17:08 patcfly

I'm having the same issue. The movie files are being put into named folders for each single movie and not appearing in the order they were added. I'm experiencing this with newly added media, it often ends up at the end of the list when sorting but added date newest first. This exact same setup works just fine on Plex.

barndawe avatar Sep 15 '24 18:09 barndawe

So my instance seems to be working fine based on file creation date. Can you verify that your setting Image is set to use file creation date or the date added to library? It could be we just need to better let people know that this setting exists.

JkBoyo avatar Oct 04 '24 15:10 JkBoyo

I've just tried changing it, including restarting the server afterwards. Both settings give me exactly the same list, and still not in order of when they were added. Currently running 10.9.11 via Docker on a Debian VM host

barndawe avatar Oct 04 '24 16:10 barndawe

My setting matches yours: image

patcfly avatar Oct 04 '24 16:10 patcfly

interesting. I will have to do some playing around and see where the location of the data it's fetching is held. Bc it does look like in mine that they match this. Did you guys check using ls -lt on the dirs where you have it stored to compare those to the order presented by the lib like OP? And maybe instead of a server restart try a library scan update?

JkBoyo avatar Oct 04 '24 16:10 JkBoyo

ls -lt on my movie dir gives me the order I'd expect (and the order I get in Plex), not the order that Jellyfin is giving me. I tried library scan update as well,forgot to say. It made no difference sadly.

barndawe avatar Oct 05 '24 12:10 barndawe

Do the metadata dates on the individual pieces of content match the ordering? For example image

This date on mine doesn't match the actual file creation date.

JkBoyo avatar Oct 05 '24 12:10 JkBoyo

but the order is still the same.

I also have a slightly weird case bc I transferred my metadata between servers semi recently.

JkBoyo avatar Oct 05 '24 12:10 JkBoyo

The 'date added' does match the ordering, and also matches the file created date ordering, but not the directories they are within. i.e. I have one file that claims it was created in 2007, but it was added a few months ago and the containing folder's creation date reflects that. image As you can see above I've got library added date for the date and forced both a library rescan and a metadata regen, no change.

barndawe avatar Oct 05 '24 15:10 barndawe

So you think it is ordering things based on when the directory was created?

JkBoyo avatar Oct 05 '24 15:10 JkBoyo

Ordering seems to be based on the 'file created date' even when 'use date scanned into the library' is selected for me, and the file created dates are wrong. It looks like Plex is using the date the folder containing the file was created (my library is like 'movies/movie name/movie name.mp4', for example) but Jellyfin is using file date even when it's told not to

barndawe avatar Oct 05 '24 16:10 barndawe

So that setting seems to be how it adds the metadata field for new content not how it pulls it in during a library scan. Can you test to see if when set to scan in date it uses that for new content?

JkBoyo avatar Oct 05 '24 16:10 JkBoyo

No, settings will matter, it just jellyfin loves using "folder created" add instead of file added into the folder, this behavior is more seen when we collect many random videos.

/videos/memevid/yyy.mp4 (let's say video `yyy.mp4` added April 2024, folder created dec 2023)
/videos/www.mp4 (added Feb 2024)

In theory by "recently added" yyy.mp4 should be sorted first. But no, jellyfin will use www.mp4 as the first recently added. It doesn't matter the setting it just works that way.

martadinata666 avatar Oct 06 '24 03:10 martadinata666

So @maradinata666 your comment is now contradicting @barndawe 's comment. I understand we have an issue here and I am trying to help prove it is something we can put our time to. To do that though I have to be able to fully understand and reproduce the issue. Are you positive it will always work the same way and ignore the aforementioned setting? Have you tested it?

JkBoyo avatar Oct 06 '24 04:10 JkBoyo

So @maradinata666 your comment is now contradicting @barndawe 's comment. I understand we have an issue here and I am trying to help prove it is something we can put our time to. To do that though I have to be able to fully understand and reproduce the issue. Are you positive it will always work the same way and ignore the aforementioned setting? Have you tested it?

Yes, I'm deleting,rescan, or change many sort settings, etc. It just don't get sorting "recently added" right, plex and emby done right. IMO Jellyfin use the folder creation date instead of the file added in to the folder, that the file added may got different "creation date", "added date" or "bla bla date" that making jellyfin sort correctly. Maybe the most correct term will be "recently added" jellyfin did not use a flat directory structure, which most user expects. If the folder was created in 2023, we need to scroll down, find the folder, and click the folder, then the newly added video will show the most top left (right behavior inside the folder). Why? When I click my library just show my media that I added last time, I don't want to scroll to find my folder to access my newly added media. Let say jellyfin don't want use "flat directory" then the folder that created in 2023 should be shown most top left as a media added in it recently.

martadinata666 avatar Oct 06 '24 04:10 martadinata666

So that setting is a bit silly for default. Newly added should be new added not newly created on disk imho.

After changing the setting and making a re-scan, it is not automatically fixed. Can that be arranged? It wont even re-fix the manually touched files.

stefandxm avatar Oct 16 '24 19:10 stefandxm