Posted to tcl by DeusFigendi at Fri Apr 16 15:27:49 GMT 2010view raw

  1. #!/bin/sh
  2. # starte Tcl-Interpreter \
  3. exec tclsh "$0" "$@"
  4.  
  5. ## Castcollector 1.3 Downloads and parses Audiocasts as RSS-feeds and puts all items chronological into a playlist.
  6. ## Copyright (C) 2010 Kai-Uwe Kramer
  7. ##
  8. ## This program is free software: you can redistribute it and/or modify
  9. ## it under the terms of the GNU General Public License as published by
  10. ## the Free Software Foundation, either version 3 of the License, or
  11. ## (at your option) any later version.
  12. ##
  13. ## This program is distributed in the hope that it will be useful,
  14. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ## GNU General Public License for more details.
  17. ##
  18. ## You should have received a copy of the GNU General Public License
  19. ## along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. ##
  21. ## You can find the whole licence at the end of this file.
  22.  
  23.  
  24.  
  25. ###########################################################
  26. ## ##
  27. ## CONFIGURATION ##
  28. ## ##
  29. ## Here you can set up the feeds you like to subscribe ##
  30. ## the playlist-file they are saved to and the point ##
  31. ## where 2digit-year-dates should be set to 19xx or 20xx.##
  32. ## ##
  33. ###########################################################
  34.  
  35. ## Dublicate the last lappend-line and alter the feed-url to add feeds.
  36. set feedlist "http://feeds.abcnews.com/abcnews/worldnewsvideopodcast"
  37. lappend feedlist "http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2090484"
  38. lappend feedlist "http://rss.cnn.com/services/podcasting/newscast/rss.xml"
  39.  
  40. ## The file the playlist will be written to. pls m3u and xspf accepted.
  41. set outputfilename "stdout"
  42.  
  43. ## The breaking point where 2-digit-dates are ordered to 20th or 21st century.
  44. set y2k_break 70
  45.  
  46. ## Debug-outputs on (true) or off (false)
  47. set debug false
  48. ## Target-channel for the debug-outputs (use the open-command to set up a file)
  49. set debugfile stdout
  50.  
  51. ## "True" prints the help
  52. set printhelp false
  53.  
  54. ## Level of encoding-correction. Sets WHERE the ec is used. If 0 no encode-correction apears.
  55. set encode_correction 1
  56.  
  57. ## Maximum age of items.
  58. set max_age 8
  59.  
  60.  
  61.  
  62.  
  63.  
  64. package require http
  65. set ErrorLevel 0
  66. set fileextension false
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. set parano 0
  74. foreach parameter $argv {
  75. set parameter [string tolower $parameter]
  76. if { $parameter == "-feeds" || $parameter == "-f" || $parameter == "-input" || $parameter == "-i"} { set feedlist [lrange $argv $parano+1 end] }
  77. if { $parameter == "-target" || $parameter == "-t" || $parameter == "-output" || $parameter == "-o"} { set outputfilename [lindex $argv $parano+1] }
  78. if { $parameter == "-debug" } { set debug true }
  79. if { $parameter == "-y2k" } { set y2k_break [lindex $argv $parano+1] }
  80. if { $parameter == "-format" } { set fileextension ".[lindex $argv $parano+1]" }
  81. if { $parameter == "-debugfile" } { set debugfile [open [lindex $argv $parano+1] a] }
  82. if { $parameter == "-age" } { set max_age [lindex $argv $parano+1] }
  83. if { $parameter == "help" || $parameter == "?"} { set printhelp true }
  84. if { $parameter == "-encode" || $parameter == "-ecl"} { set encode_correction [lindex $argv $parano+1] }
  85. incr parano
  86. }
  87. if { $fileextension == false } {
  88. if { $outputfilename == "stdout" } { set fileextension ".xspf" } else { set fileextension [string range $outputfilename [string last "." $outputfilename] end] }
  89. }
  90.  
  91.  
  92.  
  93. proc print_debug { debugsource debugstring } {
  94. global debug
  95. global debugfile
  96. if {$debug} { puts $debugfile "$debugsource\: $debugstring" }
  97. }
  98.  
  99.  
  100.  
  101.  
  102.  
  103. proc strip_string1 inputstring {
  104. set outputstring [string map {á a à a â a ä ae ã a Á A À A  A Ä AE é e è e ê e É E È E Ê E í i ì i î i Í I Ì I Î I ó o ò o ô o ö oe Ó O Ò O Ô O Ö OE ú u ù u û u ü ue Ú U Ù U Û U Ü UE Ü UE "Ã?" UE ß sz ß sz à sz \u00DF sz \u1E9E sz \u223 sz \u7838 sz \u225 sz \u0223 sz} $inputstring]
  105. while {[regexp -indices {[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\s\-\/\\\.:\?\!\$\|\+\(\),_';]} $outputstring wrongcharpos] == 1} {
  106. set outputstring "[string range $outputstring 0 [lindex $wrongcharpos 0]-1]__[string range $outputstring [lindex $wrongcharpos 1]+1 end]"
  107. print_debug "strip_string" $outputstring
  108. }
  109. return $outputstring
  110. }
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. print_debug "http-package-version" [package present http]
  122. print_debug "Fileextension:" $fileextension
  123. if {$fileextension == ".m3u"} {
  124. print_debug "ext-detection:" "MP3-URL is a known format"
  125. } elseif {$fileextension == ".pls"} {
  126. print_debug "ext-detection:" "PlayLiSt is a known format"
  127. } elseif {$fileextension == ".xspf"} {
  128. print_debug "ext-detection:" "XML Shareable Playlist Format is a known format"
  129. } else {
  130. print_debug "ext-detection:" "Unknown playlist-format"
  131. set ErrorLevel 100
  132. }
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141. set internal_playlist ""
  142. if { $ErrorLevel <= 10 } {
  143. if { $outputfilename != "stdout" } { set outputfile [open $outputfilename w] } else { set outputfile stdout }
  144. print_debug "info" "Starting loop though all feeds..."
  145. foreach feedurl $feedlist {
  146. print_debug "loading feed" $feedurl
  147. set feedcontent [http::data [set token [http::geturl $feedurl ]]]
  148.  
  149.  
  150.  
  151. if {[string first "<rss" $feedcontent 3] >= 0} {
  152. print_debug "feed-detection" "RSS-Format... parsing..."
  153. regexp -nocase {\<item(.*)</item>} $feedcontent items1
  154. print_debug "items1 (154)" $items1
  155. set items1 [string map -nocase {"</item>" "</item>\x01"} $items1]
  156. print_debug "items1 (156)" $items1
  157. set items2 [split $items1 \x01]
  158. print_debug "items2 (157)" $items2
  159.  
  160.  
  161. print_debug "info:" "Starting loop through items..."
  162. foreach item $items2 {
  163. if {[string length $item] > 10} {
  164. if {[string length $item] < 100} {
  165. print_debug "itemlength" "[string length $item] is a very short item, lets see..."
  166. print_debug "itemlength" $item
  167. }
  168.  
  169. print_debug " " " "
  170.  
  171. print_debug "itemlength" "[string length $item] parse Item..."
  172. regexp -nocase {\<title(.*?)</title>} $item im_title
  173. print_debug "title (173)" $im_title
  174. set im_title [string range $im_title 7 [expr [string length $im_title] -9]]
  175. print_debug "title (175)" $im_title
  176. if {[string first "<!\[CDATA" $im_title] >= 0 } { set im_title [string range $im_title 9 [expr [string length $im_title] -4]] }
  177. print_debug "title (177)" $im_title
  178. if { $encode_correction >= 1 } { set im_title [strip_string1 $im_title] }
  179. print_debug "title (179)" $im_title
  180. regexp -nocase {\<pubDate(.*?)</pubDate>} $item im_date1
  181. print_debug "date (181)" $im_date1
  182. set im_date1 [string range $im_date1 9 [expr [string length $im_date1] -11]]
  183. print_debug "date (183)" $im_date1
  184. if {[string first "<!\[CDATA" $im_date1] >= 0 } { set im_date1 [string range $im_date1 9 [expr [string length $im_date1] -4]] }
  185. print_debug "date (185)" $im_date1
  186.  
  187.  
  188.  
  189.  
  190.  
  191. set im_date_year [lrange $im_date1 3 3]
  192. set im_date_month [lrange $im_date1 2 2]
  193. set im_date_day [lrange $im_date1 1 1]
  194. set im_date_time [lrange $im_date1 4 4]
  195. print_debug "date (195)" "$im_date_year +++ $im_date_month +++ $im_date_day +++ $im_date_time"
  196. if { $im_date_month == "Jan" } { set im_date_month "01" }
  197. if { $im_date_month == "Feb" } { set im_date_month "02" }
  198. if { $im_date_month == "Mar" } { set im_date_month "03" }
  199. if { $im_date_month == "Apr" } { set im_date_month "04" }
  200. if { $im_date_month == "May" } { set im_date_month "05" }
  201. if { $im_date_month == "Jun" } { set im_date_month "06" }
  202. if { $im_date_month == "Jul" } { set im_date_month "07" }
  203. if { $im_date_month == "Aug" } { set im_date_month "08" }
  204. if { $im_date_month == "Sep" } { set im_date_month "09" }
  205. if { $im_date_month == "Oct" } { set im_date_month "10" }
  206. if { $im_date_month == "Nov" } { set im_date_month "11" }
  207. if { $im_date_month == "Dec" } { set im_date_month "12" }
  208. print_debug "date (208)" "$im_date_year +++ $im_date_month +++ $im_date_day +++ $im_date_time"
  209.  
  210.  
  211. set im_date_time [split $im_date_time ":"]
  212. set im_date_hour [lrange $im_date_time 0 0]
  213. set im_date_minute [lrange $im_date_time 1 1]
  214. set im_date_second [lrange $im_date_time 2 2]
  215. print_debug "date (215)" "$im_date_year +++ $im_date_month +++ $im_date_day +++ $im_date_hour --- $im_date_minute --- $im_date_second"
  216.  
  217.  
  218.  
  219.  
  220.  
  221. if {[string length $im_date_year] < 4} {
  222. if { [expr $im_date_year +0] < $y2k_break } { set im_date_year [expr $im_date_year + 2000] }
  223. if { [expr $im_date_year +0] < 100 } { set im_date_year [expr $im_date_year + 1900] }
  224. }
  225. print_debug "date (225)" "$im_date_year +++ $im_date_month +++ $im_date_day +++ $im_date_hour --- $im_date_minute --- $im_date_second"
  226. if {[string length $im_date_day] < 2} { set im_date_day "0$im_date_day" }
  227. print_debug "date (227)" "$im_date_year +++ $im_date_month +++ $im_date_day +++ $im_date_hour --- $im_date_minute --- $im_date_second"
  228. set im_date2 "$im_date_year\-$im_date_month\-$im_date_day\T$im_date_hour\-$im_date_minute\-$im_date_second"
  229. print_debug "date (229)" $im_date2
  230. set im_date3 [clock scan "$im_date_year\-$im_date_month\-$im_date_day"]
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237. set im_enclosure "<enclosure url=\"127.0.0.1/nothing.ogg\" length=\"0\" />"
  238. regexp -nocase {\<enclosure(.*?)/>} $item im_enclosure
  239. print_debug "url/length" $im_enclosure
  240. regexp -nocase {url=\"(.*?)\"} $im_enclosure im_link
  241. print_debug "url (244)" $im_link
  242. set im_link [lrange $im_link 0 0]
  243. print_debug "url (246)" $im_link
  244. set im_link [string range $im_link 6 [expr [string length $im_link] -3]]
  245. print_debug "url (248)" $im_link
  246.  
  247. regexp -nocase {length=\"(.*?)\"} $im_enclosure im_length
  248. print_debug "length (251)" $im_length
  249. set im_length [lrange $im_length 0 0]
  250. print_debug "length (253)" $im_length
  251. set im_length [string range $im_length 9 [expr [string length $im_length] -3]]
  252. print_debug "length (255)" $im_length
  253.  
  254.  
  255.  
  256.  
  257. set im_total [list $im_title $im_date2 $im_date1 $im_link $im_length]
  258. print_debug "Total item" $im_total
  259. if { $im_date3 >= [expr [clock seconds] - ($max_age * 60*60*24)] } { lappend internal_playlist $im_total } else { print_debug "age-check" "To old throwing away..." }
  260. } else { print_debug "itemlength" "[string length $item] to short, skipping item" }
  261. }
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. } else {
  269. if {$debug} {
  270. print_debug "feed-detection" "This programm suports RSS-Feeds only (no rss-tag found)"
  271. }
  272. set ErrorLevel 1
  273. }
  274. }
  275.  
  276.  
  277.  
  278. print_debug "sort" "-ing playlist"
  279. print_debug "sort" $internal_playlist
  280. set internal_playlist [lsort -index 1 $internal_playlist]
  281. print_debug "sort" "...done"
  282. print_debug "sort" $internal_playlist
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298. if {$debug} {
  299. print_debug "check-this" "calling all recorded dates..."
  300. foreach item $internal_playlist {
  301. print_debug "check-this" "~[lrange $item 4 4]~ [lrange $item 2 2]"
  302. }
  303. print_debug "check-this" "calling the whole list of data..."
  304. print_debug "check-this" $internal_playlist
  305. }
  306.  
  307.  
  308. if { $fileextension == ".m3u" } {
  309. print_debug "output" "creating m3u-file..."
  310. puts $outputfile "#EXTM3U"
  311. foreach item $internal_playlist {
  312. puts $outputfile "#EXTINF:[lrange $item 4 4],[lrange [lindex [lrange $item 2 2] 0] 1 3] - [lindex [lrange $item 0 0] 0]"
  313. puts $outputfile [lrange $item 3 3]
  314. print_debug "output" "done"
  315. }
  316. }
  317.  
  318. if { $fileextension == ".pls" } {
  319. print_debug "output" "creating pls-file..."
  320. puts $outputfile "\[playlist\]"
  321. puts $outputfile "NumberOfEntries=[llength $internal_playlist]"
  322. set item_counter 0
  323. foreach item $internal_playlist {
  324. incr item_counter
  325. puts $outputfile "File$item_counter\=[lrange $item 3 3]"
  326. puts $outputfile "Title$item_counter\=[lrange [lindex [lrange $item 2 2] 0] 1 3] - [lindex [lrange $item 0 0] 0]"
  327. puts $outputfile "Length$item_counter\=[lrange $item 4 4]"
  328. puts $outputfile ""
  329. }
  330. puts $outputfile "Version=2"
  331. print_debug "output" "...done"
  332. }
  333.  
  334.  
  335.  
  336.  
  337.  
  338. if { $fileextension == ".xspf" } {
  339. print_debug "output" "creating xspf-file..."
  340. puts $outputfile "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
  341. puts $outputfile "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">"
  342. puts $outputfile " <title>Audiocasts</title>"
  343. puts $outputfile " <trackList>"
  344.  
  345.  
  346.  
  347.  
  348. foreach item $internal_playlist {
  349. print_debug "xspf" "Writing item: $item"
  350. print_debug "xspf" "file: [lrange $item 3 3] title:[lrange $item 0 0] ==> [lindex [lrange $item 0 0] 0] date: [lrange $item 2 2] ==> [lindex [lrange $item 2 2] 0] ==> [lrange [lindex [lrange $item 2 2] 0] 1 3] duration: [lrange $item 4 4]"
  351. puts $outputfile " <track>"
  352. puts $outputfile " <location>[lrange $item 3 3]</location>"
  353. puts $outputfile " <title>[lrange [lindex [lrange $item 2 2] 0] 1 3] - [lindex [lrange $item 0 0] 0]</title>"
  354. puts $outputfile " <duration>[lrange $item 4 4]248</duration>"
  355. puts $outputfile " </track>"
  356. }
  357. puts $outputfile " </trackList>"
  358. puts $outputfile "</playlist>"
  359. print_debug "output" "...done"
  360. }
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368. } elseif { $ErrorLevel == 100 } {
  369. puts "Unknown Playlist-Format"
  370. }
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378. if { $printhelp } {
  379. set commentchar ""
  380. if { $fileextension == ".m3u" } { set commentchar "#" }
  381. if { $fileextension == ".pls" } { set commentchar ";" }
  382. if { $fileextension == ".xspf" } { puts "<!--" }
  383.  
  384.  
  385.  
  386.  
  387.  
  388. puts "$commentchar\u2554[string repeat \u2550 50]\u2557"
  389. puts "$commentchar\u2551 \u2551"
  390. puts "$commentchar\u2551 HELP \u2551"
  391. puts "$commentchar\u2551 Castcollector 1.3 \u2551"
  392. puts "$commentchar\u2551 (C) by Deus Figendi ( deusfigendi@dnd-gate.de ) \u2551"
  393. puts "$commentchar\u2551 \u2551"
  394. puts "$commentchar\u2551 Downloads and parses Audiocasts as RSS-feeds and \u2551"
  395. puts "$commentchar\u2551 puts all items chronological into a playlist. \u2551"
  396. puts "$commentchar\u2551 \u2551"
  397. puts "$commentchar\u2551 You can set up all parameters at the head of the \u2551"
  398. puts "$commentchar\u2551 sourcefile or by using arguments while \u2551"
  399. puts "$commentchar\u2551 executing the script. \u2551"
  400. puts "$commentchar\u2551 \u2551"
  401. puts "$commentchar\u2551 Arguments: \u2551"
  402. puts "$commentchar\u2551 -target - The argument after this is used as \u2551"
  403. puts "$commentchar\u2551 output-filename. Use stdout to output\u2551"
  404. puts "$commentchar\u2551 to your shell. \u2551"
  405. puts "$commentchar\u2551 Aliases are -output -t and -o \u2551"
  406. puts "$commentchar\u2551 -debug - Forces the script to call debug-infos\u2551"
  407. puts "$commentchar\u2551 \u2551"
  408. puts "$commentchar\u2551 -format - Sets up the playlist-format. Valid \u2551"
  409. puts "$commentchar\u2551 values are xspf m3u and pls. \u2551"
  410. puts "$commentchar\u2551 The format is also parsed by the \u2551"
  411. puts "$commentchar\u2551 filename but you can change it if \u2551"
  412. puts "$commentchar\u2551 you use the stdout or using no file- \u2551"
  413. puts "$commentchar\u2551 extension- \u2551"
  414. puts "$commentchar\u2551 \u2551"
  415. puts "$commentchar\u2551 help - Shows this help. Alias: ? \u2551"
  416. puts "$commentchar\u2551 \u2551"
  417. puts "$commentchar\u2551 -feed - ALL (!!) arguments after this are \u2551"
  418. puts "$commentchar\u2551 used as rss-audiocast-feed-URLs. Use \u2551"
  419. puts "$commentchar\u2551 this as your last argument. \u2551"
  420. puts "$commentchar\u2551 Aliases are -input -i and -f. \u2551"
  421. puts "$commentchar\u2551 \u2551"
  422. puts "$commentchar\u2551 -y2k - The argument after this is used as \u2551"
  423. puts "$commentchar\u2551 the \"breaking point\" where two-digit \u2551"
  424. puts "$commentchar\u2551 dates are set as 19xx or 20xx. \u2551"
  425. puts "$commentchar\u2551 If you'd like to have all 2d-dates \u2551"
  426. puts "$commentchar\u2551 in the 2ks set up 99 so all 2d-dates \u2551"
  427. puts "$commentchar\u2551 will be set in the 2000s. If you want\u2551"
  428. puts "$commentchar\u2551 every date in the 1900s set up 00. \u2551"
  429. puts "$commentchar\u2551 If you set up 70 (default) you can \u2551"
  430. puts "$commentchar\u2551 get dates from 1970 to 2069 (and \u2551"
  431. puts "$commentchar\u2551 even other if they are noted as 4 \u2551"
  432. puts "$commentchar\u2551 digit-year). \u2551"
  433. puts "$commentchar\u2551 \u2551"
  434. puts "$commentchar\u2551 -age - The argument after this is used as \u2551"
  435. puts "$commentchar\u2551 the maximum age of items. All older \u2551"
  436. puts "$commentchar\u2551 items will not apear in the playlist.\u2551"
  437. puts "$commentchar\u2551 \u2551"
  438. puts "$commentchar\u2551 -encode - Alias: -ecl (encoding correction \u2551"
  439. puts "$commentchar\u2551 level). Sets up if and where the \u2551"
  440. puts "$commentchar\u2551 encoding correction happens. This \u2551"
  441. puts "$commentchar\u2551 option is usefull if you get \u2551"
  442. puts "$commentchar\u2551 incomplete or unvalid playlists. \u2551"
  443. puts "$commentchar\u2551 Some servers deliver wrong character-\u2551"
  444. puts "$commentchar\u2551 encodings and maybe the http-package \u2551"
  445. puts "$commentchar\u2551 of TCL is a bit buggy in encoding and\u2551"
  446. puts "$commentchar\u2551 uncompression. \u2551"
  447. puts "$commentchar\u2551 The encoding-correction is pretty \u2551"
  448. puts "$commentchar\u2551 brutal it kills all characters it \u2551"
  449. puts "$commentchar\u2551 does not know. These are usualy all \u2551"
  450. puts "$commentchar\u2551 specialchars. \u2551"
  451. puts "$commentchar\u2551 In this Version you can set up level \u2551"
  452. puts "$commentchar\u2551 0 for no correction or 1 for \u2551"
  453. puts "$commentchar\u2551 correction of the titles. The \u2551"
  454. puts "$commentchar\u2551 argument after -encode (or -ecl) is \u2551"
  455. puts "$commentchar\u2551 used as ec-level. Default is 1. \u2551"
  456. puts "$commentchar\u2551 \u2551"
  457. puts "$commentchar\u2551 \u2551"
  458. puts "$commentchar\u2551 \u2551"
  459. puts "$commentchar\u2551 This program is free software: you can \u2551"
  460. puts "$commentchar\u2551 redistribute it and/or modify it under the terms \u2551"
  461. puts "$commentchar\u2551 of the GNU General Public License as published by\u2551"
  462. puts "$commentchar\u2551 the Free Software Foundation, either version 3 of\u2551"
  463. puts "$commentchar\u2551 the License, or (at your option) any later \u2551"
  464. puts "$commentchar\u2551 version. \u2551"
  465. puts "$commentchar\u2551 \u2551"
  466. puts "$commentchar\u2551 This program is distributed in the hope that it \u2551"
  467. puts "$commentchar\u2551 will be useful, but WITHOUT ANY WARRANTY; without\u2551"
  468. puts "$commentchar\u2551 even the implied warranty of MERCHANTABILITY or \u2551"
  469. puts "$commentchar\u2551 FITNESS FOR A PARTICULAR PURPOSE. See the \u2551"
  470. puts "$commentchar\u2551 GNU General Public License for more details. \u2551"
  471. puts "$commentchar\u2551 \u2551"
  472. puts "$commentchar\u2551 You should have received a copy of the GNU \u2551"
  473. puts "$commentchar\u2551 General Public License along with this program. \u2551"
  474. puts "$commentchar\u2551 If not, see <http://www.gnu.org/licenses/>. \u2551"
  475. puts "$commentchar\u2551 \u2551"
  476. puts "$commentchar\u2551 You can usualy find the complete license at the \u2551"
  477. puts "$commentchar\u2551 end of the sourcefile \u2551"
  478. puts "$commentchar\u2551 \u2551"
  479. puts "$commentchar\u255a[string repeat \u2550 50]\u255d"
  480. if { $fileextension == ".xspf" } { puts "-->" }
  481. }
  482.  
  483. ##
  484. ## GNU GENERAL PUBLIC LICENSE
  485. ## Version 3, 29 June 2007
  486. ##
  487. ## Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  488. ## Everyone is permitted to copy and distribute verbatim copies
  489. ## of this license document, but changing it is not allowed.
  490. ##
  491. ## Preamble
  492. ##
  493. ## The GNU General Public License is a free, copyleft license for
  494. ##software and other kinds of works.
  495. ##
  496. ## The licenses for most software and other practical works are designed
  497. ##to take away your freedom to share and change the works. By contrast,
  498. ##the GNU General Public License is intended to guarantee your freedom to
  499. ##share and change all versions of a program--to make sure it remains free
  500. ##software for all its users. We, the Free Software Foundation, use the
  501. ##GNU General Public License for most of our software; it applies also to
  502. ##any other work released this way by its authors. You can apply it to
  503. ##your programs, too.
  504. ##
  505. ## When we speak of free software, we are referring to freedom, not
  506. ##price. Our General Public Licenses are designed to make sure that you
  507. ##have the freedom to distribute copies of free software (and charge for
  508. ##them if you wish), that you receive source code or can get it if you
  509. ##want it, that you can change the software or use pieces of it in new
  510. ##free programs, and that you know you can do these things.
  511. ##
  512. ## To protect your rights, we need to prevent others from denying you
  513. ##these rights or asking you to surrender the rights. Therefore, you have
  514. ##certain responsibilities if you distribute copies of the software, or if
  515. ##you modify it: responsibilities to respect the freedom of others.
  516. ##
  517. ## For example, if you distribute copies of such a program, whether
  518. ##gratis or for a fee, you must pass on to the recipients the same
  519. ##freedoms that you received. You must make sure that they, too, receive
  520. ##or can get the source code. And you must show them these terms so they
  521. ##know their rights.
  522. ##
  523. ## Developers that use the GNU GPL protect your rights with two steps:
  524. ##(1) assert copyright on the software, and (2) offer you this License
  525. ##giving you legal permission to copy, distribute and/or modify it.
  526. ##
  527. ## For the developers' and authors' protection, the GPL clearly explains
  528. ##that there is no warranty for this free software. For both users' and
  529. ##authors' sake, the GPL requires that modified versions be marked as
  530. ##changed, so that their problems will not be attributed erroneously to
  531. ##authors of previous versions.
  532. ##
  533. ## Some devices are designed to deny users access to install or run
  534. ##modified versions of the software inside them, although the manufacturer
  535. ##can do so. This is fundamentally incompatible with the aim of
  536. ##protecting users' freedom to change the software. The systematic
  537. ##pattern of such abuse occurs in the area of products for individuals to
  538. ##use, which is precisely where it is most unacceptable. Therefore, we
  539. ##have designed this version of the GPL to prohibit the practice for those
  540. ##products. If such problems arise substantially in other domains, we
  541. ##stand ready to extend this provision to those domains in future versions
  542. ##of the GPL, as needed to protect the freedom of users.
  543. ##
  544. ## Finally, every program is threatened constantly by software patents.
  545. ##States should not allow patents to restrict development and use of
  546. ##software on general-purpose computers, but in those that do, we wish to
  547. ##avoid the special danger that patents applied to a free program could
  548. ##make it effectively proprietary. To prevent this, the GPL assures that
  549. ##patents cannot be used to render the program non-free.
  550. ##
  551. ## The precise terms and conditions for copying, distribution and
  552. ##modification follow.
  553. ##
  554. ## TERMS AND CONDITIONS
  555. ##
  556. ## 0. Definitions.
  557. ##
  558. ## "This License" refers to version 3 of the GNU General Public License.
  559. ##
  560. ## "Copyright" also means copyright-like laws that apply to other kinds of
  561. ##works, such as semiconductor masks.
  562. ##
  563. ## "The Program" refers to any copyrightable work licensed under this
  564. ##License. Each licensee is addressed as "you". "Licensees" and
  565. ##"recipients" may be individuals or organizations.
  566. ##
  567. ## To "modify" a work means to copy from or adapt all or part of the work
  568. ##in a fashion requiring copyright permission, other than the making of an
  569. ##exact copy. The resulting work is called a "modified version" of the
  570. ##earlier work or a work "based on" the earlier work.
  571. ##
  572. ## A "covered work" means either the unmodified Program or a work based
  573. ##on the Program.
  574. ##
  575. ## To "propagate" a work means to do anything with it that, without
  576. ##permission, would make you directly or secondarily liable for
  577. ##infringement under applicable copyright law, except executing it on a
  578. ##computer or modifying a private copy. Propagation includes copying,
  579. ##distribution (with or without modification), making available to the
  580. ##public, and in some countries other activities as well.
  581. ##
  582. ## To "convey" a work means any kind of propagation that enables other
  583. ##parties to make or receive copies. Mere interaction with a user through
  584. ##a computer network, with no transfer of a copy, is not conveying.
  585. ##
  586. ## An interactive user interface displays "Appropriate Legal Notices"
  587. ##to the extent that it includes a convenient and prominently visible
  588. ##feature that (1) displays an appropriate copyright notice, and (2)
  589. ##tells the user that there is no warranty for the work (except to the
  590. ##extent that warranties are provided), that licensees may convey the
  591. ##work under this License, and how to view a copy of this License. If
  592. ##the interface presents a list of user commands or options, such as a
  593. ##menu, a prominent item in the list meets this criterion.
  594. ##
  595. ## 1. Source Code.
  596. ##
  597. ## The "source code" for a work means the preferred form of the work
  598. ##for making modifications to it. "Object code" means any non-source
  599. ##form of a work.
  600. ##
  601. ## A "Standard Interface" means an interface that either is an official
  602. ##standard defined by a recognized standards body, or, in the case of
  603. ##interfaces specified for a particular programming language, one that
  604. ##is widely used among developers working in that language.
  605. ##
  606. ## The "System Libraries" of an executable work include anything, other
  607. ##than the work as a whole, that (a) is included in the normal form of
  608. ##packaging a Major Component, but which is not part of that Major
  609. ##Component, and (b) serves only to enable use of the work with that
  610. ##Major Component, or to implement a Standard Interface for which an
  611. ##implementation is available to the public in source code form. A
  612. ##"Major Component", in this context, means a major essential component
  613. ##(kernel, window system, and so on) of the specific operating system
  614. ##(if any) on which the executable work runs, or a compiler used to
  615. ##produce the work, or an object code interpreter used to run it.
  616. ##
  617. ## The "Corresponding Source" for a work in object code form means all
  618. ##the source code needed to generate, install, and (for an executable
  619. ##work) run the object code and to modify the work, including scripts to
  620. ##control those activities. However, it does not include the work's
  621. ##System Libraries, or general-purpose tools or generally available free
  622. ##programs which are used unmodified in performing those activities but
  623. ##which are not part of the work. For example, Corresponding Source
  624. ##includes interface definition files associated with source files for
  625. ##the work, and the source code for shared libraries and dynamically
  626. ##linked subprograms that the work is specifically designed to require,
  627. ##such as by intimate data communication or control flow between those
  628. ##subprograms and other parts of the work.
  629. ##
  630. ## The Corresponding Source need not include anything that users
  631. ##can regenerate automatically from other parts of the Corresponding
  632. ##Source.
  633. ##
  634. ## The Corresponding Source for a work in source code form is that
  635. ##same work.
  636. ##
  637. ## 2. Basic Permissions.
  638. ##
  639. ## All rights granted under this License are granted for the term of
  640. ##copyright on the Program, and are irrevocable provided the stated
  641. ##conditions are met. This License explicitly affirms your unlimited
  642. ##permission to run the unmodified Program. The output from running a
  643. ##covered work is covered by this License only if the output, given its
  644. ##content, constitutes a covered work. This License acknowledges your
  645. ##rights of fair use or other equivalent, as provided by copyright law.
  646. ##
  647. ## You may make, run and propagate covered works that you do not
  648. ##convey, without conditions so long as your license otherwise remains
  649. ##in force. You may convey covered works to others for the sole purpose
  650. ##of having them make modifications exclusively for you, or provide you
  651. ##with facilities for running those works, provided that you comply with
  652. ##the terms of this License in conveying all material for which you do
  653. ##not control copyright. Those thus making or running the covered works
  654. ##for you must do so exclusively on your behalf, under your direction
  655. ##and control, on terms that prohibit them from making any copies of
  656. ##your copyrighted material outside their relationship with you.
  657. ##
  658. ## Conveying under any other circumstances is permitted solely under
  659. ##the conditions stated below. Sublicensing is not allowed; section 10
  660. ##makes it unnecessary.
  661. ##
  662. ## 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
  663. ##
  664. ## No covered work shall be deemed part of an effective technological
  665. ##measure under any applicable law fulfilling obligations under article
  666. ##11 of the WIPO copyright treaty adopted on 20 December 1996, or
  667. ##similar laws prohibiting or restricting circumvention of such
  668. ##measures.
  669. ##
  670. ## When you convey a covered work, you waive any legal power to forbid
  671. ##circumvention of technological measures to the extent such circumvention
  672. ##is effected by exercising rights under this License with respect to
  673. ##the covered work, and you disclaim any intention to limit operation or
  674. ##modification of the work as a means of enforcing, against the work's
  675. ##users, your or third parties' legal rights to forbid circumvention of
  676. ##technological measures.
  677. ##
  678. ## 4. Conveying Verbatim Copies.
  679. ##
  680. ## You may convey verbatim copies of the Program's source code as you
  681. ##receive it, in any medium, provided that you conspicuously and
  682. ##appropriately publish on each copy an appropriate copyright notice;
  683. ##keep intact all notices stating that this License and any
  684. ##non-permissive terms added in accord with section 7 apply to the code;
  685. ##keep intact all notices of the absence of any warranty; and give all
  686. ##recipients a copy of this License along with the Program.
  687. ##
  688. ## You may charge any price or no price for each copy that you convey,
  689. ##and you may offer support or warranty protection for a fee.
  690. ##
  691. ## 5. Conveying Modified Source Versions.
  692. ##
  693. ## You may convey a work based on the Program, or the modifications to
  694. ##produce it from the Program, in the form of source code under the
  695. ##terms of section 4, provided that you also meet all of these conditions:
  696. ##
  697. ## a) The work must carry prominent notices stating that you modified
  698. ## it, and giving a relevant date.
  699. ##
  700. ## b) The work must carry prominent notices stating that it is
  701. ## released under this License and any conditions added under section
  702. ## 7. This requirement modifies the requirement in section 4 to
  703. ## "keep intact all notices".
  704. ##
  705. ## c) You must license the entire work, as a whole, under this
  706. ## License to anyone who comes into possession of a copy. This
  707. ## License will therefore apply, along with any applicable section 7
  708. ## additional terms, to the whole of the work, and all its parts,
  709. ## regardless of how they are packaged. This License gives no
  710. ## permission to license the work in any other way, but it does not
  711. ## invalidate such permission if you have separately received it.
  712. ##
  713. ## d) If the work has interactive user interfaces, each must display
  714. ## Appropriate Legal Notices; however, if the Program has interactive
  715. ## interfaces that do not display Appropriate Legal Notices, your
  716. ## work need not make them do so.
  717. ##
  718. ## A compilation of a covered work with other separate and independent
  719. ##works, which are not by their nature extensions of the covered work,
  720. ##and which are not combined with it such as to form a larger program,
  721. ##in or on a volume of a storage or distribution medium, is called an
  722. ##"aggregate" if the compilation and its resulting copyright are not
  723. ##used to limit the access or legal rights of the compilation's users
  724. ##beyond what the individual works permit. Inclusion of a covered work
  725. ##in an aggregate does not cause this License to apply to the other
  726. ##parts of the aggregate.
  727. ##
  728. ## 6. Conveying Non-Source Forms.
  729. ##
  730. ## You may convey a covered work in object code form under the terms
  731. ##of sections 4 and 5, provided that you also convey the
  732. ##machine-readable Corresponding Source under the terms of this License,
  733. ##in one of these ways:
  734. ##
  735. ## a) Convey the object code in, or embodied in, a physical product
  736. ## (including a physical distribution medium), accompanied by the
  737. ## Corresponding Source fixed on a durable physical medium
  738. ## customarily used for software interchange.
  739. ##
  740. ## b) Convey the object code in, or embodied in, a physical product
  741. ## (including a physical distribution medium), accompanied by a
  742. ## written offer, valid for at least three years and valid for as
  743. ## long as you offer spare parts or customer support for that product
  744. ## model, to give anyone who possesses the object code either (1) a
  745. ## copy of the Corresponding Source for all the software in the
  746. ## product that is covered by this License, on a durable physical
  747. ## medium customarily used for software interchange, for a price no
  748. ## more than your reasonable cost of physically performing this
  749. ## conveying of source, or (2) access to copy the
  750. ## Corresponding Source from a network server at no charge.
  751. ##
  752. ## c) Convey individual copies of the object code with a copy of the
  753. ## written offer to provide the Corresponding Source. This
  754. ## alternative is allowed only occasionally and noncommercially, and
  755. ## only if you received the object code with such an offer, in accord
  756. ## with subsection 6b.
  757. ##
  758. ## d) Convey the object code by offering access from a designated
  759. ## place (gratis or for a charge), and offer equivalent access to the
  760. ## Corresponding Source in the same way through the same place at no
  761. ## further charge. You need not require recipients to copy the
  762. ## Corresponding Source along with the object code. If the place to
  763. ## copy the object code is a network server, the Corresponding Source
  764. ## may be on a different server (operated by you or a third party)
  765. ## that supports equivalent copying facilities, provided you maintain
  766. ## clear directions next to the object code saying where to find the
  767. ## Corresponding Source. Regardless of what server hosts the
  768. ## Corresponding Source, you remain obligated to ensure that it is
  769. ## available for as long as needed to satisfy these requirements.
  770. ##
  771. ## e) Convey the object code using peer-to-peer transmission, provided
  772. ## you inform other peers where the object code and Corresponding
  773. ## Source of the work are being offered to the general public at no
  774. ## charge under subsection 6d.
  775. ##
  776. ## A separable portion of the object code, whose source code is excluded
  777. ##from the Corresponding Source as a System Library, need not be
  778. ##included in conveying the object code work.
  779. ##
  780. ## A "User Product" is either (1) a "consumer product", which means any
  781. ##tangible personal property which is normally used for personal, family,
  782. ##or household purposes, or (2) anything designed or sold for incorporation
  783. ##into a dwelling. In determining whether a product is a consumer product,
  784. ##doubtful cases shall be resolved in favor of coverage. For a particular
  785. ##product received by a particular user, "normally used" refers to a
  786. ##typical or common use of that class of product, regardless of the status
  787. ##of the particular user or of the way in which the particular user
  788. ##actually uses, or expects or is expected to use, the product. A product
  789. ##is a consumer product regardless of whether the product has substantial
  790. ##commercial, industrial or non-consumer uses, unless such uses represent
  791. ##the only significant mode of use of the product.
  792. ##
  793. ## "Installation Information" for a User Product means any methods,
  794. ##procedures, authorization keys, or other information required to install
  795. ##and execute modified versions of a covered work in that User Product from
  796. ##a modified version of its Corresponding Source. The information must
  797. ##suffice to ensure that the continued functioning of the modified object
  798. ##code is in no case prevented or interfered with solely because
  799. ##modification has been made.
  800. ##
  801. ## If you convey an object code work under this section in, or with, or
  802. ##specifically for use in, a User Product, and the conveying occurs as
  803. ##part of a transaction in which the right of possession and use of the
  804. ##User Product is transferred to the recipient in perpetuity or for a
  805. ##fixed term (regardless of how the transaction is characterized), the
  806. ##Corresponding Source conveyed under this section must be accompanied
  807. ##by the Installation Information. But this requirement does not apply
  808. ##if neither you nor any third party retains the ability to install
  809. ##modified object code on the User Product (for example, the work has
  810. ##been installed in ROM).
  811. ##
  812. ## The requirement to provide Installation Information does not include a
  813. ##requirement to continue to provide support service, warranty, or updates
  814. ##for a work that has been modified or installed by the recipient, or for
  815. ##the User Product in which it has been modified or installed. Access to a
  816. ##network may be denied when the modification itself materially and
  817. ##adversely affects the operation of the network or violates the rules and
  818. ##protocols for communication across the network.
  819. ##
  820. ## Corresponding Source conveyed, and Installation Information provided,
  821. ##in accord with this section must be in a format that is publicly
  822. ##documented (and with an implementation available to the public in
  823. ##source code form), and must require no special password or key for
  824. ##unpacking, reading or copying.
  825. ##
  826. ## 7. Additional Terms.
  827. ##
  828. ## "Additional permissions" are terms that supplement the terms of this
  829. ##License by making exceptions from one or more of its conditions.
  830. ##Additional permissions that are applicable to the entire Program shall
  831. ##be treated as though they were included in this License, to the extent
  832. ##that they are valid under applicable law. If additional permissions
  833. ##apply only to part of the Program, that part may be used separately
  834. ##under those permissions, but the entire Program remains governed by
  835. ##this License without regard to the additional permissions.
  836. ##
  837. ## When you convey a copy of a covered work, you may at your option
  838. ##remove any additional permissions from that copy, or from any part of
  839. ##it. (Additional permissions may be written to require their own
  840. ##removal in certain cases when you modify the work.) You may place
  841. ##additional permissions on material, added by you to a covered work,
  842. ##for which you have or can give appropriate copyright permission.
  843. ##
  844. ## Notwithstanding any other provision of this License, for material you
  845. ##add to a covered work, you may (if authorized by the copyright holders of
  846. ##that material) supplement the terms of this License with terms:
  847. ##
  848. ## a) Disclaiming warranty or limiting liability differently from the
  849. ## terms of sections 15 and 16 of this License; or
  850. ##
  851. ## b) Requiring preservation of specified reasonable legal notices or
  852. ## author attributions in that material or in the Appropriate Legal
  853. ## Notices displayed by works containing it; or
  854. ##
  855. ## c) Prohibiting misrepresentation of the origin of that material, or
  856. ## requiring that modified versions of such material be marked in
  857. ## reasonable ways as different from the original version; or
  858. ##
  859. ## d) Limiting the use for publicity purposes of names of licensors or
  860. ## authors of the material; or
  861. ##
  862. ## e) Declining to grant rights under trademark law for use of some
  863. ## trade names, trademarks, or service marks; or
  864. ##
  865. ## f) Requiring indemnification of licensors and authors of that
  866. ## material by anyone who conveys the material (or modified versions of
  867. ## it) with contractual assumptions of liability to the recipient, for
  868. ## any liability that these contractual assumptions directly impose on
  869. ## those licensors and authors.
  870. ##
  871. ## All other non-permissive additional terms are considered "further
  872. ##restrictions" within the meaning of section 10. If the Program as you
  873. ##received it, or any part of it, contains a notice stating that it is
  874. ##governed by this License along with a term that is a further
  875. ##restriction, you may remove that term. If a license document contains
  876. ##a further restriction but permits relicensing or conveying under this
  877. ##License, you may add to a covered work material governed by the terms
  878. ##of that license document, provided that the further restriction does
  879. ##not survive such relicensing or conveying.
  880. ##
  881. ## If you add terms to a covered work in accord with this section, you
  882. ##must place, in the relevant source files, a statement of the
  883. ##additional terms that apply to those files, or a notice indicating
  884. ##where to find the applicable terms.
  885. ##
  886. ## Additional terms, permissive or non-permissive, may be stated in the
  887. ##form of a separately written license, or stated as exceptions;
  888. ##the above requirements apply either way.
  889. ##
  890. ## 8. Termination.
  891. ##
  892. ## You may not propagate or modify a covered work except as expressly
  893. ##provided under this License. Any attempt otherwise to propagate or
  894. ##modify it is void, and will automatically terminate your rights under
  895. ##this License (including any patent licenses granted under the third
  896. ##paragraph of section 11).
  897. ##
  898. ## However, if you cease all violation of this License, then your
  899. ##license from a particular copyright holder is reinstated (a)
  900. ##provisionally, unless and until the copyright holder explicitly and
  901. ##finally terminates your license, and (b) permanently, if the copyright
  902. ##holder fails to notify you of the violation by some reasonable means
  903. ##prior to 60 days after the cessation.
  904. ##
  905. ## Moreover, your license from a particular copyright holder is
  906. ##reinstated permanently if the copyright holder notifies you of the
  907. ##violation by some reasonable means, this is the first time you have
  908. ##received notice of violation of this License (for any work) from that
  909. ##copyright holder, and you cure the violation prior to 30 days after
  910. ##your receipt of the notice.
  911. ##
  912. ## Termination of your rights under this section does not terminate the
  913. ##licenses of parties who have received copies or rights from you under
  914. ##this License. If your rights have been terminated and not permanently
  915. ##reinstated, you do not qualify to receive new licenses for the same
  916. ##material under section 10.
  917. ##
  918. ## 9. Acceptance Not Required for Having Copies.
  919. ##
  920. ## You are not required to accept this License in order to receive or
  921. ##run a copy of the Program. Ancillary propagation of a covered work
  922. ##occurring solely as a consequence of using peer-to-peer transmission
  923. ##to receive a copy likewise does not require acceptance. However,
  924. ##nothing other than this License grants you permission to propagate or
  925. ##modify any covered work. These actions infringe copyright if you do
  926. ##not accept this License. Therefore, by modifying or propagating a
  927. ##covered work, you indicate your acceptance of this License to do so.
  928. ##
  929. ## 10. Automatic Licensing of Downstream Recipients.
  930. ##
  931. ## Each time you convey a covered work, the recipient automatically
  932. ##receives a license from the original licensors, to run, modify and
  933. ##propagate that work, subject to this License. You are not responsible
  934. ##for enforcing compliance by third parties with this License.
  935. ##
  936. ## An "entity transaction" is a transaction transferring control of an
  937. ##organization, or substantially all assets of one, or subdividing an
  938. ##organization, or merging organizations. If propagation of a covered
  939. ##work results from an entity transaction, each party to that
  940. ##transaction who receives a copy of the work also receives whatever
  941. ##licenses to the work the party's predecessor in interest had or could
  942. ##give under the previous paragraph, plus a right to possession of the
  943. ##Corresponding Source of the work from the predecessor in interest, if
  944. ##the predecessor has it or can get it with reasonable efforts.
  945. ##
  946. ## You may not impose any further restrictions on the exercise of the
  947. ##rights granted or affirmed under this License. For example, you may
  948. ##not impose a license fee, royalty, or other charge for exercise of
  949. ##rights granted under this License, and you may not initiate litigation
  950. ##(including a cross-claim or counterclaim in a lawsuit) alleging that
  951. ##any patent claim is infringed by making, using, selling, offering for
  952. ##sale, or importing the Program or any portion of it.
  953. ##
  954. ## 11. Patents.
  955. ##
  956. ## A "contributor" is a copyright holder who authorizes use under this
  957. ##License of the Program or a work on which the Program is based. The
  958. ##work thus licensed is called the contributor's "contributor version".
  959. ##
  960. ## A contributor's "essential patent claims" are all patent claims
  961. ##owned or controlled by the contributor, whether already acquired or
  962. ##hereafter acquired, that would be infringed by some manner, permitted
  963. ##by this License, of making, using, or selling its contributor version,
  964. ##but do not include claims that would be infringed only as a
  965. ##consequence of further modification of the contributor version. For
  966. ##purposes of this definition, "control" includes the right to grant
  967. ##patent sublicenses in a manner consistent with the requirements of
  968. ##this License.
  969. ##
  970. ## Each contributor grants you a non-exclusive, worldwide, royalty-free
  971. ##patent license under the contributor's essential patent claims, to
  972. ##make, use, sell, offer for sale, import and otherwise run, modify and
  973. ##propagate the contents of its contributor version.
  974. ##
  975. ## In the following three paragraphs, a "patent license" is any express
  976. ##agreement or commitment, however denominated, not to enforce a patent
  977. ##(such as an express permission to practice a patent or covenant not to
  978. ##sue for patent infringement). To "grant" such a patent license to a
  979. ##party means to make such an agreement or commitment not to enforce a
  980. ##patent against the party.
  981. ##
  982. ## If you convey a covered work, knowingly relying on a patent license,
  983. ##and the Corresponding Source of the work is not available for anyone
  984. ##to copy, free of charge and under the terms of this License, through a
  985. ##publicly available network server or other readily accessible means,
  986. ##then you must either (1) cause the Corresponding Source to be so
  987. ##available, or (2) arrange to deprive yourself of the benefit of the
  988. ##patent license for this particular work, or (3) arrange, in a manner
  989. ##consistent with the requirements of this License, to extend the patent
  990. ##license to downstream recipients. "Knowingly relying" means you have
  991. ##actual knowledge that, but for the patent license, your conveying the
  992. ##covered work in a country, or your recipient's use of the covered work
  993. ##in a country, would infringe one or more identifiable patents in that
  994. ##country that you have reason to believe are valid.
  995. ##
  996. ## If, pursuant to or in connection with a single transaction or
  997. ##arrangement, you convey, or propagate by procuring conveyance of, a
  998. ##covered work, and grant a patent license to some of the parties
  999. ##receiving the covered work authorizing them to use, propagate, modify
  1000. ##or convey a specific copy of the covered work, then the patent license
  1001. ##you grant is automatically extended to all recipients of the covered
  1002. ##work and works based on it.
  1003. ##
  1004. ## A patent license is "discriminatory" if it does not include within
  1005. ##the scope of its coverage, prohibits the exercise of, or is
  1006. ##conditioned on the non-exercise of one or more of the rights that are
  1007. ##specifically granted under this License. You may not convey a covered
  1008. ##work if you are a party to an arrangement with a third party that is
  1009. ##in the business of distributing software, under which you make payment
  1010. ##to the third party based on the extent of your activity of conveying
  1011. ##the work, and under which the third party grants, to any of the
  1012. ##parties who would receive the covered work from you, a discriminatory
  1013. ##patent license (a) in connection with copies of the covered work
  1014. ##conveyed by you (or copies made from those copies), or (b) primarily
  1015. ##for and in connection with specific products or compilations that
  1016. ##contain the covered work, unless you entered into that arrangement,
  1017. ##or that patent license was granted, prior to 28 March 2007.
  1018. ##
  1019. ## Nothing in this License shall be construed as excluding or limiting
  1020. ##any implied license or other defenses to infringement that may
  1021. ##otherwise be available to you under applicable patent law.
  1022. ##
  1023. ## 12. No Surrender of Others' Freedom.
  1024. ##
  1025. ## If conditions are imposed on you (whether by court order, agreement or
  1026. ##otherwise) that contradict the conditions of this License, they do not
  1027. ##excuse you from the conditions of this License. If you cannot convey a
  1028. ##covered work so as to satisfy simultaneously your obligations under this
  1029. ##License and any other pertinent obligations, then as a consequence you may
  1030. ##not convey it at all. For example, if you agree to terms that obligate you
  1031. ##to collect a royalty for further conveying from those to whom you convey
  1032. ##the Program, the only way you could satisfy both those terms and this
  1033. ##License would be to refrain entirely from conveying the Program.
  1034. ##
  1035. ## 13. Use with the GNU Affero General Public License.
  1036. ##
  1037. ## Notwithstanding any other provision of this License, you have
  1038. ##permission to link or combine any covered work with a work licensed
  1039. ##under version 3 of the GNU Affero General Public License into a single
  1040. ##combined work, and to convey the resulting work. The terms of this
  1041. ##License will continue to apply to the part which is the covered work,
  1042. ##but the special requirements of the GNU Affero General Public License,
  1043. ##section 13, concerning interaction through a network will apply to the
  1044. ##combination as such.
  1045. ##
  1046. ## 14. Revised Versions of this License.
  1047. ##
  1048. ## The Free Software Foundation may publish revised and/or new versions of
  1049. ##the GNU General Public License from time to time. Such new versions will
  1050. ##be similar in spirit to the present version, but may differ in detail to
  1051. ##address new problems or concerns.
  1052. ##
  1053. ## Each version is given a distinguishing version number. If the
  1054. ##Program specifies that a certain numbered version of the GNU General
  1055. ##Public License "or any later version" applies to it, you have the
  1056. ##option of following the terms and conditions either of that numbered
  1057. ##version or of any later version published by the Free Software
  1058. ##Foundation. If the Program does not specify a version number of the
  1059. ##GNU General Public License, you may choose any version ever published
  1060. ##by the Free Software Foundation.
  1061. ##
  1062. ## If the Program specifies that a proxy can decide which future
  1063. ##versions of the GNU General Public License can be used, that proxy's
  1064. ##public statement of acceptance of a version permanently authorizes you
  1065. ##to choose that version for the Program.
  1066. ##
  1067. ## Later license versions may give you additional or different
  1068. ##permissions. However, no additional obligations are imposed on any
  1069. ##author or copyright holder as a result of your choosing to follow a
  1070. ##later version.
  1071. ##
  1072. ## 15. Disclaimer of Warranty.
  1073. ##
  1074. ## THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  1075. ##APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  1076. ##HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
  1077. ##OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
  1078. ##THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  1079. ##PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
  1080. ##IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
  1081. ##ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  1082. ##
  1083. ## 16. Limitation of Liability.
  1084. ##
  1085. ## IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  1086. ##WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
  1087. ##THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
  1088. ##GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  1089. ##USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  1090. ##DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  1091. ##PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
  1092. ##EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
  1093. ##SUCH DAMAGES.
  1094. ##
  1095. ## 17. Interpretation of Sections 15 and 16.
  1096. ##
  1097. ## If the disclaimer of warranty and limitation of liability provided
  1098. ##above cannot be given local legal effect according to their terms,
  1099. ##reviewing courts shall apply local law that most closely approximates
  1100. ##an absolute waiver of all civil liability in connection with the
  1101. ##Program, unless a warranty or assumption of liability accompanies a
  1102. ##copy of the Program in return for a fee.
  1103. ##
  1104. ## END OF TERMS AND CONDITIONS
  1105. ##
  1106.