README 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310
  1. README for Plait v 1.6.2
  2. ========================
  3. 0. Introduction
  4. ---------------
  5. Plait (pronounced "play") can do two things for you: find and play
  6. music from your personal music library, and find and play Shoutcast
  7. radio streams. In order to actually play the music it finds, Plait
  8. hands off a play list to one of the supported music players (iTunes,
  9. Winamp, Beep Media Player, Xmms, amaroK, mpg123, ogg123, mpg321, XSPF
  10. Web Music Player, or Plaiter). The end result is that you can type,
  11. for example,
  12. plait "miles davis"
  13. and any music by Miles Davis that you own will begin playing in your
  14. music player. More complex commands allow you to play mixes of
  15. several albums or artists, read complex mixes from files, reorder the
  16. play list according to one of several patterns, select a certain
  17. number of tracks, queue tracks, send commands to the music player, and
  18. more.
  19. I wrote Plait because I was looking for an alternative to tedious
  20. point and click digging through my music library, on the one hand, and
  21. tedious typing of long file names, on the other. The solution used by
  22. Plait is based on "hints", which are basically fragments of song
  23. titles, artist's names, or album names. You specify as many hints as
  24. needed to get exactly the music you want. For example, rather than
  25. typing out the complete file name
  26. "/music/Billie Holiday/Ken Burns Jazz/Solitude.wav"
  27. or digging through a file requester to find this file, with Plait one
  28. types
  29. plait billie solitude
  30. When you already know exactly what you want to hear, this is really
  31. the quickest and easiest way to let the computer know (and when you
  32. don't know exactly what you want to hear, Plait has an interactive
  33. mode that allows you to browse tracks, albums, artists, and radio
  34. streams.)
  35. Even though it searches the entire music library every time it creates
  36. a play list, Plait is optimized for these types of queries (it caches
  37. your music directory) and can perform them very quickly. With a
  38. medium sized music collection of about 3,000 tracks, queries take less
  39. than a second. On Cygwin, which can be slow, queries take a little
  40. longer-- about 2.5 seconds on a 700 mhz system.
  41. 0.1 What's new
  42. ---------------
  43. Release 1.6.2 is a security upgrade which cleans up all security flaws
  44. related to temp files.
  45. Release 1.6.1 is a maintenance release to track recent changes in the
  46. Shoutcast.com web site. You will need it if you want to continue
  47. running stream queries.
  48. 1. About that name...
  49. ----------------------
  50. "Plait" is French for "it pleases," because it is so pleasing to use.
  51. It also suggests the soundalike English word "play," which describes
  52. what it actually does. You might say it's a plait on words. At one
  53. point in the misty past, Plait was known as "play," but that name was
  54. taken.
  55. 2. Searching your music library
  56. -------------------------------
  57. Plait doesn't make any assumptions about the layout of your music
  58. library, but the better organized it is, the more useful the searches
  59. you can do. Ideally your file paths contain artists, albums, and song
  60. titles. In that case you can provide a hint about an artist and get
  61. all the material by that artist:
  62. plait mingus
  63. You can provide a hint which matches just one album:
  64. plait "kind of blue"
  65. Or you can match a single song
  66. plait "blue in green"
  67. (Although examples like these will typically "just work," keep in mind
  68. that Plait doesn't actually know that "Kind of Blue" is an album or
  69. Mingus is an artist. If you have a song named "Mingus", it will play
  70. also. Other options were considered, but this method is the easiest
  71. to use, and it seems to work very well. In fact, it is almost always
  72. possible to create a hint that picks exactly the music you want. See
  73. the section on advanced hinting for more information.)
  74. Because Plait scans your entire music library when matching hints, you
  75. are not limited to results from one directory. So if you have a
  76. compilation album that is distributed by artist throughout your
  77. collection, you can play the whole thing by searching for the album
  78. name. Similarly, you can play an entire album series, as in
  79. plait --random "ken burns jazz"
  80. This type of matching is also useful when you want to play several
  81. cover versions of the same song.
  82. Querying the entire music library for songs rather than finding files
  83. by directory also helps resolve some problems of categorization that
  84. come up when ripping a CD collection. If you rip Cecilia Bartoli's
  85. "Vivaldi Album," for example, do you store that as
  86. /music/Vivaldi/The Vivaldi Album feat. Cecilia Bartoli
  87. so that you can play it as Vivaldi music, or
  88. /music/Cecilia Bartoli/The Vivaldi Album
  89. so that you can play it as Cecilia Bartoli music? With Plait, it
  90. doesn't matter because, either way, the album will turn up when you
  91. type `plait cecilia` or `plait vivaldi`.
  92. Sometimes one hint is not enough to say exactly what you mean, so
  93. Plait does not place any limit on the number of hints you can specify.
  94. This comes in handy when you have a song title that is used by more
  95. than one artist. In my music collection, for example, if I type
  96. plait "walk on"
  97. I will hear "Walk On" by Neil Young, "Walk On" by U2, and the album
  98. "Walk On" by John Hiatt (which includes a song named "Walk On").
  99. Additional hints allow me to disambiguate:
  100. plait "walk on" neil # Neil Young's version
  101. plait "walk on" u2 # by u2
  102. plait "walk on/" # the album by John Hiatt
  103. plait "walk on[.]" hiatt # just the song
  104. (The last two examples are a little tricky. They work by matching the
  105. path separator or the dot in ".mp3". See the section on advanced
  106. hinting for more ideas.)
  107. This feature also comes in handy when you want to avoid typing a long
  108. song title, but the short hints available are ambiguous. If I use the
  109. hint "someday" for example, I get "Someday" by the Strokes, and
  110. "Someday We'll All Be Free" by Charlie Hunter. The command
  111. plait charlie someday
  112. gives me exactly what I want. Feel free to use hints that are easy to
  113. remember rather than trying to be efficient. That is one of the
  114. purposes of hinting, beyond just putting you on a first name basis
  115. with your favorite artists (or you could type `plait someday be` and
  116. save a few keystrokes; it's up to you).
  117. There is an implicit logical "and" between the hints in these
  118. commands, although you do not need to think of it that way if you are
  119. a non-programmer. In any case, you get just the songs that match
  120. *all* the hints, rather than any of the hints. (As we will see later,
  121. there is another type of search in which there is an implicit "or" and
  122. you get songs that match *any* of the hints.)
  123. Sometimes positive assertions about the music you want to hear are not
  124. sufficient to say exactly what you mean. For these situations the
  125. `not` keyword, which allows you to exclude songs that match a hint, is
  126. provided. As an example, the following command plays some music by
  127. Herbie Hancock, leaving out one track that I set aside for special
  128. occasions:
  129. plait herbie not rockit
  130. You can use as many "not" hints as you like, but you have to make at
  131. least one positive assertion about the music you want to hear, and it
  132. has to be the first hint on the command line. Therefore
  133. plait not miles
  134. will look for a song named "not" by Miles Davis. This is intentional.
  135. If you really want to hear random selections from almost your entire
  136. collection, you can just use a very broad positive assertion, as in
  137. plait --random ".*" not miles
  138. (".*" is a regular expression that matches anything. See the section
  139. on advanced hinting.)
  140. The features explained so far allow you to pick out a particular
  141. track, artist, album, or series, but sometimes you are interested in
  142. mixing together material from several artists or albums. In that case
  143. you will want the `--mix` option, which picks tracks that match *any*
  144. of your hints rather than all of them. For example
  145. plait --mix metheny hunter "tj kirk" "broun fellinis"
  146. will create a play list with a selection of jazz artists. Because it
  147. allows me to do something that would be totally impractical with CDs,
  148. the ability to make mixes has changed my listening habits more than
  149. any other feature of Plait.
  150. 3. Playing radio streams
  151. -------------------------
  152. Plait can search the Shoutcast web site, find stations matching your
  153. query, and play them in your music player. If you are interested in
  154. hearing trance music, for example, you might try
  155. plait --stream trance
  156. You can use a hint that contains spaces by enclosing it in quote
  157. marks, as in
  158. plait --stream "modern jazz"
  159. As of Plait 0.53, stream queries support multiple hints and the `not`
  160. keyword, just like music library queries. This allows you to search
  161. for radio stations much more selectively than before. The `--mix`
  162. keyword is also supported, but not the `as` keyword or mix files. The
  163. current thinking is that these features would be of limited usefulness
  164. with streams.
  165. Genre hints work well, because the Shoutcast directory includes a
  166. genre in the description of each radio station, but you can try other
  167. types of search, including by station name, call letters, artist or
  168. country.
  169. By default, you get the most popular stations matching your query, but
  170. if you don't like the popular stations in a certain genre, you can mix
  171. things up with the `--random` option (see below). For performance
  172. reasons, Plait limits you to ten streams (because they take a while to
  173. load into the music player), but you can request more with the
  174. `--tracks` option. In interactive mode, the number of streams is
  175. unlimited.
  176. Examples:
  177. plait --stream --random --tracks 5 jazz not smooth
  178. plait --stream 70s
  179. plait --stream bachata
  180. plait --stream NPR -i
  181. 4. Mix Files
  182. -------------
  183. As you make more complex mixes you may begin to use so many hints that
  184. they become inconvenient to type. At this point you will be ready for
  185. mix files. Once you have created an appropriate mix file with a hint
  186. for each jazz artist in your collection, for example, you can type
  187. plait --mixfile jazz --random
  188. to play random selections from your entire jazz collection. Creating
  189. mix files is easy because they are just text files with lists of
  190. hints, but Plait is also capable of creating mix files for you. First
  191. let's look at creating a mix file by hand. Mix files are stored in a
  192. subdirectory of your music directory. Specifically, if your music
  193. directory is /music, the mixfiles are at /music/.plait/mixfiles.
  194. (Storing them here rather than in plait's working directory allows you
  195. to continue using your mix files when you are accessing your music
  196. collection as a guest on someone else's computer.) To create a mix
  197. file for jazz, then, you might type the following into
  198. /music/.plait/mixfiles/jazz:
  199. "billie" "blakey" "brubeck" "coltrane" "dolphy" "getz"
  200. "hunter" "metheny" "miles" "mingus" "ornette" "rollins"
  201. "scofield" "stanton" "surman" "thelonious"
  202. (The hints should be separated by spaces or line feeds. It is only
  203. necessary to enclose a hint in quote marks if it contains a space.)
  204. That's all there is to it.
  205. Plait also has a simple syntax for creating mix files automatically,
  206. using the `as` keyword. For example, the following command creates a
  207. mix file and plays some cuts from it simultaneously:
  208. plait --mix galactic "scott amendola" "oranj symphonette"
  209. as postjazz
  210. The `as` keyword also comes in handy when you need to maintain mix
  211. files. Let's say you have a jazz mix file and you acquire some new
  212. music by Herbie Hancock. You can add him to the jazz mix as follows:
  213. plait --mixfile jazz herbie as jazz
  214. If Herbie Hancock were already in your jazz mix, no harm would be
  215. done--Plait makes sure that each hint occurs exactly once.
  216. You can use more than one mix file with a `plait` command. This allows
  217. you to create a "mix of mixes," for example:
  218. plait --mixfile jazz --mixfile postjazz as alljazz
  219. In general, you can combine mix files and hints freely on the command
  220. line, allowing you to play variations on a given mix depending on your
  221. mood:
  222. plait --mixfile jazz not miles not ornette
  223. Because they are based on hints, mix files have some of the features
  224. of play lists and some of the features of genres. As with play lists,
  225. a given artist can be included in as many mix files as you like. This
  226. allows you to create free form, overlapping categories for artists,
  227. rather than being forced to assign each artist to a single fixed
  228. category. As with genres, on the other hand, once an artist belongs
  229. to a mix, any new music you purchase by that artist is automatically
  230. added to the mix. In this sense mix files are more dynamic than play
  231. lists.
  232. (By the way, nothing said here should be taken to mean that mix files
  233. always have to consist of artist hints. That is probably the typical
  234. case, but there is nothing to prevent you from using album hints or
  235. song hints in your mix files.)
  236. Since you create mix files yourself, they require a little more work
  237. than genres, which can probably be assigned using automated tools.
  238. But it really doesn't take long to create mix files, and you will find
  239. that the added flexibility is worth the effort.
  240. 5. Playlist optimization
  241. -------------------------
  242. When you create a mix featuring two artists, it is most likely that
  243. you would like to hear approximately the same number of tracks from
  244. each artist. But if, for example, you have 6 albums by artist A and
  245. only 2 by artist B, tracks by artist A will dominate the playlist
  246. Plait creates. As of Plait 1.2 there is a playlist optimizer which
  247. addresses this problem by balancing the playlist. It has other nice
  248. features as well.
  249. You need to enable the playlist balancer by setting a track count with
  250. the `--tracks` option; otherwise you get the old behavior where Plait
  251. selects all the tracks that match your hints. There are special
  252. symbolic track counts which control the behavior of the playlist
  253. balancer. Some examples will clarify:
  254. plait -l --mix "miles davis" "charles mingus" --tracks all
  255. This command creates a playlist with all the available tracks from
  256. Miles Davis and Charles Mingus. This is also the default behavior if
  257. you don't specify a track count.
  258. plait -l --mix "miles davis" "charles mingus" --tracks min
  259. This command determines the number of tracks in the smallest hint
  260. group and then creates a balanced playlist by selecting that number of
  261. tracks from each group. Some tracks from larger hint groups will be
  262. skipped.
  263. plait -l --mix "miles davis" "charles mingus" --tracks max
  264. This command determines the number of tracks in the largest hint group
  265. and then creates a balanced playlist by selecting that number of
  266. tracks from each group. Some tracks from smaller hint groups will be
  267. repeated.
  268. plait -l --mix "miles davis" "charles mingus" --tracks avg
  269. This command determines the average number of tracks per group and
  270. then creates a balanced playlist by selecting that number of tracks
  271. from each group. Some tracks may be skipped and some tracks may be
  272. repeated.
  273. plait -l --mix "miles davis" "charles mingus" --tracks 20
  274. This command creates a balanced playlist with approximately 20 tracks.
  275. Tracks may be skipped or repeated depending on the particular count
  276. you specify and the number of tracks in the source playlist.
  277. Because Plait is designed to create unique playlists every time you
  278. run it, there is a lot of random fudge in the algorithm that balances
  279. playlists. The track counts you specify are just goals; they are
  280. translated into a probability that tracks from each group will be
  281. selected and this is combined with a random number to determine
  282. whether each track is selected. As a result, the playlist will
  283. contain a number of tracks close to the goal you specify but not
  284. necessarily exactly the same.
  285. #### Weighting the balance
  286. It's not always the case that you want to hear exactly equal amounts
  287. of music from each artist, and Plait provides a simple way to weight
  288. the balance when you don't, by repeating hints. The following command
  289. creates a mix with more tracks by Miles Davis than John Coltrane:
  290. plait -l --mix davis davis coltrane --tracks 15
  291. This sets a 2:1 ratio between Miles Davis tracks and John Coltrane
  292. tracks as a goal. Depending on the content of the source playlist,
  293. the goal may or may not be achieved exactly. Tracks will not be
  294. repeated in order to achieve the goal; the effect of repeating hints
  295. is just to give each track a "second chance" in the case where it is
  296. not printed the first time it matches a hint.
  297. This technique can be used to generate a playlist with a featured
  298. artist or featured album, for example
  299. plait -l --mixfile jazz 58 58 --tracks 30 --stripe
  300. This command creates a playlist with a variety of Jazz tracks, but
  301. featuring the album "'58 Sessions" by Miles Davis.
  302. #### Patterns
  303. The playlist optimizer also allows you to order the tracks in the
  304. playlist according to one of several patterns:
  305. plait -l --mix "miles davis" "charles mingus" --tracks 15 --sort
  306. The --sort option causes the tracks to appear in sorted order
  307. plait -l --mix "miles davis" "charles mingus" --tracks 15 --stripe
  308. The --stripe option picks one track matching hint a and then one track
  309. matching hint b, in an alternating pattern. Within the stripes, the
  310. tracks appear in sorted order.
  311. plait -l --mix "miles davis" "charles mingus" --tracks 15 --stripe2
  312. --stripe2 is similar to --stripe, but within the stripes the tracks
  313. appear in random order.
  314. plait -l --mix "miles davis" "charles mingus" --tracks 15 --fade
  315. The --fade option arranges the tracks matching each hint according to
  316. a gaussian distribution. The effect is that tracks matching each hint
  317. are clustered around a certain position in the playlist and appear
  318. less frequently as you move away from that position. Thus each
  319. section of the playlist focuses on one artist, but there are no rigid
  320. boundaries between the sections.
  321. plait -l --mix "miles davis" "charles mingus" --tracks 15 --random
  322. In this case tracks are arranged randomly.
  323. plait -l --mix "miles davis" "charles mingus" --tracks 15 --group
  324. The --group option groups the tracks by hint and shuffles randomly
  325. within each group.
  326. #### Target devices
  327. The final new feature of the playlist optimizer is intended to help
  328. people with a mixture of lossy and lossless encodings in their music
  329. libraries. It filters the playlist so that the encoding types you
  330. specify are either preferred or used exclusively, allowing you to
  331. create playlists that are suitable for a variety of target devices,
  332. including Hi-Fi stereos, disk-based portable music players, and
  333. flash-based portable music players. Examples:
  334. plait doors --device hifi
  335. This command selects tracks in both lossless and lossy formats. If a
  336. given track is available in more than one format, the lossless
  337. encoding is preferred. It is suitable for a home stereo with high
  338. quality audio. This is also the default device.
  339. plait doors --device medium
  340. This command selects tracks in both lossless and lossy formats. If a
  341. given track is available in more than one format, the lossy
  342. encoding is preferred. It is suitable for a disk-based portable music
  343. player.
  344. plait doors --device compact
  345. This command selects tracks in the mp3 format only. It is suitable
  346. for a flash-based portable music player like the iPod Shuffle.
  347. You can define your own target devices or change the default device in
  348. the config file. See section 10.
  349. In all cases, two files are considered to be the same track in
  350. different formats if the file paths are identical except for the
  351. extension. Thus the following two files are considered to be the same
  352. track in two different formats:
  353. /music/Miles Davis/Kind of Blue/Blue in Green.wav
  354. /music/Miles Davis/Kind of Blue/Blue in Green.mp3
  355. The following two files are not considered to be the same track in two
  356. different formats:
  357. /music/WAV/Miles Davis/Kind of Blue/Blue in Green.wav
  358. /music/MP3/Miles Davis/Kind of Blue/Blue in Green.mp3
  359. 6. Options
  360. -----------
  361. These options provide finer control over the music you play:
  362. ### --list, -l
  363. Learning to use hints involves trial and error. The `--list` option
  364. facilitates this by allowing you to see what songs a hint will play
  365. without actually playing them. Its use is self-explanatory. If you
  366. like the songs listed, you don't have to run the query again to play
  367. them. Simply typing
  368. plait
  369. without any hints plays the list returned by the last query.
  370. ### --queue, -q
  371. Normally the songs found by a `plait` command will play instantly,
  372. interrupting whatever was playing when you typed the command. If you
  373. want the songs to be added to the play list, use `--queue`. They will
  374. begin playing after the previous play list completes (mpg123 and
  375. mpg321 do not support queuing, but Plaiter, which is a front end to
  376. those programs, supports queuing and several more features.)
  377. ### --random, -r
  378. By default, songs are sorted by file path. If your music library is
  379. organized by artist, album, and title, your playlists will be
  380. organized the same way. If your song names are preceded by track
  381. numbers, they will play in album order. `--random` is for those times
  382. when you want a little variety. It shuffles the play list before
  383. sending it to your music player.
  384. ### --sort
  385. Plays tracks in sorted order. --sort is also the default.
  386. ### --stripe
  387. Arranges tracks in an alternating pattern with one track matching hint
  388. a, followed by one track matching hint b, and so on until all of the
  389. hints have been used; then the pattern repeats. Within the stripes,
  390. tracks appear in sorted order. This option does not apply to stream
  391. queries.
  392. ### --stripe2
  393. Arranges tracks in an alternating pattern with one track matching hint
  394. a, followed by one track matching hint b, and so on until all of the
  395. hints have been used; then the pattern repeats. Within the stripes,
  396. tracks appear in random order. The hints themselves are also
  397. shuffled, so you get a different pattern every time. This option does
  398. not apply to stream queries.
  399. ### --fade
  400. Clusters the tracks matching each hint around a particular position in
  401. the playlist, in a gaussian distribution. Thus each section of the
  402. playlist is focused on tracks matching one hint, but there are no
  403. rigid boundaries between the sections. Within each cluster, tracks
  404. are distributed randomly. This option does not apply to stream
  405. queries.
  406. ### --group
  407. Groups tracks by hint. Within hint groups, tracks appear in random
  408. order. This option does not apply to stream queries.
  409. ### --stream, -s
  410. Plays Shoutcast radio streams (see Section 3). Examples:
  411. plait --stream --random --tracks 5 salsa
  412. plait --stream kplu
  413. plait --stream chinese
  414. plait --stream --random reggaeton
  415. ### --tracks, -t
  416. Normally, Plait plays at most ten radio stations at a time, or an
  417. unlimited number of tracks. More than that and your music player will
  418. freeze for a while, which can seem broken. This option allows you to
  419. override the default values. For example
  420. plait --mix --tracks 10 "nick cave" "nick drake"
  421. plait --stream --tracks 20 industrial
  422. As of Plait 1.2, this option behaves differently depending on whether
  423. or not you are doing a stream query. For stream queries, the track
  424. count must be a number and it is a simple limit on the number of
  425. stations that will be selected.
  426. For library queries, the track count is a goal for the playlist
  427. balancer. In addition to particular numbers, there are symbolic track
  428. counts which control the behavior of the balancer, including min, max,
  429. avg, and all. See Section 5.
  430. ### --mix, -m
  431. This option selects songs which match *any* of the hints you provide
  432. rather than *all* of them. As an example,
  433. plait --mix "broun fellinis" "stanton moore" motherbug
  434. creates a play list with tracks by three bands. This option does not
  435. effect negative assertions.
  436. ### --mixfile, -f
  437. This option causes Plait to read hints from a file. Tracks are then
  438. selected from the music library just as if you had typed the hints on
  439. the command line with the `--mix` option. See Section 4. You can use
  440. this option multiple times to specify more than one mix file:
  441. plait -f punk -f rock
  442. plait --mixfile punk --mixfile rock
  443. Just as `--mixfile` causes Plait to read hints from a file, the `as`
  444. keyword causes Plait to write hints to a file, for example:
  445. plait "neil young" "john hiatt" "nick drake" "john cale" \
  446. as folkrock
  447. In naming mix files, it is best not to use spaces. You can force
  448. Plait to accept a mix file with a space in its name by enclosing the
  449. name in quote marks, but in this case Plait will just replace the
  450. space with a dash. So
  451. plait --mix belafonte strummer as "calypso punk"
  452. will actually create a mix file named "calypso-punk". The same
  453. logic applies to the --mixfile option, so
  454. plait --mixfile "calypso punk"
  455. will correctly find the file you created. The only time you need to
  456. be aware of this rule is when you create mix files by hand--don't use
  457. spaces in their names.
  458. ### --device, -d
  459. This option specifies a target device for the playlist. The target
  460. device determines what kinds of files will be selected or preferred.
  461. There are three predefined target devices: "hifi" accepts all file
  462. types but prefers lossless encodings when a given track is available
  463. in more than one encoding; "medium" accepts all file types but prefers
  464. lossy; and "compact" accepts lossy encodings (mp3) only. It is
  465. possible to define your own target devices; see the section on
  466. customization.
  467. ### --cache, -c
  468. You need to run `plait` with this option whenever the contents of your
  469. music directory changes. Plait will rescan the entire music directory
  470. and find every new piece of music. Keep in mind that each guest
  471. configuration has its own cache. As of Plait 0.53 this option has an
  472. optional directory argument which causes the rescanning to be
  473. restricted to a subdirectory of your music library, useful for doing a
  474. quick update when you have added, renamed, or deleted music by a
  475. single artist. For example, if your music directory is /music,
  476. plait -c "David Kane Quartet"
  477. will rescan only the `/music/David Kane Quartet` directory. It only
  478. takes about a minute to scan a 3,000 track music library, so if you
  479. lose track of which directories you have scanned, you may simply want
  480. to rescan everything.
  481. Important note: if you rename an artist or album, you may have to run
  482. two cache commands to register the change correctly. If, for example,
  483. you moved music by the band R.E.M from the directory R.E.M to the
  484. directory REM, you would run the commands
  485. plait -c R.E.M
  486. plait -c REM
  487. The first command will delete old cache entries that point to songs
  488. which no longer exist. The second command will register the songs in
  489. their new location.
  490. ### --guest, -g
  491. This option provides support for multiple, named configurations. The
  492. main reason you would want this is that each configuration can have a
  493. different music directory. So if a friend has a music collection that
  494. is accessible on your LAN, he will be able to play his music from your
  495. computer. To use this feature, just provide a guest name, for example
  496. plait --guest mypal "einsturzende neubauten"
  497. The first time you use a new guest name, Plait will ask for the
  498. location of that guest's music directory. Subsequently, the location
  499. will be remembered. It is up to you to mount the guest music
  500. directory, if that is necessary. This feature should be particularly
  501. useful if you have a VPN set up, but I have not had a chance to test
  502. that.
  503. When you use a guest configuration you also get the guest's mix files
  504. (and lose your own mix files temporarily). It is done this way
  505. because mix files tend to be compatible with the collection for which
  506. they were created.
  507. ### --platform
  508. This option allows you to temporarily override the default platform.
  509. The single argument can be any of the values allowed for the variable
  510. PLATFORM.
  511. ### --coverart
  512. This option allows you to temporarily override the cover art setting.
  513. "--coverart 1" causes cover art to be located on the Amazon.com web
  514. site when creating XSPF playlists. "--coverart 0" turns off this
  515. feature.
  516. ### --interactive, -i
  517. This option selects interactive mode, in which each track or station
  518. in the playlist is presented for you to vote yes or no on. When
  519. editing tracks, the available responses are:
  520. * y or yes: play this track
  521. * n or no: don't play this track
  522. * Y or Yes: play this track and all remaining tracks
  523. * N or No: don't play this track or any of the remaining tracks
  524. * u or up: move up one level in the hierarchy (from tracks
  525. to albums, for example).
  526. * d or down: move down one level in the hierarchy
  527. * /: search forward
  528. By moving up one or two levels you can vote on albums or artists all
  529. at once. When searching, you may enter a search term immediately
  530. after the slash. A slash by itself repeats the prior search. If
  531. there was no prior search you will be prompted for a search term.
  532. For the purpose of moving through the hierarchy, the character "/" is
  533. used to separate the levels. If your music library is laid out
  534. differently, you can set this to something else in the config file,
  535. for example,
  536. LEVELSEP=" - "
  537. In more complex cases, you may want to use a regular expression, for
  538. example,
  539. LEVELSEP="(/| - )"
  540. For display purposes, the "/" character will be used as the separator,
  541. but the regular expression will be used internally.
  542. When editing radio streams, the available responses are:
  543. * y or yes: play this stream
  544. * n or no: don't play this stream
  545. * Y or Yes: play this stream and all remaining streams
  546. * N or No: don't play this stream or any of the remaining streams
  547. * /: search forward
  548. Plait does its best to present a helpful description of each stream,
  549. but sometimes the Shoutcast web page will outwit Plait's regular
  550. expression-fu and you will see HTML gunk in the description.
  551. ### --play
  552. This option forwards the command "play" to the music player.
  553. ### --pause
  554. This option forwards the command "pause" to the music player.
  555. ### --stop
  556. This option forwards the command "stop" to the music player.
  557. ### --next
  558. This option forwards the command "next track" to the music player.
  559. ### --prev
  560. This option forwards the command "previous track" to the music player.
  561. ### --install
  562. This option installs Plait. You will normally need to do this only
  563. once, but it may also come in handy if Plait stops working because an
  564. important file is deleted. To do a complete reinstall, run this
  565. command from the install directory. You should run this option as
  566. root, using the `su` or `sudo` command.
  567. ### --uninstall
  568. This option uninstalls Plait. It is up to you to uninstall any
  569. prerequisites you had to install to make it work, if you don't want
  570. them anymore. If you installed Plait as root, you should run this
  571. option as root, using the `su` or `sudo` command.
  572. ### --help
  573. Shows brief help text.
  574. ### --version
  575. Shows information about the version of `plait` you are using, the
  576. license, and the author.
  577. 7. Advanced hinting
  578. --------------------
  579. Plait hints are actually extended regular expressions that will be
  580. executed by a `grep` command, which fact enables certain advanced
  581. queries. If you are familiar with regular expressions, some examples
  582. have probably occurred to you already. This section provides some
  583. ideas for the uninitiated.
  584. Simplicity is one of Plait's goals and as a result a division is drawn
  585. between simple queries, which include several hints that must all be
  586. matched, usually narrowing the results to a song or an album, and mix
  587. queries, which match any of their hints. But sometimes you would like
  588. a query which combines a little of both. For example, what if you
  589. want to hear "Solitude" by Billie Holiday (but not by Marc Ribot) and
  590. "Walk On" by Neil Young (but not by U2). One solution is to use two
  591. queries:
  592. plait billie solitude
  593. plait -q "walk on" neil
  594. However, there is a one line solution which depends on the fact that
  595. in regular expressions, the string ".*" matches anything. By
  596. exploiting this fact we can combine two hints into one complex hint.
  597. The resulting command is
  598. plait --mix "billie.*solitude" "neil.*walk on"
  599. In this way the "and" part of each query is built into a single hint
  600. and then the two complex hints are "or"-ed together with the `--mix`
  601. option. A variation on this idea is to combine the "or" parts of a
  602. query into a complex hint and then "and" it with another hint. For
  603. example, the following query plays three of my favorite tracks by
  604. Charlie Hunter:
  605. plait charlie "flau|dersu|revo"
  606. The fact that ".*" means "anything" is also useful if you are simply
  607. looking for a way to play a little of everything from your
  608. collection. For example, the following query plays 17 random tracks:
  609. plait --tracks 17 ".*" --random
  610. Some of the more interesting regular expressions will rely on the
  611. naming conventions you use in your music library. Here's one that
  612. works if your tracks are numbered. It will play the first two tracks
  613. of each John Coltrane album in a collection:
  614. plait coltrane "0[1-2]"
  615. #### Eponyms
  616. The fact that Plait uses whole path matching occasionally results in
  617. ambiguous hints when albums and songs are named eponymously. However,
  618. it is generally easy to come up with a precise hint with a little
  619. thought. The following suggestions assume that your music library is
  620. organized by Artist/Album/Song, but similar techniques would apply to
  621. other layouts. An example of an album and song with the same title is
  622. "Walk On" by John Hiatt. Here the trick is to match the path
  623. separator, in order to pick the album, or the dot before the file
  624. type, in order to pick the song:
  625. plait "walk on/" # the album
  626. plait "walk on[.]" # the song
  627. The brackets are necessary around the dot because dot is a regular
  628. expression matching any single character. The brackets tell Plait
  629. that we really mean a literal dot.
  630. Distinguishing an eponymous album from the artist is a little trickier
  631. because they will both end with the path separator. For example,
  632. Charlie Hunter has a self-titled album which appears in my music
  633. collection as
  634. /music/Charlie Hunter/Charlie Hunter/
  635. Typing `plait "charlie hunter"` will give me everything by that
  636. artist, not just the album I am interested in. In this case the
  637. secret is to match a combination of artist and title which is unique
  638. to the album "Charlie Hunter," for example
  639. plait "Charlie Hunter/Charlie Hunter"
  640. or just
  641. plait "Hunter/Charlie"
  642. (or `plait ter/cha` for the terse-minded).
  643. #### Using precise hints
  644. Many of the examples in this document use a relaxed form of hinting
  645. which is convenient and easy. Most of the time hints like these will
  646. "just work". Every once in a while, though, this approach breaks
  647. down. For example,
  648. plait miles
  649. may get you
  650. /music/Byrds/Eight Miles High
  651. /music/Who/I Can See for Miles
  652. rather than the Miles Davis music you might have been looking for.
  653. Likewise,
  654. plait rem
  655. may get you
  656. /music/Talking Heads/Remain in Light
  657. rather than music by the band R.E.M. In cases like this you should
  658. just use a more precise hint, ie
  659. plait "/miles davis/"
  660. or
  661. plait /rem/
  662. 8. Installation
  663. ----------------
  664. Since Plait is glue ware, it has several dependencies. Follow these
  665. instructions to make it all work.
  666. ### Uninstallation
  667. As of Plait 1.5.2, it is possible to install Plait to a directory of
  668. your choice. Since this could lead to a situation where you have
  669. multiple versions of Plait installed in different directories, it's a
  670. good idea to uninstall any old versions of Plait prior to upgrading.
  671. But if you know you are installing to the same directory as the old
  672. version of Plait, this isn't really necessary.
  673. ### Windows/Cygwin prerequisites
  674. Running Plait on Windows requires that you install Cygwin, the open
  675. source UNIX compatibility layer for Windows. Follow the instructions
  676. at Cygwin.com to download and install Cygwin. Plait also requires two
  677. optional packages, wget and gawk. Be sure to select these packages
  678. when you run Cygwin Setup.
  679. For those who are using Winamp, you may need to install it. Get
  680. Winamp at Winamp.com.
  681. In order to control Winamp, Plait uses a COM object written by John
  682. Adcock. To install it:
  683. * Download gen_com.zip from www.adcock8.freeserve.co.uk/winamp.htm
  684. * Unzip.
  685. * Copy gen_com.dll into the C:\Program Files\Winamp\Plugins directory.
  686. * Restart Winamp. Winamp will detect and install the new plugin.
  687. For those using iTunes, a standard installation of that program should
  688. work without any additional steps, but you need to edit the file
  689. ~/.plait/config to make iTunes your music player. Change the line
  690. that defines PLATFORM to read
  691. PLATFORM=cygwin-itunes
  692. ### OS X prerequisites
  693. Running Plait on OS X requires one package that isn't part of the
  694. default install: wget. You can compile wget from source and install
  695. it yourself, if you know how to do that sort of thing. The easier
  696. option is to install "fink" and have fink install wget for you:
  697. * Download fink from fink.sourceforge.net. Follow the instructions
  698. provided there to install it.
  699. * Now install wget. Type
  700. sudo apt-get install wget
  701. and enter your administrator password when prompted.
  702. (Users of Plait 0.53 and earlier also need to take the following step:
  703. * Install gawk and findutils. Type
  704. sudo apt-get install gawk findutils
  705. Newer versions of Plait don't depend on these packages.)
  706. ### GNU/Linux prerequisites
  707. On GNU/Linux, Plait works with ogg123, mpg123, mpg321, Xmms, Beep
  708. Media Player, or amaroK. If you are using Xmms, xmms-shell is also
  709. required. Installation varies depending on your distro. Be sure to
  710. install the package esound if you want to play via esd.
  711. Xmms, Beep Media Player, or amaroK will be used if they are present.
  712. If not, Plaiter will be used as a front end to any command line
  713. players that are present. Otherwise Plait will work in "list only"
  714. mode unless you configure your own player.
  715. ### Finishing up (all operating systems)
  716. You now have all the prerequisites to run Plait. The last step is
  717. installing Plait itself:
  718. * Untar the package:
  719. tar xvzf plait-x.xx.tar.gz
  720. cd plait
  721. * Tell `plait` to install itself. You may run this command as a
  722. non-root user, in which case Plait will default to installing in
  723. your home directory; you may run it as root, in which case Plait
  724. will default to installing in /usr/local; or you may set the install
  725. directory to anything you like by providing an argument. Examples:
  726. su -c "./plait --install"
  727. or
  728. sudo ./plait --install
  729. or
  730. ./plait --install
  731. or
  732. sudo ./plait --install /usr
  733. If you install Plait as a non-root user, you may have to add ~/bin to
  734. your path. On Cygwin, the install routine does not actually check
  735. whether you are root, but rather whether or not you have permission to
  736. touch root's files. This works well because a typical install of
  737. Cygwin creates a non-root user with root permissions, and there is no
  738. su command. Thus (on Cygwin only), as long as you have permission to
  739. touch root's files, install will default to /usr/local.
  740. Plait is now ready to run. The first time you run it, Plait will do
  741. some additional self-installation which involves asking for the
  742. location of your music directory. You only have to do this once.
  743. ### Setting up for XSPF
  744. If you want to use the XSPF web publishing feature, you will need to
  745. install the XSPF Web Music Player
  746. (http://musicplayer.sourceforge.net). Download and unpack the player
  747. from that address and then copy the file xspf_player.swf to
  748. ~/.plait/xspf.
  749. If your music library is located on a web server, you also need to set
  750. the variable BASEURL, for example:
  751. BASEURL=http://www.example.com/mp3/
  752. Otherwise, leave BASEURL set to the empty string.
  753. If your music directory is laid out as Artist/Album/Song, you're all
  754. set. Otherwise, you may need to set the three variables ARTISTIDX,
  755. ALBUMIDX, and SONGIDX in the config file. For Example, if your music
  756. directory is laid out as Artist/Year/Album/Song, set
  757. ARTISTIDX=1
  758. ALBUMIDX=3
  759. SONGIDX=4
  760. If your music directory is laid out as Artist/Artist - Album - Song,
  761. set
  762. LEVELSEP="(/| - )"
  763. ARTISTIDX=1
  764. ALBUMIDX=3
  765. SONGIDX=4
  766. 9. Uninstallation
  767. ------------------
  768. If you installed Plait as root, you must be root to uninstall it;
  769. otherwise you must be the same user as you were during installation.
  770. Type
  771. su -c "plait --uninstall"
  772. or
  773. sudo plait --uninstall
  774. or just
  775. plait --uninstall
  776. to uninstall Plait. See the instructions that came with gen_com if
  777. you want to remove that plugin. To remove wget, gawk or findutils,
  778. follow the package removal technique for Cygwin or Fink, as
  779. appropriate. If you are updating Plait, and you decide to install it
  780. into a different directory this time, uninstall the old version before
  781. installing the new one. Otherwise two versions of Plait will be
  782. installed and you can't be sure which one will run.
  783. 10. Customization
  784. ------------------
  785. There are a few changes you can make to ~/.plait/config to customize
  786. the behavior of Plait.
  787. #### File types
  788. By default Plait looks for files of type mp3, wav, aif, ogg and flac.
  789. You can change this by setting the variable TYPES, for example:
  790. TYPES=".ogg .mp3 .flac"
  791. You may need to run `plait --cache` to rebuild the cache after
  792. changing the file types.
  793. As of Plait 1.2, you are advised to set the variable TYPES once to a
  794. very broad set of file types, and then use target devices to customize
  795. your playlists for different devices. You can either redefine one of
  796. the built-in target devices, or define a new one. For example, to
  797. define a target device that supports the same file types as an iPod,
  798. add the following line to the config file:
  799. ipod="m4a M4A mp3 MP3 wav WAV"
  800. In contrast to the TYPES variable, with devices you don't include the
  801. dot in the file extension, and you must repeat each extension twice,
  802. in upper and lower case. In this list, order is important; thus the
  803. ipod device will prefer mp3 files to wav files.
  804. To use this device to build a playlist, select it on the command line:
  805. plait britney --device ipod
  806. You can also set the default device in the config file:
  807. DEVICE="$ipod"
  808. Important note: if you redefine the default device (hifi), you should
  809. then reassign DEVICE to it in the config file, ie:
  810. hifi="wav WAV flac FLAC"
  811. DEVICE="$hifi"
  812. Otherwise DEVICE will continue to have the old value of hifi from
  813. before it was redefined.
  814. #### Alternate players
  815. Although there is a default player on each operating system, some OSs
  816. support several players. You can pick something besides the default
  817. by setting the variable PLATFORM, for example:
  818. PLATFORM=linux-plaiter
  819. The currently supported platforms are: cygwin-winamp, cygwin-itunes,
  820. osx-itunes, linux-xmms, linux-beep-media-player, linux-amarok,
  821. linux-mpg123, linux-mpg123-esd, linux-mpg321, linux-mpg321-esd,
  822. linux-ogg123, linux-ogg123-esd, linux-plaiter, any-xspf and
  823. any-xspf-copy. In the interest of accuracy, there are also "unix-"
  824. synonyms for all the "linux-" players. The "esd" platforms play via
  825. the Enlightened Sound Daemon, which can stream audio across the
  826. network to an esd server. You specify which server by setting
  827. ESPEAKER, for example:
  828. ESPEAKER=192.168.1.2:16001
  829. See README.plaiter for information on Plaiter, which is the ideal
  830. platform choice if you currently use a command line player like
  831. mpg123.
  832. 11. XSPF Playlists
  833. -------------------
  834. Plait can generate a complete web site with an embedded MP3 playlist,
  835. including an XSPF playlist, a web page that embeds the XSPF Web Music
  836. Player (http://musicplayer.sourceforge.net), and MP3 files.
  837. The steps are as follows:
  838. 1. Download and unpack the web music player from the site above. Copy
  839. the file xspf_player.swf to ~/.plait/xspf.
  840. 2. Customize the file /usr/share/plait/playlist.html, if you like. It
  841. is a template file in which the special text string "%TITLE%" will
  842. be replaced by the playlist title generated automatically by Plait.
  843. 3. Set the variable BASEURL appropriately in the config file (see
  844. below). You may also need to set the variables ARTISTIDX,
  845. ALBUMIDX, and SONGIDX. See the section on installation.
  846. 4. Run an appropriate Plait command to generate a playlist (see
  847. below).
  848. 5. Upload the directory ~/.plait/xspf to a new directory on your web
  849. server.
  850. 6. Test the playlist by loading the file playlist.html from the upload
  851. directory into your browser.
  852. The Plait command you run depends on where your music library is
  853. located: if it is located on your web server where MP3 files can be
  854. loaded via a URL, the MP3s can be accessed in place. In this case,
  855. set the variable BASEURL in the Plait config file to the base address
  856. of your MP3 directory, for example
  857. BASEURL=http://www.example.com/mp3/
  858. Then generate a playlist with a command like the following:
  859. plait "Dire Straits" --tracks 7 --platform any-xspf --device compact --coverart 1
  860. and upload the directory ~/.plait/xspf to your web server. The flag
  861. "--coverart 1" is optional and causes Plait to look up album cover art
  862. on Amazon. You can turn this feature on permanently by setting
  863. COVERART=1
  864. in the config file (in which case you can turn it off temporarily with
  865. the flag "--coverart 0").
  866. If your music library is not on a web server, you will need to upload
  867. the MP3 files in the playlist to your server as well. In that case,
  868. leave BASEURL set to the empty string. Then generate a playlist with
  869. a command like the following:
  870. plait "Dire Straits" --tracks 7 --platform any-xspf-copy --device compact
  871. This form of the command actually copies MP3 files into the directory
  872. ~/.plait/xspf, which you then upload. You may want to clean old MP3
  873. files out of this directory periodically to avoid unnecessary
  874. uploads.
  875. Of course, you can always pick and choose which files to upload
  876. depending upon your application. The file playlist.html can be used
  877. as an example if you prefer to embed the playlist in a preexisting web
  878. page.
  879. 12. Bugs
  880. ---------
  881. Plait does a poor job of handling file names with various accent
  882. characters. iTunes refuses to play these files at all, because
  883. Applescript can't translate them into Macintosh file paths. On other
  884. platforms you should be able to play these files, but it is still
  885. difficult to search for them, because Plait doesn't know how to ignore
  886. accent marks when making string comparisons. The problem does not
  887. just involve comparing characters that could be considered equivalent
  888. in the current locale, which would be resolved by equivalence classes;
  889. here the problem is to compare characters which could be considered
  890. equivalent in any locale. There is a version of `agrep` for OS/2 and
  891. Windows which can do this type of accent-insensitive comparison, so if
  892. you are interested in this problem, bug the authors of `agrep` about
  893. back-porting this feature to UNIX.
  894. 13. What's next
  895. ----------------
  896. Who knows?
  897. Copyright (c) 2005-2008 by Stephen Jungels