#!/usr/bin/env python3 import os manualPages = ( "kxstudio_introduction", "kxstudio_and_free_software", "downloading_and_booting_kxstudio", "installing_kxstudio", "package_management", "video_drivers", "included_and_recommended_apps", "linux_audio_overview", "alsa_and_kxstudio", "cadence_introduction", "jack_configuration", "simple_claudia_studio", "latency", "wineasio_and_reaper", "useful_links_and_getting_help" ) for page in manualPages: print(page) tmppage = "tmp_%s" % page webpage = "http://wiki.linuxaudio.org/wiki/%s" % page os.system("wget %s -O %s" % (webpage, tmppage)) tmppageFd = open(tmppage, "r") tmppageRead = tmppageFd.read().strip() tmppageFd.close() # remove initial html code readPart1 = tmppageRead.split("", 1)[1].strip() # remove TOC, if any readPart2 = readPart1.split("", 1)[-1].strip() # remove final html code readPart3 = readPart2.split("", 1)[0].strip() # remove first part of the page, we want the title readPart4 = readPart3.split("

", 1)[1].split("", 1)[0].strip() # remove initial bits of html code (title) readPart5 = readPart4.split("

", 1)[1].strip() # custom mods readPart5 = readPart5.replace("/_detail/wiki/cadence.png?id=wiki%3Acadence_introduction", "/screenshots/cadence1.png") readPart5 = readPart5.replace("/_media/wiki/cadence.png", "/screenshots/cadence1.png") readPart5 = readPart5.replace("/_detail/wiki/cadence-wineasio.png?id=wiki%3Awineasio_and_reaper", "/screenshots/cadence3.png") readPart5 = readPart5.replace("/_media/wiki/cadence-wineasio.png", "/screenshots/cadence3.png") readPart5 = readPart5.replace("/_detail/wiki/cadence-jack-settings.png?id=wiki%3Ajack_configuration", "/screenshots/cadence-jacksettings2.png") readPart5 = readPart5.replace("/_media/wiki/cadence-jack-settings.png", "/screenshots/cadence-jacksettings2.png") readPart5 = readPart5.replace("/_detail/wiki/claudia2.png?id=wiki%3Asimple_claudia_studio", "/screenshots/claudia-qtractor.png") readPart5 = readPart5.replace("/_media/wiki/claudia2.png", "/screenshots/claudia-qtractor.png") readPart5 = readPart5.replace("/_detail/wiki/kmixer.png?id=wiki%3Aalsa_and_kxstudio", "/screenshots/kmix.png") readPart5 = readPart5.replace("/_media/wiki/kmixer.png", "/screenshots/kmix.png") k1 = '' k2 = 'The kmix icon' k3 = '' readPart5 = readPart5.replace(k1+k2+k3, k2) readPart5 = readPart5.replace('?w=500" class="mediacenter" alt="" width="500"', '" class="media" alt=""') # html cleanup for i in range(2, 10): readPart5 = readPart5.replace(" class=\"sectionedit%i\"" % i, "") readPart5 = readPart5.replace("

", "") readPart5 = readPart5.replace("

", "") readPart5 = readPart5.replace("/_detail/wiki/", "http://wiki.linuxaudio.org/_detail/wiki/") readPart5 = readPart5.replace("/_media/wiki/", "http://wiki.linuxaudio.org/_media/wiki/") readPart5 = readPart5.replace('href="/wiki/', 'target="_blank" href="http://wiki.linuxaudio.org/wiki/') readPart5 = readPart5.replace('title="wiki:', 'title="') # FIXME: this should happen on the wiki readPart5 = readPart5.replace("kxstudio.sourceforge.net", "kxstudio.linuxaudio.org") # final adjustment readPart5 = readPart5.replace(" The 'UAC3553B' tab displays controls for a USB audio device whilst 'Playback Streams' can be ignored unless you are using PulseAudio.", "") readPart5 = readPart5.replace("as 'Mic' and 'Mic Boost' do", "as 'Beep' does") readPart5 = readPart5.replace('href="http://kxstudio.linuxaudio.org/', 'href="/') readPart5 = readPart5.replace('title="http://kxstudio.linuxaudio.org/', 'title="') kxPageContent = '\n' kxPageContent += '\n' kxPageContent += readPart5 kxPageContent += '\n' kxPageContent += '\n' kxPageContent += '


\n' kxPageContent += '\n' kxPageContent += '\n' pageFd = open("Documentation:Manual:%s.php" % page, "w") pageFd.write(kxPageContent) pageFd.close() # removing temporary file os.remove(tmppage)