Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_playlist_output_custom (Read 20279 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_playlist_output_custom

Download: here
foo_playlist_output: here

Adds the ability for users to specify their own custom formatting strings for foo_playlist_output.  Includes source code so others can write outputers if they are so interested.

This work is licensed under the Creative Commons Attribution-NonCommercial License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.                                                         

Okay, got title formatting working for Header/Footer..  Don't use %album%, %artist%, etc as this will have unpredicatable results..  I suggest sticking to only %_foobar2000_version% and the extra stuff I give you below:
%_average_track_length_string%
%_average_track_length_seconds%
%_average_track_length_minutes%
%_playlist_length_string%
%_playlist_length_seconds%
%_playlist_length_minutes%
%_playlist_length_hours%
%_playlist_number% -- Will be -1 for header, -2 for footer
%_playlist_total%
%_num_tracks_no_length%
%_custom_output_version%

Example:
Header:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>foobar2000 Playlist</title>
<link rel="stylesheet" type="text/css" href="foobar2000.css" />
</head>
<body>
<table>


Format:
Code: [Select]
<tr>
<td>[%_playlist_number%.]</td>
<td>[%artist%]</td>
<td>$if(%title%,%title%,%_filename_ext%)</td>
<td>[%_length%]</td>
</tr>


Footer
Code: [Select]
</table>
</body>
</html>


With slight modification could this would give you something akin to this

foo_playlist_output_custom

Reply #1
http://my.netian.com/~cajunlee/wlist.htm

Cloned Winamp output. Deals with 1-hour, 1-minute, 1-second tracks successfuly, as in original. Used %% to display % in output. Used manual $crlf() settings for clear human-readable output.

Might be buggy.

edit: Mr_Rabid_Teddybear's code was integrated. Used [] to show spaces between numbers and letters.

Header:
Code: [Select]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="null">
<style TYPE="text/css">
<!--
BODY { background: #000040; }
.para1 { margin-top: -42px; margin-left: 210px; margin-right: 10px; font-family: "font2, Arial"; font-size: 30px; line-height: 35px; text-align: left; color: #E1E1E1; }
.para2 { margin-top: 15px; margin-left: 15px; margin-right: 50px; font-family: "font1, Arial Black"; font-size: 50px; line-height: 40px; text-align: left; color: #004080; }
-->
</style>
<title>foobar2000 Generated PlayList</title>
</head>
<body BGCOLOR="#000080" topmargin="0" leftmargin="0" ext="#FFFFFF">
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<div align="center">
<div CLASS="para2" align="center">
<p>foobar2000</p>
</div>
<div CLASS="para1" align="center">
<p>playlist</p>
</div>
</div>
<hr align="left" width="90%%" noshade size="1" color="#FFBF00">
<div align="right">
<table border="0" cellspacing="0" cellpadding="0" width="98%%">
<tr>
<td>
<small>
<small>
<font face="Arial" color="#FFBF00">
%_playlist_total%</font> []
<font color="#409FFF" face="Arial">
track$if($strcmp(%_playlist_total%,1),,s) in playlist, average track length: </font>
<font face="Arial" color="#FFBF00">
%_average_track_length_string%</font>
</small>
</small>
<br>
<small>
<small>
<font color="#409FFF" face="Arial">
Playlist length: </font>
$if($strcmp(%_playlist_length_hours%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_hours%</font> []
<font color="#409FFF" face="Arial">
hour$if($strcmp(%_playlist_length_hours%,1),,s) </font>])
$if($strcmp(%_playlist_length_minutes%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_minutes%</font> []
<font color="#409FFF" face="Arial">
minute$if($strcmp(%_playlist_length_minutes%,1),,s) </font>])
$if($strcmp(%_playlist_length_seconds%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_seconds%</font> []
<font color="#409FFF" face="Arial">
second$if($strcmp(%_playlist_length_seconds%,1),,s) </font>])
<BR>
</small>
</small>
</td>
</tr>
</table>
</div>
<blockquote>
<p>
<font color="#FFBF00" face="Arial">
<big>Playlist files:</big>
</font>
<ul>
<font face="Arial" color="#FFFFFF">
<small>$crlf()


Format:
Code: [Select]
%_playlist_number%. $replace([%artist% - ]$if2(%title%,%_filename%),'',&apos;,",&quot;,<,&lt;,>,&gt;,&,&amp;)[ '('%_length%')']<BR>$crlf()
//Workaround applied, thanks to Mr_Rabid_Teddybear
//&apos; won't work with MSIE. Use "& # 3 9;" without the spaces or quotes if you use MSIE.


Footer:
Code: [Select]
</font></ul></blockquote><hr align="left" width="90%%" noshade size="1" color="#FFBF00"></body></html>$crlf()



foo_playlist_output_custom

Reply #4
@kjonlee: The statistics (n tracks in playlist...) are very tiny, cannot read it (in Opera)

foo_playlist_output_custom

Reply #5
About the tiny letters: that's not a bug, that's a feature! I wanted to reproduce Winamp's output, even if it meant non-standard HTML or strange output.

Feel free to adjust as necessary. You could start by geting rid of <small><small> and </small></small> to make it less small.

As for creating a new version which is standards-compliant but looks the same, or something that looks better, I'll leave that job to someone else. I prefer a table-based approach, you see.

foo_playlist_output_custom

Reply #6
Okay. Am I just plain stupid or why can't I find the fscking way to edit the template? ^^;

EDIT: NO! It just hadn't loaded the component. *goes to a corner to hide*

EDIT 2: Oh screw it. I still can't find the way to edit it. So, would anyone mind to tell me?


foo_playlist_output_custom

Reply #8
Ah. Thank you. I had no preferences entry like that - until I updated my Playlist Output component ^^ That didn't even occur to me that it could've been because of old components..

foo_playlist_output_custom

Reply #9
I tried out kjoonlee's Winamp style formatting. The format bit goes:

%_playlist_number%. [%artist% - ]$if2(%title%,%_filename%)[ '('%_length%')']<BR>$crlf()

OK. "Convert Special HTML Characters" checked also converts <BR> to &lt;BR&gt; in addition to converting occurences of <, > and & from %artist% and %title% fields in playlist. That makes a little crappy output.....  On the other hand; not checking "Convert Special HTML Characters" does not fix occurences of <, > and & from %artist% and %title% fields in playlist, so what to do.... Is there a way around this dilemma....
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

foo_playlist_output_custom

Reply #10
Ideally, Convert Special HTML Characters should only be active on %tag_contents%.

Workaround:
Code: [Select]
[$replace(%title%,&,&amp;,'',&apos;,",&quot;,<,&lt;,>,&gt;)]
//&apos; won't work with MSIE. Use "& # 3 9;" without the spaces or quotes if you use MSIE.

foo_playlist_output_custom

Reply #11
Thanks. Yes this works like a charm:
Code: [Select]
%_playlist_number%. $replace([%artist% - ]$if2(%title%,%_filename%),'',&apos;,",&quot;,<,&lt;,>,&gt;,&,&amp;)[ '('%_length%')']<BR>$crlf()
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

foo_playlist_output_custom

Reply #12
Thank you, Tres`ni, for a wonderful plugin.

Right now, there's just one more thing I want to ask for, and that's auto-$crlf() being made the default for header, format, and footer strings. Maybe getting rid of that checkbox too.

Header:
A

Format:
B

Footer:
C

Generating a playlist from the settings above will give ABBBC. It's not pretty if there are lots of items, and if an item is pretty long, it makes it difficult to debug your TAGZ formatting.

Right now, with the $crlf() option, the playlist results in:
AB
B
B
C

---

It would be much easier to debug TAGZ if the playlist resulted in:
A
B
B
B
C

Incidentally, the "copy strings" feature appends $crlf() for each string copied from an item in the playlist, (well, maybe not, but it sure looks as if something similar is happening, ) so I think this change would be more user-friendly as well.

foo_playlist_output_custom

Reply #13
Using %artist% or %album% or such in the footer or header is "safe," from an end-user's perspective; they just get shown as question marks, just like how normal TAGZ behaves for %unavailable tags%.

However, using %_playlist_number% in the footer just gives -1 instead of -2.

edit: Maybe you could just drop support for %_playlist_number% in the header/footer?

foo_playlist_output_custom

Reply #14
I modiefied it a bit:

Code: [Select]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="null">
<style TYPE="text/css">
<!--
BODY { background: #000040; }
.para1 { margin-top: -42px; margin-left: 210px; margin-right: 10px; font-family: "font2, Arial"; font-size: 30px; line-height: 35px; text-align: left; color: #E1E1E1; }
.para2 { margin-top: 15px; margin-left: 15px; margin-right: 50px; font-family: "font1, Arial Black"; font-size: 50px; line-height: 40px; text-align: left; color: #004080; }
-->
</style>
<title>foobar2000 Generated PlayList</title>
</head>
<body BGCOLOR="#000080" topmargin="0" leftmargin="0" ext="#FFFFFF">
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<div align="center">
<div CLASS="para2" align="center">
<p>foobar2000</p>
</div>
<div CLASS="para1" align="center">
<p>playlist</p>
</div>
</div>
<hr align="left" width="90%%" noshade size="1" color="#FFBF00">
<div align="right">
<table border="0" cellspacing="0" cellpadding="0" width="98%%">
<tr>
<td>
<small>
<small>
<font face="Arial" color="#FFBF00">
%_playlist_total% </font>
<font color="#409FFF" face="Arial">
track$if($strcmp(%_playlist_total%,1),,s) in playlist, average track length: </font>
<font face="Arial" color="#FFBF00">
%_average_track_length_string%</font>
</small>
</small>
<br>
<small>
<small>
<font color="#409FFF" face="Arial">
Playlist length: </font>
$if($strcmp(%_playlist_length_hours%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_hours%</font>
<font color="#409FFF" face="Arial">
hour$if($strcmp(%_playlist_length_hours%,1),,s) </font>])
$if($strcmp(%_playlist_length_minutes%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_minutes%</font>
<font color="#409FFF" face="Arial">
minute$if($strcmp(%_playlist_length_minutes%,1),,s) </font>])
$if($strcmp(%_playlist_length_seconds%,0),,
[<font face="Arial" color="#FFBF00">
%_playlist_length_seconds%</font>
<font color="#409FFF" face="Arial">
second$if($strcmp(%_playlist_length_seconds%,1),,s) </font>])
<BR>
</small>
</small>
</td>
</tr>
</table>
</div>
<blockquote>
<p>
<font color="#FFBF00" face="Arial">
<big>Playlist files:</big>
</font>
<ul>
<font face="Arial" color="#FFFFFF">
<small>$crlf()


Code: [Select]
$num(%_playlist_number%,$len(%_playlist_total%)): [%artist% - ]$if2(%title%,%_filename%)[ '('%_length%')']<BR>$crlf()


Code: [Select]
</font></ul></blockquote><hr align="left" width="90%%" noshade size="1" color="#FFBF00"></body></html>$crlf()


foo_playlist_output_custom

Reply #16
New Version

Encode HTML options is gone in place is @htmlsafe{} fake function..  Use it like you would most functions for foobar.

Code: [Select]
@htmlsafe{[%artist%]}


AutoCRLF is now defaults to on and applies to all 3 areas.

Ctrl-A now selects all

Removed the %_playlist_number% for HEADER and FOOTER [as pointed out it ain't really needed..]

Think that's everything..

[edit. fixed my horrible missing and  ]

foo_playlist_output_custom

Reply #17
You should make one unique plugin, not a  fix and a custom one. Foobar users are tweakers anyway, so I'd rather recommend a plugin with default fields and a "reset options" button.
I mean there's some confusion about the two plugins...

foo_playlist_output_custom

Reply #18
i have a suggestion/request:
i d like to be able to import/export the config to a file


EDIT: i have a problem with version 1.0.5
The "footer" section doesn t seem to be appended to the end of the file .
And the tag %_custom_output_version% displays version 1.0.3 instead of 1.0.5

foo_playlist_output_custom

Reply #19
Quote
You should make one unique plugin, not a  fix and a custom one. Foobar users are tweakers anyway, so I'd rather recommend a plugin with default fields and a "reset options" button.
I mean there's some confusion about the two plugins...
[a href="index.php?act=findpost&pid=296504"][{POST_SNAPBACK}][/a]


Well, let me simplify.  Think of foo_playlist_output as the main plugin.  It provides all the real functionality.  foo_playlist_output_custom is an extension to foo_playlist_ouput for those who really want to tweak how their playlist is output.  It's not required and foo_playlist_output work fine on it's own.

Quote
i have a suggestion/request:
i d like to be able to import/export the config to a file


EDIT: i have a problem with version 1.0.5
The "footer" section doesn t seem to be appended to the end of the file .
And the tag %_custom_output_version% displays version 1.0.3 instead of 1.0.5
[a href="index.php?act=findpost&pid=296636"][{POST_SNAPBACK}][/a]


I'll add the import/export.  footer seems to be working for me, what's your config?

foo_playlist_output_custom

Reply #20
  I m very sorry , it works now , yesterday i tried 3 times with 3 different playlists and the part:
</table>
</body>
</html>
was not added at the end of the file
I don t manage to reproduce it, i ll try again and if i do have the problem again , i ll post the source code of the generated html file to show you
The wrong version problem is still here

Quote
...footer seems to be working for me, what's your config?


It s a slightly modified version of the one you gave as example in the first post

HEADER
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>foobar2000 Playlist</title>
<link rel="stylesheet" type="text/css" href="foobar2000.css" />
</head>
<body>
Average song lenght: %_average_track_length_string%<br>$crlf()
Playlist lenght: %_playlist_length_string%<br>$crlf()
Number of songs in playlist: %_playlist_total%<br>$crlf()
%_custom_output_version%<br>$crlf()
<table>


FORMAT
Code: [Select]
<tr>
<td>$pad_right(%_playlist_number%,$len(%_playlist_total%),o)</td>
<td>[%artist%]</td>
<td>$if(%title%,%title%,%_filename_ext%)</td>
<td>%_length%</td>
</tr>


FOOTER
Code: [Select]
</table>
</body>
</html>


Sorry again for bothering you for nothing

foo_playlist_output_custom

Reply #21
New version

Added Save, Load, and Reset configuration buttons [to save and load from an external file.]

Added %average_track_length_seconds_d% and %playlist_length_seconds_d%.  These use floating point precision so you don't lose those precious microseconds  [Just so you can get everything foobar can]

foo_playlist_output_custom

Reply #22
Quote
New version

Added Save, Load, and Reset configuration buttons [to save and load from an external file.]

Added %average_track_length_seconds_d% and %playlist_length_seconds_d%.  These use floating point precision so you don't lose those precious microseconds  [Just so you can get everything foobar can]
[a href="index.php?act=findpost&pid=296982"][{POST_SNAPBACK}][/a]


Thanks a lot for this addition and for fixing the version number problem

foo_playlist_output_custom

Reply #23
In my foobar2000 playlist there is: Abstürzende Brieftauben

when i output it into html (CUSTOM!!) then there is Abstürzende Brieftauben
if i do it with HTML (not CUSTOM) then it works normaly....

anyone can help?

and if i set a varable in header. can i output it in the "entry format"? i don't think so. or i am doing something wrong?!...

foo_playlist_output_custom

Reply #24
You're using Windows 2000/XP/2003, right?

Make sure you have <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> this in your HTML output, like in the exxamples.