示例#1
0
 /**
  * update_tags
  *
  * Update tags of tv shows
  */
 public function update_tags($tags_comma, $override_childs, $add_to_childs, $current_id = null, $force_update = false)
 {
     if ($current_id == null) {
         $current_id = $this->id;
     }
     Tag::update_tag_list($tags_comma, 'tvshow', $current_id, $force_update ? true : $override_childs);
     if ($override_childs || $add_to_childs) {
         $episodes = $this->get_episodes();
         foreach ($episodes as $ep_id) {
             Tag::update_tag_list($tags_comma, 'episode', $ep_id, $override_childs);
         }
     }
 }
示例#2
0
 /**
  * Updates artist tags from given song
  * @param Song $song
  */
 protected static function updateArtistTags(Song $song)
 {
     $tags = self::getSongTags('artist', $song->artist);
     Tag::update_tag_list(implode(',', $tags), 'artist', $song->artist, true);
 }
示例#3
0
 /**
  * Update a broadcast from data array.
  * @param array $data
  * @return int
  */
 public function update(array $data)
 {
     if (isset($data['edit_tags'])) {
         Tag::update_tag_list($data['edit_tags'], 'broadcast', $this->id, true);
     }
     $sql = "UPDATE `broadcast` SET `name` = ?, `description` = ?, `is_private` = ? " . "WHERE `id` = ?";
     $params = array($data['name'], $data['description'], !empty($data['private']), $this->id);
     Dba::write($sql, $params);
     return $this->id;
 }
示例#4
0
 public function update(array $data)
 {
     if (isset($data['edit_tags'])) {
         Tag::update_tag_list($data['edit_tags'], 'channel', $this->id, true);
     }
     $sql = "UPDATE `channel` SET `name` = ?, `description` = ?, `url` = ?, `interface` = ?, `port` = ?, `fixed_endpoint` = ?, `admin_password` = ?, `is_private` = ?, `max_listeners` = ?, `random` = ?, `loop` = ?, `stream_type` = ?, `bitrate` = ?, `object_id` = ? " . "WHERE `id` = ?";
     $params = array($data['name'], $data['description'], $data['url'], $data['interface'], $data['port'], !empty($data['interface']) && !empty($data['port']), $data['admin_password'], !empty($data['private']), $data['max_listeners'], $data['random'], $data['loop'], $data['stream_type'], $data['bitrate'], $data['object_id'], $this->id);
     Dba::write($sql, $params);
     return $this->id;
 }
示例#5
0
 /**
  * update_tags
  *
  * Update tags of artists and/or albums
  */
 public function update_tags($tags_comma, $override_childs, $current_id = null)
 {
     if ($current_id == null) {
         $current_id = $this->id;
     }
     Tag::update_tag_list($tags_comma, 'artist', $current_id);
     if ($override_childs) {
         $albums = $this->get_albums(null, true);
         foreach ($albums as $album_id) {
             $album = new Album($album_id);
             $album->update_tags($tags_comma, $override_childs);
         }
     }
 }
示例#6
0
 /**
  * update_tags
  *
  * Update tags of albums and/or songs
  */
 public function update_tags($tags_comma, $override_songs, $current_id = null)
 {
     if ($current_id == null) {
         $current_id = $this->id;
     }
     Tag::update_tag_list($tags_comma, 'album', $current_id);
     if ($override_songs) {
         $songs = $this->get_songs();
         foreach ($songs as $song_id) {
             Tag::update_tag_list($tags_comma, 'song', $song_id);
         }
     }
 }
