Bug Kodi 20: <dateadded>1</dateadded> in videolibrary node is not working.
#1
I have been updating my rather large library with H.265 versions of TV Show episodes & Movies. They keep showing up in my newly added episodes or movies when they didn't do that in a prior version of Kodi 19

Right now, it keeps using ctime instead of mtime. As you can see from the wiki, 1 is supposed to use mtime and only use ctime if mtime is invalid. Only way an mtime can be invalid is if it is prior to January 1st 1970.

From wiki:
xml:

<videolibrary>
    <allitemsonbottom>false</allitemsonbottom>  <!-- sorts the "*All" items at the bottom of the list when in Ascending order -->
    <cleanonupdate>false</cleanonupdate>  <!-- default set to false to prevent Kodi from removing items from the database while updating.  -->
    <usefasthash>true</usefasthash> <!-- defaults to true. Set to false in order to skip hashing based on the folders modification time. -->
    <recentlyaddeditems>35</recentlyaddeditems> <!-- number of recently added items. Defaults to 25 -->
    <itemseparator> / </itemseparator>  <!-- separator used for multiple artists/genres in tags. Note, this is *space* *slash* *space* -->
    <exportautothumbs>false</exportautothumbs>  <!-- export auto-generated thumbs. Defaults to false -->
    <importwatchedstate>false</importwatchedstate>  <!-- import previously exported playdate and playcount from .nfo files. Defaults to false -->
    <importresumepoint>false</importresumepoint>  <!-- import previously exported resume point from .nfo files. Defaults to false -->
    <dateadded>1</dateadded> <!-- 0 results in using the current datetime when adding a video;
                                  1 (default) results in prefering to use the files mtime (if it's valid) and only using the file's ctime if the mtime isn't valid;
                                  2 results in using the newer datetime of the file's mtime and ctime -->
  </videolibrary>

My advancedsettings.xml:

xml:

    <videolibrary>
        <hideallitems>true</hideallitems>
        <recentlyaddeditems>300</recentlyaddeditems>
        <cleanonupdate>true</cleanonupdate>
        <dateadded>1</dateadded>
    </videolibrary>
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#2
(2022-04-15, 19:20)Pr.Sinister Wrote: I have been updating my rather large library with H.265 versions of TV Show episodes & Movies.
If you are completely replacing the video file and rescraping it into Kodi, wouldn't it be reading the mtime / ctime of the new file, not the original file?

I guess you are not using nfo files to add back to the library, otherwise that date you want would be in the <dateadded></dateadded> tag of the nfo file.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#3
(2022-04-15, 21:58)Karellen Wrote:
(2022-04-15, 19:20)Pr.Sinister Wrote: I have been updating my rather large library with H.265 versions of TV Show episodes & Movies.
If you are completely replacing the video file and rescraping it into Kodi, wouldn't it be reading the mtime / ctime of the new file, not the original file?

I guess you are not using nfo files to add back to the library, otherwise that date you want would be in the <dateadded></dateadded> tag of the nfo file.

Yes of course it is using the mtime of the new file. I do set the mtime of the new file to be the aired date. I do use NFO files but I don't want to use the dateadded from the NFO. In fact, my NFOs do NOT have that attribute:

xml:

<episodedetails>
  <title>Life, Liberty and the Pursuit of Wealthiness</title>
  <season>1</season>
  <episode>1</episode>
  <aired>2010-10-14</aired>
  <plot>Welcome to Beverly Hills, where pint-size puppies are served breakfast in bed and a three million dollar home is scoffed at. In the premiere episode, Adrienne, whose family owns the Palm Casino Resort and the Sacramento Kings, decides to take the rest of the ladies on a private jet to get VIP treatment and sit courtside at a Kings game. The ladies include Lisa, a witty British restaurateur; former child actresses (and sisters) Kim and Kyle Richards, who are also Paris HiltonΓÇÖs aunts; Kelsey GrammerΓÇÖs soon to be ex-wife Camille, and Taylor, a beauty from Oklahoma with big Beverly Hills dreams. These ladies live big and when they fight, they fight big. They may be living in the lap of luxury, but with all that wealth comes even more drama.</plot>
  <uniqueid type="tvdb" default="true">2951421</uniqueid>
  <uniqueid type="sonarr">57486</uniqueid>
  <thumb>https://artworks.thetvdb.com/banners/episodes/196741/2951421.jpg</thumb>
  <watched>false</watched>
  <rating>8.5</rating>
  <fileinfo>
    <streamdetails>
      <video>
        <aspect>1.77777779</aspect>
        <bitrate>3771384</bitrate>
        <codec>h265</codec>
        <framerate>23.976</framerate>
        <height>1080</height>
        <scantype></scantype>
        <width>1920</width>
        <duration>44.12</duration>
        <durationinseconds>2647</durationinseconds>
      </video>
      <audio>
        <bitrate>224000</bitrate>
        <channels>2</channels>
        <codec>EAC3</codec>
        <language>English</language>
      </audio>
      <subtitle>
        <language>English / English</language>
      </subtitle>
    </streamdetails>
  </fileinfo>
</episodedetails>
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#4
Is this something that will be fixed in Kodi 20?
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#5
(2022-04-19, 21:10)Pr.Sinister Wrote: Is this something that will be fixed in Kodi 20?
No-one has tested it.
How do you adjust the mtime and ctime in the file?
Do you have a small file that you can share where those two times are different?
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#6
Sonarr does it automatically when adding an episode.

Before i was using Sonarr and for my French TV Shows (Sonarr is amazing but sucks big floppy donkey dick for French TV Shows so i use Medusa), I used FileTouch to set all 3 dates to the air date set in the aired node of the NFO. I get the date from the NFO using Xidel. Sonarr only set the mtime. I wonder if there is new logic in Kodi that checks to see if ctime is bigger than mtime, it decides mtime is invalid. I always found it weird that you can have a Creation Date/Time be newer than the Modified Date/Time. Which is why in my script i set ALL dates to be the same

Windows CMD Script:
Code:

@echo off
REM **********************************************
REM      Set File Dates from NFO Airdates
REM **********************************************
setlocal ENABLEDELAYEDEXPANSION
for /R %1 %%l in (*.nfo) do (
cd %%~dpl
for /F "tokens=1,2,3 delims=-" %%a in ('xidel -q "%%~nl.nfo" --extract //aired') do (
set year=%%a
set month=%%b
set day=%%c
if !year! LSS 1970 set year=1970
echo Processing %%~nl ...
if exist "%%~nl.nfo" filetouch /W /A /C /D !month!-!day!-!year! /T 12:34:56 "%%~nl*.*" 
)
)
pause
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#7
I used BulkRename Utility to modify the times of a test file.

I added <dateadded>1</dateadded> and I got the following...
I also tried with <dateadded>2</dateadded> and got the same which is expected as mtime is preferred.

Image

I changed it to <dateadded>0</dateadded> and got the following...

Image

Maybe I am going down the wrong track, but I cannot replicate the problem you reported.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#8
Set the created date to be AFTER the modified date and use <dateadded>1</dateadded> in advancedsettings.xml

If i download a show form 2010, i want it to say i added it in 2010 so it doesn't show up in my recently added. THe creation date will be the moment i download the file. Again, using my script, all is fine cause all dates are the same. But with automated tools like Sonarr, it ONLY sets the mtime and the created is obviously now instead of 2010
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#9
Like this...

Image
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#10
Only thing i can think of is that my issue is with TV Show Episodes and not Movies
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#11
Since this is still not fixed in v20, here are workarounds for SQLite and MySQL for people that would like to use the modified date as the date added.

To recap, adding TV Show episodes to the library doesn't use the modified date even though it is specified in the advancedsettings.xml

Because i am not being taken seriously with my bug reports, i am done reporting them even though i see plenty in v20. If i find a workaround, i can inform others though...

For MySQL, run the following SQL Commands:

sql:

update myvideos121.files files
inner join myvideos121.episode episode on
    files.idFile = episode.idFile
set files.dateAdded = episode.c05;

For SQLite:

sql:

update files 
     set dateAdded = (
          select episode.c05
          from episode 
          where episode.idFile = files.idFile
     )
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#12
I should specify:

My modified date for TV Episodes is the aired date. That is why i am copying the aired date (c05) to the dateAdded
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#13
This has really got me scratching my head at the moment. 
A few months ago (december, and probably on latest stable V19), I replaced a bunch of movies, and used a "touch" command to change the modified date - "touch -d" with the date&time and file. I set them to the date of the original file so they would be in the list when I originally added them. 
I can't remember what step I took next, but it was either a "refresh" on the information for each Movie, or I re-added them. 
It worked, and the movies jumped back down the list when sorted by "date added" and happy days.

Now, I can't get it to work. 
I've done the same touch command (grabbed it from bash_history and just replaced the filename) and I've added the Movie, I've refreshed information, I've put the "<dateadded>1</dateadded> in the advancedsettings.xml (it wasn't there last time I did this). 
I just cannot get it to use the historic date for dateadded. 

As far as I can tell, this is happening to me when adding on V20 and on 20.1. My database is mysql based, and clients share it. 


These are the "stat file.mkv" dates for one I did back in December:
Code:
Access: 2022-07-26 13:01:00.000000000 +0100
Modify: 2022-07-26 13:01:00.000000000 +0100
Change: 2022-12-05 16:43:36.449464226 +0000
 Birth: 2022-12-05 14:34:57.251491518 +0000

That one appears in the list correctly, showing as dateadded 26th July 2022.
sql database shows:
Code:
+-----------------------+
| dateAdded             |
+-----------------------+
| 26 July 2022 13:01:00 |
+-----------------------+

I've tried using that same touch command and a slightly altered one on a Movie file now:
Code:
Access: 2022-07-26 13:00:00.000000000 +0100
Modify: 2022-07-26 13:00:00.000000000 +0100
Change: 2023-03-21 12:57:17.914345974 +0000
 Birth: 2023-03-21 11:45:08.485748712 +0000
That movie will not add with the modified date. 
Code:
+------------------------+
| dateAdded              |
+------------------------+
| 21 March 2023 11:50:45 |
+------------------------+
11:50 is the time that the NFO was created from Radarr. I've also updated the modify time on that file too:
Code:
Access: 2022-07-26 13:00:00.000000000 +0100
Modify: 2022-07-26 13:00:00.000000000 +0100
Change: 2023-03-21 13:24:12.538623281 +0000
 Birth: 2023-03-21 11:50:52.402241490 +0000

On the movie I updated back in December, the NFO's dates had no bearing on the dateadded. 

Not sure what else I can try. I do plan on enabling extra logging to see if anything shows up there.
Reply
#14
(2023-03-21, 15:32)ryamoo Wrote: This has really got me scratching my head at the moment. 
A few months ago (december, and probably on latest stable V19), I replaced a bunch of movies, and used a "touch" command to change the modified date - "touch -d" with the date&time and file. I set them to the date of the original file so they would be in the list when I originally added them. 
I can't remember what step I took next, but it was either a "refresh" on the information for each Movie, or I re-added them. 
It worked, and the movies jumped back down the list when sorted by "date added" and happy days.

Now, I can't get it to work. 
I've done the same touch command (grabbed it from bash_history and just replaced the filename) and I've added the Movie, I've refreshed information, I've put the "<dateadded>1</dateadded> in the advancedsettings.xml (it wasn't there last time I did this). 
I just cannot get it to use the historic date for dateadded. 

As far as I can tell, this is happening to me when adding on V20 and on 20.1. My database is mysql based, and clients share it. 

On the movie I updated back in December, the NFO's dates had no bearing on the dateadded. 

Not sure what else I can try. I do plan on enabling extra logging to see if anything shows up there.

Back in v19, it seemed that only the TV Episodes were affected by this and not Movies.

I have about 500 Movies i need to replace with H265 versions and they are all sitting in a folder for 3 months now.. Once i get around to replacing them (prolly later this week), i'll post my findings here and the SQL command to fix it if it is indeed also broken.
[4 Kodi Clients + 4 Norco RPC-4224 Media Servers w/376 TB HDD Space]
Reply
#15
A long time later, but I've finally got around to playing around with this to test different versions, because I wanted to replace a bunch of media but keep them in the same list position. 
I've reinstalled Kodi v19.5 on my Pi (headless, manages my media mounted on the Pi), and my PC (windows 10, accesses via nfs, with path subtitution). 
With Kodi V19.5 I can "touch -m" on the file on my Pi, and refresh on Windows Kodi, and the "dateAdded" changes based on the modified date I used with my touch command. 

In the below screenshot of my V19 database, you can see date added was 2024-02-20, I then touched it to be 19th Feb and you can see it was then 2024-01-19 in the database after refresh, then touched again to be 28th Feb, and you can see that too. 
Between each "touch", I used Kodi for Windows, brought up the context menu for the movie and selected "Information", then scrolled the buttons to the right and selected "Refresh" - it re-added to the the movie with an updated "date added" each time, moving the movie in my list (ordered by date added). 

Code:
MariaDB [MyVideos119]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5368 |   9608 | 2024-02-20 15:42:00 | 32421 | 18039 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.011 sec)

