
adam at RFXTechnologies
Mar 10, 2011, 8:07 AM
Post #4 of 4
(473 views)
Permalink
|
|
RE: Media->OutputChannels->Destinations->Servers->HostNames
[In reply to]
|
|
Bret, You hit the nail on the head. Here is my utility template, in case some other noob like myself comes along and needs help figuring it out. <%args> $media </%args> <%perl> my $media_uri; foreach my $destination (Bric::Dist::ServerType->list({ output_channel_id => $media->get_primary_oc->get_id, move_method => 'File System' })){ foreach my $server ($destination->get_servers){ $media_uri = $server->get_host_name; } } return $media_uri . lc($media->get_uri()); </%perl> This utility template will only return a FQDN when I have set up a File System type destination as a possible destination for an asset. Otherwise, it returns a relative URI for the asset. It is called using $m->comp("/get_destination_host_name.mc",media => $media); Thanks for the help, Adam > -----Original Message----- > From: Bret Dawson [mailto:bret [at] pectopah] > Sent: Wednesday, March 09, 2011 5:23 PM > To: users [at] lists > Subject: Re: Media->OutputChannels->Destinations->Servers->HostNames > > ...Although, if you were simply asking how to extract a list of possible > host names from a media asset, you can do it, just in a roundabout way. > > Bric::Dist::ServerType is the destination object. If you have the OCs of > your media objects, you can call ServerType->list and find the > destinations associated with those OCs. > > Then you can call $destination->get_servers, and on each of those, you > can can call $server->get_host_name. > > Hope this helps, > > Bret > > > > On Wed, 2011-03-09 at 17:09 -0500, Bret Dawson wrote: > > Hi Adam, > > > > Because you can have assets going to multiple places (for example, > you > > can send a single image file to 10 output channels, each with 10 > > destinations, each with 10 servers), this can get a little tangled. > > > > So far as I know, the only method for getting Bricolage itself to > > provide a fully-qualified URL is $burner->best_uri($asset), and that > > only happens when the asset in question is not in the current site. > > > > > > If you're splitting up your assets (for example, you're sending > images > > to one place and PDFs to another), and you want to map the media type > to > > a host, I don't think there's a way to do it directly. > > > > If you have different OC for each media type, you could make a > utility > > template that maps output channels to hosts, like this: > > > > > > my %where_things_live = ( > > 'Images' => 'images.mysite.com', > > 'PDF' => 'pdf.mysite.com', > > ); > > return $where_things_live{$media->get_primary_oc->get_name}; > > > > > > ...and then just call that anytime you want to make a URL for a media > > asset. > > > > > > Hope this helps, > > > > Bret > > > > > > > > > > > > > > On Wed, 2011-03-09 at 20:56 +0000, Adam Wilson wrote: > > > I want to know, in a template, what the possible hostnames would be > for a media object that I am publishing with a story. > > > > > > I can't seem to find a path to that information when I look in the > docs. Does anyone have any ideas? > > > > > > Thanx for the help, > > > Adam Wilson > > > > > > BTW - I am looking for this information so that I can separate my > website assets onto different servers and have the template write my > hrefs to point to those resources. If I can't do it this way, I will > create webserver redirects for the resources, but that seems an > unnecessary step if I can get Bricolage to do it for me. > > > > > > > -- > Bret Dawson > Producer > Pectopah Productions Inc. > (416) 895-7635 > bret [at] pectopah > www.pectopah.com
|