Giter VIP home page Giter VIP logo

Comments (2)

zzarbi avatar zzarbi commented on August 13, 2024

Hi,

I'm not sure what you asking, are you unable to access the additional data field?
You can access them with the following code:

$result = $synology->getList('/home', 25, 0, 'name', 'asc', '', 'all', true);
foreach($result->files as $file){
    echo 'Name: '.$file->name.PHP_EOL;
    echo 'Path: '.$file->path.PHP_EOL;
    echo 'atime: '.$file->additional->time->atime.PHP_EOL;
    echo 'crtime: '.$file->additional->time->crtime.PHP_EOL;
    echo 'ctime: '.$file->additional->time->ctime.PHP_EOL;
    echo 'mtime: '.$file->additional->time->mtime.PHP_EOL.PHP_EOL;
}

Now if you want to filter the result based on any additional field (including time), the FileStation API doesn't allow that.
You can only retrieve additional parameter, you cannot use them to filter result.

FileStation has a search API that I didn't implement yet, that can search for range of date on mtime, crtime and atime. However it's a bit complicated, you have to "start" a search with one call to the API, then you can poll the result with a second call, but the search might not be 100% done so you will have to poll a gain. Then you can stop the search and you have to clean the search API at some point. All of that seems a bit complicated for just a filter by date.

In your case I would sort by date to get the recent files, filter the one you need, then re sort them by name in PHP. I'm guessing this would be the best case scenario.

from synology.

Bojhan avatar Bojhan commented on August 13, 2024

Ah, yeah this is the work around that I implemented as well. I looked into the Search API but as you mentioned it is quite inefficient way of doing it. It is smarter for me to just occasionally purge the number of files in this directory.

I will look into the performance of both approaches. If its too much, I will just put it into a file and cache it. I think its rather silly restriction of Synology its API, I will get in touch with them to see if they might consider adding support for this.

I am going to close this issue, since the issue does not originate from this api.

from synology.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.