Nologic 30 Posted December 18, 2016 Posted December 18, 2016 Okay the goal of this little script was to remove unwanted TV channels, in my case this dealt with SD channels where I had an HD option available, or foreign language, shopping,..so on and so forth. #Include <Array.au3> #Include <File.au3> ; /////////////////////////////////////////// ; // Array Remove Channels ; /////////////////////////////////////////// Dim $aChannelsToRemove[1] = [0] $aFileList = _FileListToArray( @ScriptDir, 'Remove Channels *.txt' , 1 , True ) For $ii = 1 To $aFileList[0] Dim $aCurrentFileList _FileReadToArray( $aFileList[$ii] , $aCurrentFileList , 1 ) For $jj = 1 To $aCurrentFileList[0] If _ArraySearch( $aChannelsToRemove , $aCurrentFileList[$jj] , 1 ) = -1 Then _ArrayAdd( $aChannelsToRemove , Number( $aCurrentFileList[$jj] )) $aChannelsToRemove[0] += 1 EndIf Next Next _ArraySort ( $aChannelsToRemove , 0 , 1 ) ; /////////////////////////////////////////// ; // Process TV Tuners ; /////////////////////////////////////////// $aTunners = StringRegExp( BinaryToString( InetRead( 'http://ipv4-my.hdhomerun.com/discover' , 0 )) , '"BaseURL": "(.+?)"' , 3 ) For $aa = 0 To UBound( $aTunners ) - 1 $aActiveChannelList = _JsonTVChannelList( $aTunners[$aa] ) For $bb = 1 To $aChannelsToRemove[0] _ArraySearch( $aActiveChannelList , $aChannelsToRemove[$bb] , 1 , 0 , 0 ,0 , 1 , 0 ) If NOT @[member="Error"] Then _ToggleChannels( $aTunners[$aa] , 'disabled' , $aChannelsToRemove[$bb] ) Next Next Func _JsonTVChannelList( $URL ) $sBuffer = BinaryToString( InetRead( $URL & '/lineup.json' , 0 )) $sBuffer = StringMid( $sBuffer , 2 , StringLen( $sBuffer ) - 2 ) $aChannels = StringRegExp( $sBuffer , '{(.+?)}' , 3 ) Dim $aCurrentChannelList[UBound( $aChannels ) + 1][5] = [[UBound( $aChannels )]] For $ii = 0 To UBound( $aChannels ) - 1 $aCurrentChannel = StringSplit( $aChannels[$ii] , ',' ) $kk = 0 For $jj = 1 To $aCurrentChannel[0] $aCurrentElement = StringSplit( $aCurrentChannel[$jj] , '":"' , 1 ) If $aCurrentElement[0] = 2 AND StringInStr( 'GuideNumber|GuideName|VideoCodec|AudioCodec|URL' , StringReplace( $aCurrentElement[1] , '"' , '' )) <> 0 Then $aCurrentChannelList[$ii + 1][$kk] = StringReplace( $aCurrentElement[2] , '"' , '' ) $kk += 1 EndIf Next Next Return $aCurrentChannelList EndFunc Func _ToggleChannels( $URL , $Status , $Channel ) Switch $Status Case "disabled" $tgl = "x" Case "star" $tgl = "+" Case "unstar" $tgl = "-" EndSwitch InetRead( $URL & '/lineup.post?favorite=' & $tgl & $Channel ) EndFunc Save the above code as an .AU3 file...you of course need to have AutoIt installed for the script to work at all. Next you need to create one or more text files that list a channel number per line. Each file must be named as "Remove Channels *.txt" with the Asterisk being replaced with whatever you want. Each file must be saved next to the AutoIt script. Simply run the script and in a few seconds and it well be done. You can check your handy work by going to the following URL on your Network: http://my.hdhomerun.com/ Then clicking on the Channel links for each Tuner. Everything can be reversed by editing line 32...change 'disabled' to 'unstar' and run the script again. This has been tested on a HDHomeRun Prime, but should work with any other product made by SiliconDust. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now