-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Neto
committed
Jun 28, 2024
1 parent
554c707
commit c4383b7
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters