INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album  (Read 14036 times)

sraymond

  • Guest
XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« on: October 07, 2003, 10:16:15 am »

I wonder if this name is already taken?

Anyway, I've done some more work on the XSLT that transforms an MPL into HTML.  Here's a screenshot:


You can download Version 0.2 of the XSLT (and a graphics folder) from http://pages.sbcglobal.net/scottraymond/AlbumGroup.zip.

I've added some features:
1)  Alternate highlighting of the song rows.
2)  Check to see if there's Cover Art - if not, insert a defaul NoCoverArt image.
3)  Internal "styles" (which I'll move to an external document next time around).
4)  Use of XSLT variables for a much easier customization.  Here's a description of them:
Quote
     <!-- Define Album Sort Fields -->
      <xsl:variable name="AlbumSort1">Artist</xsl:variable>
      <xsl:variable name="AlbumSort2">Album</xsl:variable>
      <xsl:variable name="AlbumSort3"></xsl:variable>
      <!-- Define AlbumDetails Columns -->
      <xsl:variable name="AlbumDetailsColumn1">Artist</xsl:variable>
      <xsl:variable name="AlbumDetailsColumn2">Album</xsl:variable>
      <xsl:variable name="AlbumDetailsColumn3">Year</xsl:variable>
      <xsl:variable name="AlbumDetailsColumn4">Genre</xsl:variable>
      <!-- Define SongDetails Columns -->
      <xsl:variable name="SongDetailsColumn1">Track #</xsl:variable>
      <xsl:variable name="SongDetailsColumn2">Name</xsl:variable>
      <xsl:variable name="SongDetailsColumn3">Duration</xsl:variable>
      <xsl:variable name="SongDetailsColumn4">Bitrate</xsl:variable>
      <xsl:variable name="SongDetailsColumn5">Rating</xsl:variable>
      <!-- Define Song Sort Fields -->
      <xsl:variable name="SongSort1">Track #</xsl:variable>
      <xsl:variable name="SongSort2"></xsl:variable>
      <xsl:variable name="SongSort3"></xsl:variable>
The names should explain what they do.  Just replace the element content and away you go.  The only caveat is the sort:  the "data-type" is still down in the XSLT.  SongSort1 is currently a "number" and the rest text.

As a reminder, to use this XSLT, do the following:
Quote
If you want to see what it looks like for real:
1.  "Export Playlist" as an MPL and save to a directory.  Let's say you call it "Audio.xml".
2.  Download the XSLT http://pages.sbcglobal.net/scottraymond/AlbumGroup.zip.  Extract it to a directory (preferably where the "Audio.xml" is.
3.  In the "Audio.xml" file, add the line "<?xml-stylesheet type="text/xsl" href="C:\Program Files\J River\Media Center\XMLDevelopment\AlbumGroup.xsl"?>" right after the first line (which is "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>").  Make sure the path matches where you saved the "AlbumGroup.xsl" - or if they're in the same directory, you don't need the path.
 
Now just open "Audio.xml" with IE.  The transformation will be applied automatically.

Next up:
1)  Put the syles in an external document
2)  Think about hiding content - maybe each song list or a lyrics field.
3)  Add a variable for "data-type".
4)  Figure out why you can't save the resulting HTML from within IE.
5)  Anything else reasonable that someone asks for.

Scott-
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: AlbumViewer
« Reply #1 on: October 07, 2003, 11:19:10 am »

Quote
I wonder if this name is already taken?


Well there is my AlbumView plugin.
Logged

sraymond

  • Guest
Re: AlbumViewer
« Reply #2 on: October 07, 2003, 12:04:22 pm »

Yikes...  that's awful close.  I took a look at your plug-in:  it's quite extensive and impressive.

Being as the name is so similar, you're not interested in writing the back-end to perform the MPL export, apply the XSLT and pass any variables, are you?  It would certainly facilitate the "TM" problem, eh?

Scott-
Logged

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re: AlbumViewer
« Reply #3 on: October 07, 2003, 02:44:43 pm »

Scott,

The XSLT is fantastic but for one issue.  All of my cover art is a folder.jpg file stored in the album folder.  Because MC only exports the image file name "folder.jpg" minus the path I get a red cross for the image.  I looked the XSLT and thought ah well o problem I can just add the file path in front of the image file name but MC does not export calculated fields so only the complete filename path is exported...

Any ideas?

Adam

UPDATE:
Also the date is not being shown for my files.  They have a date in MC and it has been exported however it appears as an odd number in the MPL rather than as a date...Don't know if the export to XML option would actually convert the dates first??

Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re: AlbumViewer
« Reply #4 on: October 07, 2003, 02:56:55 pm »

Ive realised the problem...for both issues.
MPL export only exports the normal fields not the calculated fields meaning no date(year) and no image path.  XML export exports the calculated fields but does not allow a selective output.  Consequently we are back to being scuppered again ;D  Either we need selective XML export or we need MPL export to output all fields...

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

sraymond

  • Guest
Re: AlbumViewer
« Reply #5 on: October 07, 2003, 03:00:19 pm »

Adam,

Quote
All of my cover art is a folder.jpg file stored in the album folder.  Because MC only exports the image file name "folder.jpg" minus the path I get a red cross for the image.  I looked the XSLT and thought ah well o problem I can just add the file path in front of the image file name but MC does not export calculated fields so only the complete filename path is exported...


So you're saying that each album cover art is called "folder.jpg" and resides in a separate folder (depending on the album)?  And the "Image File" <Field> doesn't point to the right file?  Is there a logical way to to derive the folder path from another MPL field?  

An example <Item> element might help me understand better.

I wonder if JRiver might consider exporting calculated fields as well...  but still no response on the CDATA problem, so maybe one step at a time :-).

Quote
Also the date is not being shown for my files.  They have a date in MC and it has been exported however it appears as an odd number in the MPL rather than as a date...Don't know if the export to XML option would actually convert the dates first??


Yeah, I forgot about that.  If someone knows what the "Date" field means (i.e. how to convert it to a real date (year?), it's easy to do the conversion in XSLT.

Scott-
Logged

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re: AlbumViewer
« Reply #6 on: October 07, 2003, 03:15:00 pm »

Okay...I exported an XML file to test but my whole library (5000ish tracks was too much) so reduced it to about twent albums.  Date field appeared fine.  I then edited the XSL to point to Filename path/Image File ratehr than just Image file and it worked fine so if we could persuade J River to either export calculated fields in MPL or to export a selection to XML all will be sorted...

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

kiwi

  • Citizen of the Universe
  • *****
  • Posts: 817
  • Don't worry, be happy...
Re: AlbumViewer
« Reply #7 on: October 07, 2003, 04:23:14 pm »

Will it only display images if you've stored them external to the files?

kiwi
Logged

sraymond

  • Guest
Re: AlbumViewer
« Reply #8 on: October 07, 2003, 06:03:26 pm »

Quote
Will it only display images if you've stored them external to the files?


Yeah...  remember, this just takes the exported MPL and creates the "presentation".  If we want to get "fancy", we could to do some client-side script (i.e. JavaScript orVBScript) to increase functionality.  But at that point, we'd need someone smarter than me - I'm no JavaScript expert.

Scott-
Logged

sraymond

  • Guest
Re: AlbumViewer
« Reply #9 on: October 07, 2003, 06:10:33 pm »

Adam,

Quote
I then edited the XSL to point to Filename path/Image File ratehr than just Image file and it worked fine


Here's an example of an MPL that MC creates for me:
Quote
<Item>
<Field Name="Filename">\\workstation1\c$\Music\Andrea Bocelli\romanza\05 -  Caruso.mp3</Field>
<Field Name="Artist">Andrea Bocelli</Field>
<Field Name="Album">romanza</Field>
<Field Name="Name">Caruso</Field>
<Field Name="File Type">mp3</Field>
<Field Name="Genre">Classical</Field>
<Field Name="Comment"></Field>
<Field Name="Bitrate">124</Field>
<Field Name="Image File">C:\Program Files\J River\Media Center\Data\Cover Art\Andrea Bocelli - romanza.jpg</Field>
<Field Name="Media Type">Audio</Field>
<Field Name="Last Played">1064185849</Field>
<Field Name="Rating"></Field>
<Field Name="File Size">5095552</Field>
<Field Name="Duration">319</Field>
<Field Name="Number Plays">9</Field>
<Field Name="Track #">5</Field>
<Field Name="Date Created">1053826883</Field>
<Field Name="Date Modified">1053298933</Field>
<Field Name="Date Imported">1038782534</Field>
<Field Name="Replay Gain"></Field>
<Field Name="Peak Level"></Field>
<Field Name="Intensity"></Field>
<Field Name="BPM"></Field>
<Field Name="Notes"></Field>
<Field Name="Lyrics"></Field>
<Field Name="Width"></Field>
<Field Name="Height"></Field>
<Field Name="Tempo"></Field>
<Field Name="Mood"></Field>
<Field Name="Situation"></Field>
<Field Name="Bios"></Field>
<Field Name="Preference"></Field>
<Field Name="Composer"></Field>
<Field Name="Keywords"></Field>
<Field Name="Album Artist"></Field>
<Field Name="Photographer"></Field>
<Field Name="To Print"></Field>
<Field Name="Date">36526</Field>
<Field Name="Language"></Field>
<Field Name="People"></Field>
<Field Name="Places"></Field>
<Field Name="Events"></Field>
<Field Name="Series"></Field>
<Field Name="PaintStyle"></Field>
<Field Name="Country"></Field>
<Field Name="Continent"></Field>
<Field Name="Gallery"></Field>
<Field Name="Source"></Field>
<Field Name="Topic"></Field>
<Field Name="Period"></Field>
<Field Name="Playback Range"></Field>
</Item>


Edited:
As you can see, "Image File" includes the path.  Does your MPL look different?  If so, how did you generate it?  I didn't realize that using the Export XML gave more fields.  Thanks for pointing it out!

Quote
Date field appeared fine.


But it's not a "date" type, right?  Anyone know the formula for conversion?

You didin't have any problems with mal-formed XML?  Good!

Scott-
Logged

sraymond

  • Guest
Re: AlbumViewer
« Reply #10 on: October 08, 2003, 06:48:16 pm »

I've added a few more things to the XSLT.  Here's a screenshot:


You can download the latest files at http://pages.sbcglobal.net/scottraymond/AlbumGroup35.zip

The changes:
1)  Moved all the CSS to an external XML.  It doesn't look perfect, but I think I've hit the limits of my CSS knowledge...  "inheritance" isn't exactly intuitive and I'm never exactly sure where to put the properties (table?  td?).  I also couldn't figure out how to get rid of the white borders within the song listing cells - I think it might be a padding problem.
2)  Converted "Duration" (which is in seconds) to min:sec.
3)  Added graphics for the rating.

I'll probably make one more rounds of additions/changes - and if no one volunteers to do the back-end plug-in, I'll stop there.  Any requests?

Scott-
Logged

Hugo_Elbuho

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 99
  • nothing more to say...
Re: AlbumViewer
« Reply #11 on: October 08, 2003, 08:37:26 pm »

Hello my friend.

To get rid of those "padding problems" just use inside your table's style definition a property like this:


"table-layout:fixed;"

and withing the table's html tag itself:

"cellpadding=0"

like this:

<table cellpadding='0' style='table-layout:fixed;' >
<tr>
...
</tr>
</table>

This will cause all the properties to be rendered the same as the first row and will keep that blank space out of your nice layout.

Or if your're keeping styles on a separate document i'm sure just how to do it so i won't go further ... :)

I also wanted to say i fully support your efforts towards XSLT, which i currently use for all my web programming. Though, i've found that with a database like mine, which is like 4000 files, MC's XML export, even with my 2.8GHz processor, it takes some time to process. So perhaps, a feature like the one i've seen that's proposed in one thread or another (selective XML export) should make our day...

Finally, If you've got any question concerning XSLT that i can be of any help with, just tell me, ok?

Peace and good luck.
Logged

sraymond

  • Guest
Re: AlbumViewer
« Reply #12 on: October 08, 2003, 09:05:50 pm »

Hugo,

Thanks for the advice...  all those properties can be confusing.  When I originally did it with in-line CSS it worked fine.  Now that I've moved to external CSS, it's broke.  I'll keep "googling' towards a solution.

Quote
I also wanted to say i fully support your efforts towards XSLT, which i currently use for all my web programming. Though, i've found that with a database like mine, which is like 4000 files, MC's XML export, even with my 2.8GHz processor, it takes some time to process. So perhaps, a feature like the one i've seen that's proposed in one thread or another (selective XML export) should make our day...


Have you tried "Export Playlist" MPL format?  I guess it doesn't work out if you store coverart in the folder as folder.jpg, but it works great for me (I have a separate coverart folder).

I do hope JRiver helps us out with a better XML Export...

I appreciate the offer for XSLT help - I won't hesitate to ask if I need it.

Pax e Bonum!

Scott-
Logged

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re: AlbumViewer
« Reply #13 on: October 09, 2003, 12:47:03 am »

Scott,

I made a couple of changes to the XSLT last night and got it to run in firebird...firebird will display the whole of my XML library export (eventually!!) which is good as IE times out on this file (16MB).  The only problem is that FB doesn't seem to be showing the cover art.  I originally had it set to show "[filename (path)] [Image file]" within the source which should have been a direct path to the image file but this did not work (although it did in IE) so I created a calculated filed in MC called XSL image which was basically the same (thinking it might be that FB didn't like having two statements for the path).  FB still won't display the cover art though...it displays the no art image so I know it can display graphics using the format you specified.  I am at a loss now as to why it doesn't display.  Wondering if FB cannot accept an XML node as a path???  Any advice would be great.  I will send details of the changes I made and that way the XSLT should work in IE and Gecko,

