#24 Need obj.date for scripting

open
Jin
3
2007-12-16
2007-12-15
krbvroc1
No

The object passed to the scripting capability is very limited. I would like to request that an obj.date be added. This would correspond to the creation date of the physical file (result of calling stat on the file). (Not to be confused with obj.meta[M_DATE])

This would allow the scripting to build the tree based on the date of the files rather than relying on id3 tags and/or encoding the date into the filename (obj.location).

Discussion

  • Jin
    Jin
    2007-12-16

    Logged In: YES
    user_id=1205152
    Originator: NO

    hmm, I think this could be added rather easily, could probably be solved via the AUX array; I'll have a look.

     
  • Jin
    Jin
    2007-12-16

    • priority: 5 --> 3
     
  • Simon Kerry
    Simon Kerry
    2008-04-21

    Logged In: YES
    user_id=2068565
    Originator: NO

    I agree. I have used import.js to create custom conatiners, but would like to create a 'Recently Added' container. This needs the file date stamp to be passed as a property of the object.

     
  • robolaf
    robolaf
    2008-06-01

    Logged In: YES
    user_id=1152325
    Originator: NO

    Hi Jin,

    Any news/ideas here? I tried EXTRACTOR_MODIFICATION_DATE - but it did not work :-(

    File date and time would be a very powerful option for own scripts.

    Thanks.
    Olaf

     
  • robolaf
    robolaf
    2008-06-01

    Logged In: YES
    user_id=1152325
    Originator: NO

    Hi Jin,

    Any news/ideas here? I tried EXTRACTOR_MODIFICATION_DATE - but it did not work :-(

    File date and time would be a very powerful option for own scripts.

    Thanks.
    Olaf

     
  • Logged In: NO

    This is definitely the feature I want most in mediatomb. Being able to browse my media by creation date would be very helpful indeed.

     
  • Byner
    Byner
    2008-10-25

    Any updates on this one? I need this feature as do many I'm sure. I probably will just code it myself, but if this hasn't been worked on yet then I would be willing to submit it as well.

    Thanks

     
  • krbvroc1
    krbvroc1
    2008-12-31

    File Added: OBJ_DATE_PATCH.bz2

     
  • krbvroc1
    krbvroc1
    2008-12-31

    Since this never got implemented, I went ahead and implemented it myself. Below is the link to the patch against the Trunk (Rev 2001). I used the svn diff command.

    The attached patch modifies the database schema to add a timestamp. The timestamp is based on the time associated with the actual file. It is available to Javascript as obj.timestamp and is easily converted to a Javascript Date. All the JS date functions are available for the user.

    Include is a modified import.js which highlights its use. I use it to sort all my podcasts based on the file times (which is really when the files were downloaded).

    I modified the schema update and bumped the version for both SQLITE3 and MySQL. I tested sqlite3, but am not running MySQL so I could not test that.

    When interfacing with the database and with Javascript, I am using timestamp as a 32-bit value. In the year 2038, this will break, but I dont care. Adding new 64-bit methods for everything was not worth the risk of breaking stuff.

    I have only tested this with audio and m3u playlist.

    Originally I looked at handling this with either AUX or METADATA, but from what I could tell that part of the code is kinda messy. It seems there is only a single 'handler' that is invoked rather than the ability to hook multiple handlers. I started writing a 'fileinfo' handler but when I went to 'hook' it in, I realized that id3lib or the other libs, in a certain order, are invoked. I think my ultimate solution is much cleaner.

    I hope this finds it way into the baseline since numerous people over the past year have commented how useful this feature was.

     
  • krbvroc1
    krbvroc1
    2008-12-31

    Patch againt Rev 2001 Trunk

     
    Attachments
  • Patch works fine with current trunk, but the sql statements defined incorrect for mysql.

    +// updates 4->5
    +#define MYSQL_UPDATE_3_4_1
    ...

    sould be
    +#define MYSQL_UPDATE_4_5_1
    ...