Advertisement
Cozza38

Untitled

Jun 14th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. $i = 0;
  2. if ( !count($plex_session_xml->Video) == 0 ) {
  3. // Someone is watching, get their progress
  4. foreach($plex_session_xml->Video as $plex_session) {
  5. $i++; // Increment i every pass through the array
  6. $duration = $plex_session[$i - 1]['duration'];
  7. $viewOffset = $plex_session[$i - 1]['viewOffset'];
  8. $progress = sprintf('%.0f', ($viewOffset / $duration) * 100);
  9. $progress_array = [
  10. "progress" => $progress,
  11. ];
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement