SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-25-2006, 06:08 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Arrow STVI: CD player & Windows Media DRM tag parser/player

SageWMP is a Java plugin and STVI for using Windows Media audio files with SageTV. It is not a replacement for the Sage music library UI, but an add-on that lets you play back, using the standard UI, any audio format supported by Windows Media Player, including DRM-protected WMA files. You can also use it to play audio CDs directly from the CD drive, without having to rip them and import the tracks.

It does all this by using Windows Media Player's COM interface to read out media file properties and to play back the file. So to use this plugin you must have (a) an up-to-date version of Windows Media Player, and (b) valid licenses for any DRM content you want to play. No other external player apps are needed.

Note that neither visualization nor video playback is supported, just audio playback.

The latest version of SageWMP is version 1.4 intended for use with SageTV V6.1. Version 1.4 may also work to some degree with SageTV V6.0, but there are some known issues in the SageTV core that are fixed in 6.1.

I'm also leaving SageWMP version 1.3 available for users of SageTV V5, but don't expect much ongoing support for this version.
__________________
-- Greg

Last edited by GKusnick; 03-22-2007 at 05:27 PM.
Reply With Quote
  #2  
Old 04-25-2006, 07:26 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,301
Nice job Greg!

This is the FIRST plugin that uses the MediaFileMetadataImporter plugin to support extraction of metadata from a MediaFile without having the SageTV core support it. We didn't give out any info on it previously. But now it's available.

This is a great example of how to extend support in SageTV to support a new format; and of course a nice plugin in and of itself.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #3  
Old 04-25-2006, 07:31 PM
Deadbolt's Avatar
Deadbolt Deadbolt is offline
Sage Expert
 
Join Date: Nov 2003
Posts: 687
Quote:
Originally Posted by Narflex
Nice job Greg!

This is the FIRST plugin that uses the MediaFileMetadataImporter plugin to support extraction of metadata from a MediaFile without having the SageTV core support it. We didn't give out any info on it previously. But now it's available.

This is a great example of how to extend support in SageTV to support a new format; and of course a nice plugin in and of itself.
Wow, great plug in! Is there any way to use the same concept to allow Sage to play encrypted AAC iTunes files?
Reply With Quote
  #4  
Old 04-25-2006, 07:38 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I'm not an iTunes user myself, so I'm not familiar with the iTunes player software. But if there's a way to interface with the player programmatically to (a) extract metadata and (b) control playback, then something similar should be possible.
__________________
-- Greg
Reply With Quote
  #5  
Old 04-25-2006, 08:10 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,186
Quote:
Originally Posted by Narflex
Nice job Greg!
Dito!

Quote:
This is the FIRST plugin that uses the MediaFileMetadataImporter plugin to support extraction of metadata from a MediaFile without having the SageTV core support it. We didn't give out any info on it previously. But now it's available.
Jeff, were did I miss this? Does it work for formats SageTV supports (like video files) or does it require an associated mediaplayer plugin?

Oh, and Greg, if you don't mind me asking, how did you generate the com wrapper?

Last edited by stanger89; 04-25-2006 at 08:14 PM.
Reply With Quote
  #6  
Old 04-25-2006, 08:25 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
The parser and player interfaces are separate. So you can implement a custom parser for a format that's supported natively, and Sage will use it in preference to the built-in parser, while still using the native player. (Or vice versa.)

If you have more than one custom parser class, separate them with semicolons like so:

mediafile_metadata_parser_plugins=Package1.Parser1;Package2.Parser2;...

For each file to be parsed, Sage will go down the list, trying each parser in turn until it finds one that returns a valid Airing from Parser.extractMetadata. So if you don't want to handle a particular format in your parser, just return null for that file and Sage will fall through to the next parser in the list (or the default parser if it falls off the end of the list).

Take a look at my source code (included in the zip) for a working example of all this.

Quote:
Oh, and Greg, if you don't mind me asking, how did you generate the com wrapper?
JacobGen is supposed to be able to generate wrappers automatically from COM typelibs, but I never got it to work right. What I did instead was to use OleView to export the WMP typelib to an IDL file, then I wrote some VBScript code to parse through the IDL and spit out Java wrappers for all the interface methods. (That seemed simpler -- or at least more fun -- than wrapping each method by hand.)
__________________
-- Greg
Reply With Quote
  #7  
Old 04-25-2006, 08:45 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
OK, well I'm embarrassed to admit I've already found a bug in which I had hard-coded the string "SageTVClient.exe" instead of checking to see whether I was running on the server. I've now uploaded a fix for that, so the six of you who downloaded it so far might want to download again.
__________________
-- Greg
Reply With Quote
  #8  
Old 04-25-2006, 08:56 PM
sleonard's Avatar
sleonard sleonard is offline
Sage Icon
 
Join Date: Nov 2003
Posts: 1,506
Wonderful job, Greg. I've been waiting for the tag parser since Sage added playback support for WMA. I am all over this tonight!

How would one access your parser from Studio in order to create an import that reads and displays tags using your parser? I've only worked through about 1/3 of the Studio tutorial before life got too busy and I quit but for this import I'll jump back in.

Also, my server is not used for playback at all, just clients. I assume then that I only need to import this on the clients, correct?

Scott
Reply With Quote
  #9  
Old 04-25-2006, 09:14 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
The tag parser executes on the server during media import. So if you want your DRM files indexed properly, you need to install this on the server and re-import. (Although you don't necessarily need to hook up the media_player_plugin_class property on the server if you don't plan on using it for playback.)

The only time the tag parser executes on the client is if you Browse Media Files and choose one that's not already in the library.

As for the Studio question, the STV doesn't interact directly with the plugin. Rather, once all your files have been re-imported using the plugin, you would then use the AlbumAPI to access the media library just as you would using the default tag parser.
__________________
-- Greg
Reply With Quote
  #10  
Old 04-26-2006, 12:43 AM
sleonard's Avatar
sleonard sleonard is offline
Sage Icon
 
Join Date: Nov 2003
Posts: 1,506
OK, then how would one access the tags that AlbumAPI does not support yet are in the files and readable by your parser. Tags such as Album Artist (vs. Artist), Composer, Label, etc.? I need to display these tags in the Sage UI as well as sort on some of them.

Scott
Reply With Quote
  #11  
Old 04-26-2006, 05:52 AM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Great job, Greg !

Would something similar be possible for FLAC files ?


Dirk
Reply With Quote
  #12  
Old 04-26-2006, 11:21 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by sleonard
OK, then how would one access the tags that AlbumAPI does not support yet are in the files and readable by your parser. Tags such as Album Artist (vs. Artist), Composer, Label, etc.? I need to display these tags in the Sage UI as well as sort on some of them.
With this parser, GetAlbumArtist() should return the AlbumArtist if that tag is present; otherwise, it uses the Artist tag as a fallback.

What I could do (but haven't done yet) is provide a SageWMP_Parser_GetTags(file) API that would return a Map containing name/value pairs for all the defined tags in a file. Then you could do what you like with that. However since Sage is not caching that info anywhere in its database, there might be performance issues with reparsing the files every time you fire up Sage.

Another option is to pull info from the Windows Media Player database. This contains a copy of all the tag data from all the files WMP knows about, all in one place, so doing it this way might be more efficient than the previous option. The downside here is that you have to make sure your WMP DB is in sync with your Sage media library.

I'll take a look at including one or both of these options in the next release.
__________________
-- Greg
Reply With Quote
  #13  
Old 04-26-2006, 11:38 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by flachbar
Would something similar be possible for FLAC files ?
I'm not a FLAC wizard by any stretch, but a quick browse of the FLAC download page seems to indicate that there are plugins available for WMP to allow it to work with FLAC files. If you can get that to work, then you should be able to get SageWMP working as well by adding the following line to your Sage.properties (in addition to the above install instructions):

media_player_plugin_class/flac=SageWMP.Player

(This will automatically enable SageWMP.Parser for .flac files as well.)

Let me know how it goes.
__________________
-- Greg
Reply With Quote
  #14  
Old 04-26-2006, 11:45 AM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by GKusnick
I'm not a FLAC wizard by any stretch, but a quick browse of the FLAC download page seems to indicate that there are plugins available for WMP to allow it to work with FLAC files. If you can get that to work, then you should be able to get SageWMP working as well by adding the following line to your Sage.properties (in addition to the above install instructions):

media_player_plugin_class/flac=SageWMP.Player

(This will automatically enable SageWMP.Parser for .flac files as well.)

Let me know how it goes.
Cool, I will give this a try !
Thanks !!

One more question: I assume that there is no way to use your plugin class only for importing, but not for playback ?

Dirk
Reply With Quote
  #15  
Old 04-26-2006, 11:57 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by flachbar
One more question: I assume that there is no way to use your plugin class only for importing, but not for playback ?
As currently coded, that's correct. Although the tag parser and the media player are separate classes, they currently use the same media_player_plugin_class properties to decide which file types to handle. However it's literally a one-line change to decouple that, if you have a Java compiler and want to tinker with the source.

For the next release, I could add an optional SageWMP/parser/tags property to control tag parsing separately from playback.
__________________
-- Greg
Reply With Quote
  #16  
Old 04-26-2006, 12:03 PM
sleonard's Avatar
sleonard sleonard is offline
Sage Icon
 
Join Date: Nov 2003
Posts: 1,506
I have not tried any of the FLAC plugins for WMP in months but back then they did not enable WMP to read (or write) the tags in FLAC files. Only play them. I gave up and converted everything to WMA lossless.

As far as the AlbumArtist and Artist tags go in WM files go, I really need the ability to display both in a Sage screen. If you are correct and your parser returns the AlbumArtist tag instead of the Artist tag (if both are present) then I'm halfway there. Sages parser only returns the Artist tag and never the AlbumArtist tag so my library in Sage gets scrambled to the point of uselessness.

It still sounds to me like Sage needs to update the core AlbumAPI to support more tags in Studio created menu screens. In the meantime, option 2 to pull the metadata from the WMP database sounds like the better option to me.
Reply With Quote
  #17  
Old 04-26-2006, 12:06 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by GKusnick
As currently coded, that's correct. Although the tag parser and the media player are separate classes, they currently use the same media_player_plugin_class properties to decide which file types to handle. However it's literally a one-line change to decouple that, if you have a Java compiler and want to tinker with the source.

For the next release, I could add an optional SageWMP/parser/tags property to control tag parsing separately from playback.
Great, didn't notice that the source is included in the download
I'll play around with it and let you know ...

Thanks,
Dirk
Reply With Quote
  #18  
Old 04-26-2006, 12:19 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by sleonard
It still sounds to me like Sage needs to update the core AlbumAPI to support more tags in Studio created menu screens. In the meantime, option 2 to pull the metadata from the WMP database sounds like the better option to me.
Bear in mind that the AlbumAPI isn't the whole story. From the AlbumAPI you can get Airings representing the tracks, and from Airings you can get Shows, which gives you access to GetPeopleInShow, GetPeopleInShowRoles, etc. So that's another way to pass through additional tag info from the parser to the STV, if we can agree on which roles should correspond to which tags. Plus there's always GetShowMisc().
__________________
-- Greg
Reply With Quote
  #19  
Old 04-26-2006, 02:47 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,301
This is on the list to update in the core. We'll be adding an Album Artist role type so you can independently specify the Song Artist vs. the Album Artist. More info will be available when it's out. An FYI for any planning you're doing.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #20  
Old 04-27-2006, 01:00 AM
sleonard's Avatar
sleonard sleonard is offline
Sage Icon
 
Join Date: Nov 2003
Posts: 1,506
Quote:
Originally Posted by Narflex
This is on the list to update in the core. We'll be adding an Album Artist role type so you can independently specify the Song Artist vs. the Album Artist. More info will be available when it's out. An FYI for any planning you're doing.

Sweet! Thanks a lot for the heads up. I'm sure you have more than this planned but just in case I would suggest supporting as many tag types as possible. I personally use:

Track #
Track (Name)
Album Artist
Artist
Composer
Conductor
Album
Genre
Label
Date Released

Another thing I have noticed Sage getting confused by is when there is more than one artist listed such as "Al Kooper; Johnny Winter; Michael Bloomfield". Some songs from the album get listed under Various in Sage while others like this get listed under only the first artist listed. The album is often listed multiple times under different artists but each listing for that album shows only the song(s) by that artist.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.