示例#1
0
 /**
  * uninstall
  * This removes the remote catalog
  */
 public function uninstall()
 {
     $sql = "DELETE FROM `catalog` WHERE `catalog_type` = ?";
     Dba::query($sql, array($this->get_type()));
     $sql = "DROP TABLE `catalog_" . $this->get_type() . "`";
     Dba::query($sql);
     return true;
 }
示例#2
0
 /**
  * get_instance
  * This returns a single instance and all it's variables
  */
 public function get_instance($instance = '')
 {
     $instance = $instance ? $instance : AmpConfig::get('vlc_active');
     $sql = "SELECT * FROM `localplay_vlc` WHERE `id` = ?";
     $db_results = Dba::query($sql, array($instance));
     $row = Dba::fetch_assoc($db_results);
     return $row;
 }
示例#3
0
 /**
  * install
  * This function installs the local catalog
  */
 public function install()
 {
     $sql = "CREATE TABLE `catalog_local` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " . "`path` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`catalog_id` INT( 11 ) NOT NULL" . ") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
     $db_results = Dba::query($sql);
     return true;
 }
示例#4
0
 /**
  * Sort the tracks and save the new position
  */
 public function sort_tracks()
 {
     /* First get all of the songs in order of their tracks */
     $sql = "SELECT A.`id`\n                FROM `playlist_data` AS A\n           LEFT JOIN `song` AS B ON A.object_id = B.id\n           LEFT JOIN `artist` AS C ON B.artist = C.id\n           LEFT JOIN `album` AS D ON B.album = D.id\n               WHERE A.`playlist` = ?\n            ORDER BY C.`name` ASC,\n                     B.`title` ASC,\n                     D.`year` ASC,\n                     D.`name` ASC,\n                     B.`track` ASC";
     $db_results = Dba::query($sql, array($this->id));
     $i = 1;
     $results = array();
     while ($r = Dba::fetch_assoc($db_results)) {
         $new_data = array();
         $new_data['id'] = $r['id'];
         $new_data['track'] = $i;
         $results[] = $new_data;
         $i++;
     }
     // end while results
     foreach ($results as $data) {
         $sql = "UPDATE `playlist_data` SET `track` = ? WHERE `id` = ?";
         Dba::write($sql, array($data['track'], $data['id']));
     }
     // foreach re-ordered results
     return true;
 }
示例#5
0
 /**
  * install
  * This function installs the remote catalog
  */
 public function install()
 {
     $sql = "CREATE TABLE `catalog_dropbox` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " . "`apikey` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`secret` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`path` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`authtoken` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " . "`getchunk` TINYINT(1) NOT NULL, " . "`catalog_id` INT( 11 ) NOT NULL" . ") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
     $db_results = Dba::query($sql);
     return true;
 }