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 {
|
||||
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["action"],
|
||||
$episodeAction["timestamp"],
|
||||
$episodeAction["started"],
|
||||
$episodeAction["position"],
|
||||
$episodeAction["total"],
|
||||
$episodeAction["started"] ?? -1,
|
||||
$episodeAction["position"] ?? -1,
|
||||
$episodeAction["total"] ?? -1,
|
||||
$episodeAction["guid"] ?? null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,7 @@ class EpisodeActionSaver
|
||||
|
||||
private function convertTimestampToUnixEpoch(string $timestamp): string
|
||||
{
|
||||
return \DateTime::createFromFormat('D F d H:i:s T Y', $timestamp)
|
||||
->setTimezone(new DateTimeZone('UTC'))
|
||||
return \DateTime::createFromFormat('Y-m-d\TH:i:s', $timestamp)
|
||||
->format("U");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user