Beispiel #1
0
 def writeBcmWifiConfig(self, iface, essid, encryption, psk):
     contents = ["ssid=%s" % essid]
     contents.append("method=%s" % encryption)
     contents.append("key=%s" % psk)
     print("[Wlan] writeBcmWifiConfig DEBUG: Content:\n%s" %
           "\n".join(contents))
     fileWriteLines(getWlanConfigName(iface),
                    lines=contents,
                    source=MODULE_NAME)
Beispiel #2
0
 def setMovieTags(self, serviceRef, tags):
     filename = serviceRef.getPath()
     filename = "%s.meta" % filename if filename.endswith(
         ".ts") else "%s.ts.meta" % filename
     if isfile(filename):
         lines = fileReadLines(filename, source=MODULE_NAME)
         idTags = iDVBMetaFile.idTags
         if len(lines) > idTags:
             tagList = " ".join(tags)
             if tagList != lines[idTags]:
                 lines[idTags] = tagList
                 fileWriteLines(filename, lines, source=MODULE_NAME)
Beispiel #3
0
 def writeConfig(self, iface):
     essid = config.plugins.wlan.essid.value
     hiddenessid = config.plugins.wlan.hiddenessid.value
     encryption = config.plugins.wlan.encryption.value
     wepkeytype = config.plugins.wlan.wepkeytype.value
     psk = config.plugins.wlan.psk.value
     contents = ["ssid=%s\n" % essid]
     if encryption in ("WPA", "WPA2", "WPA/WPA2", "WEP"):
         if encryption == "WPA/WPA2":
             encryption = "WPA2"
         contents.append("method=%s" % encryption.lower())
         if encryption.lower() == "unencrypted":
             contents.append("method=None")
         contents.append("key=%s" % psk)
     fileWriteLines(getWlanConfigName(iface),
                    lines=contents,
                    source=MODULE_NAME)
Beispiel #4
0
 def writeConfig(self, iface):
     essid = config.plugins.wlan.essid.value
     hiddenessid = config.plugins.wlan.hiddenessid.value
     encryption = config.plugins.wlan.encryption.value
     wepkeytype = config.plugins.wlan.wepkeytype.value
     psk = config.plugins.wlan.psk.value
     contents = ["#WPA Supplicant Configuration by enigma2"]
     contents.append("ctrl_interface=/var/run/wpa_supplicant")
     contents.append("eapol_version=1")
     contents.append("fast_reauth=1")
     contents.append("ap_scan=1")
     contents.append("network={")
     contents.append("\tssid=\"%s\"" % essid)
     if hiddenessid:
         contents.append("\tscan_ssid=1")
     else:
         contents.append("\tscan_ssid=0")
     if encryption in ("WPA", "WPA2", "WPA/WPA2"):
         contents.append("\tkey_mgmt=WPA-PSK")
         if encryption == "WPA":
             contents.append("\tproto=WPA")
             contents.append("\tpairwise=TKIP")
             contents.append("\tgroup=TKIP")
         elif encryption == "WPA2":
             contents.append("\tproto=RSN")
             contents.append("\tpairwise=CCMP")
             contents.append("\tgroup=CCMP")
         else:
             contents.append("\tproto=WPA RSN")
             contents.append("\tpairwise=CCMP TKIP")
             contents.append("\tgroup=CCMP TKIP")
         contents.append("\tpsk=\"%s\"" % psk)
     elif encryption == "WEP":
         contents.append("\tkey_mgmt=NONE")
         if wepkeytype == "ASCII":
             contents.append("\twep_key0=\"%s\"" % psk)
         else:
             contents.append("\twep_key0=%s" % psk)
     else:
         contents.append("\tkey_mgmt=NONE")
     contents.append("}")
     fileWriteLines(getWlanConfigName(iface),
                    lines=contents,
                    source=MODULE_NAME)
Beispiel #5
0
 def saveCIHelper(self):
     if isfile(CI_HELPER_CONF):
         helperConfig = fileReadLines(CI_HELPER_CONF)
         newhelperConfig = []
         for line in helperConfig:
             line = line.replace("\n", "")
             if line.startswith("ENABLE_CI0="):
                 line = "ENABLE_CI0%s" % ("yes" if self.cihelper_ci0.value
                                          else "no")
             elif line.startswith("ENABLE_CI1="):
                 line = "ENABLE_CI1%s" % ("yes" if self.cihelper_ci1.value
                                          else "no")
             newhelperConfig.append("%s\n" % line)
         fileWriteLines(CI_HELPER_CONF_TMP, newhelperConfig)
     else:
         errorText = _("Sorry CIHelper Config is Missing")
         with open("/tmp/CIHelper.log", "a") as fd:
             fd.write("%s\n" % errorText)
         self.session.open(MessageBox, errorText, MessageBox.TYPE_INFO)
     if isfile(CI_HELPER_CONF_TMP):
         rename(CI_HELPER_CONF_TMP, CI_HELPER_CONF)
     self.close()
Beispiel #6
0
 def saveTags(self):
     if self.tags != self.fileTags:
         filename = resolveFilename(SCOPE_CONFIG, "movietags")
         if fileWriteLines(filename, self.tags, source=MODULE_NAME):
             print("[TagEditor] %d tags written to '%s'." %
                   (len(self.tags), filename))