예제 #1
0
function nowNext($channel)
{
    $query = array('numberOfItems' => 10, 'sorting' => 'multi', 'multiSorting' => array(array('criterion' => 'byTime')), 'filter' => array('term' => 'sourceId', 'value' => $channel), 'annotation' => 'full', 'windowOfAvailabilityType' => 'strictStart', 'descendingDefaultByTime' => 'true', 'windowOfAvailabilityStart' => now(), 'windowOfAvailabilityEnd' => than(TIMESPAN));
    $response = watchmi("/asset", $query);
    return filter($response);
}
예제 #2
0
     foreach ($res as $rec) {
         $response[] = condenseAsset($rec->asset);
     }
     break;
 case "/recommendForItem":
     $query = array('context' => 'simDefault', 'seed' => $_GET["item"], 'adHocContext' => array('rules' => array(array('then' => array('global' => array('numberOfItems' => 17, 'windowOfAvailabilityStart' => format_time(time()), 'windowOfAvailabilityEnd' => format_time(time() + 7200), 'annotation' => 'full', 'filter' => array('term' => 'sourceId', 'operator' => 'in', 'values' => $CHANNELS)))))));
     //print_r($query);exit();
     $res = watchmi("/recommendations", $query);
     $response = array();
     foreach ($res->recommendations as $rec) {
         $response[] = condenseAsset($rec->asset);
     }
     break;
 case "/recommendForUser":
     $query = array('context' => 'prefDefault', 'subscriber' => $SUBSCRIBER, 'profile' => $PROFILES[$_GET['profile']], 'adHocContext' => array('rules' => array(array('then' => array('preferenceEngines' => array(array('name' => 'prefEngine1')), 'global' => array('numberOfItems' => 10, 'windowOfAvailabilityStart' => format_time(time()), 'windowOfAvailabilityEnd' => format_time(time() + 3600 * 12), 'annotation' => 'full', 'filter' => array('term' => 'sourceId', 'operator' => 'in', 'values' => $CHANNELS)))))));
     $res = watchmi("/recommendations", $query);
     $response = array();
     foreach ($res->recommendations as $rec) {
         $response[] = condenseAsset($rec->asset);
     }
     break;
 case "/rate":
     // watchmi.php/rate?asset=86336205&rating=1&profile=various
     $url = "/profile/" . $PROFILES[$_GET['profile']] . "/scorer?errorTolerant=true&recordingSuggestion=false";
     $data = array('assetId' => floor($_GET['asset']), 'rating' => (floor($_GET['rating']) - 1.0) / 2.0 - 1.0, 'subscriber' => $SUBSCRIBER);
     //$response = array($url, $data); break;
     $response = post_watchmi($url, $data);
     break;
 case "/createUser":
     $newUser = md5(rand());
     $newUser = "******";