Page 1 of 1

last added?

PostPosted: Tue Dec 22, 2009 8:13 pm
by fizze
serviio 0.3 works quite stable, still one issue unnerves me.
The folder "last added" always seems to show the same content. How comes?

Does it depend on the mtime, or ctime of the files?
Is it only refreshed on startup? Which is weird, because new files are being picked up using inotify... ;)

Anyway, I've got quite a large library and I rely on the last added feature a lot, I can of course be your guinea pig if you require some testing.

keep up the good work, and open the source :P :D

Re: last added?

PostPosted: Tue Dec 22, 2009 9:09 pm
by zip
The last added datetime is stored in the library and it's the date the file has been added to it, ie read by Serviio in a shared folder. This works for me, e.g. when i add a new file into a shared folder it's then appears as the first in 'Last added'.

Re: last added?

PostPosted: Tue Dec 22, 2009 9:46 pm
by zip
fizze wrote:keep up the good work, and open the source :P :D

If you want to help, look here: viewtopic.php?f=3&t=12

Re: last added?

PostPosted: Sun Dec 27, 2009 2:04 pm
by fizze
Last added definetley doesn't work right.
I've added a TV series, and while it showed up in the folder under the series and season, it doesn't show up under last added.

Is there a limit to the items last added?
How are they sorted?
What can I do to help you debug this?

Re: last added?

PostPosted: Sun Dec 27, 2009 7:10 pm
by zip
I just get the last 10 video items in the library, sorted by 'creation_date' DESC. I'm using Apache Derby DB, so if you find a way how to connect to it (stop Serviio first), run this query:

  Code:
SELECT * FROM media_item WHERE file_type = 'VIDEO' ORDER BY creation_date DESC OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY;


This should return last 10 added videos.

What device are you using btw?

Re: last added?

PostPosted: Mon Dec 28, 2009 6:29 pm
by fizze
I'm using the LG BD390 to as upnp client.
The select returns exactly those 10 titles shown on the BD390. ;)

I don't know about apache derby, but usually it isn't trivial for databases to sort and limit the results to a certain number of rows. The result then is only sorted within those 10 rows, for instance.

I'm an Oracle DBA, and this is certainly how it works with cursors there.
First of all, many creation_time fields have truncated time portion, as in 00:00:00. Not all though.

I compared the ctime of one file with the creation_time in the db.
This is the result:
  Code:
file ctime: 2009-12-19 11:45

serviio db's creation_time:
  Code:
2009-12-18 00:00:00.0


What's going on here?

Even if the creation_time isn't the ctime, but the mtime of the file, how can it be added before it was created in the fs?

Re: last added?

PostPosted: Mon Dec 28, 2009 11:18 pm
by zip
creation_time in db is the time the record was created, i.e. the time the file has been scanned by Serviio and added to the library. I am not sure why the time is 00:00:00, but will double check the code.

Re: last added?

PostPosted: Tue Dec 29, 2009 7:53 am
by fizze
Ok, so this is the correct time, the files ctime wouldn't make much sense. ;)

Any plans on making the
  Code:
FETCH FIRST 10 ROWS ONLY;
a configuration parameter?
Also I'd like to see a number of days modifier, so just show whatever has been added in the last 7 days, for instance, regardless of the number of items.

Re: last added?

PostPosted: Thu Dec 31, 2009 2:19 pm
by zip
So there was a bug, the date it should look at is added_date, not creation_date (whichis a date related to the media item, eg when was a photo taken or cdate of the file). Fixed in 0.3.1.

The browse command will not be configurable at the moment. Is 10 not enough? It can be increased.

Re: last added?

PostPosted: Thu Dec 31, 2009 3:16 pm
by fizze
I guess 10 is ok. Making that an option isn't really a priority ;)
Glad you fixed the ctime bug though. I expect this feature to be much more useful in 0.3.1.

And no go out and have a few cold ones! :lol:
Happy New Year! :mrgreen: