Hi Craig,
DISCLAIMER: I don't work with CONTENTdm, so everything I'm telling you is
being pulled out of my hat.
Eyeballing your specific examples, it appears that the
cdm-applnxprd1.library.ubc.ca is locally hosted -- in which case it
wouldn't follow the pattern you seek. As such, it appears the most reliable
way to do it would be to do a regex match that treats OCLC and locally
hosted installations differently.
Having said that, in your examples, the first cname entry appears to be
what you need. If that pattern holds, something along the lines of:
nslookup digitalcollections.library.ubc.ca |tr '\n' ' ' | grep -o
"canonical name = [^ ]\+" |head -1 |sed 's/canonical name = //'|sed 's/\(
\|\.$\)//'
will grab the first canonical name, though I'm sure there's a more elegant
way to do it. HTH
kyle
On Tue, Jul 3, 2018 at 12:56 PM, Craig Dietrich <[log in to unmask]>
wrote:
> Hi Kyle,
>
> Thanks for your quick reply!
>
> That worked! When I run a nslookup for "digitalcollections.library.ubc.ca
> "
> it returns "cdm-applnxprd1.library.ubc.ca" that, while it doesn't follow
> the "server12345" pattern, does return results when I append API fields:
>
> http://cdm-applnxprd1.library.ubc.ca/dmwebservices/index.
> php?q=dmQuery/all/title^%20Victoria%20Cruz%20and%20Maxwell%20Maxwell%20at%
> 20the%20CiTR%20booth%20at%20Clubs%20Days^all^and/title!
> subjec!descri!thumb/nosort/10/1/1/0/0/0/xml
>
> Like all things CONTENTdm I'll need to code around a few things, for
> example, doing a nslookup for "digitalcollections.lib.washington.edu"
> returns a couple URLs including "cdml02.contentdm.oclc.org" which doesn't
> return results when similarly adding API fields. However, for the
> Washington site I'm able to get a working URL from their HTML. So I
> suppose a combination of those things will work sufficiently. Thanks
> again!
>
> Re the why: I'm a Scalar co-creator and have spun Scalar's import system
> (whereby authors can import content into their projects from various
> digital archives) into its own application, Tensor. Architected from the
> ground up Tensor can do many more things than Scalar's antiquated import
> system can do, including linking to archives that have complex or
> multi-dimensional APIs. All that's needed is a parser file then one can
> use Tensor to move content in Scalar, and actually my goal is for Tensor to
> not only hook into many archives but also many publishing systems, not just
> Scalar.
>
> Here is a list of the parsers I've already created:
> https://github.com/craigdietrich/tensor-profiles/tree/master/parsers
>
> Once a parser is created, any archive that uses that platform can be
> accessed.
>
> I've attached a couple screengrabs, not sure if they'll come through the
> list server but provides a general sense of Tensor, hopefully.
>
> All the best,
> Craig
>
> On Tue, Jul 3, 2018 at 10:48 AM Kyle Banerjee <[log in to unmask]>
> wrote:
>
> > Hi Craig,
> >
> > Have you tried using nslookup? That should return the CNAME entry
> > containing what you seek.
> >
> > Also, curiosity is killing me as to why knowing server numbers for
> machines
> > you don't control would be useful.
> >
> > kyle
> >
> > On Tue, Jul 3, 2018 at 10:17 AM, Craig Dietrich <[log in to unmask]
> >
> > wrote:
> >
> > > Hi all,
> > >
> > > This has been driving me crazy and OCLC hasn't written me back: is
> there
> > a
> > > trustworthy way to get the server ID# from CONTENTdm?
> > >
> > > I've been relying on
> > >
> > > '//'.$hostname.'/utils/diagnostics'
> > >
> > > ... which under some cases returns this string:
> > >
> > > server12345.contentdm.oclc.org
> > >
> > > ... with 12345 in this case being the server ID#.
> > >
> > > But for many CONTENTdm sites this string isn't present.
> > >
> > > The home page HTML for CONTENTdm has a lot of useful info in it, but
> not
> > > the ID# that I can find.
> > >
> > > Anyone had any luck?
> > >
> > > Thanks!
> > > Craig
> > >
> >
>
|