当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::get_object_tags方法代码示例

本文整理汇总了PHP中Tag::get_object_tags方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::get_object_tags方法的具体用法?PHP Tag::get_object_tags怎么用?PHP Tag::get_object_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::get_object_tags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_video_from_tags

 public static function update_video_from_tags($results, Video $video)
 {
     /* Setup the vars */
     $new_video = new Video();
     $new_video->file = $results['file'];
     $new_video->title = $results['title'];
     $new_video->size = $results['size'];
     $new_video->video_codec = $results['video_codec'];
     $new_video->audio_codec = $results['audio_codec'];
     $new_video->resolution_x = $results['resolution_x'];
     $new_video->resolution_y = $results['resolution_y'];
     $new_video->time = $results['time'];
     $new_video->release_date = $results['release_date'] ?: 0;
     $new_video->bitrate = $results['bitrate'];
     $new_video->mode = $results['mode'];
     $new_video->channels = $results['channels'];
     $new_video->display_x = $results['display_x'];
     $new_video->display_y = $results['display_y'];
     $new_video->frame_rate = $results['frame_rate'];
     $new_video->video_bitrate = $results['video_bitrate'];
     $tags = Tag::get_object_tags('video', $video->id);
     if ($tags) {
         foreach ($tags as $tag) {
             $video->tags[] = $tag['name'];
         }
     }
     $new_video->tags = $results['genre'];
     $info = Video::compare_video_information($video, $new_video);
     if ($info['change']) {
         debug_event('update', $video->file . " : differences found, updating database", 5);
         $video->update_video($video->id, $new_video);
         if ($video->tags != $new_video->tags) {
             Tag::update_tag_list(implode(',', $new_video->tags), 'video', $video->id, true);
         }
     } else {
         debug_event('update', $video->file . " : no differences found", 5);
     }
     return $info;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:39,代码来源:catalog.class.php

示例2: get_genre

 public function get_genre()
 {
     $tags = Tag::get_object_tags('channel', $this->id);
     $genre = "";
     if ($tags) {
         foreach ($tags as $tag) {
             $genre .= $tag['name'] . ' ';
         }
         $genre = trim($genre);
     }
     return $genre;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:12,代码来源:channel.class.php

示例3: addVideo

 public static function addVideo($xml, $video)
 {
     $xvideo = $xml->addChild('video');
     $xvideo->addAttribute('id', self::getVideoId($video->id));
     $xvideo->addAttribute('title', $video->f_full_title);
     $xvideo->addAttribute('isDir', 'false');
     $xvideo->addAttribute('coverArt', self::getVideoId($video->id));
     $xvideo->addAttribute('isVideo', 'true');
     $xvideo->addAttribute('type', 'video');
     $xvideo->addAttribute('duration', $video->time);
     if ($video->year > 0) {
         $xvideo->addAttribute('year', $video->year);
     }
     $tags = Tag::get_object_tags('video', $video->id);
     if (count($tags) > 0) {
         $xvideo->addAttribute('genre', $tags[0]['name']);
     }
     $xvideo->addAttribute('size', $video->size);
     $xvideo->addAttribute('suffix', $video->type);
     $xvideo->addAttribute('contentType', $video->mime);
     // Create a clean fake path instead of song real file path to have better offline mode storage on Subsonic clients
     $path = basename($video->file);
     $xvideo->addAttribute('path', $path);
     // Set transcoding information if required
     $transcode_cfg = AmpConfig::get('transcode');
     $valid_types = Song::get_stream_types_for_type($video->type, 'api');
     if ($transcode_cfg == 'always' || $transcode_cfg != 'never' && !in_array('native', $valid_types)) {
         $transcode_settings = $video->get_transcode_settings(null, 'api');
         if ($transcode_settings) {
             $transcode_type = $transcode_settings['format'];
             $xvideo->addAttribute('transcodedSuffix', $transcode_type);
             $xvideo->addAttribute('transcodedContentType', Video::type_to_mime($transcode_type));
         }
     }
 }
开发者ID:nioc,项目名称:ampache,代码行数:35,代码来源:subsonic_xml_data.class.php

示例4: update_song_from_tags

 /**
  * update_song_from_tags
  * Updates the song info based on tags; this is called from a bunch of
  * different places and passes in a full fledged song object, so it's a
  * static function.
  * FIXME: This is an ugly mess, this really needs to be consolidated and
  * cleaned up.
  * @param array $results
  * @param \Song $song
  * @return array
  */
 public static function update_song_from_tags($results, Song $song)
 {
     /* Setup the vars */
     $new_song = new Song();
     $new_song->file = $results['file'];
     $new_song->title = $results['title'];
     $new_song->year = $results['year'];
     $new_song->comment = $results['comment'];
     $new_song->language = $results['language'];
     $new_song->lyrics = str_replace(array("\r\n", "\r", "\n"), '<br />', strip_tags($results['lyrics']));
     $new_song->bitrate = $results['bitrate'];
     $new_song->rate = $results['rate'];
     $new_song->mode = $results['mode'] == 'cbr' ? 'cbr' : 'vbr';
     $new_song->size = $results['size'];
     $new_song->time = $results['time'];
     $new_song->mime = $results['mime'];
     $new_song->track = intval($results['track']);
     $new_song->mbid = $results['mb_trackid'];
     $new_song->label = $results['publisher'];
     $new_song->composer = $results['composer'];
     $new_song->replaygain_track_gain = floatval($results['replaygain_track_gain']);
     $new_song->replaygain_track_peak = floatval($results['replaygain_track_peak']);
     $new_song->replaygain_album_gain = floatval($results['replaygain_album_gain']);
     $new_song->replaygain_album_peak = floatval($results['replaygain_album_peak']);
     $tags = Tag::get_object_tags('song', $song->id);
     if ($tags) {
         foreach ($tags as $tag) {
             $song->tags[] = $tag['name'];
         }
     }
     $new_song->tags = $results['genre'];
     $artist = $results['artist'];
     $artist_mbid = $results['mb_artistid'];
     $albumartist = $results['albumartist'] ?: $results['band'];
     $albumartist = $albumartist ?: null;
     $albumartist_mbid = $results['mb_albumartistid'];
     $album = $results['album'];
     $album_mbid = $results['mb_albumid'];
     $album_mbid_group = $results['mb_albumid_group'];
     $disk = $results['disk'];
     /*
      * We have the artist/genre/album name need to check it in the tables
      * If found then add & return id, else return id
      */
     $new_song->artist = Artist::check($artist, $artist_mbid);
     if ($albumartist) {
         $new_song->albumartist = Artist::check($albumartist, $albumartist_mbid);
     }
     $new_song->album = Album::check($album, $new_song->year, $disk, $album_mbid, $album_mbid_group, $new_song->albumartist);
     $new_song->title = self::check_title($new_song->title, $new_song->file);
     /* Since we're doing a full compare make sure we fill the extended information */
     $song->fill_ext_info();
     $info = Song::compare_song_information($song, $new_song);
     if ($info['change']) {
         debug_event('update', "{$song->file} : differences found, updating database", 5);
         // Duplicate arts if required
         if ($song->artist != $new_song->artist) {
             if (!Art::has_db($new_song->artist, 'artist')) {
                 Art::duplicate('artist', $song->artist, $new_song->artist);
             }
         }
         if ($song->albumartist != $new_song->albumartist) {
             if (!Art::has_db($new_song->albumartist, 'artist')) {
                 Art::duplicate('artist', $song->albumartist, $new_song->albumartist);
             }
         }
         if ($song->album != $new_song->album) {
             if (!Art::has_db($new_song->album, 'album')) {
                 Art::duplicate('album', $song->album, $new_song->album);
             }
         }
         $song->update_song($song->id, $new_song);
         if ($song->tags != $new_song->tags) {
             Tag::update_tag_list(implode(',', $new_song->tags), 'song', $song->id, true);
             self::updateAlbumTags($song);
             self::updateArtistTags($song);
         }
         // Refine our reference
         //$song = $new_song;
     } else {
         debug_event('update', "{$song->file} : no differences found", 5);
     }
     return $info;
 }
开发者ID:nioc,项目名称:ampache,代码行数:95,代码来源:catalog.class.php

示例5: createSong

 public static function createSong($xml, $song, $elementName = 'song')
 {
     $xsong = $xml->addChild($elementName);
     $xsong->addAttribute('id', self::getSongId($song->id));
     $xsong->addAttribute('parent', self::getAlbumId($song->album));
     //$xsong->addAttribute('created', );
     $xsong->addAttribute('title', $song->title);
     $xsong->addAttribute('isDir', 'false');
     $xsong->addAttribute('isVideo', 'false');
     $xsong->addAttribute('type', 'music');
     $album = new Album($song->album);
     $xsong->addAttribute('albumId', self::getAlbumId($album->id));
     $xsong->addAttribute('album', $album->name);
     $artist = new Artist($song->artist);
     $xsong->addAttribute('artistId', self::getArtistId($album->id));
     $xsong->addAttribute('artist', $artist->name);
     $xsong->addAttribute('coverArt', self::getAlbumId($album->id));
     $xsong->addAttribute('duration', $song->time);
     $xsong->addAttribute('bitRate', intval($song->bitrate / 1000));
     if ($song->track > 0) {
         $xsong->addAttribute('track', $song->track);
     }
     if ($song->year > 0) {
         $xsong->addAttribute('year', $song->year);
     }
     $tags = Tag::get_object_tags('song', $song->id);
     if (count($tags) > 0) {
         $xsong->addAttribute('genre', $tags[0]['name']);
     }
     $xsong->addAttribute('size', $song->size);
     if ($album->disk > 0) {
         $xsong->addAttribute('discNumber', $album->disk);
     }
     $xsong->addAttribute('suffix', $song->type);
     $xsong->addAttribute('contentType', $song->mime);
     // Create a clean fake path instead of song real file path to have better offline mode storage on Subsonic clients
     $path = $artist->name . '/' . $album->name . '/' . basename($song->file);
     $xsong->addAttribute('path', $path);
     // Set transcoding information if required
     $transcode_cfg = AmpConfig::get('transcode');
     $transcode_mode = AmpConfig::get('transcode_' . $song->type);
     if ($transcode_cfg == 'always' || $transcode_cfg != 'never' && $transcode_mode == 'required') {
         $transcode_settings = $song->get_transcode_settings(null);
         if ($transcode_settings) {
             $transcode_type = $transcode_settings['format'];
             $xsong->addAttribute('transcodedSuffix', $transcode_type);
             $xsong->addAttribute('transcodedContentType', Song::type_to_mime($transcode_type));
         }
     }
     return $xsong;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:51,代码来源:subsonic_xml_data.class.php

示例6: update_song_from_tags

 /**
  * update_song_from_tags
  * Updates the song info based on tags; this is called from a bunch of
  * different places and passes in a full fledged song object, so it's a
  * static function.
  * FIXME: This is an ugly mess, this really needs to be consolidated and
  * cleaned up.
  * @param array $results
  * @param \Song $song
  * @return array
  */
 public static function update_song_from_tags($results, Song $song)
 {
     /* Setup the vars */
     $new_song = new Song();
     $new_song->file = $results['file'];
     $new_song->title = $results['title'];
     $new_song->year = $results['year'];
     $new_song->comment = $results['comment'];
     $new_song->language = $results['language'];
     $new_song->lyrics = str_replace(array("\r\n", "\r", "\n"), '<br />', strip_tags($results['lyrics']));
     $new_song->bitrate = $results['bitrate'];
     $new_song->rate = $results['rate'];
     $new_song->mode = $results['mode'] == 'cbr' ? 'cbr' : 'vbr';
     $new_song->size = $results['size'];
     $new_song->time = $results['time'];
     $new_song->mime = $results['mime'];
     $new_song->track = intval($results['track']);
     $new_song->mbid = $results['mb_trackid'];
     $new_song->label = $results['publisher'];
     $new_song->composer = $results['composer'];
     $new_song->replaygain_track_gain = floatval($results['replaygain_track_gain']);
     $new_song->replaygain_track_peak = floatval($results['replaygain_track_peak']);
     $new_song->replaygain_album_gain = floatval($results['replaygain_album_gain']);
     $new_song->replaygain_album_peak = floatval($results['replaygain_album_peak']);
     $tags = Tag::get_object_tags('song', $song->id);
     if ($tags) {
         foreach ($tags as $tag) {
             $song->tags[] = $tag['name'];
         }
     }
     $new_song->tags = $results['genre'];
     $artist = $results['artist'];
     $artist_mbid = $results['mb_artistid'];
     $albumartist = $results['albumartist'] ?: $results['band'];
     $albumartist = $albumartist ?: null;
     $albumartist_mbid = $results['mb_albumartistid'];
     $album = $results['album'];
     $album_mbid = $results['mb_albumid'];
     $album_mbid_group = $results['mb_albumid_group'];
     $disk = $results['disk'];
     /*
      * We have the artist/genre/album name need to check it in the tables
      * If found then add & return id, else return id
      */
     $new_song->artist = Artist::check($artist, $artist_mbid);
     if ($albumartist) {
         $new_song->albumartist = Artist::check($albumartist, $albumartist_mbid);
     }
     $new_song->album = Album::check($album, $new_song->year, $disk, $album_mbid, $album_mbid_group, $new_song->albumartist);
     $new_song->title = self::check_title($new_song->title, $new_song->file);
     /* Since we're doing a full compare make sure we fill the extended information */
     $song->fill_ext_info();
     if (Song::isCustomMetadataEnabled()) {
         $ctags = self::get_clean_metadata($song, $results);
         if (method_exists($song, 'updateOrInsertMetadata') && $song::isCustomMetadataEnabled()) {
             $ctags = array_diff_key($ctags, array_flip($song->getDisabledMetadataFields()));
             foreach ($ctags as $tag => $value) {
                 $field = $song->getField($tag);
                 $song->updateOrInsertMetadata($field, $value);
             }
         }
     }
     $info = Song::compare_song_information($song, $new_song);
     if ($info['change']) {
         debug_event('update', "{$song->file} : differences found, updating database", 5);
         // Duplicate arts if required
         if ($song->artist != $new_song->artist) {
             if (!Art::has_db($new_song->artist, 'artist')) {
                 Art::duplicate('artist', $song->artist, $new_song->artist);
             }
         }
         if ($song->albumartist != $new_song->albumartist) {
             if (!Art::has_db($new_song->albumartist, 'artist')) {
                 Art::duplicate('artist', $song->albumartist, $new_song->albumartist);
             }
         }
         if ($song->album != $new_song->album) {
             if (!Art::has_db($new_song->album, 'album')) {
                 Art::duplicate('album', $song->album, $new_song->album);
             }
         }
         $song->update_song($song->id, $new_song);
         if ($song->tags != $new_song->tags) {
             Tag::update_tag_list(implode(',', $new_song->tags), 'song', $song->id, true);
             self::updateAlbumTags($song);
             self::updateArtistTags($song);
         }
         // Refine our reference
         //$song = $new_song;
//.........这里部分代码省略.........
开发者ID:cheese1,项目名称:ampache,代码行数:101,代码来源:catalog.class.php


注:本文中的Tag::get_object_tags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。