Cheers

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

Marko

  • Guest
Re: AlbumViewer
« Reply #14 on: October 09, 2003, 03:08:11 am »

8) 8)This is great fun!!! Thank you so much.

I been tweaking a bit. Trying to learn some of the very basics by reading what was already there.

see my tweaks <--- if you like. Not sure how quick it will load, entire dir is 581 kb.

Scott, I looked @ how you'd converted the time, and tried applying this to the filesize entry. I got the basics, but could not figure out how to output the figure to 2 decimal places. Is that possible? Could you show me how if it is?
please. :D

-marko
Logged

sraymond

  • Guest
Re:AlbumViewer
« Reply #15 on: October 09, 2003, 12:39:25 pm »

Marko,

Looks good - you've got the song columns lined up under the heading...  that was driving me a bit nuts.

You can use the format-number XPATH function to do what you want:
Quote
<xsl:value-of select="format-number(Field[@Name=$SongDetailsColumn6] div 1048576, '#.##')"/>

The floor function just returns the modolu "div" - maybe there's an easy way to do that with format-number - I'm not sure.

I was also trying to use format-number to pad the zero on the minutes - but it didn't work after one or two tries and I went the "if" route.  I'll fix that soon.

Edit
I replaced the "if"s with
Quote
<xsl:value-of select="format-number(Field[@Name=$SongDetailsColumn3] mod 60, '00.')"/>
and it now pads fine.  I'm not sure what I was doing wrong before.

Quote
I been tweaking a bit.

See...  this is the power of using XML.  Now there's another "presentation" for others to use.  I like the extra column.

I've been wondering...  if no plug-in writer volunteers, maybe we can do something in JavaScript.

Scott-
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #16 on: October 09, 2003, 04:18:16 pm »

OK...  I finally figured out the cell spacing problem.  (Thanks Hugo!  While googling on table-layout, I found it.)

Quote
border-collapse:collapse;

Scott-
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #17 on: October 10, 2003, 01:52:16 am »

Well, I'm starting to despair that this will never become a plug-in...  but I've continued adding some features.  At this point, I guess the intent is to show a bit of everything - which should give those interested a good start towards customizing for themselves.

Here's the latest screenshot:


The files may be downloaded at http://pages.sbcglobal.net/scottraymond/AlbumGroup4.zip.

The latest features:
1)  Added a second level of grouping.  It now groups on artist and then album.
2)  Added an expand/collapse functionality.  Thanks to Stilton's ExportIt:  I used his JavaScript.

OK...  I'm running out of "features" to add.  If anyone has any requests, let me know - otherwise, I think I'm about done.

Scott-
Logged

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #18 on: October 10, 2003, 03:12:55 am »

Hi Scott,

How about a sort on Year before album so it displays each artists albums chronologically eg Artist/Year/Album...  Haven't done anymore yet to be able to get the images to show in FB.  Don't know what is going to be best at the moment...  May have to put all my cover art in the data folder again...Just seems an awful waste to have it in two places butI think your XSLT is worth it :D

Thanks for a great piece of work.  Has helped me to learn a bit more XSLT too which is good!!

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #19 on: October 10, 2003, 11:12:35 am »

Hi Scott,

How about a sort on Year before album so it displays each artists albums chronologically eg Artist/Year/Album...  Haven't done anymore yet to be able to get the images to show in FB.  Don't know what is going to be best at the moment...  May have to put all my cover art in the data folder again...Just seems an awful waste to have it in two places butI think your XSLT is worth it :D

Thanks for a great piece of work.  Has helped me to learn a bit more XSLT too which is good!!

Adam

It's quite easy to add another sort - good idea.  Just add another <xsl:sort>:
Quote
                        <xsl:for-each select="$Artist[count(. | key('GroupByAlbum', Field[@Name='Album'])[1])=1]">
                           <xsl:sort select="Field[@Name=$AlbumSort2]"/>
                           <xsl:sort select="Field[@Name=$AlbumSort3]"/>
where $AlbumSort2 is "Date" and $AlbumSort3 is "Album".  But I still don't know how the "Date" field is encoded!

What's the problem with Firebird?  For testing, it's important you have a way to view the XSLT output.  For example, in IE, if you right-click and select "View Source", you get the original XML.  If you install the MSXSL tools, it adds a right-click option of "View XSL Output".  This way, you can compare the result with a static HTML page that does exactly what you want.

Or is the problem generating the path, because it's not in the "Image File" field?

If you have any questions about the XSLT (especially that you'd like me to explain better), don't hesitate to ask!  The grouping function can be a bit confusion, thuugh the method is well-known and well-documented.

Scott-
Logged

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #20 on: October 10, 2003, 07:09:02 pm »

I sorted out the FB issue.  i did two things, not sure which solved it...one I had a unicode encoding meta tag to the head and secondly I changed the xsl image field so that it began with file:///.  I guess it was the latter...Have now edited the XSLT so that it shows Album Artist in all instances so that various artists Albums are properly displayed as various artists...Not sure yet whetehr to go the whol hog and create a calculated field to show artist names for individual tracks in multi artist albums...

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #21 on: October 10, 2003, 07:53:28 pm »

I found another thing too.  If you want FB to generate HTML the media method must be set to html.  You have it set to xml hence it produces another xml doc in firebird...this doesn't affect IE

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #22 on: October 10, 2003, 08:32:52 pm »

The script does not work in Firebird.  Any chacne this could be changed to use css visibility directly from within the code eg (pseudo code)onclick layer.visibility=visible, onclick layer.visibility=hidden? Or is there a standards compliant script which would work instead?

Cheers

Adam
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #23 on: October 10, 2003, 08:57:26 pm »

I found another thing too.  If you want FB to generate HTML the media method must be set to html.  You have it set to xml hence it produces another xml doc in firebird...this doesn't affect IE

Adam

Cool.  I really should read up on the details of <xsl:output>.  Google will be my friend!

Edit:

I wanted the output to conform to XHTML - it would seem that using method="html" would not insert an end-tag for HTML empty elements.  I wonder if the problem is, instead, with the XML declaration.  You might try omit-xml-declaration="yes" and see if that helps.

Scott-
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #24 on: October 10, 2003, 09:10:01 pm »

The script does not work in Firebird.  Any chacne this could be changed to use css visibility directly from within the code eg (pseudo code)onclick layer.visibility=visible, onclick layer.visibility=hidden? Or is there a standards compliant script which would work instead?

Cheers

Adam

I'm not very well-versed in JavaScript - but it seemed pretty straight-forward.  I did have some trouble with a conflict between the <img> and <div> id.  Can you debug in FB and see where the problem is?  I can't think of a way to change an element's attribute in the resultant HTML without some sort of script - you want to be able to change a document from within the same document.

I'm curious...  if you download http://pages.sbcglobal.net/scottraymond/ExportIt.zip, does it display OK in FB?  It's the result of the ExportIt plugin.

Scott-
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer
« Reply #25 on: October 11, 2003, 12:26:02 am »

The script does not work in Firebird.  Any chacne this could be changed to use css visibility directly from within the code eg (pseudo code)onclick layer.visibility=visible, onclick layer.visibility=hidden? Or is there a standards compliant script which would work instead?

Cheers

Adam

Adam,

I just realized that IE doesn't use JavaScript...  it uses JScript.  FB uses JavaScript.  There're both quite similiar, but from what I gather, JScript has some extra functionality that only IE supports.  So - figure out the script to change the element's style.visibility using JavaScript and things should be copesthetic.

Scott-
Logged

MachineHead

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer - Now AlbumView XSLT
« Reply #26 on: October 11, 2003, 07:57:51 am »

You really need to come up with another name. The addition of 'XSLT' isn't much of a nod to RhinoBanga.

It could also be somewhat confusing to anyone keeping tabs on the other.

Logged

lee269

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 575
  • sleep eat sleep eat sleep eat
Re:The Plug-in Formerly Known As AlbumViewer - Now AlbumView XSLT
« Reply #27 on: October 11, 2003, 10:16:58 am »

Im almost certainly jumping into things I dont understand here - I dont even know what XSLT is.

I seem to remember Matt once saying that MC dates were counted in seconds from 1/1/1970. They are certainly related to this as never played files show in MC as last played 33.8 years ago. Dont know if this has any relation to your date encoding question though.

This piece of work is very interesting.
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer - Now AlbumView XSLT
« Reply #28 on: October 11, 2003, 11:13:11 am »

You really need to come up with another name. The addition of 'XSLT' isn't much of a nod to RhinoBanga.

It could also be somewhat confusing to anyone keeping tabs on the other.



What, no suggestions?

Scott-
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #29 on: October 11, 2003, 11:18:19 am »

XAlbum it is...  and a bit of explanation never hurts:  XMLtoHTML Conversion via XSLT Grouped by Album.

Scott-
Logged

MachineHead

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #30 on: October 11, 2003, 11:41:17 am »

No confusion now.  ;)

Good Choice
Logged

sraymond

  • Guest
Re:The Plug-in Formerly Known As AlbumViewer - Now AlbumView XSLT
« Reply #31 on: October 11, 2003, 04:10:32 pm »

I seem to remember Matt once saying that MC dates were counted in seconds from 1/1/1970. They are certainly related to this as never played files show in MC as last played 33.8 years ago. Dont know if this has any relation to your date encoding question though.

I thought about that, but I have a Date of 2000 and the value is "36526".  Thanks for the suggestion, though.

Scott-
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #32 on: October 11, 2003, 04:49:35 pm »

Here's the latest screenshot:


The files may be downloaded at http://pages.sbcglobal.net/scottraymond/AlbumGroup45.zip.

The latest features:
1)  Added "expand all" and "collapse all" buttons.
2)  Added a song count and album count to each artist (i.e. "x songs in y albums" header.

And I'm pretty much tapped out of ideas.  I might consider trying to do a browser-side JavaScript that gets the MPL export from MC (assuming this is possible) and transforms it with the XSLT, but this might be more than I want to bite off (or chew).

Until then, if anyonse has any XSLT questions, please don't hesitate to ask.  I've tried to document it as good as possible - but I'm sure it's not as clear as it could be.

Scott-
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #33 on: October 12, 2003, 03:22:03 pm »

Just wondering what the specifics of the back-end you require are. What exactly does it need to output? I really dont know much about XML, but your idea is great. I'd be keen to maybe give a plug-in a go in my spare time (University is finishing soon, so once end of year exams are over I might actually have some!)

Cheers,

Scott.
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #34 on: October 12, 2003, 03:51:06 pm »

Just wondering what the specifics of the back-end you require are. What exactly does it need to output? I really dont know much about XML, but your idea is great. I'd be keen to maybe give a plug-in a go in my spare time (University is finishing soon, so once end of year exams are over I might actually have some!)

Cheers,

Scott.

The back-end would simply (that might be an exaggeration!) need to create an XML object/document (either from MC's Export Playlist MPL format or Export to XML, *or* by directly accessing the records and creating the object/document that conforms to the MPL schema), apply an XSLT transformation, and save/open the resulting HTML in a browser (or within MC using its internal browser functinality).

It would definitely add to the "slick" factor to modify the XSLT's variables (for fields to display, sort, etc.) prior to the transformation.  This would let the HTML generation function take care of minor changes to the XSLT.

And if we'd want to publish to a webserver, we'd need to copy the graphics stored in "Image File".

It doesn't sound too complicated...  but for someone without the experience (like me), it's probably more than I'd want to do.  If you're interested, I can provide more details.

Scott-

P.S.  Where are you going to school?  Don't end-of-year exams happen in May?  Or maybe December?

Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #35 on: October 12, 2003, 04:00:37 pm »

Sounds interesting... I'll have to see what I can do - I'm new to the plug-in thing, but I'm up for a challenge. I'll get back to you once I've figured out just how much of this I can actually do :)

P.S.  Where are you going to school?  Don't end-of-year exams happen in May?  Or maybe December?

University of Waikato, New Zealand. Our end of year exams are in mid-November. Summer here is December-February so that's when we get our summer break.
Logged

millertivo

  • Regular Member
  • Recent member
  • *
  • Posts: 47
  • nothing more to say...
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #36 on: October 12, 2003, 06:24:17 pm »

Are there instructions for getting this to work?  The screenshots look awesome.  I exported my library to one large XML file and I download your latest zip file.  I'm just not sure what to do next.  Thanks.
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #37 on: October 12, 2003, 07:00:52 pm »

Are there instructions for getting this to work?  The screenshots look awesome.  I exported my library to one large XML file and I download your latest zip file.  I'm just not sure what to do next.  Thanks.

Sure...

Quote
If you want to see what it looks like for real:
1.  "Export Playlist" as an MPL and save to a directory.  Let's say you call it "Audio.xml".
2.  Download the XSLT http://pages.sbcglobal.net/scottraymond/AlbumGroup45.zip.  Extract it to a directory (preferably where the "Audio.xml" is).
3.  In the "Audio.xml" file, add the line "<?xml-stylesheet type="text/xsl" href="C:\Program Files\J River\Media Center\XMLDevelopment\AlbumGroup.xsl"?>" right after the first line (which is "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>").  Make sure the path matches where you saved the "AlbumGroup.xsl" - or if they're in the same directory, you don't need the path.

Now just open "Audio.xml" with IE.  The transformation will be applied automatically.

The only caveat is that you may have characters in your library that cause the XML to be mal-formed (for example, < or > signs).  If this happens, you're stuck until JRiver helps us out by wrapping the <Field> content in a CDATA section.

Any other questions, let me know.

Scott-
Logged

millertivo

  • Regular Member
  • Recent member
  • *
  • Posts: 47
  • nothing more to say...
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #38 on: October 12, 2003, 08:05:45 pm »

Thanks!  Looks very nice.  My only "problem" is that I store my images inside the file rather than in a separate folder.
Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #39 on: October 16, 2003, 03:45:04 pm »

Are there instructions for getting this to work?  The screenshots look awesome.  I exported my library to one large XML file and I download your latest zip file.  I'm just not sure what to do next.  Thanks.

Sure...

Quote
If you want to see what it looks like for real:
1.  "Export Playlist" as an MPL and save to a directory.  Let's say you call it "Audio.xml".
2.  Download the XSLT http://pages.sbcglobal.net/scottraymond/AlbumGroup45.zip.  Extract it to a directory (preferably where the "Audio.xml" is).
3.  In the "Audio.xml" file, add the line "<?xml-stylesheet type="text/xsl" href="C:\Program Files\J River\Media Center\XMLDevelopment\AlbumGroup.xsl"?>" right after the first line (which is "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>").  Make sure the path matches where you saved the "AlbumGroup.xsl" - or if they're in the same directory, you don't need the path.

Now just open "Audio.xml" with IE.  The transformation will be applied automatically.

The only caveat is that you may have characters in your library that cause the XML to be mal-formed (for example, < or > signs).  If this happens, you're stuck until JRiver helps us out by wrapping the <Field> content in a CDATA section.

Any other questions, let me know.

Scott-

Hi Scott - love the work, love the screenshots.  However - i just created a playlist for my entire library and exported to XML.  My library is 70,000 songs approx, the resultant XML export is 107Mb, and opening it on IE has so far taken 1 hour 3 mins, with IE using 97% CPU utilisation, and 689Mb memory (peak at over 1GB).

I know i am being a bit optimistic for my first attemp, but is there anyway to speed things up?

If i can't use it for my whole library it seems a little pointless?

Your thoughts

Thanks

Graham
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #40 on: October 16, 2003, 05:00:09 pm »

Graham,

I wish I had a better answer for you...  XSLT isn't really meant for *large* XML databases.  Someone's going to send me an 80 MB file and I'll do some analysis to see where the delays are taking place.  I'm pretty sure about 20% of the processing time is spent on the <xsl:choose> to figure out how many graphics to place for the rating.  Tonight I'll move that to JavaScript and see what happens.

The other thing I'll try to do is prune the MPL (getting rid of the unneeded fields) to a smaller XML - that should halve the XML in one-fell-swoop.  As I mentioned before, the weakness of XSLT is that all processors (currently, at least) load the whole document in memory.  It's not like a relational database where there are indexes:  sorting and grouping can be a bit intensive.

If you have a braodband connection, could you FTP your MPL to me?

Scott-
Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #41 on: October 16, 2003, 05:54:05 pm »

Graham,

I wish I had a better answer for you...  XSLT isn't really meant for *large* XML databases.  Someone's going to send me an 80 MB file and I'll do some analysis to see where the delays are taking place.  I'm pretty sure about 20% of the processing time is spent on the <xsl:choose> to figure out how many graphics to place for the rating.  Tonight I'll move that to JavaScript and see what happens.

The other thing I'll try to do is prune the MPL (getting rid of the unneeded fields) to a smaller XML - that should halve the XML in one-fell-swoop.  As I mentioned before, the weakness of XSLT is that all processors (currently, at least) load the whole document in memory.  It's not like a relational database where there are indexes:  sorting and grouping can be a bit intensive.

If you have a braodband connection, could you FTP your MPL to me?

Scott-

Yes sure, either i can FTP or just plain Email if you can accept it?

Let me know

Thanks

PS - if you want a laugh.  After about 1hr 30 it finally all loaded and i was playing with it and experimenting etc.  I then though i would check interact for the latest MC version.  Clicked Help and interact.  What  happens!!!!!!  It opens the currently open IE window.

I click back - now i wait another 1hr 30???

Graham
Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #42 on: October 16, 2003, 06:03:55 pm »

PS - My library also needs a little work in terms of assigning cover art etc
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #43 on: October 16, 2003, 07:06:02 pm »

Quote
I click back - now i wait another 1hr 30???

Well, you'd really want to save the resultant HTML!

If you don't mind, please FTP your MPL to ftp://sraymond.no-ip.com - it'll be up for the next day or so.

Scott-
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #44 on: October 16, 2003, 09:32:02 pm »

Well...  I'm feeling satisfied with the XAlbum "proof-of-concept".  Here's a screenshot:


And it can be downloaded at http://pages.sbcglobal.net/scottraymond/XMLAlbumProof.zip.

What this does it let you choose the input MPL and the XSLT transformation of choice and it will apply the transformation and display it in a newly opened browser window.  You can then save the resultant HTML using the browser's "Save As" command.  It will probably only work with IE, as I'm not good enough with JavaScript to write more browser independent scripts.

I also added the JavaScript to convert the date to a year.

Once someone sends me some large libraries, I'll look to see how the generation time can be improved - but I don't expect it would ever come close to approaching a compiled program's performance.  Remember, we're trading off end-user flexibility in customization for performance.

Scott-
Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #45 on: October 17, 2003, 05:36:08 am »

Sent.  It's called All Files 161003.xml

graham
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #46 on: October 17, 2003, 09:20:31 pm »

Graham,

Thanks for the file...  it is certainly sufficienty large to be considered HUGE.

Unfortunately, there are invalid characters in the <Field> content...  they seem to be mostly accented-characters.  I'm curious how you were able to transform this in IE6...  copying just one <Item> with a special character (i.e. â) into a new MPL document creates an error for me.  For example:
Quote
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="C:\Program Files\J River\Media Center\XMLDevelopment\AudioPrune.xsl"?>
<MPL Version="2.0">
<Item>
<Field Name="Filename">J:\My Music\Aled Jones\Aled\Aled Jones - 05 - Suo-Gân.mp3</Field>
<Field Name="Artist">Aled Jones</Field>
<Field Name="Album">Aled</Field>
<Field Name="Name">Suo-Gân</Field>
<Field Name="File Type">mp3</Field>
<Field Name="Genre">Alternative</Field>
<Field Name="Comment"></Field>
<Field Name="Bitrate">128</Field>
<Field Name="Image File"></Field>
<Field Name="Media Type">Audio</Field>
<Field Name="Last Played"></Field>
<Field Name="Rating"></Field>
<Field Name="File Size">4388864</Field>
<Field Name="Duration">274</Field>
<Field Name="Number Plays"></Field>
<Field Name="Track #">5</Field>
<Field Name="Date Created">1038409249</Field>
<Field Name="Date Modified">1045951842</Field>
<Field Name="Date Imported">1045160396</Field>
<Field Name="Replay Gain">-7.99340</Field>
<Field Name="Peak Level">0.92627</Field>
<Field Name="Intensity">2</Field>
<Field Name="BPM">100</Field>
<Field Name="Notes"></Field>
<Field Name="Lyrics"></Field>
<Field Name="Width"></Field>
<Field Name="Height"></Field>
<Field Name="Composer"> </Field>
<Field Name="Keywords"></Field>
<Field Name="Custom 1">A</Field>
<Field Name="Custom 2"></Field>
<Field Name="Album Artist"></Field>
<Field Name="Custom 3"></Field>
<Field Name="Tempo"> </Field>
<Field Name="Mood"> </Field>
<Field Name="Situation">  </Field>
<Field Name="Bios"> </Field>
<Field Name="Preference"> </Field>
<Field Name="Date">37257</Field>
<Field Name="People"></Field>
<Field Name="Places"></Field>
<Field Name="Events"></Field>
<Field Name="Playback Range"></Field>
</Item>
</MPL>
won't transform for me.

Scott-



Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #47 on: October 18, 2003, 06:00:28 am »

Hi Scott,

Don't know if it makes a difference but when i exported from MC, instead of leaving it with an MPL extension, i changed it to .xml before the export.

Graham
Logged

sraymond

  • Guest
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #48 on: October 18, 2003, 11:05:56 am »

Graham,

That just changes the extension - the file is still a pseudo-XML (I say pseudo, because it isn't well-formed) that conforms to the MPL schema.

If you take the above quoted XML file, can you transform it "no problem"?  If so, maybe I have an encoding-problem.  That might be an easy fix for special characters (accents, etc.), but it won't help for those that have things like "<" signs in the field content.

Scott-
Logged

graham131

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 345
  • Yadb (get it?) dabba do.....
Re:XAlbum - XMLtoHTML Conversion via XSLT Grouped by Album
« Reply #49 on: October 18, 2003, 11:40:06 am »

Scott,

Yes it tranforms fine for me into IE6.

I am going to now creat an MPL file with just a couple of albums in (with odd characters), and try to transform this, rather than the "big" one, and i will let you know.

Graham
Logged
Pages: [1] 2   Go Up