PDA

View Full Version : Re: [slim] New plugin for wma streaming on windows



Caleb Epstein
2003-12-03, 11:32
[Moved from discuss@]

On Wed, Dec 03, 2003 at 09:48:59AM -0800, dean blackketter wrote:

> Caleb, You are absolutely right and we should fix this. The tricky
> party is adding the code that supports the reading of meta
> information (ID3 tags, etc.) from the files. This is typically some
> new code for every file type. -dean

The basic stuff that needs to change to make this work,
AFAICT, is:

What about some code that would try and dynamically load a
the module Slim::Formats::$type; something like:

# Keep track of dynamic formats that have been loaded
if (not exists $DYNFORMATS{$type}) {
eval "use Slim::Formats::$type";
$DYNFORMATS{$type} = length $@ ? 0 : 1;
}

# If we successfully loaded a handler for this type, use it
if ($DYNFORMATS{$type}) {
$tempCacheEntry =
eval "Slim::Formats::$type::get_tags (\$filepath)";
}

This will require that the primary interface to
Slim::Formats::<whatever> is a method called "get_tags".

Having slimserver re-read convert.conf and types.conf on
SIGHUP would be nice too.

--
Caleb Epstein | bklyn . org |There are two ways of disliking poetry; one way
cae at | Brooklyn Dust |is to dislike it, the other is to read Pope.
bklyn dot org | Bunny Mfg. | -- Oscar Wilde

Dan Sully
2003-12-03, 11:46
* Caleb Epstein <cae (AT) bklyn (DOT) org> shaped the electrons to say...

> The basic stuff that needs to change to make this work,
> AFAICT, is:
>
> What about some code that would try and dynamically load a
> the module Slim::Formats::$type; something like:
>
> # Keep track of dynamic formats that have been loaded
> if (not exists $DYNFORMATS{$type}) {
> eval "use Slim::Formats::$type";
> $DYNFORMATS{$type} = length $@ ? 0 : 1;
> }
>
> # If we successfully loaded a handler for this type, use it
> if ($DYNFORMATS{$type}) {
> $tempCacheEntry =
> eval "Slim::Formats::$type::get_tags (\$filepath)";
> }
>
> This will require that the primary interface to
> Slim::Formats::<whatever> is a method called "get_tags".

I've been thinking of something along similar lines.

You might also consider using UNIVERSAL->can() to see if the format has a get_tags()

Also make sure that proper error handling is done if the eval() blows up.

Perhaps there should be some association between convert/types.conf where a Format module "registers" itself.

-D
--
<nil> It sucks to discover that you are the foremost authority on some set of things when you've got a problem.

Kevin Deane-Freeman
2003-12-03, 11:50
I'm just going to inject a thought I had mere moments ago on this issue. Why not
make the formats plugins? each type has a plugin of the same name. This way,
each type can be added just by installing a plugin with its own readTagmethod
and transcode methods.

I konw its a total rework, but it would split off pretty much all of the types
functions from the core code, leaving more freedom to develop paths from format
to format.

-kdf

Quoting Caleb Epstein <cae (AT) bklyn (DOT) org>:

>
> [Moved from discuss@]
>
> On Wed, Dec 03, 2003 at 09:48:59AM -0800, dean blackketter wrote:
>
> > Caleb, You are absolutely right and we should fix this. The tricky
> > party is adding the code that supports the reading of meta
> > information (ID3 tags, etc.) from the files. This is typically some
> > new code for every file type. -dean
>
> The basic stuff that needs to change to make this work,
> AFAICT, is:
>
> What about some code that would try and dynamically load a
> the module Slim::Formats::$type; something like:
>
> # Keep track of dynamic formats that have been loaded
> if (not exists $DYNFORMATS{$type}) {
> eval "use Slim::Formats::$type";
> $DYNFORMATS{$type} = length $@ ? 0 : 1;
> }
>
> # If we successfully loaded a handler for this type, use it
> if ($DYNFORMATS{$type}) {
> $tempCacheEntry =
> eval "Slim::Formats::$type::get_tags (\$filepath)";
> }
>
> This will require that the primary interface to
> Slim::Formats::<whatever> is a method called "get_tags".
>
> Having slimserver re-read convert.conf and types.conf on
> SIGHUP would be nice too.
>
> --
> Caleb Epstein | bklyn . org |There are two ways of disliking poetry; one
> way
> cae at | Brooklyn Dust |is to dislike it, the other is to read Pope.
> bklyn dot org | Bunny Mfg. | -- Oscar Wilde
>

dean
2003-12-03, 11:58
I'd like to make this work as a Plugin, but otherwise it sounds
reasonable.

On Dec 3, 2003, at 10:32 AM, Caleb Epstein wrote:

>
> [Moved from discuss@]
>
> On Wed, Dec 03, 2003 at 09:48:59AM -0800, dean blackketter wrote:
>
>> Caleb, You are absolutely right and we should fix this. The tricky
>> party is adding the code that supports the reading of meta
>> information (ID3 tags, etc.) from the files. This is typically some
>> new code for every file type. -dean
>
> The basic stuff that needs to change to make this work,
> AFAICT, is:
>
> What about some code that would try and dynamically load a
> the module Slim::Formats::$type; something like:
>
> # Keep track of dynamic formats that have been loaded
> if (not exists $DYNFORMATS{$type}) {
> eval "use Slim::Formats::$type";
> $DYNFORMATS{$type} = length $@ ? 0 : 1;
> }
>
> # If we successfully loaded a handler for this type, use it
> if ($DYNFORMATS{$type}) {
> $tempCacheEntry =
> eval "Slim::Formats::$type::get_tags (\$filepath)";
> }
>
> This will require that the primary interface to
> Slim::Formats::<whatever> is a method called "get_tags".
>
> Having slimserver re-read convert.conf and types.conf on
> SIGHUP would be nice too.
>
> --
> Caleb Epstein | bklyn . org |There are two ways of disliking poetry;
> one way
> cae at | Brooklyn Dust |is to dislike it, the other is to read
> Pope.
> bklyn dot org | Bunny Mfg. | -- Oscar Wilde
>

Kevin Deane-Freeman
2003-12-03, 12:15
Quoting dean blackketter <dean (AT) slimdevices (DOT) com>:

> I'd like to make this work as a Plugin, but otherwise it sounds
> reasonable.
Using a plugin would also get around any security concerns openong up
convert.conf to a settings page. Each coversion/file can provide hooks for
applicable settings only, such as bitrate for http streaming or selection of
valid clients list. The plugin can register its type with Info.pm to be
included in the searches.

-kdf


>
> On Dec 3, 2003, at 10:32 AM, Caleb Epstein wrote:
>
> >
> > [Moved from discuss@]
> >
> > On Wed, Dec 03, 2003 at 09:48:59AM -0800, dean blackketter wrote:
> >
> >> Caleb, You are absolutely right and we should fix this. The tricky
> >> party is adding the code that supports the reading of meta
> >> information (ID3 tags, etc.) from the files. This is typically some
> >> new code for every file type. -dean
> >
> > The basic stuff that needs to change to make this work,
> > AFAICT, is:
> >
> > What about some code that would try and dynamically load a
> > the module Slim::Formats::$type; something like:
> >
> > # Keep track of dynamic formats that have been loaded
> > if (not exists $DYNFORMATS{$type}) {
> > eval "use Slim::Formats::$type";
> > $DYNFORMATS{$type} = length $@ ? 0 : 1;
> > }
> >
> > # If we successfully loaded a handler for this type, use it
> > if ($DYNFORMATS{$type}) {
> > $tempCacheEntry =
> > eval "Slim::Formats::$type::get_tags (\$filepath)";
> > }
> >
> > This will require that the primary interface to
> > Slim::Formats::<whatever> is a method called "get_tags".
> >
> > Having slimserver re-read convert.conf and types.conf on
> > SIGHUP would be nice too.
> >
> > --
> > Caleb Epstein | bklyn . org |There are two ways of disliking poetry;
> > one way
> > cae at | Brooklyn Dust |is to dislike it, the other is to read
> > Pope.
> > bklyn dot org | Bunny Mfg. | -- Oscar Wilde
> >