Skip to content

Commit 0af93d3

Browse files
committed
0.9.15 (2017-02-28)
- audio codec compatibility with UK tuners. - overwrite transcode setting for HDTC-2US.
1 parent d622cb2 commit 0af93d3

File tree

3 files changed

+59
-21
lines changed

3 files changed

+59
-21
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
##0.9.15 (2017-02-28)
2+
- audio codec compatibility with UK tuners.
3+
- overwrite transcode setting for HDTC-2US.
4+
15
##0.9.14 (2017-02-26)
26
- PMS 1.4.x video codec fix.
37

CREDITS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ Credits
1010
Deinterlace
1111
- [chateaukok@plex](https://forums.plex.tv/profile/chateaukok) (P. Kok)
1212
audiocodec & videocodec detection
13+
- [SpacemanJT@plex](https://forums.plex.tv/profile/SpacemanJT)
14+
sample files and info for UK tuner support.

Contents/Code/__init__.py

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HDHR Viewer V2 v0.9.14
1+
# HDHR Viewer V2 v0.9.15
22

33
import time
44
import string
@@ -8,9 +8,9 @@
88
from lxml import etree
99

1010
DEBUGMODE = True
11-
TITLE = 'HDHR Viewer 2 (0.9.14)'
11+
TITLE = 'HDHR Viewer 2 (0.9.15)'
1212
PREFIX = '/video/hdhrv2'
13-
VERSION = '0.9.14'
13+
VERSION = '0.9.15'
1414

1515
#GRAPHICS
1616
ART = 'art-default.jpg'
@@ -61,7 +61,8 @@
6161

6262
AUDIO_CHANNELS = 6 # Audio Channels = 2 - stereo; 6 - 5.1
6363
MEDIA_CONTAINER = 'mpegts' # Default media container = 'mpegts'
64-
VIDEO_CODEC = 'mpeg2video' # Default codec = 'mpeg2video'
64+
VIDEO_CODEC = 'mpeg2video' # Default video codec = 'mpeg2video'
65+
AUDIO_CODEC = 'ac3' # Default audio codec = 'ac3'
6566

6667
###################################################################################################
6768
# Entry point - set up default values for all containers
@@ -854,17 +855,28 @@ def AddChannelObjectContainer(oc, tuneridx, title, channels, search=False):
854855

855856
jsonData = getDeviceInfoJsonData(tuner)
856857
modelNumber = jsonData.get('ModelNumber','unknown')
858+
firmwareName = jsonData.get('FirmwareName','unknown')
859+
firmwareVersion = jsonData.get('FirmwareVersion','unknown')
857860
#localIP = tuner['LocalIP']
858861
localIP = tuner.get('LocalIP','')
859862
deviceID = jsonData.get('DeviceID','unknown')
860863

861-
# Allow trancoding only on HDTC-2US
862-
if modelNumber=='HDTC-2US':
863-
logInfo('HDTC-2US detected. Transcode='+Prefs['transcode'])
864+
#Debugging info
865+
logInfo('********************[Tuner]***********************')
866+
logInfo('Model :'+modelNumber)
867+
logInfo('Firmware :'+firmwareName+' '+firmwareVersion)
868+
869+
#Overwrite PreTranscode setting according to model.
870+
if modelNumber=='HDTC-2US' and Prefs['transcode'] in ['none','default']:
871+
logInfo('Transcode:'+Prefs['transcode']+'; Overwrite to none')
872+
transcode = 'none'
873+
elif modelNumber=='HDTC-2US':
874+
logInfo('Transcode:'+Prefs['transcode'])
864875
transcode = Prefs['transcode']
865876
else:
866-
logInfo(modelNumber + ' detected. Transcode=default/ignore')
877+
logInfo('Transcode:default/ignore')
867878
transcode = 'default'
879+
logInfo('**************************************************')
868880

869881
# setup the VideoClipObjects from the channel list
870882
for channel in channels:
@@ -883,19 +895,27 @@ def AddChannelObjectContainer(oc, tuneridx, title, channels, search=False):
883895
if search and localIP!='':
884896
vcoTitle = vcoTitle+' ['+localIP+']'
885897

886-
# For older firmwares/products.
887-
if videoCodec in ['','MPEG2',None]:
898+
#If codec not defined/available (older firmware), assume default codec.
899+
if videoCodec in ['',None]:
888900
videoCodec=VIDEO_CODEC
901+
logError('Video Codec not defined. Are you running the latest firmware? Trying videoCodec='+AUDIO_CODEC)
902+
if audioCodec in ['',None]:
903+
logError('Audio Codec not defined. Are you running the latest firmware? Trying audioCodec='+AUDIO_CODEC)
904+
audioCodec=AUDIO_CODEC
889905

890-
#HDTC-2US and transcoding enabled:
906+
#VideoCodec correction
891907
if modelNumber=='HDTC-2US' and transcode not in ['default','none']:
892908
videoCodec=VideoCodec.H264
909+
elif videoCodec.lower()=='mpeg2':
910+
videoCodec='mpeg2video'
893911
else:
894912
videoCodec=videoCodec.lower()
895-
896-
# For older firmwares/products.
897-
if audioCodec=='':
898-
audioCodec='ac3'
913+
914+
#AudioCodec correction
915+
if audioCodec.lower()=='aac':
916+
audioCodec=='aac_latm'
917+
elif audioCodec.lower()=='mpeg':
918+
audioCodec=='mp2'
899919
else:
900920
audioCodec=audioCodec.lower()
901921

@@ -979,7 +999,11 @@ def CreateVO(tuneridx, url, title, year=None, tagline='', summary='', thumb=R(IC
979999
),
9801000
]
9811001
)
982-
elif transcode=='default':
1002+
elif transcode in ['default','none']:
1003+
if transcode=='none':
1004+
mo_url=url+'?transcode=none'
1005+
else:
1006+
mo_url=url
9831007
vo = VideoClipObject(
9841008
rating_key = uniquekey,
9851009
key = Callback(CreateVO, tuneridx=tuneridx, url=url, title=title, year=year, tagline=tagline, summary=summary, thumb=thumb, starRating=starRating, include_container=True, checkFiles=checkFiles, videoCodec=videoCodec, audioCodec=audioCodec, transcode=transcode,includeBandwidths=includeBandwidths),
@@ -994,7 +1018,7 @@ def CreateVO(tuneridx, url, title, year=None, tagline='', summary='', thumb=R(IC
9941018
thumb = thumb,
9951019
items = [
9961020
MediaObject(
997-
parts = [PartObject(key=(url))],
1021+
parts = [PartObject(key=(mo_url))],
9981022
container = MEDIA_CONTAINER,
9991023
video_resolution = 1080,
10001024
#bitrate = 20000,
@@ -1021,8 +1045,9 @@ def CreateVO(tuneridx, url, title, year=None, tagline='', summary='', thumb=R(IC
10211045
thumb = thumb,
10221046
items = [
10231047
MediaObject(
1024-
parts = [PartObject(key=(url+"?transcode="+Prefs["transcode"]))],
1048+
parts = [PartObject(key=(url+'?=transcode'+transcode))],
10251049
container = MEDIA_CONTAINER,
1050+
video_resolution = 1080,
10261051
video_codec = videoCodec,
10271052
audio_codec = audioCodec,
10281053
audio_channels = AUDIO_CHANNELS,
@@ -1061,7 +1086,7 @@ def xint(s):
10611086
###################################################################################################
10621087
# Make safe file name for channel logo
10631088
###################################################################################################
1064-
def makeSafeFilename(inputFilename):
1089+
def makeSafeFilename(inputFilename):
10651090
try:
10661091
safechars = string.letters + string.digits + "-_."
10671092
return filter(lambda c: c in safechars, inputFilename)
@@ -1120,12 +1145,19 @@ def errorMessage(message):
11201145
# Client Information.
11211146
###################################################################################################
11221147
def getInfo():
1123-
svrOSver = Platform.OSVersion
1148+
#svrOSver = Platform.OSVersion
11241149
logInfo('******************[System Info]*******************')
1125-
logInfo('Server: '+Platform.OS+' '+svrOSver+' ['+Platform.CPU+']')
1150+
logInfo('Server: '+Platform.OS+' '+Platform.OSVersion+' ['+Platform.CPU+']')
11261151
logInfo('PMS : '+Platform.ServerVersion)
11271152
logInfo('Client: '+Client.Product+' '+Client.Version+' ['+Client.Platform+']')
11281153
logInfo("HDHRV2: "+VERSION)
1154+
logInfo('*******************[Settings]*********************')
1155+
logInfo('HDHomerunIP:'+Prefs['hdhomerun_ip'])
1156+
logInfo('Transcode :'+Prefs['transcode'])
1157+
logInfo('XMLTV Mode :'+Prefs['xmltv_mode'])
1158+
logInfo('XMLTV File :'+Prefs['xmltv_file'])
1159+
logInfo('XMLTV URL :'+Prefs['xmltv_api_url'])
1160+
logInfo('XMLTV Match:'+Prefs['xmltv_match'])
11291161
logInfo('**************************************************')
11301162

11311163
###################################################################################################

0 commit comments

Comments
 (0)