zzarbi / synology Goto Github PK
View Code? Open in Web Editor NEWPHP Implementation of Synology Download Station
License: MIT License
PHP Implementation of Synology Download Station
License: MIT License
Hello !
First of all : thank you for this library :-)
I use Surveillance Station in my house and I tried to implement some methods, ex :
const API_SERVICE_NAME = 'SurveillanceStation';
public function getCameraSchedule($camId)
{
$params['cameraId'] = $camId;
return $this->_request('Notification.Schedule', 'entry.cgi', 'GetCameraSchedule', $params);
}
public function setCameraSchedule($params)
{
return $this->_request('Notification.Schedule', 'entry.cgi', 'SetCameraSchedule', $params, null, 'post');
}
The getCameraSchedule() method works just fine.
But the setCameraSchedule() doesn't work when I call it with this code :
$params['eventType'] = 5;
$params['cameraId'] = 4;
$params['schedule'] = '[{"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}, {"schedule": "1"}]';
print_r($synology->setCameraSchedule($params));
I'm using a DS1513+ with Surveillance Station v7.1-4058.
Do you have any idea on how to implement this method ?
Is this problem beacause of the JSON format needed for "schedule" parameter ?
Thanks !
First of all, thanks for the great work!
I've taken the liberty to add some code on my fork to support the Search functionality of the DSM Download Station.
My changes can be seen on my "features/btsearch" branch
Some limitation do apply unfortunately.
It looks like search tasks are bound to the session so once you log-out or otherwise destroy the session, you will not be able to get the results anymore.
Using the wrapped stream endpoint lets a user get the audio content by calling $synology->stream('music_xxx');
This is returned as byte-range if the browser supports it (if the API call is done directly from a browser ofc). Best is to relay ALL response headers from the API but I don't know how to do that and more importantly where it should go; in the AudioStation API wrapper or the demo code.
Any help with this issue is really appreciated!
Hi,
Thanks for your excellent work ! I want to use your class for a private implementation and I have a problem with your example, I guess explain that
It's my code for Filestation API :
echo $synology->download($path2); Where $path2 is the link for the file.
Unfortunally this action dosen't work.
I'm trying to copy/paste your header but I hve got an error when I launch my code.
Can you help me for discover an issue ?
Thank's by advance
Currently it keeps trying to connect even when the server isn't reachable. Should the API $synology->connect have some kind of timeout measure?
Hi, is there any Information regarding the noteStation API?
Hello,
I try to execute the code in WAMP for testing.
I can't use it, I have always a class problem... I try to include php file, trying namespace, use etc.... Nothing works...
How can I load the namespace ?
Thank you
Can your register you package on packagist ?
does this still work? i cannot get it to show anything.
Not sure if this is something we can fix though; but authentication fails when the connection is secured by https.
Hi,
I am trying to use this, but its a little hard. Since the demo is quite limited, wondering if you have any examples for retrieving things like the directory and files with some timestamps. Right now this library seems limited to primary the Download Manager it would be nice if it could do more generic stuff.
I suspect this is some leftover after you created a seperate file for the errorcodes (Exception.php)
Hi,
It would be nice if the system can provide me with error codes instead of exceptions.
I currently cannot provide a error_log for $synology->connect and instead the script "hangs" for ages. There seems to be no timeout on the curl initiation.
Regards,
Bojhan
Great Job!
Where is the destination option in addTask downloadstation api ?
Thnx!
Hello zzarbi,
I have tried implementing your API to work on it but it doesn't seem to be working. When I run the PHP, it shows:
Connect Session: AudioStation User: admin Requested Url: https://XXX.synology.me:5001/webapi/auth.cgi?account=admin&passwd=XXX&session=AudioStation&format=sid&api=SYNO.API.Auth&version=2&method=login Response code: 0 Result:
I replaced my personal information with XXX, there is nothing on Result:, but when I go to this URL on a different browser tab, it works, connects fine, it even gives me an ID.
How can I solve this?
Thank you
Hello, thanks for you code!!!
I have written a small php application that worked great.
Now with the new DSM 5.1 does not make me do more access!!
The following is a sample debug of login:
Connect Session: DSM
User: admin
Requested Url GET: https://1.1.1.1:4444/webapi/auth.cgi?account=username&passwd=plaipassword&session=DSM&format=sid&api=SYNO.API.Auth&version=2&method=login
Response code: 0
Result:
Errore di connessione: Connection Error
you're experiencing some problems with the new version 5.1 of dsm ??
Best Regards
Gabriele
Hi,
I am trying to acces the data in the 'additional' => $additional' array. In order to filter my list of files only to certain creation dates (crtime) (e.g. I only want to show the files created on 5 December 2014). According to the API docs this should be possible, when printing a raw print_r($synology->getList('/recordings')); with additional on true - it is shown in the raw dump.
However it is not directly accessible as an object. Doing something like $file->additional['crtime]'. Does not render any results. I am not sure if this is a bug, or whether its because this still needs to be fully implemented.
From the API docs, time is broken down like:
"time": {
"atime": 1371630215,
"crtime": 1352168821,
"ctime": 1368769689,
"mtime": 1368769689
}
This value is part of the additional parameter.
I have been trying to work around it, but thats far les elegant. Essentially you would want to only load the files, with a certain creation date (or a range). Rather than loading all the files, and iterating over them. To give you an idea I have about 5000 files I have to iterate over. It looks like you can do this with file type, owner, etc. Just not with these additional values.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.