MariaDB [MyVideos119]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5369 |   9608 | 2024-01-19 15:00:00 | 32423 | 18041 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.011 sec)

MariaDB [MyVideos119]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5370 |   9608 | 2024-02-28 11:00:00 | 32425 | 18043 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.010 sec)

I've then repeated this on Kodi 20.4, and the dateAdded is always the creation date. It's added to the database with the creation date, and doing a "touch" on the file to change the modified date doesn't change it (however you can see that some IDs changed, so it has re-scanned the file). 
Following the steps as above with 19.5 but on 20.4, the dateAdded stays the same in the database, and on my movie list it doesn't move and stays as "26/02/2024":

Code:


MariaDB [MyVideos121]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' AND votes <> 14441 order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5547 |  10574 | 2024-02-26 13:36:58 | 32760 | 19896 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.011 sec)

MariaDB [MyVideos121]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' AND votes <> 14441 order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5549 |  10574 | 2024-02-26 13:36:58 | 32764 | 19900 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.009 sec)

and for completeness, tried on V21 Beta too, giving the same result as V20.4: 
Code:


Database changed
MariaDB [MyVideos131]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' AND votes <> 14441 order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5546 |  10574 | 2024-02-26 13:36:58 | 32758 | 19892 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.007 sec)

MariaDB [MyVideos131]> select c00, idMovie, idFile, dateAdded, c05, c09, premiered, rating, votes from movie_view where c00 like 'Test%' AND votes <> 14441 order by dateAdded DESC limit 5;
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| c00  | idMovie | idFile | dateAdded           | c05   | c09   | premiered  | rating | votes |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
| Test |    5548 |  10574 | 2024-02-26 13:36:58 | 32762 | 19898 | 2023-11-13 |    5.7 | 20350 |
+------+---------+--------+---------------------+-------+-------+------------+--------+-------+
1 row in set (0.005 sec)

I've also tried Kodi for Mac to do the re-add or refresh, and also tried removing from library and re-scanning to the library using Kodi on the Pi.
On both, again only V19 adds it with the updated modified date as the dateAdded, V20 and V21 add it with the creation date. 

I'll gather logs to see if that shows anything, but I briefly checked last night and didn't spot anything that seemed relevant.
Reply

Logout Mark Read Team Forum Stats Members Help
Kodi 20: <dateadded>1</dateadded> in videolibrary node is not working.0