KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
5.6KB

  1. #!/usr/bin/env python3
  2. import os
  3. manualPages = (
  4. "kxstudio_introduction",
  5. "kxstudio_and_free_software",
  6. "downloading_and_booting_kxstudio",
  7. "installing_kxstudio",
  8. "package_management",
  9. "video_drivers",
  10. "included_and_recommended_apps",
  11. "linux_audio_overview",
  12. "alsa_and_kxstudio",
  13. "cadence_introduction",
  14. "jack_configuration",
  15. "simple_claudia_studio",
  16. "latency",
  17. "wineasio_and_reaper",
  18. "useful_links_and_getting_help"
  19. )
  20. for page in manualPages:
  21. print(page)
  22. tmppage = "tmp_%s" % page
  23. webpage = "http://wiki.linuxaudio.org/wiki/%s" % page
  24. os.system("wget %s -O %s" % (webpage, tmppage))
  25. tmppageFd = open(tmppage, "r")
  26. tmppageRead = tmppageFd.read().strip()
  27. tmppageFd.close()
  28. # remove initial html code
  29. readPart1 = tmppageRead.split("<!-- wikipage start -->", 1)[1].strip()
  30. # remove TOC, if any
  31. readPart2 = readPart1.split("<!-- TOC END -->", 1)[-1].strip()
  32. # remove final html code
  33. readPart3 = readPart2.split("<!-- wikipage stop -->", 1)[0].strip()
  34. # remove first part of the page, we want the title
  35. readPart4 = readPart3.split("<h1 class=\"sectionedit1\"><a name=", 1)[1].strip()
  36. # get the title
  37. kxPageTitle = readPart4.split(">", 1)[1].split("</a>", 1)[0].strip()
  38. # remove initial bits of html code (title)
  39. readPart5 = readPart4.split("</h1>", 1)[1].strip()
  40. # custom mods
  41. readPart5 = readPart5.replace("/_detail/wiki/cadence.png?id=wiki%3Acadence_introduction",
  42. "<?php echo $ROOT; ?>/screenshots/cadence1.png")
  43. readPart5 = readPart5.replace("/_media/wiki/cadence.png",
  44. "<?php echo $ROOT; ?>/screenshots/cadence1.png")
  45. readPart5 = readPart5.replace("/_detail/wiki/cadence-wineasio.png?id=wiki%3Awineasio_and_reaper",
  46. "<?php echo $ROOT; ?>/screenshots/cadence3.png")
  47. readPart5 = readPart5.replace("/_media/wiki/cadence-wineasio.png",
  48. "<?php echo $ROOT; ?>/screenshots/cadence3.png")
  49. readPart5 = readPart5.replace("/_detail/wiki/cadence-jack-settings.png?id=wiki%3Ajack_configuration",
  50. "<?php echo $ROOT; ?>/screenshots/cadence-jacksettings2.png")
  51. readPart5 = readPart5.replace("/_media/wiki/cadence-jack-settings.png",
  52. "<?php echo $ROOT; ?>/screenshots/cadence-jacksettings2.png")
  53. readPart5 = readPart5.replace("/_detail/wiki/claudia2.png?id=wiki%3Asimple_claudia_studio",
  54. "<?php echo $ROOT; ?>/screenshots/claudia-qtractor.png")
  55. readPart5 = readPart5.replace("/_media/wiki/claudia2.png",
  56. "<?php echo $ROOT; ?>/screenshots/claudia-qtractor.png")
  57. readPart5 = readPart5.replace("/_detail/wiki/kmixer.png?id=wiki%3Aalsa_and_kxstudio",
  58. "<?php echo $ROOT; ?>/screenshots/kmix.png")
  59. readPart5 = readPart5.replace("/_media/wiki/kmixer.png",
  60. "<?php echo $ROOT; ?>/screenshots/kmix.png")
  61. k1 = '<a href="/_detail/wiki/kmix-tray.png?id=wiki%3Aalsa_and_kxstudio" class="media" title="wiki:kmix-tray.png">'
  62. k2 = '<img src="/_media/wiki/kmix-tray.png" class="media" title="The kmix icon" alt="The kmix icon" />'
  63. k3 = '</a>'
  64. readPart5 = readPart5.replace(k1+k2+k3, k2)
  65. readPart5 = readPart5.replace('?w=500" class="mediacenter" alt="" width="500"', '" class="media" alt=""')
  66. # html cleanup
  67. for i in range(2, 10):
  68. readPart5 = readPart5.replace(" class=\"sectionedit%i\"" % i, "")
  69. readPart5 = readPart5.replace("<h2><a name=", "<h2><span name=").replace("</a></h2>", "</span></h2>")
  70. readPart5 = readPart5.replace("<h3><a name=", "<h3><span name=").replace("</a></h3>", "</span></h3>")
  71. readPart5 = readPart5.replace("/_detail/wiki/", "http://wiki.linuxaudio.org/_detail/wiki/")
  72. readPart5 = readPart5.replace("/_media/wiki/", "http://wiki.linuxaudio.org/_media/wiki/")
  73. readPart5 = readPart5.replace('href="/wiki/', 'target="_blank" href="http://wiki.linuxaudio.org/wiki/')
  74. readPart5 = readPart5.replace('title="wiki:', 'title="')
  75. # FIXME: this should happen on the wiki
  76. readPart5 = readPart5.replace("kxstudio.sourceforge.net", "kxstudio.linuxaudio.org")
  77. # final adjustment
  78. readPart5 = readPart5.replace(" The &#039;UAC3553B&#039; tab displays controls for a USB audio device whilst &#039;Playback Streams&#039; can be ignored unless you are using PulseAudio.",
  79. "")
  80. readPart5 = readPart5.replace("as &#039;Mic&#039; and &#039;Mic Boost&#039; do", "as &#039;Beep&#039; does")
  81. readPart5 = readPart5.replace('href="http://kxstudio.linuxaudio.org/', 'href="<?php echo $ROOT; ?>/')
  82. readPart5 = readPart5.replace('title="http://kxstudio.linuxaudio.org/', 'title="')
  83. kxPageContent = '<?php\n'
  84. kxPageContent += '$PAGE_TITLE = "KXStudio";\n'
  85. kxPageContent += '$PAGE_TYPE = "NONKXSTUDIO";\n'
  86. kxPageContent += '$PAGE_SOURCE_1 = ARRAY("/Documentation", "/Documentation", "/Documentation:Manual:%s");\n' % page
  87. kxPageContent += '$PAGE_SOURCE_2 = ARRAY("Documentation", "Manual", "%s");\n' % kxPageTitle
  88. kxPageContent += 'include_once("includes/header.php");\n'
  89. kxPageContent += '?>\n'
  90. kxPageContent += '\n'
  91. kxPageContent += readPart5
  92. kxPageContent += '\n'
  93. kxPageContent += '\n'
  94. kxPageContent += '<p><br/></p>\n'
  95. kxPageContent += '\n'
  96. kxPageContent += '<?php\n'
  97. kxPageContent += 'include_once("includes/footer.php");\n'
  98. kxPageContent += '?>\n'
  99. pageFd = open("Documentation:Manual:%s.php" % page, "w")
  100. pageFd.write(kxPageContent)
  101. pageFd.close()
  102. # removing temporary file
  103. os.remove(tmppage)