Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-04 01:56:26

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

populate a flash playlist using article posting

is there a way to have textpattern populate a playlist file if something new in that category is posted? for example, in many flash players they use an xml file, and if you want to add a file to the playlist you go in and edit it manually. i’m looking for a way to automatically update that xml file by posting in the articles though.

playlist options

also, is there any way for textpattern to track the amount of plays an audio file gets?

Last edited by mrtunes (2008-12-04 01:57:29)

Offline

#2 2008-12-04 02:22:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: populate a flash playlist using article posting

mrtunes wrote:

is there a way to have textpattern populate a playlist file if something new in that category is posted?

Yes. I’ve done this sort of thing but with a slightly different approach. Just get your flash player to point to a special TXP section that generates the XML playlist for you on-the-fly and feeds it to the flash player. That way you always get the most up-to-date info from the category. Have a look at how to do it with images and adapt from there.

The general idea is:

<object some_param="<txp:site_url />xml">
   <param name="blah blah">
</object>

where xml is a section in your site, with an associated page that begins with a call to the incredibly useful plugin mg_setheader. The XML structured data follows it, with calls to TXP tags littered inside to grab the dynamic content.

For example, in your XML-generator page you can read stuff from custom fields in an article to change where you get the playlist files from.

is there any way for textpattern to track the amount of plays an audio file gets?

If it’s in the files directory and you refer to the files in your playlist XML file with http://site.com/file_download/id/filename then TXP will count the “downloads” (a.k.a. plays) for you. But remember to add a robots.txt file to exclude (good) bots from downloading files, or you’ll get misleading counts.

Last edited by Bloke (2008-12-04 02:30:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2008-12-04 08:01:57

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: populate a flash playlist using article posting

hey thanks for getting back to me so fast. i was able to get started right away. i almost got it working! i figured out how to do it with posts that don’t go onto the normal blog, but it would be great to do it with articles that belong to the default form so it automatically adds certain posts to the player – the player acts as a summery of the latest podcasts.

let me explain where i’m at right now:

Created a section called xml, with the page xml:

<txp:mg_setheader /><?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
	<trackList>
<txp:article_custom form="playlist-dummy"  />
	</trackList>
</playlist>

Created a form called playlist-dummy

<track>
<title><txp:title /></title>
<location><txp:custom_field name="podcast-url" /></location>
<info><txp:permlink /></info>
</track>

If i make a new post, i fill in the custom field called podcast-url, and set the section to xml, then it works.

how do i integrate this with a standard form?

<div id="post"><h3><txp:permlink><txp:title /></txp:permlink> </h3><small><txp:posted /></small>
<txp:if_excerpt>
		<txp:excerpt />
		<txp:permlink>Read more</txp:permlink>
	<txp:else />
		<txp:body />
	</txp:if_excerpt>
</div>

Somewhere in there it has to do something like “if category=podcast”, take certain fields and send them to the playlist-dummy form. or if you have the unlimited categories plugin set up you can activate the post using that.

Last edited by mrtunes (2008-12-04 08:03:01)

Offline

#4 2008-12-15 02:45:51

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: populate a flash playlist using article posting

just wanted to post back here to emphasize how useful the mg-setheader plugin is for a variety of uses, mainly in working with media files and rss feeds. check out the author’s article on podcasting with textpattern

you could in theory do even more stuff for music websites. for example if you make every song you upload an article, you can make various playlists around a website simply by making that article part of a particular category with rss_unlimited_categories. ie a category called “frontpage_playlist” and then the name of the album it’s from can be another category where you will make a different playlist deeper in the site.

very neat stuff.

Offline

Board footer

Powered by FluxBB