Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DsayersCustomMixImporter] Allow user to select different sources
- Loading branch information
Showing
9 changed files
with
101 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SUBDIRS = meta po src | ||
SUBDIRS = meta po src mixes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
installdir = $(libdir)/enigma2/python/Plugins/SystemPlugins/DsayersCustomMixImporter/mixes | ||
|
||
install_DATA = *.xml |
5 changes: 5 additions & 0 deletions
5
DsayersCustomMixImporter/mixes/dsayers_skyuk_fta_into_vmuk.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<custommiximport> | ||
<name>Dsayers: Sky UK free to air channels into Virgin Media UK</name> | ||
<provider>cable_uk_virgin</provider> | ||
<url>https://raw.githubusercontent.com/davesayers2014/AutoBouquetsMaker/master/AutoBouquetsMaker/custom/cable_uk_virgin_CustomMix.xml</url> | ||
</custommiximport> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<custommiximport> | ||
<name>Dsayers: Virgin Media UK channels into Sky UK</name> | ||
<provider>sat_282_sky_uk</provider> | ||
<url>https://raw.githubusercontent.com/davesayers2014/AutoBouquetsMaker/master/AutoBouquetsMaker/custom/sat_282_sky_uk_CustomMix.xml</url> | ||
</custommiximport> |
5 changes: 5 additions & 0 deletions
5
DsayersCustomMixImporter/mixes/jawz_vmie_and_skyie_into_skyuk.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<custommiximport> | ||
<name>Jawz: Virgin Media IE and Sky IE channels into Sky UK</name> | ||
<provider>sat_282_sky_uk</provider> | ||
<url>https://raw.githubusercontent.com/jawz86/Jawz-CustomMix/master/sat_282_sky_uk_CustomMix.xml</url> | ||
</custommiximport> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
import xml.dom.minidom | ||
|
||
class Mixes(): | ||
MIXES_DIR = os.path.dirname(__file__) + "/mixes" | ||
|
||
def parseXML(self, filename): | ||
try: | ||
mix = open(filename, "r") | ||
except Exception, e: | ||
print "[DsayersCustomMixImporter][Mixes] Cannot open %s: %s" % (filename, e) | ||
return None | ||
|
||
try: | ||
dom = xml.dom.minidom.parse(mix) | ||
except Exception, e: | ||
print "[DsayersCustomMixImporter][Mixes] XML parse error (%s): %s" % (filename, e) | ||
mix.close() | ||
return None | ||
|
||
mix.close() | ||
return dom | ||
|
||
def read(self): | ||
mixes = {} | ||
for filename in os.listdir(self.MIXES_DIR): | ||
if filename[-4:] != ".xml": | ||
continue | ||
|
||
dom = self.parseXML(self.MIXES_DIR + "/" + filename) | ||
if dom is None: | ||
continue | ||
|
||
mix = {} | ||
mix["key"] = filename[:-4] | ||
if dom.documentElement.nodeType == dom.documentElement.ELEMENT_NODE and dom.documentElement.tagName == "custommiximport": | ||
for node in dom.documentElement.childNodes: | ||
if node.nodeType != node.ELEMENT_NODE: | ||
continue | ||
|
||
if node.tagName == "name": | ||
node.normalize() | ||
if len(node.childNodes) == 1 and node.childNodes[0].nodeType == node.TEXT_NODE: | ||
mix["name"] = node.childNodes[0].data.encode("utf-8") | ||
elif node.tagName == "provider": | ||
node.normalize() | ||
if len(node.childNodes) == 1 and node.childNodes[0].nodeType == node.TEXT_NODE: | ||
mix["provider"] = node.childNodes[0].data.encode("utf-8") | ||
elif node.tagName == "url": | ||
node.normalize() | ||
if len(node.childNodes) == 1 and node.childNodes[0].nodeType == node.TEXT_NODE: | ||
mix["url"] = node.childNodes[0].data.encode("utf-8") | ||
|
||
if not ("name" in mix and "provider" in mix and "url" in mix): | ||
|
||
print "[DsayersCustomMixImporter][Mixes] Incomplete XML %s" % filename | ||
continue | ||
|
||
mixes[mix["key"]] = mix | ||
|
||
return mixes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<!--suppress XmlUnboundNsPrefix --> | ||
<setupxml> | ||
<setup key="dsayerscustommiximporter" title="Dsayers CustomMix"> | ||
<item level="2" text="Enable autofetch" description="Allows you automatically fetch the Dsayers CustomMix file.">config.plugins.dsayersImporter.enableImporter</item> | ||
<setup key="dsayerscustommiximporter" title="Dsayers CustomMix Importer"> | ||
<item level="2" text="Import" description="Select the CustomMix you want to import">config.plugins.dsayersImporter.mix</item> | ||
<item level="2" text="Enable autofetch" description="Allows you automatically fetch the CustomMix file.">config.plugins.dsayersImporter.enableImporter</item> | ||
<item level="2" text="Lead time" requires="config.plugins.dsayersImporter.enableImporter" description="Number of minutes prior to the ABM scan that the CustomMix file should be fetched">config.plugins.dsayersImporter.leadTime</item> | ||
</setup> | ||
</setupxml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters