72bf365285
persist and list with database create episodeAction list reponse (with mocked timestamp, started and total) create episodeActions with received values update existing episodeActions by unique episode link receive and store subscription changes deal with multiple subscription changes in single request split database into subdirectories only return subscription changes younger then passed parameter since parse passed timestamp parse passed timestamp for episode_actions listing only return list of urls for subscription changes align list endpoint naming schema store userId with episode actions and subscriptions return json object on application root route
29 lines
860 B
PHP
29 lines
860 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\GPodderSync\Core\EpisodeAction;
|
|
|
|
class EpisodeActionReader {
|
|
public function fromString(string $episodeActionString): EpisodeAction {
|
|
file_put_contents('actionreader.log', var_export($episodeActionString, true), FILE_APPEND);
|
|
preg_match(
|
|
'/\[EpisodeAction{(podcast=\')(?<podcast>.*?)(\', episode=\')(?<episode>.*?)(\', action=)(?<action>.*?)(, timestamp=)(?<timestamp>.*?)(, started=)(?<started>.*?)(, position=)(?<position>.*?)(, total=)(?<total>.*?)}]*/',
|
|
$episodeActionString,
|
|
$matches
|
|
);
|
|
|
|
file_put_contents('actionreader.log', var_export($matches, true), FILE_APPEND);
|
|
|
|
return new EpisodeAction(
|
|
$matches["podcast"],
|
|
$matches["episode"],
|
|
$matches["action"],
|
|
$matches["timestamp"],
|
|
(int)$matches["started"],
|
|
(int)$matches["position"],
|
|
(int)$matches["total"],
|
|
);
|
|
}
|
|
|
|
}
|