示例#7
0
 /**
  * update_tags
  *
  * Update tags of albums and/or songs
  * @param string $tags_comma
  * @param boolean $override_childs
  * @param boolean $add_to_childs
  * @param int|null $current_id
  */
 public function update_tags($tags_comma, $override_childs, $add_to_childs, $current_id = null, $force_update = false)
 {
     if ($current_id == null) {
         $current_id = $this->id;
     }
     // When current_id not empty we force to overwrite current object
     Tag::update_tag_list($tags_comma, 'album', $current_id, $force_update ? true : $override_childs);
     if ($override_childs || $add_to_childs) {
         $songs = $this->get_songs();
         foreach ($songs as $song_id) {
             Tag::update_tag_list($tags_comma, 'song', $song_id, $override_childs);
         }
     }
 }
示例#8
0
 /**
  * update
  * This takes a key'd array of data as input and updates a video entry
  * @param array $data
  * @return int
  */
 public function update(array $data)
 {
     if (isset($data['release_date'])) {
         $f_release_date = $data['release_date'];
         $release_date = strtotime($f_release_date);
     } else {
         $release_date = $this->release_date;
     }
     $title = isset($data['title']) ? $data['title'] : $this->title;
     $sql = "UPDATE `video` SET `title` = ?, `release_date` = ? WHERE `id` = ?";
     Dba::write($sql, array($title, $release_date, $this->id));
     if (isset($data['edit_tags'])) {
         Tag::update_tag_list($data['edit_tags'], 'video', $this->id, true);
     }
     $this->title = $title;
     $this->release_date = $release_date;
     return $this->id;
 }
示例#9
0
 /**
  * update
  * This takes a key'd array of data does any cleaning it needs to
  * do and then calls the helper functions as needed.
  * @param array $data
  * @return int
  */
 public function update(array $data)
 {
     foreach ($data as $key => $value) {
         debug_event('song.class.php', $key . '=' . $value, '5');
         switch ($key) {
             case 'artist_name':
                 // Need to create new artist according the name
                 $new_artist_id = Artist::check($value);
                 $this->artist = $new_artist_id;
                 self::update_artist($new_artist_id, $this->id);
                 break;
             case 'album_name':
                 // Need to create new album according the name
                 $new_album_id = Album::check($value);
                 $this->album = $new_album_id;
                 self::update_album($new_album_id, $this->id);
                 break;
             case 'year':
             case 'title':
             case 'track':
             case 'artist':
             case 'album':
             case 'mbid':
             case 'license':
             case 'composer':
             case 'label':
             case 'language':
             case 'comment':
                 // Check to see if it needs to be updated
                 if ($value != $this->{$key}) {
                     $function = 'update_' . $key;
                     self::$function($value, $this->id);
                     $this->{$key} = $value;
                 }
                 break;
             case 'edit_tags':
                 Tag::update_tag_list($value, 'song', $this->id, true);
                 $this->tags = Tag::get_top_tags('song', $this->id);
                 break;
             default:
                 break;
         }
         // end whitelist
     }
     // end foreach
     $this->write_id3();
     return $this->id;
 }
示例#10
0
 /**
  * update
  * This takes a key'd array of data does any cleaning it needs to
  * do and then calls the helper functions as needed.
  */
 public function update($data)
 {
     foreach ($data as $key => $value) {
         debug_event('song.class.php', $key . '=' . $value, '5');
         switch ($key) {
             case 'artist_name':
                 // Need to create new artist according the name
                 $new_artist_id = Artist::check($value);
                 self::update_artist($new_artist_id, $this->id);
                 break;
             case 'album_name':
                 // Need to create new album according the name
                 $new_album_id = Album::check($value);
                 self::update_album($new_album_id, $this->id);
                 break;
             case 'title':
             case 'track':
             case 'artist':
             case 'album':
             case 'mbid':
                 // Check to see if it needs to be updated
                 if ($value != $this->{$key}) {
                     $function = 'update_' . $key;
                     self::$function($value, $this->id);
                     $this->{$key} = $value;
                 }
                 break;
             case 'edit_tags':
                 Tag::update_tag_list($value, 'song', $this->id);
                 break;
             default:
                 break;
         }
         // end whitelist
     }
     // end foreach
     return true;
 }