soundcloud-uploader.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. date_default_timezone_set("UTC");
  3. $webRoot = apache_getenv("DOCUMENT_ROOT");
  4. //require_once $webRoot . "/../application/configs/conf.php";
  5. //$CC_CONFIG = Config::getConfig();
  6. require_once($webRoot.'/application/configs/constants.php');
  7. require_once($webRoot.'/application/configs/conf.php');
  8. // Ensure library/ is on include_path
  9. set_include_path(implode(PATH_SEPARATOR, array(
  10. get_include_path(),
  11. realpath($webRoot . '/library')
  12. )));
  13. require_once($webRoot.'/application/common/Database.php');
  14. require_once($webRoot.'/application/models/StoredFile.php');
  15. require_once($webRoot.'/application/models/Preference.php');
  16. require_once($webRoot.'/application/models/MusicDir.php');
  17. require_once($webRoot.'/application/common/OsPath.php');
  18. set_include_path($webRoot.'/library' . PATH_SEPARATOR . get_include_path());
  19. require_once($webRoot.'/application/models/Soundcloud.php');
  20. set_include_path($webRoot."/application/models" . PATH_SEPARATOR . get_include_path());
  21. require_once 'propel/runtime/lib/Propel.php';
  22. Propel::init($webRoot."/application/configs/airtime-conf-production.php");
  23. if(count($argv) != 2){
  24. exit;
  25. }
  26. $id = $argv[1];
  27. $file = Application_Model_StoredFile::RecallById($id);
  28. // set id with -2 which is indicator for processing
  29. $file->setSoundCloudFileId(SOUNDCLOUD_PROGRESS);
  30. $file->uploadToSoundCloud();