public function format($details = true) { $this->f_name = $this->name; $this->f_link = '<a href="' . AmpConfig::get('web_path') . '/broadcast.php?id=' . $this->id . '">' . scrub_out($this->f_name) . '</a>'; if ($details) { $this->tags = Tag::get_top_tags('broadcast', $this->id); $this->f_tags = Tag::get_display($this->tags, true, 'broadcast'); } }
<td class="edit_dialog_content_header"><?php echo T_('MusicBrainz ID'); ?> </td> <td><input type="text" name="mbid" value="<?php echo $artist->mbid; ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Tags'); ?> </td> <td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($artist->tags); ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"></td> <td><input type="checkbox" name="apply_childs" value="checked" /><?php echo T_(' Apply tags to all childs (override tags for albums and songs)'); ?> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $artist->id; ?> " />
/** * format * this function takes an array of artist * information and reformats the relevent values * so they can be displayed in a table for example * it changes the title into a full link. */ public function format() { /* Combine prefix and name, trim then add ... if needed */ $name = trim($this->prefix . " " . $this->name); $this->f_name = $name; $this->f_full_name = trim(trim($this->prefix) . ' ' . trim($this->name)); // If this is a fake object, we're done here if ($this->_fake) { return true; } if ($this->catalog_id) { $this->f_link = AmpConfig::get('web_path') . '/artists.php?action=show&catalog=' . $this->catalog_id . '&artist=' . $this->id; $this->f_name_link = "<a href=\"" . $this->f_link . "\" title=\"" . $this->f_full_name . "\">" . $name . "</a>"; } else { $this->f_link = AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $this->id; $this->f_name_link = "<a href=\"" . $this->f_link . "\" title=\"" . $this->f_full_name . "\">" . $name . "</a>"; } // Get the counts $extra_info = $this->_get_extra_info($this->catalog_id); //Format the new time thingy that we just got $min = sprintf("%02d", floor($extra_info['time'] / 60) % 60); $sec = sprintf("%02d", $extra_info['time'] % 60); $hours = floor($extra_info['time'] / 3600); $this->f_time = ltrim($hours . ':' . $min . ':' . $sec, '0:'); $this->tags = Tag::get_top_tags('artist', $this->id); $this->f_tags = Tag::get_display($this->tags); $this->object_cnt = $extra_info['object_cnt']; return true; }
" /></td> </tr> <tr> <td class="edit_dialog_content_header"></td> <td><input type="checkbox" name="private" value="1" <?php echo $broadcast->is_private ? 'checked' : ''; ?> /> <?php echo T_('Authentication Required'); ?> </td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Genre'); ?> </td> <td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($broadcast->tags); ?> " /></td> </tr> </table> <input type="hidden" name="id" value="<?php echo $broadcast->id; ?> " /> <input type="hidden" name="type" value="broadcast_row" /> </form> </div>
public function format($details = true) { if ($details) { $this->tags = Tag::get_top_tags('channel', $this->id); $this->f_tags = Tag::get_display($this->tags, true, 'channel'); } }
/** * format * This takes the current song object * and does a ton of formating on it creating f_??? variables on the current * object */ public function format() { $this->fill_ext_info(); // Format the filename preg_match("/^.*\\/(.*?)\$/", $this->file, $short); if (is_array($short) && isset($short[1])) { $this->f_file = htmlspecialchars($short[1]); } // Format the album name $this->f_album_full = $this->get_album_name(); $this->f_album = $this->f_album_full; // Format the artist name $this->f_artist_full = $this->get_artist_name(); $this->f_artist = $this->f_artist_full; // Format the title $this->f_title_full = $this->title; $this->f_title = $this->title; // Create Links for the different objects $this->link = AmpConfig::get('web_path') . "/song.php?action=show_song&song_id=" . $this->id; $this->f_link = "<a href=\"" . scrub_out($this->link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->title) . "\"> " . scrub_out($this->f_title) . "</a>"; $this->f_album_link = "<a href=\"" . AmpConfig::get('web_path') . "/albums.php?action=show&album=" . $this->album . "\" title=\"" . scrub_out($this->f_album_full) . "\"> " . scrub_out($this->f_album) . "</a>"; $this->f_artist_link = "<a href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $this->artist . "\" title=\"" . scrub_out($this->f_artist_full) . "\"> " . scrub_out($this->f_artist) . "</a>"; // Format the Bitrate $this->f_bitrate = intval($this->bitrate / 1000) . "-" . strtoupper($this->mode); // Format the Time $min = floor($this->time / 60); $sec = sprintf("%02d", $this->time % 60); $this->f_time = $min . ":" . $sec; // Format the track (there isn't really anything to do here) $this->f_track = $this->track; // Get the top tags $this->tags = Tag::get_top_tags('song', $this->id); $this->f_tags = Tag::get_display($this->tags); // Format the size $this->f_size = UI::format_bytes($this->size); $this->f_lyrics = "<a title=\"" . scrub_out($this->title) . "\" href=\"" . AmpConfig::get('web_path') . "/song.php?action=show_lyrics&song_id=" . $this->id . "\">" . T_('Show Lyrics') . "</a>"; return true; }
* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /** * Sub-Ajax page, requires AJAX_INCLUDE */ if (!defined('AJAX_INCLUDE')) { exit; } $results = array(); switch ($_REQUEST['action']) { case 'show_add_tag': break; case 'get_tag_map': $tags = Tag::get_display(Tag::get_tags()); $results['tags'] = $tags; break; case 'get_labels': $labels = Label::get_display(Label::get_all_labels()); $results['labels'] = $labels; break; case 'add_tag': debug_event('tag.ajax', 'Adding new tag...', '5'); Tag::add_tag_map($_GET['type'], $_GET['object_id'], $_GET['tag_id']); break; case 'add_tag_by_name': debug_event('tag.ajax', 'Adding new tag by name...', '5'); Tag::add($_GET['type'], $_GET['object_id'], $_GET['tag_name'], false); break; case 'delete':
<tr> <td class="edit_dialog_content_header"><?php echo T_('MusicBrainz ID'); ?> </td> <td><input type="text" name="mbid" value="<?php echo $song->mbid; ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Tags'); ?> </td> <td> <input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($song->tags); ?> " /> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $song->id; ?> " /> <input type="hidden" name="type" value="song_row" /> </form> </div>
echo T_('MusicBrainz ID'); ?> </td> <td><input type="text" name="mbid" value="<?php echo $album->mbid; ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Tags'); ?> </td> <td> <input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($album->tags); ?> " /> </td> </tr> <tr> <td class="edit_dialog_content_header"></td> <td><input type="checkbox" name="apply_childs" value="checked" /><?php echo T_(' Apply tags to all childs (override tags for songs)'); ?> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $album->id; ?>
private static function _itemVideo($video, $parent) { $api_session = AmpConfig::get('require_session') ? Stream::get_session() : false; $art_url = Art::url($video->id, 'video', $api_session); $fileTypesByExt = self::_getFileTypes(); $arrFileType = $fileTypesByExt[$video->type]; return array('id' => $parent . '/' . $video->id, 'parentID' => $parent, 'restricted' => '1', 'dc:title' => self::_replaceSpecialSymbols($video->f_title), 'upnp:class' => isset($arrFileType['class']) ? $arrFileType['class'] : 'object.item.unknownItem', 'upnp:albumArtURI' => $art_url, 'upnp:genre' => Tag::get_display($video->tags, false, 'video'), 'res' => Video::play_url($video->id, '', 'api'), 'protocolInfo' => $arrFileType['mime'], 'size' => $video->size, 'duration' => $video->f_time_h . '.0'); }
private static function tlv_songs($songs, $meta) { if (array_search('all', $meta) > -1) { $meta = self::$metas; } $lo = ''; foreach ($songs as $song) { $song->format(); $o = self::tlv('dmap.itemkind', 2); $o .= self::tlv('dmap.itemid', $song->id); foreach ($meta as $m) { switch ($m) { case 'dmap.itemname': $o .= self::tlv($m, $song->f_title); break; case 'dmap.containeritemid': /* case 'dmap.persistentid': */ $o .= self::tlv($m, $song->id); break; case 'daap.songalbum': $o .= self::tlv($m, $song->f_album); break; case 'daap.songartist': $o .= self::tlv($m, $song->f_artist); break; case 'daap.songbitrate': $o .= self::tlv($m, intval($song->bitrate / 1000)); break; case 'daap.songcomment': $o .= self::tlv($m, $song->comment); break; case 'daap.songdateadded': $o .= self::tlv($m, $song->addition_time); break; case 'daap.songdatemodified': if ($song->update_time) { $o .= self::tlv($m, $song->update_time); } break; case 'daap.songdiscnumber': $album = new Album($song->album); $o .= self::tlv($m, $album->disk); break; case 'daap.songformat': $o .= self::tlv($m, $song->type); break; case 'daap.songgenre': $o .= self::tlv($m, Tag::get_display($song->tags, false, 'song')); break; case 'daap.songsamplerate': $o .= self::tlv($m, $song->rate); break; case 'daap.songsize': $o .= self::tlv($m, $song->size); break; case 'daap.songtime': $o .= self::tlv($m, $song->time * 1000); break; case 'daap.songtracknumber': $o .= self::tlv($m, $song->track); break; case 'daap.songuserrating': $rating = new Rating($song->id, "song"); $rating_value = $rating->get_average_rating(); $o .= self::tlv($m, $rating_value); break; case 'daap.songyear': $o .= self::tlv($m, $song->year); break; } } $lo .= self::tlv('dmap.listingitem', $o); } return $lo; }
public function format() { $this->tags = Tag::get_top_tags('channel', $this->id); $this->f_tags = Tag::get_display($this->tags); }
/** * format * This formats a video object so that it is human readable */ public function format($details = true) { $this->f_title = scrub_out($this->title); $this->f_full_title = $this->f_title; $this->link = AmpConfig::get('web_path') . "/video.php?action=show_video&video_id=" . $this->id; $this->f_link = "<a href=\"" . $this->link . "\" title=\"" . scrub_out($this->f_title) . "\"> " . scrub_out($this->f_title) . "</a>"; $this->f_codec = $this->video_codec . ' / ' . $this->audio_codec; if ($this->resolution_x || $this->resolution_y) { $this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y; } if ($this->display_x || $this->display_y) { $this->f_display = $this->display_x . 'x' . $this->display_y; } // Format the Bitrate $this->f_bitrate = intval($this->bitrate / 1000) . "-" . strtoupper($this->mode); $this->f_video_bitrate = (string) intval($this->video_bitrate / 1000); if ($this->frame_rate) { $this->f_frame_rate = $this->frame_rate . ' fps'; } // Format the Time $min = floor($this->time / 60); $sec = sprintf("%02d", $this->time % 60); $this->f_time = $min . ":" . $sec; $hour = sprintf("%02d", floor($min / 60)); $min_h = sprintf("%02d", $min % 60); $this->f_time_h = $hour . ":" . $min_h . ":" . $sec; if ($details) { // Get the top tags $this->tags = Tag::get_top_tags('video', $this->id); $this->f_tags = Tag::get_display($this->tags, true, 'video'); } $this->f_length = floor($this->time / 60) . ' ' . T_('minutes'); $this->f_file = $this->f_title . '.' . $this->type; if ($this->release_date) { $this->f_release_date = date('Y-m-d', $this->release_date); } }
/** * format * This takes the current song object * and does a ton of formating on it creating f_??? variables on the current * object */ public function format($details = true) { if ($details) { $this->fill_ext_info(); // Get the top tags $this->tags = Tag::get_top_tags('song', $this->id); $this->f_tags = Tag::get_display($this->tags, true, 'song'); } // Format the album name $this->f_album_full = $this->get_album_name(); $this->f_album = $this->f_album_full; // Format the artist name $this->f_artist_full = $this->get_artist_name(); $this->f_artist = $this->f_artist_full; // Format the album_artist name $this->f_albumartist_full = $this->get_album_artist_name(); // Format the title $this->f_title_full = $this->title; $this->f_title = $this->title; // Create Links for the different objects $this->link = AmpConfig::get('web_path') . "/song.php?action=show_song&song_id=" . $this->id; $this->f_link = "<a href=\"" . scrub_out($this->link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->title) . "\"> " . scrub_out($this->f_title) . "</a>"; $this->f_album_link = "<a href=\"" . AmpConfig::get('web_path') . "/albums.php?action=show&album=" . $this->album . "\" title=\"" . scrub_out($this->f_album_full) . "\"> " . scrub_out($this->f_album) . "</a>"; $this->f_artist_link = "<a href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $this->artist . "\" title=\"" . scrub_out($this->f_artist_full) . "\"> " . scrub_out($this->f_artist) . "</a>"; if (!empty($this->albumartist)) { $this->f_albumartist_link = "<a href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $this->albumartist . "\" title=\"" . scrub_out($this->f_albumartist_full) . "\"> " . scrub_out($this->f_albumartist_full) . "</a>"; } // Format the Bitrate $this->f_bitrate = intval($this->bitrate / 1000) . "-" . strtoupper($this->mode); // Format the Time $min = floor($this->time / 60); $sec = sprintf("%02d", $this->time % 60); $this->f_time = $min . ":" . $sec; $hour = sprintf("%02d", floor($min / 60)); $min_h = sprintf("%02d", $min % 60); $this->f_time_h = $hour . ":" . $min_h . ":" . $sec; // Format the track (there isn't really anything to do here) $this->f_track = (string) $this->track; // Format the size $this->f_size = UI::format_bytes($this->size); $this->f_lyrics = "<a title=\"" . scrub_out($this->title) . "\" href=\"" . AmpConfig::get('web_path') . "/song.php?action=show_lyrics&song_id=" . $this->id . "\">" . T_('Show Lyrics') . "</a>"; $this->f_file = $this->f_artist . ' - '; if ($this->track) { $this->f_file .= $this->track . ' - '; } $this->f_file .= $this->f_title . '.' . $this->type; $this->f_publisher = $this->label; $this->f_composer = $this->composer; }
/** * format * this function takes the object and reformats some values */ public function format($details = true) { $this->f_name = trim($this->prefix . " " . $this->name); $this->link = AmpConfig::get('web_path') . '/tvshows.php?action=show&tvshow=' . $this->id; $this->f_link = '<a href="' . $this->link . '" title="' . $this->f_name . '">' . $this->f_name . '</a>'; if ($details) { $this->_get_extra_info(); $this->tags = Tag::get_top_tags('tvshow', $this->id); $this->f_tags = Tag::get_display($this->tags, true, 'tvshow'); } return true; }
/** * format * This is the format function for this object. It sets cleaned up * album information with the base required * f_link, f_name */ public function format() { $web_path = AmpConfig::get('web_path'); /* Pull the advanced information */ $data = $this->_get_extra_info(); foreach ($data as $key => $value) { $this->{$key} = $value; } /* Truncate the string if it's to long */ $this->f_name = $this->full_name; $this->f_link_src = $web_path . '/albums.php?action=show&album=' . scrub_out($this->id); $this->f_name_link = "<a href=\"" . $this->f_link_src . "\" title=\"" . scrub_out($this->full_name) . "\">" . scrub_out($this->f_name); // Looking if we need to combine or display disks if ($this->disk && (!$this->allow_group_disks || $this->allow_group_disks && !AmpConfig::get('album_group'))) { $this->f_name_link .= " <span class=\"discnb\">[" . T_('Disk') . " " . $this->disk . "]</span>"; } $this->f_name_link .= "</a>"; $this->f_link = $this->f_name_link; $this->f_title = $this->full_name; if ($this->artist_count == '1') { $artist = trim(trim($this->artist_prefix) . ' ' . trim($this->artist_name)); $this->f_artist_name = $artist; $this->f_artist_link = "<a href=\"{$web_path}/artists.php?action=show&artist=" . $this->artist_id . "\" title=\"" . scrub_out($this->artist_name) . "\">" . $artist . "</a>"; $this->f_artist = $artist; } else { $this->f_artist_link = "<span title=\"{$this->artist_count} " . T_('Artists') . "\">" . T_('Various') . "</span>"; $this->f_artist = T_('Various'); $this->f_artist_name = $this->f_artist; } if ($this->year == '0') { $this->year = "N/A"; } $this->tags = Tag::get_top_tags('album', $this->id); $this->f_tags = Tag::get_display($this->tags); }
" /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Bitrate'); ?> </td> <td><input type="text" name="bitrate" value="<?php echo scrub_out($libitem->bitrate); ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Genre'); ?> </td> <td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($libitem->tags); ?> " /></td> </tr> </table> <input type="hidden" name="id" value="<?php echo $libitem->id; ?> " /> <input type="hidden" name="type" value="channel_row" /> </form> </div>
" /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Bitrate'); ?> </td> <td><input type="text" name="bitrate" value="<?php echo scrub_out($channel->bitrate); ?> " /></td> </tr> <tr> <td class="edit_dialog_content_header"><?php echo T_('Genre'); ?> </td> <td><input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($channel->tags); ?> " /></td> </tr> </table> <input type="hidden" name="id" value="<?php echo $channel->id; ?> " /> <input type="hidden" name="type" value="channel_row" /> </form> </div>