Hi Rob,
2009/6/5 Rob Canning <[email protected]>:
> i would like to have a playlist
>
> song1.ogg
> song2.ogg
> song3.ogg
> song4.ogg
> etc.
>
> i would like these songs to be played randomly
The only trick is not to look at the random() operator. Random is for
switching from one source to another randomly. All you need here is a
playlist that creates its stream from tracks, in a random order:
songs = playlist(mode="randomize","file.txt")
In fact you don't need to specify mode="randomize" because it's the
default. Your file.txt is just a plain text file with one filename
(absolute path is safer) per line.
> i would also like to have little fillers between them like
The best solution is append. It takes a source and a function which,
given the metadata of the current track, builds another source from
which one track will be taken for appending.
def example(meta)
single("/path/to/humanreadsmetadata" ^ basename(meta["initial_uri"])
end
songs_filled = append(songs,example)
You can also use a more complex function for computing the name of the
filler track, or call an external script written in your favorite
language. Another option is to attach the filler's name to the track
URI, by writing your playlist as:
annotate:filler="filler1.ogg":/path/to/song1.ogg
annotate:filler="filler2.ogg":/path/to/song2.ogg
annotate:filler="filler2.ogg":/path/to/song3.ogg
Now all you have to do in the append function is get that metadata:
def example(meta)
single(meta["filler"])
end
Have fun.
--
David
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users