Archive for the 'News' Category
April 24th, 2007
This article will build up an absurdly complex playlist tree query from a simple example.
Requirements:
- foo_cwb_hooks
- playlist tree panel
- foo_playcount (official)
- well tagged library
Step 1 – Music from the 60′s
Make sure you have a playlist tree panel in your layout. Then create a new query from the main menu by selecting “Libary->Playlist Tree->Root->New Query…” and fill in the fields with the following information:
Label: <Your choice>
Source: @database
Criteria: date GREATER 1959 AND date LESS 1971
*** Note, it is IMPORTANT that GREATER and LESS and AND be ALL CAPS
Format: $replace(%path%,\,|)
Maximum: 0
Population Sort Order: <blank>
Sort by Display Name: Checked
Automatically Refresh: Unchecked
Now, click Ok, and the query result should show up based on where they are located on your computer.
Step 2 – … And Rating > 2
Middle click, or right click while holding shift, on the query you created in Step 1, and change the criteria.
New Criteria:
date GREATER 1959 AND date LESS 1971
AND rating GREATER 2
Step 3 – … And Songs 4-6 Minutes in Length
New Criteria:
date GREATER 1959 AND date LESS 1971
AND rating GREATER 2
AND %length_seconds% LESS 360 AND %length_seconds% GREATER 240
Step 4 – … And Not Heard in the Last Week
New Criteria:
date GREATER 1959 AND date LESS 1971
AND rating GREATER 2
AND %length_seconds% LESS 360 AND %length_seconds% GREATER 240
AND (“$cwb_datediff(%last_played%,%cwb_systemdate%)” GREATER 7 OR NOT %last_played% HAS 20)
Step 5 – … And By Bob Dylan
New Criteria:
date GREATER 1959 AND date LESS 1971
AND rating GREATER 2
AND %length_seconds% LESS 360 AND %length_seconds% GREATER 240
AND (“$cwb_datediff(%last_played%,%cwb_systemdate%)” GREATER 7 OR NOT %last_played% HAS 20)
AND artist HAS bob dylan
Step 6 – … In Scheme
To use the built in scheme language, you must change the source to @scheme.
Then, you can enter the scheme code into the format field. For doing your own scheme queries, I suggest using an editor that knows how to edit scheme code such as Emacs, then copying and pasting the code into Playlist Tree’s format box.
The following code will give you basically the same query as step 5, but in scheme.
Source: @scheme
New Format:
(let ((filter
(string-append
;; Notice that this filter string is basically the same as we used in the traditional query
;; We can use any traditional query strings here to select which songs we want
“date GREATER 1959 AND date LESS 1971″
” AND %length_seconds% LESS 360 AND %length_seconds% GREATER 240″
” AND rating GREATER 3″
” AND (\”$cwb_datediff(%last_played%,%cwb_systemdate%)\” GREATER 7 OR NOT %last_played% HAS 20)”
” AND artist HAS bob dylan”)))
(for-each-db-entry
(lambda (handle)
(let ((artist (format-title handle “%artist%”))
(album (format-title handle “%album%”))
(title (format-title handle “%title%”)))
(add-node handle (list artist album title))))
filter)
(when start-index
(play-from-playlist start-index)))
Step 7 – … Added to Album Playlists and Start Playing
New Format:
(let ((filter
(string-append
;; Notice that this filter string is basically the same as we used in the traditional query
“date GREATER 1959 AND date LESS 1971″
” AND %length_seconds% LESS 360 AND %length_seconds% GREATER 240″
” AND rating GREATER 3″
” AND (\”$cwb_datediff(%last_played%,%cwb_systemdate%)\” GREATER 7 OR NOT %last_played% HAS 20)”
” AND artist HAS bob dylan”))
(start-index #f))
(for-each-db-entry
(lambda (handle)
(let* ((playlist-name (format-title handle “** %album%”))
(index (find-or-create-playlist playlist-name)))
;;; store the index of the first playlist we make
(when (not start-index)
(set! start-index index))
(add-to-playlist handle index)))
filter)
(when start-index
(play-from-playlist start-index)))
Step 8 – … And Hooked Up To a Button
If you look in the main menu under Libary->Playlist Tree->Refresh you should see options for refreshing all of your scheme queries. To hook up a scheme query to a Columns UI button, make sure you have a button toolbar somewhere in your layout.
Then:
- Right click on the buttons and select “Customize…”.
- Add a new button by clicking the Add button
- Select the “Change…” button to select the action.
- Select “Main Menu Items” from the command group
- Select “None” for the item group
- Find in your the command list “Libary/Playlist Tree/Refresh/<Your Query>”
- Click Ok.
- Change the Display to “Text”
- Check “Use Custom Text”
- Enter some text in there that will refer to the query.
When you are done, a new button should have shown up in your button layout with the label you provided. You can now click on that button to refresh the query which will run the scheme code and begin playing some good old school Bob Dylan that you haven’t listened in a while.
April 23rd, 2007
With the end of Easter comes the much awaited PanelsUI v0.10.0. Terrestrial has been hard at work resolving a number of issues, specifically related to the powerful new sort/group criteria.
Without further adieu,
0.10.0
- Window size/position stored in pui
- FILTER: button sorts by current sort/group
- Tray context menu
- SORTGROUP_PRESET:index button (where index is the number of the preset)
- $sortgroup_preset(index) returns the name of the specified preset.
- %sortgroup_preset_count% returns the number of presets
- %sortgroup% to get the name of the current sort/group criteria
- Changed $playlistname() to %playlistname%
- %sortgroup% returns the current sort/group.
- %groupformat% (only valid in SCPL “Group Display”) to get the current group by string.
- “Singles” layout is chosen as default. Use this + %groupformat% to handle different grouping criteria dynamically.
- Changed base path to be relative to layout folder.
eg. if you have your pui in ..\foobar2000\PanelsUI\MyTheme\MyTheme.pui
then /images\myimage.jpg would be:
..\foobar2000\PanelsUI\MyTheme\images\myimage.jpg - Customizable double click / middle click actions
- Sort/group settings are remembered by playlist name and applied on playlist changes
- + misc bug fixes / tweaks
This version also comes with some much improved sort/group criteria defaults for artist, album, date, folder, rating, random and type. If you are using PanelsUI v0.9+ already, to see these defaults you will have to remove the panels component, open fb2k and select “no” when it asks if you want to save settings, then close fb2k, re-add the component and open. You will have to select your pui again and you will lose your home-made sort strings, so back them up first.
Same ol’ link: Download
I am presently working on a compatible FofR Config v0.7 (which uses the defaults in v10), soon to be coming to a town near you.
April 19th, 2007
Intro
Playlist Tree began as a playlist manager that builds playlists as trees. Most audio players use a list based approach to playlists, but I wanted to be able to create hierarchies in my playlists, so that I could have greater control of how I listened to music.
Playlist Tree has become one of the most powerful playlist managers that I have used. That power comes at a price of a fairly steep learning curve to use it to its full potential.
PT acts a Columns UI Panel, and this article will assume that you already known how to make the PT Panel appear in your layout. If you don’t know how to operate Columns UI, please ask someone other than me . This article also assumes some familiarity with foobar2000 titleformatting.
Nodes
PT has 3 types of nodes in its trees. First, it supports nodes that represent a single playable item. These items can be dropped onto the playlist tree panel from a playlist view or from the Windows Explorer. Second, it has what I refer to as static folders, which can contain playable items or other static folders, or the third type of nodes, the query. Queries are what give PT its power.
All of these nodes can be moved around by dragging and dropping them in the panel, and items can be copied rather than moved if you hold down shift when you begin dragging.
When you drop folders from windows explorer, it will create folders for each directory, and subdirectory, and playable nodes for audio files.
Queries
Queries are PT’s automatic playlists. They let you enter the criteria for which tracks should show up in the results, and how you want the results to be laid out in the tree. They also let you place limits on the size of resultant list in the form of number of tracks, duration, filesize and number of subfolders.
Source
(More here)
Source instructs PT which files to use as possible candidates for the playlist. In most situations @database is probably the desired source. But other sources exist such as @drop<> for using playlists and directories as a source, @node<> for using other tree nodes as source and @playlists and @playlist
Criteria
Criteria lets you prune files from your source. If you want all the files in the source to show up in the resultant tree, then leave the criteria blank. Otherwise, you can use the same syntax as foo_playlist_gen to remove non-matching tracks. For example, if you wanted only tracks by the Beatles that you have rated 4 or higher, you can use “artist HAS beatles AND rating GREATER 3″ for your criteria.
Format
Format specifies how the resultant playlist will be arranged. It use the foobar2000 titleformatting syntax. Tree layers are split using the | character. If you wanted all the files to be put into folders based on their artist, then the album and finally the title, the format string would look like “%artist%|%album%|%title%”.
Population Sort Order
Population sort order determines the order in which songs go through the playlist generation process. Its especially useful when you are using the maximum options. For example, if you wanted a list of 10 random songs, you would set the Population Sort Order to “$rand()” and the maximum to 10 tracks.
Playlist Generation Process
Under the hood, the tree in a query basically gets generated like this:
- 1 – make a list of all possible songs based on source
- 2 – sort the list based on population sort order.
- 3 – prune off items that don’t match criteria
- 4 – for each item, add it to the tree based on format.
- 5 – stop if you reach the end of the list or hit the maximum whatever.
- 6 – if Sort by display name is check, sort by display name.
Random Things You Should Know
If you hold shift while dragging and dropping nodes, you can make a copy rather than move.
By default, right clicking on a node will give the normal foobar2000 context menu options, holding down shift while right clicking or middle clicking on a node will give you the playlist tree specific context menu. (These are configurable)
PT is very configurable. To get to the preferences select File->Preferences from main menu, then look under Media Library->Playlist Tree Panel.
You can configure what happens when you select, double click, and middle click on nodes.
PT adds its main menu options under Library->Playlist Tree.
In addition to the main Playlist Tree panel, PT also adds a Playlist Tree Search panel you can use in your Columns UI layout to quickly search your trees.
You probably also want my foo_cwb_hooks plugin.
I like getting email from people who enjoy using my programs. I also keep track of bugs and feature requests. If you have questions on how to do something, please use the forums. Other people may benefit from the information or respond that way. My email is chris@bowron.us
The playlist tree discussion on the foobar2000 forums is here
I maintain my own forums here
I make and distribute PT because I enjoy using it myself, and I think others also enjoy it. But I also have a job, a fiancee, a mortgage payment, and a life. I wish I could implement every cool feature people suggest and respond to everyone’s post, but I have a limited amount of time that I can spend on this, so please forgive me if you don’t hear back from me on a bug or a feature request or a question.
Scheme
As of version 3.0.0, PT contains an embedded version of the Scheme programming language. This is intended for advanced users.
The embedded scheme has the following benefits:
- 1 – It is a real programming language with things like conditionals and loops.
- 2 – Because it is a real programming language, you can do things that are flat out impossible with a normal playlist tree query.
- 3 – Because it is a real programming language, I can add ways to script foobar2000 actions.
- 4 – It’s easier to use than foobar2000 titleformatting for complex tasks (when you get the hang of it).
- 5 – It’s hardcore.
See the MORE section for more information and links to examples.
MORE
More information about playlist tree can be found on the components homepage here.
More information about the embedded version of scheme in playlist tree can be found at here. I also suggest finding on online scheme tutorial or the book “The Little Schemer”.
Example queries can be found at here.
April 19th, 2007
Things have been a little quiet in the foobar department lately, maybe a lot of us packed it in for the Easter break or are too busy with Finals or whatever, I personally had to endure a 12,000 word essay on the distribution of internet services throughout the home.
Anyway, onwards and upwards, on April 15th a new beta version of fb2k was unveiled, the changelog is as follows:
0.9.4.3
-
Fixed multiple bugs in ReplayGain Scanner (Peter (fb2k developer) says: “Crash on high-sample-rate input, rare GUI glitches – nothing that affected results”)
-
Musepack decoding bug fixes
-
Fixed a rare crash in the Properties dialog
-
Fixed bugs in File Types preferences page
You can download this beta fromĀ foobar2000.org. The Hydrogen Audio topic can be found here.
April 2nd, 2007
Terrestrial has updated his PanelsUI component again, this time implementing a major new sort by/group by dialogue and configuration, as illustrated below:
This allows for some very powerful new sorting and grouping layouts. The system uses discretely defined criteria for sorting or grouping which can be edited and added to. For instance Album, Artist, Date, etc. when in the small edit box, to group and sort by left click, to simply sort by just right click. To remove the criteria click again.
SCPL has also had some updates, allowing multiple SCPL codes to be used in a single panel, which can be switched between based on sort mode. For instance, in an SCPL panel named “playlist” there could be two completely separate sets of code, say Album and Single, then when grouped by album is selected the first SCPL shows, when grouped by anything else singles could show (it’s really up to the user because everything is extremely configurable).
Before you upgrade
There are some things to be aware of, first this new system completely removes the original SCPL “group by” dialogue – any code in that section will disappear on loading up your pui using PanelsUI 0.9+. Make a backup of your .pui file.
What’s more, sorting mechanisms in configurations such as FofR v0.6 and Brumal’s config are now incompatible and will cease to work correctly.
Most Previous configuration releases are incompatible.
My release of v0.7 (a compatibility update) has been delayed because all sorting and grouping information is NOT stored in the pui – instead it is placed in a users fb2k configuration file (.cfg). If I release a configuration under this guise sorting and grouping will not work the same on each persons machine, as a result installation will be more complicated – I cannot conceive releasing a configuration that requires its users to spend 20 mins adding sort/group commands to their fb2k, considering the difficulty of getting everything to work smoothly for everyone when there is just one variable to change! The removal of the group by dialogue also prevents backwards compatibility.
So whilst this update is very powerful I recommend that users happy with their configurations hold off for a short while.
Same URL as usual:
Download
I am presently lobbying for a number of things at HA, firstly the inclusion of sort/group by configuration strings and the SCPL selector code within a PUI so they can be theme based. Secondly for the possibility of installing sort by commands upon a theme installation and thirdly a set of default sort standards (the development of these hasn’t been met with much enthusiasm). Sadly, the Foobar and HA way is never in favour of making things easy for the person that just wants everything to work.
Changelog:
0.9.2
- misc bug fixes / tweaks
- delay load uxtheme.dll to support win2k
- $playlistname() to get the playlist name
- $sortidx(name) returns the sort index or false if not sorted
- sort/group presets in main menu (view / panels ui / sort\ group by)
- $extra(FOOBAR2000_VERSION)
0.9.0
- New sorting/grouping system