Help - Search - Members - Calendar
Full Version: Listing Albums From Playlist (txt)
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
bustacap2k3
Hi

I searched for some posts regarding "exporting" your playlist to an HTML format and came across the 'Copy Command' formatting settings method where I can input some HTML come from which Foobar can build my playlist in the HTML format when I copy the whole thing and paste it into an HTML document.

I was wondering if there is some way, possibly using Copy Command or the Database somehow, to "export" a list of all of the albums I have (by artist) into some sort of a TXT or HTML document of some kind - and if possible - number each album as it appears? And maybe the date info could be present too. I have searched through this forum but to no avail.

For example, the output could be something like this:
CODE
1. Black Sabbath - Paranoid - 1970
2. Black Sabbath - Sabbath Bloody Sabbath - 1974
3. Candlemass - Self-Titled - 2005

(of course with the whole playlist)


If there is a way to do this, or a point in the right direction, please let me know.
Thanks!

-Mike
ludox
It's the string i use in Copy command:
CODE
%artist% $char(9) %tracknumber% $char(9) %title% $char(9) %album% $char(9) %date% $char(9) %genre% $char(9) %_length% $char(9) %__codec% $char(9) %__bitrate% $char(9) %__extrainfo% $char(9) %__mp3_stereo_mode% $char(9) %_length_seconds%

Then I select all my tracks, copy them and I paste them in Excel. smile.gif
bustacap2k3
Thanks for your quick reply ludox, but it's not exactly what I was asking. smile.gif
I'm looking for a way to have Foobar list only the albums I have by artist, not the individual songs.

I'm sure there is a way to do this, as I have seen the plugin foo_uie_albumlist and using the Sort by Artist method, it shows each artist with each album they have produced.

I'm looking for something similar to that, only it outputs my CDs into some sort of txt file (excel would have been fine like you suggested) as it is shown in the example above.

Thanks again

-Mike
Cosmo
There is probably a better way, but all I can come up with so far is -
copy string:
CODE
$if($strcmp($num(%tracknumber%,2),01),[%artist%][ - %album%][ - %date%])

...which only copies "Artist - Album - Date" for tracks that are numbered 1 or 01

Two problems:
1.) It doesn't number the list.
(I think this may be feasible, but I don't have time atm)
2.) It leaves a blank line for every track number greater than 1.
(I couldn't figure out how to parse the blank lines. Perhaps a special sorted playlist can be made for this purpose)

I hope that's better than nothing, if nobody comes up with a better solution.

Good Luck!
bustacap2k3
QUOTE(Cosmo @ Apr 19 2005, 09:52 PM)
There is probably a better way, but all I can come up with so far is -
copy string:
CODE
$if($strcmp($num(%tracknumber%,2),01),[%artist%][ - %album%][ - %date%])

...which only copies "Artist - Album - Date" for tracks that are numbered 1 or 01

Two problems:
1.) It doesn't number the list.
(I think this may be feasible, but I don't have time atm)
2.) It leaves a blank line for every track number greater than 1.
(I couldn't figure out how to parse the blank lines. Perhaps a special sorted playlist can be made for this purpose)

I hope that's better than nothing, if nobody comes up with a better solution.

Good Luck!
*


This is definately a step in the right direction, thanks!! Very clever. If anyone could elaborate Cosmo's code or think of another method, that would be great. If not, Cosmo's work will suffice smile.gif

Thanks again!

--Mike
Cosmo
I had an idea shortly after posting, and figured out a way to eliminate all the blank lines.

In the Album list panel settings, create a new view sort string:

Name: albumlist
Value:
CODE
$if($strcmp($num(%tracknumber%,2),01),[%artist%][ - %album%][ - %date%])

Then in the Album list panel, right-click and sort by (view>) "albumlist",
highlight "All music" ("show root node" must be enabled),
right-click on "All music" and select "Copy names"...

biggrin.gif

edit:
"Album list panel" = the foo_uie_albumlist plugin, in case you're wondering...
bustacap2k3
Thanks Cosmo! Your method works like a champ. Using my own webserver and PHP, I have a way to number the albumlist, if anyone else is wondering. Copy the albumlist that you got by using Cosmo's method into a txt file called playlist.txt and drop it in the same directory as a PHP file containing the following code:
CODE
<?
$filename = "playlist.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
$playlist = explode("\n", $contents);
for ($i = 0; $i < count($playlist); $i++) {
$vis = $i + 1;
echo "".$vis.". $playlist[$i] <br>";
}
?>

Load up whateveryoucalledit.php from your webserver, and your list will be complete, numbered and all.

Thanks again, Cosmo! biggrin.gif
bustacap2k3
I whipped up some quick PHP to further parse the list into an HTML table that looks kind of nice, if anyone is interested:
(I slightly modified Cosmo's code to include genre and be parsed correctly with PHP)
Foobar: Copy Command:
CODE
$if($strcmp($num(%tracknumber%,2),01),[%artist%][ -- %album%][ -- %date%][ -- %genre% ])

Foobar: Album list panel view string:
CODE
Name: albumlist
Value: $if($strcmp($num(%tracknumber%,2),01),[%artist%][ - %album%][ - %date%][ - %genre% ])
Remember, once you copy your playlist, save it as 'albums.txt' in your webserver.

albums.php (or whatever you want to call it):
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Album List</title><style type="text/css">
<!--/*--><![CDATA[/*><!--*/
body {
 background-color: #000;
 padding-bottom: 0 !important;
 padding-bottom: 35px;
 }
table {
 width: 85%;
 margin: 35px 0px;
 border: 1px solid #575757;
 background: #212121;
 font: 10px Verdana, Arial, Helvetica, sans-serif;
 text-align: left;
 color: #fff;
 }
td {
 border-right: 1px solid #666;
 padding: 3px;
 }
#header {
 font-weight: bold;
 background: url(img/playlist_bg.png) repeat-x 0% 0%;
 }
#header td {
 border-right: 0;
 border-bottom: 1px solid #666;
 }
.stripe {
 background: #333;
 }
.last {
 border-right: 0;
 }
/*]]>*/-->
</style>
</head>
<body><center>
<table cellspacing=0>
<tr id="header">
<td>&nbsp;</td><td>Artist</td><td>Album</td><td>Year</td><td

class=last>Genre</td></tr>
<?php
$filename = "albums.txt"; $handle = fopen($filename, "r"); $contents = fread

($handle, filesize($filename)); fclose($handle); $playlist = explode("\n",

$contents);
for ($i = 0; $i < count($playlist); $i++) {
  $xx = explode(" -- ", $playlist[$i]);

  $vis = $i + 1;
  $mod = $vis % 2;
  if ($mod == '0') {
      $str = 'class=stripe';
  } else {
      $str = '';
  }
  echo "<tr $str><td width=10 align=left>" . $vis . "</td><td>$xx[0]

</td><td>$xx[1]</td><td>$xx[2]</td><td>$xx[3]</td></tr>";
} ?></center></body></html>
PS: sorry for the messy code, I wrote this pretty quick. Overall, I think it looks pretty clean/neat.

Edit: Code touchups.
Cosmo
I'm glad to have been helpful. Cheers to you for sparking the idea! I will be making use of this myself (in a slightly different way) ... and I probably wouldn't have thought of using this method if it wasn't for coming across this thread.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.