Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




Jellyfin - How to m...
 
Share:
Notifications
Clear all

Jellyfin - How to make "Latest Movies" and "Latest TV Shows" show latest released, instead of latest added


 Hans
(@hans)
Noble Member Admin
Joined: 9 years ago
Posts: 2187
Topic starter  

I have seen that I'm not the only one running into this with JellyFin - "Latest Movies" and "Latest TV Shows" actually show "Latest ADDED files" and not the most recent releases.
So when you add a movie from 1954 today, it will show first in line with "Latest Movies" - cool if that would have been called "Latest added movies", not so cool if you'd rather see the most recent released movies ...

I did see that this has been a question for several years already, and all requests seem to have been closed and/or ignored. (no hard feelings, I'm sure the JellyFin team has their hands full)

Since I didn't find a "clean" and proper way to do this (I think this should be done in the UI, instead of in the database): I would like to caution everybody when using this trick.
The idea I had was to set the Date (DateCreated) that is being used for "Latest ..." to match the actual Release/Aired date (PremiereDate).
This can be done with a simple SQL query (I didn't dare to add this as a trigger on the database):

UPDATE TypedBaseItems SET DateCreated=PremiereDate;

 

So when doing this, the date when a file has been added to the database, will now be set to the actual release date or aired date of a movie or TV episode (or collection or person etc).

Since JellyFin uses an awesome single user database engine (SQLite), you would first need to "disconnect" JellyFin from its database (by stopping the JellyFin server).
Next you will have to execute the SQL query, and after that start the JellyFin server again.

Warning: before running this, probably a good idea to make a backup of "library.db" after (!) stopping JellyFin.

So in short: stop JellyFin, update database, start JellyFin.

JellyFin on my QNAP is stored in "/share/CACHEDEV1_DATA/.qpkg/Jellyfin", and the database files are stored in the DB directory (/share/CACHEDEV1_DATA/.qpkg/Jellyfin/DB).
This may be different on your QNAP, Linux machine, Windows machine of Mac ...

So ... it looks like this on my QNAP in the JellyFin qpkg directory

cd /share/CACHEDEV1_DATA/.qpkg/Jellyfin
./Jellyfin.sh stop
./sqlite3 DB/data/library.db 'UPDATE TypedBaseItems SET DateCreated=PremiereDate;' 
./Jellyfin.sh start &

 

I managed to shove that in a little script so I can occasionally call it. Maybe a cron task for the future, just don't forget to make the script executable with "chmod +x myupdatescript.sh".

Also note that your QNAP comes with several "local" copies of sqlite3, but is nowhere to be found in the path. See also this post.

Again; this may totally trash you database ... so use at your own risk.


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 9 years ago
Posts: 2187
Topic starter  

On my QNAP I've added this as a cron job (daily 6 AM - details here).
For this I created a script (fix_dates.sh located in the JellyFin QPKG directory).

echo "0 6 * * * /share/CACHEDEV1_DATA/.qpkg/Jellyfin/fix_dates.sh" >> /etc/config/crontab
crontab /etc/config/crontab && /etc/init.d/crond.sh restart

 


ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: