Align episode upload format to gpodder-api
'started', 'position' and 'total' are optional and 'timestamp' is in 'Y-m-d\TH:i:s' format
This commit is contained in:
parent
d6c81e7f83
commit
d131b59348
@ -84,17 +84,4 @@ class EpisodeActionController extends Controller {
|
|||||||
public function filterEpisodesFromRequestParams(array $data): array {
|
public function filterEpisodesFromRequestParams(array $data): array {
|
||||||
return array_filter($data, "is_numeric", ARRAY_FILTER_USE_KEY);
|
return array_filter($data, "is_numeric", ARRAY_FILTER_USE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int|null $since
|
|
||||||
*
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
|
||||||
return ($since !== null)
|
|
||||||
? (new \DateTime)->setTimestamp($since)
|
|
||||||
: (new \DateTime('-1 week'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,11 @@ class EpisodeActionReader
|
|||||||
$episodeAction["episode"],
|
$episodeAction["episode"],
|
||||||
$episodeAction["action"],
|
$episodeAction["action"],
|
||||||
$episodeAction["timestamp"],
|
$episodeAction["timestamp"],
|
||||||
$episodeAction["started"],
|
$episodeAction["started"] ?? -1,
|
||||||
$episodeAction["position"],
|
$episodeAction["position"] ?? -1,
|
||||||
$episodeAction["total"],
|
$episodeAction["total"] ?? -1,
|
||||||
$episodeAction["guid"] ?? null,
|
$episodeAction["guid"] ?? null,
|
||||||
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,7 @@ class EpisodeActionSaver
|
|||||||
|
|
||||||
private function convertTimestampToUnixEpoch(string $timestamp): string
|
private function convertTimestampToUnixEpoch(string $timestamp): string
|
||||||
{
|
{
|
||||||
return \DateTime::createFromFormat('D F d H:i:s T Y', $timestamp)
|
return \DateTime::createFromFormat('Y-m-d\TH:i:s', $timestamp)
|
||||||
->setTimezone(new DateTimeZone('UTC'))
|
|
||||||
->format("U");
|
->format("U");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user