Example #1
0
 /**
  * Dispatch get actions
  *
  * @param array $segments Method segments indicate action and resource
  *
  * @return void
  */
 public function restGet($segments)
 {
     $action_id = $segments[0];
     switch ($action_id) {
         case 'get-song-audio-td':
             $validate_song_id = LMValidateHelper::validateNoEmpty($_GET['song_id']);
             if (!$validate_song_id) {
                 $type = 'not_exist_value';
                 $parameter = array("none" => "none");
                 $error_messanger = new LMErrorMessenger($type, $parameter);
                 $error_messanger->printErrorJSON();
                 unset($error_messanger);
             } else {
                 $song_id = $_GET['song_id'];
                 require SITE_ROOT . "/ajax-action/SongActionView/song-audio-td.php";
             }
             break;
         case 'song-list':
             $offset = $_GET['offset'];
             if (!LMValidateHelper::validateNoEmpty($offset)) {
                 $offset = 0;
             }
             $length = $_GET['length'];
             if (!LMValidateHelper::validateNoEmpty($length)) {
                 $length = 33;
             }
             switch ($_GET['song_list_type']) {
                 case 'audio':
                     $song_list_type = 'audio';
                     break;
                 case 'no-audio':
                     $song_list_type = 'no-audio';
                     break;
                 case 'all':
                 default:
                     $song_list_type = 'all';
                     break;
             }
             $song_god_obj = new LMSongGod();
             $song_list = $song_god_obj->getList($song_list_type, $offset, $length);
             require SITE_ROOT . "/ajax-action/SongActionView/song-list.php";
             unset($song_god_obj);
             break;
         default:
             $type = 'page_not_found';
             $parameter = array("none" => "none");
             $error_messanger = new LMErrorMessenger($type, $parameter);
             $error_messanger->printErrorJSON();
             unset($error_messanger);
             break;
     }
 }
Example #2
0
         case 'no-audio':

            $song_list_type = 'no-audio';

            break;

         case 'all':
         default:

            $song_list_type = 'all';

            break;
         }

         $song_god_obj = new LMSongGod();


         if (isset($_GET['search_query']) && !empty($_GET['search_query'])) {
            $song_list = $song_god_obj->search($_GET['search_query']);
         } else {
            $song_list = $song_god_obj->getList($song_list_type, $offset, $length);
         }



         require SITE_ROOT."/ajax-action/SongActionView/song-list.php";

         unset($song_god_obj);

         ?>
 *
 * @category PHP
 * @package  /p-schedule/
 * @author   Fukuball Lin <*****@*****.**>
 * @license  No Licence
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
require_once dirname(dirname(__FILE__)) . "/p-config/application-setter.php";
$kkbox_link = 'http://tw.kkbox.com';
$db_obj = LMDBAccess::getInstance();
$performer_god_obj = new LMPerformerGod();
$composer_god_obj = new LMComposerGod();
$lyricist_god_obj = new LMLyricistGod();
$disc_god_obj = new LMDiscGod();
$song_god_obj = new LMSongGod();
$select_sql = "SELECT " . "* " . "FROM temp_midi " . "WHERE " . "is_moved='0' AND kkbox_url != '' AND memo=''";
$query_result = $db_obj->selectCommand($select_sql);
// get unprocess data
foreach ($query_result as $query_result_data) {
    $midi_id = $query_result_data['id'];
    echo "create midi_id {$midi_id} \n";
    $artist_title = $query_result_data['artist_title'];
    $song_title = $query_result_data['song_title'];
    $midi_path = $query_result_data['midi_path'];
    $temp_kkbox_url = $query_result_data['kkbox_url'];
    // get song detail
    $yql_query = urlencode('SELECT * FROM html WHERE url="' . $temp_kkbox_url . '"');
    $song_page_html = file_get_contents('http://query.yahooapis.com/v1/public/yql?q=' . $yql_query . '&format=json');
    $song_page_dom = json_decode($song_page_html);
    //print_r($song_page_dom);