Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Jun 28, 2024
1 parent 554c707 commit c4383b7
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
71 changes: 71 additions & 0 deletions plugin/JustWatch/JustWatch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

global $global;
require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';

class JustWatch extends PluginAbstract {

public function getTags() {
return array(
PluginTags::$FREE,
);
}

public function getDescription() {
$txt = "";

return $txt;
}

public function getName() {
return "JustWatch";
}

public function getUUID() {
return "JustWatch-43a9-479b-994a-5430dc22958c";
}

public function getEmptyDataObject() {
$obj = new stdClass();
$obj->streaming_service_name = 'Example Streaming Service';
$obj->streaming_service_url = 'https://www.example.com';

$o = new stdClass();
$o->type = "textarea";
$o->value = '[
{
"platform": "apple",
"url": "https://apps.apple.com/us/app/justwatch-movies-tv-shows/id979227482",
"country_iso": "US"
},
{
"platform": "google",
"url": "https://play.google.com/store/apps/details?id=com.justwatch.justwatch\u0026hl=en\u0026gl=US",
"country_iso": "XX"
}
]';
$obj->application_stores = $o;


$o = new stdClass();
$o->type = "textarea";
$o->value = '[
{
"platform": "android_tv",
"name": "com.justwatch.android-app",
"country_iso": "XX"
},
{
"platform": "ios_mobile",
"name": "com.justwatch.ios-app",
"country_iso": "XX"
}
]';
$obj->application_packages = $o;


return $obj;
}


}
52 changes: 52 additions & 0 deletions plugin/JustWatch/feed.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

require_once '../../videos/configuration.php';
header('Content-Type: application/json');


$obj = AVideoPlugin::getDataObjectIfEnabled('JustWatch');

if(empty($obj)){
forbiddenPage('Plugin is disabled');
}

// Create a new DateTime object for the current date and time in UTC
$date = new DateTime('now', new DateTimeZone('UTC'));
// Format the date in the specified format
$formattedDate = $date->format('Y-m-d\TH:i:sP');

$array = array();
$array['streaming_service'] = array();
$array['streaming_service']['name'] = $obj->streaming_service_name;
$array['streaming_service']['url'] = $obj->streaming_service_url;
$array['streaming_service']['application_stores'] = json_decode($obj->application_stores->value);
$array['streaming_service']['application_packages'] = json_decode($obj->streaming_service_url->value);

$array['contents'] = array();

$rows = Video::getAllVideosLight();
foreach ($rows as $row) {
$element = array();
$element['id'] = $row['id'];
$element['object_type'] = 'movie';
$element['original_title'] = $row['title'];
$element['original_description'] = $row['description'];
$element['images'] = array();
$posters = Video::getMediaSessionPosters($row['id']);
foreach ($posters as $key => $value) {

$element['images'][] = array(
'url' => $value['url'],
'image_type' => 'poster',
'width' => $key,
'height' => $key,
//'language' => 'en',
);
}
}


$array['last_modified'] = $formattedDate;


?>
5 changes: 5 additions & 0 deletions view/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ try {
forwardToIframe(e.data);
}
*/

// this is for plugin/SocialMediaPublisher/script.js
if (typeof e.data.provider !== 'undefined' && typeof saveYPT !== 'undeined') {
forwardToIframe(e.data);
}
}, false);

eventer("online", function (e) {
Expand Down

0 comments on commit c4383b7

Please sign in to comment.