Skip to content

Commit

Permalink
Merge pull request #59 from su1s/0.7-updates-dm
Browse files Browse the repository at this point in the history
v0.7.4
  • Loading branch information
DougMac committed Apr 10, 2018
2 parents 965ffe9 + 5573f20 commit 646463a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
39 changes: 15 additions & 24 deletions README.md
Expand Up @@ -4,7 +4,7 @@ Latest release can be downloaded from [releases](https://github.com/su1s/e2m3u2b

## Usage
```
usage: e2m3u2bouquet.py [-h] [-m M3UURL] [-e EPGURL] [-n PROVIDERNAME]
usage: e2m3u2bouquet.py [-h] [-m M3UURL] [-e EPGURL]
[-u USERNAME] [-p PASSWORD] [-i] [-sttv STTV]
[-stvod STVOD] [-M] [-a] [-P] [-q ICONPATH] [-xs]
[-b BOUQUETURL] [-bd] [-bt] [-U] [-V]
Expand Down Expand Up @@ -53,14 +53,7 @@ URL Based Setup:
URL to download m3u data from (required)
-e EPGURL, --epgurl EPGURL
URL source for XML TV epg data sources
Provider Based Setup:
-n PROVIDERNAME, --providername PROVIDERNAME
Host IPTV provider name (FAB/EPIC) (required)
-u USERNAME, --username USERNAME
Your IPTV username (required)
-p PASSWORD, --password PASSWORD
Your IPTV password (required)
Config file based setup
No parameters required
The script will create a default config file
Expand Down Expand Up @@ -90,17 +83,11 @@ cd /etc/enigma2/e2m3u2bouquet
```
chmod 755 e2m3u2bouquet.py
```
## Provider Based Setup
```
./e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD
```
Supported providers are currently
FAB, EPIC, ULTIMATESPORTS, ACE, POSH

## URL Based Setup
Run the script passing the url for your m3u file and the url for your providers XML TV data feed (for FAB hosting the below works)
```
./e2m3u2bouquet.py -m "http://stream.fabiptv.com:25461/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://stream.fabiptv.com:25461/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD"
./e2m3u2bouquet.py -m "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD"
```
**NB: you need to replace the username and password values X 2**

Expand All @@ -123,17 +110,17 @@ is `/usr/share/enigma2/picon/` (internal flash) other enigma2 picon search locat
N.B. If you store the picons on HDD it was spin up whenever they are shown

```
./e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD -P
./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -P
```

## Specify all stream types to be IPTV
Default is DVB stream types for live channels and IPTV for VOD, all IPTV type streams may be required if you are unable to record channels.
```
./e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD -i
./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -i
```

## Keep VOD all in a single bouquet
./e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD -s
./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -s

## Uninstall
./e2m3u2bouquet.py -U
Expand Down Expand Up @@ -165,10 +152,6 @@ crontab -e
Once open press i to switch to INSERT mode enter the following (retype or ctrl-v to paste)
This will automatically run the script at 06:00 & 18:00 every day
```
0 6,18 * * * /etc/enigma2/e2m3u2bouquet/e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD
```
or
```
0 6,18 * * * /etc/enigma2/e2m3u2bouquet/e2m3u2bouquet.py -m "http://stream.fabiptv.com:25461/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://stream.fabiptv.com:25461/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD"
```
or
Expand All @@ -189,7 +172,7 @@ which makes editing the crontab easier)
* Select the required update frequency
* For the command to run enter i.e. to run at 06:00 & 18:00 enter
```
0 6,18 * * * cd /home/root && ./e2m3u2bouquet.py -n FAB -u USERNAME -p PASSWORD
0 6,18 * * * cd /home/root && ./e2m3u2bouquet.py
```
* Ensure that cron Autostart is active

Expand Down Expand Up @@ -312,4 +295,12 @@ which makes editing the crontab easier)
* Unicode fixes
* Url encoding fixes

### v0.7.3
* Fix issue where main screen showing no text on some skins
* Add option to reset bouquets

### v0.7.4
* Extra checking to ensure that logos are actually images
* Keep provider order from config file

Visit https://www.suls.co.uk/enigma2-iptv-bouquets-with-epg/ for further information on the script
28 changes: 18 additions & 10 deletions e2m3u2bouquet.py
Expand Up @@ -39,9 +39,9 @@
from argparse import RawDescriptionHelpFormatter

__all__ = []
__version__ = '0.7.3'
__version__ = '0.7.4'
__date__ = '2017-06-04'
__updated__ = '2018-03-07'
__updated__ = '2018-04-10'

DEBUG = 0
TESTRUN = 0
Expand Down Expand Up @@ -642,10 +642,18 @@ def download_picon_file(self, logourl, title, iconpath):
sys.stdout.write('.')
sys.stdout.flush()
try:
urllib.urlretrieve(logourl, piconfilepath)
response = urllib.urlopen(logourl)
info = response.info()
response.close()
if info.maintype == 'image':
urllib.urlretrieve(logourl, piconfilepath)
else:
if DEBUG:
print('Download Picon - not an image skipping')
return
except Exception, e:
if DEBUG:
print(e)
print('Download picon urlopen error', e)
return
self.picon_post_processing(piconfilepath)

Expand All @@ -659,7 +667,7 @@ def picon_post_processing(self, piconfilepath):
ext = imghdr.what(piconfilepath)
except Exception, e:
if DEBUG:
print(e)
print('Picon post processing - not an image or no file', e, piconfilepath)
return
# if image but not png convert to png
if (ext is not None) and (ext is not 'png'):
Expand All @@ -669,22 +677,22 @@ def picon_post_processing(self, piconfilepath):
Image.open(piconfilepath).save("{}.{}".format(piconfilepath, 'png'))
except Exception, e:
if DEBUG:
print(e)
print('Picon post processing - unable to convert image', e)
return
try:
# remove non png file
os.remove(piconfilepath)
except Exception, e:
if DEBUG:
print(e)
print('Picon post processing - unable to remove non png file', e)
return
else:
# rename to correct extension
try:
os.rename(piconfilepath, "{}.{}".format(piconfilepath, ext))
except Exception, e:
if DEBUG:
print(e)
print('Picon post processing - unable to rename file ', e)

def get_picon_name(self, serviceName):
"""Convert the service name to a Picon Service Name
Expand Down Expand Up @@ -1144,7 +1152,7 @@ def makeconfig(self, configfile):
</config>""")

def readconfig(self, configfile):
suppliers = {}
suppliers = OrderedDict()
tree = ET.ElementTree(file=configfile)
for node in tree.findall('.//supplier'):
supplier = {}
Expand Down Expand Up @@ -1286,7 +1294,7 @@ def main(argv=None): # IGNORE:C0111
if epgurl is None:
epgurl = "http://www.vuplus-community.net/rytec/rytecxmltv-UK.gz"
# Set piconpath
if iconpath is None:
if iconpath is None or TESTRUN == 1:
iconpath = PICONSPATH
if provider is None:
provider = "E2m3u2Bouquet"
Expand Down

0 comments on commit 646463a

Please sign in to comment.