Search the Community
Showing results for tags 'AutoIt'.
-
What this solves: Adding Channel Schedules in bulk to NextPVR User Friendly Channel Names Cleans up Channel Names Prune Channels by Language Download Channel Icons/Logos Requirements: AutoIt Curl (SSL support) FSUM NextPVR Schedules Direct (Account) References: ISO 639-1 Codes Notes: I wrote this against two HDHomeRun Primes (Comcast Cable), so not sure how it will fair with OTA & Satellite. One might also be able to alter this script to work with other services, but since I don't have access to others, I can't add support for them. How: This is made up of two scripts, one will download & prep 1 or more JSON Channel lineups that you created on your Schedules Direct Account. The other will import information from one of the Lineups, into the data scrapped from a fresh Channel listing XML made by NextPVR, and output a new XML along with downloading all the Icon's\Logo's that Schedules Direct has to offer. Instructions: Install AutoIt and set it to execute scripts when double clicked. Now Right Click on desktop and select "New\Folder" from the context menu, and Rename it "NextPVR Stuff" Now download & extract Curl and FSUM into "NextPVR Stuff" Now in "NextPVR Stuff" Right Click on the background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Schedules Direct LineUp's.au3" Now Right Click "Schedules Direct LineUp's.au3" & select "Edit Script" from the context menu. Now paste the following code into: Be sure to edit the values of $sUserName and $sUserPassword to match what is used for your Schedules Direct account. Now save the script & execute it by double clicking it and if all went well...then you should now see one or more txt files that are prefixed with "[LineUp]", these are the lineups you setup on your account. Okay at this point one needs to fire up NextPVR. Now with NextPVR open, Right Click on the background and select "Settings" from the context menu. With the Settings Dialog open, Click Devices on the ListView on the left side of the dialog. Select one of your Devices from the ListView on the right, it should be marked as Present & Enabled, (if it doesn't list any Channels, please Click the "Device Setup" Button, then perform a scan by Clicking the "Scan" button, then Click the "OK" button) with the device selected Click the "Export Channels" Button, when the Export Dialog comes up save the file to the location you have "NextPVR Stuff" which according to the instructions I've been giving should be on your Desktop. Once you saved off the file and are back to the Settings dialog, Click the Channels item in the ListView on the left side. With the Channels ListView now shown on the right, select one of the channels and Click the "Details" Button. When the "Channel Details" Dialog pops up, in the EPG Source Group control, select "Schedules Direct" from the Source comboBox...this should if I recall prompt you for your Schedules Direct account information...when it's done for the first time. After that set things to whatever...as it doesn't really matter...the main purpose is to have your Account info added to NextPVR's config...which I currently don't know the type of encryption used...so I can't automatically add it for you...via a script. Hence...doing this manually now. So Click all the "OK" buttons till you are back to the main NextPVR form...now close NextPVR...as we are done with it for now. Now in "NextPVR Stuff" Right Click on the background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Merge Schedules Direct.au3" Now Right Click "Merge Schedules Direct.au3" & select "Edit Script" from the context menu. Now paste the following code into: You will now need to edit some of the variables, at the top of the script, to match what you have or want: $sArtPath this is where your logo's are for NextPVR to make use of them$sBuffer1 this is your Schedules Direct Lineup that you intend to use$sBuffer2 this is the xml with the list of channels detected by NextPVR$sLangsOnly leave this empty if you do not wish to prune any langs...if you do however wish to remove other langs, add all the langs you wish to keep, but split them with a comma$bRemoveParentheses this will remove anything in paren's...review your Schedules Direct file to help decide if you wish to prune these or not$bSplitOnDash this will remove the dash and anything on the right side of it, note that a space must be both before and after the dash, for a split to occure Now save the script & execute it by double clicking it and if all went well...then you should see a bunch of images in the path you set for $sArtPath, and a new file called "New.xml" that is ready to be imported into NextPVR. Alright time to fire up NextPVR once again. Now with NextPVR open, Right Click on the background and select "Settings" from the context menu. With the Settings Dialog open, Click Devices on the ListView on the left side of the dialog. Select one of your Devices from the ListView on the right, (it should be marked as Present & Enabled) now Click "Device Setup" Button, and wait for the new dialog to open, once open Click on the first channel in the ListView, then scroll down to the last and SHIFT + Click on it, then Click on the "Delete" Button followed by the "OK" Button. Once the dialog closes repeat this for every Device you intend to apply a new Channel List to. Select one of your Devices from the ListView on the right, now Click the "Import Channels" Button and navigate to the "NextPVR Stuff" folder, and select "New.xml", then Click the "Open" Button. Repeat this for every device this channel list applies to. Once done with that, Click the Channels item in the ListView on the left side. With the Channels ListView now shown on the right, Click the "Update EPG" Button, then wait till the update is complete, and Click the "OK" Button to close out the Settings dialog. Now when you select the "TV Guide" on the main NextPVR form...you should be greated with all your show info, pretty names...and hopefully a bunch of icons.
- 20 replies
-
- 2
-
- NextPVR
- Schedules Direct
- (and 5 more)
-
Why: mediacowboy needed something to help find videos that wouldn't play directly on the Roku, but ended up required transcoding to do so. Notes: This only detects at present very basic reasons a file might fail. Container not mkv, mp4, mov, m4v, m3u8, ts Video Codec not H.264 Audio Codec not AC3 or Stero AAC Requirements: AutoIt FFMpeg Instructions: Install AutoIt and set it to execute scripts when double clicked. Create a folder somewhere...lets call it "Roku Detect uncompliant Videos" just to be unimaginative. Now inside "Roku Detect Uncompliant Videos" create a sub folder called "Bin". Now extract the contents of FFMpeg's "Bin" folder into your new "Bin" sub folder. Now going back into "Roku Detect Uncompliant Videos" folder Right Click on it's background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Roku Detect Uncompliant Videos.au3" Now Right Click "Roku Detect Uncompliant Videos.au3" & select "Edit Script" from the context menu. Now paste the following code into: #Include <Array.au3> #Include <File.au3> #Include <String.au3> Dim $aKnown[7] = [6 , '.mkv' , '.mp4' , '.mov' , '.m4v' , '.m3u8' , '.ts'] Dim $aUnknown[1] = [0] Dim $sErrorLog ; Select Video Folder While 1 $sFolder = FileSelectFolder( 'Select Video Folder.' , '' , 6 ) If @Error = 1 AND $sFolder = '' Then MsgBox( 4096 , 'Exit:' , 'Ending Application' ) Exit ElseIf $sFolder = '' Then MsgBox( 4096 , 'Error:' , 'Unable To Open Folder.' ) ElseIf NOT FileExists ( $sFolder ) Then MsgBox( 4096 , 'Error:' , 'Invalid Folder.' ) Else If StringRight( $sFolder , 1 ) <> '\' Then $sFolder &= '\' $aAllFiles = _FileListToArrayRec( $sFolder , '*.*|*.bif;*.db;*.jpg;*.nfo;*.png;*.tbn;*.xml;*.srt;*.sub;*.ssa;*.mp3' , 1 , 1 , 0 , 2 ) If NOT IsArray( $aAllFiles ) Then MsgBox( 4096 , 'Error:' , 'No Videos Found.' ) Else _ArraySort( $aAllFiles , 0 , 1 ) ExitLoop EndIf EndIf WEnd For $ii = 1 To $aAllFiles[0] _Macros( $aAllFiles[$ii] ) $iFind1 = _ArraySearch( $aKnown , $sFileExt , 1 ) If @Error Then $sErrorLog &= 'Unknown File Type:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF $iFind2 = _ArraySearch( $aUnknown , $sFileExt , 1 ) If @Error Then _ArrayAdd( $aUnknown , $sFileExt ) $aUnknown[0] += 1 EndIf Else ; Build Array of Streams $sRandomString = _RandomString() RunWait( @ComSpec & ' /c ffprobe -show_streams "' & $aAllFiles[$ii] & '">"' & @TempDir & '\' & $sRandomString & '.txt"' , @ScriptDir & '\BIN\' , @SW_HIDE ) $aAllStreams = _StringBetween( FileRead( @TempDir & '\' & $sRandomString & '.txt' ) , '[STREAM]' , '[/STREAM]' ) FileDelete( @TempDir & '\' & $sRandomString & '.txt' ) ; Find Video Streams $aFindVideoStreams = _ArrayFindAll( $aAllStreams , 'codec_type=video' , 0 , 0 , 0 , 1 ) If $aFindVideoStreams <> -1 Then ; Process Video Streams For $aa = 0 To UBound( $aFindVideoStreams ) - 1 $sSVideoCodec = _RegExString( $aAllStreams[$aFindVideoStreams[$aa]] , '(?s)(?i)(?:.+?codec_name=(\S+))?' ) If $sSVideoCodec <> 'h264' And $sSVideoCodec <> 'mpeg4' Then $sErrorLog &= 'Unsupported Video Codec: (' & $sSVideoCodec & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF ContinueLoop 2 EndIf Next Else $sErrorLog &= 'Missing Video Stream:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF ContinueLoop EndIf ; Find Audio Streams $aFindAudioStreams = _ArrayFindAll( $aAllStreams , 'codec_type=audio' , 0 , 0 , 0 , 1 ) If $aFindAudioStreams <> -1 Then ; Process Audio Streams For $aa = 0 To UBound( $aFindAudioStreams ) - 1 $sSAudioCodec = _RegExString( $aAllStreams[$aFindAudioStreams[$aa]] , '(?s)(?i)(?:.+?codec_name=(\S+))?' ) $iSAudioChannels = _RegExString( $aAllStreams[$aFindAudioStreams[$aa]] , '(?s)(?i)(?:.+?channels=(\S+))?' ) If $sSAudioCodec <> 'AAC' And $sSAudioCodec <> 'AC3' Then $sErrorLog &= 'Unsupported Audio Codec: (' & $sSAudioCodec & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF ContinueLoop 2 EndIf If $sSAudioCodec = 'AAC' And $iSAudioChannels > 2 Then $sErrorLog &= 'To Many Audio Channels: (' & $iSAudioChannels & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF ContinueLoop 2 EndIf Next Else $sErrorLog &= 'Missing Audio Stream:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF ContinueLoop EndIf EndIf Next ; Create Error Log If StringLen( $sErrorLog ) > 1 Then If NOT FileExists( @ScriptDir & '\Error Logs\' ) Then DirCreate( @ScriptDir & '\Error Logs\' ) $sErrorLogFile = @ScriptDir & '\Error Logs\[' & @YEAR & '-' & @MON & '-' & @MDAY & '] ' & @HOUR & '-' & @MIN & '-' & @SEC & '.txt' FileWrite( $sErrorLogFile , $sErrorLog ) ShellExecute( $sErrorLogFile ) EndIf ; Create Unknown File Extensions Text If $aUnknown[0] > 0 Then $sUknownExtensions = @ScriptDir & '\UnKnown.txt' If FileExists( $sUknownExtensions ) Then Dim $aPriorUnknown _FileReadToArray( $sUknownExtensions , $aPriorUnknown ) For $ii = 1 To $aPriorUnknown[0] $iFind2 = _ArraySearch( $aUnknown , $aPriorUnknown[$ii] , 1 ) If @Error Then _ArrayAdd( $aUnknown , $aPriorUnknown[$ii] ) $aUnknown[0] += 1 EndIf Next FileDelete( $sUknownExtensions ) EndIf _FileWriteFromArray( $sUknownExtensions , $aUnknown , 1 ) ShellExecute( $sUknownExtensions ) EndIf MsgBox( 0 , 'Finished' , 'Batch Operation Complete' ) Func _Macros( $sFile ) Global $sFileDir = StringLeft ( $sFile , StringInStr( $sFile , '\' , 0 , -1 ) ) Global $sFileExt = StringTrimLeft ( $sFile , StringInStr( $sFile , '.' , 0 , -1 ) - 1 ) Global $sFileName = StringTrimLeft ( $sFile , StringInStr( $sFile , '\' , 0 , -1 ) ) Global $sShortName = StringLeft ( $sFileName , StringInStr( $sFileName , '.' , 0 , -1 ) - 1 ) Global $sParent = StringLeft ( $sFileDir , StringInStr( $sFileDir , '\' , 0 , -2 ) ) Global $sFolderName = StringTrimRight( StringTrimLeft( $sFileDir , StringInStr( $sFileDir , '\' , 0 , -2 ) ) , 1 ) EndFunc Func _RandomString() $sString = '' Dim $aSpace[3] For $i = 1 To 15 $aSpace[0] = Chr( Random( 65 , 90 , 1 )) ; A-Z $aSpace[1] = Chr( Random( 97 , 122 , 1 )) ; a-z $aSpace[2] = Chr( Random( 48 , 57 , 1 )) ; 0-9 $sString &= $aSpace[Random( 0 , 2 , 1 )] Next Return $sString EndFunc Func _RegExString( $sString , $sRegEx ) Local $sValue = _ArrayToString( StringRegExp( $sString , $sRegEx , 1 )) If StringIsFloat( $sValue ) = 1 OR StringIsInt( $sValue ) = 1 Then Return Number( $sValue ) Else If $sValue = 'N/A' OR $sValue = 'N' OR $sValue = 'A' Then Return '' Else Return $sValue EndIf EndIf EndFunc Now save the script & execute it by double clicking it and then select the folder holding your videos that you wish to process. Now go do something else, this will take a while...maybe a great while depending on the number of videos you have. The script will notify you when it's done...and if you're curious as to if it's still running there should be a icon in your system tray that looks like a blue "A". Past that you can start your Task Manager and you should more than likely see FFMpeg running in the background. Result: This should possibly produce one or more text files. The primary one will be what is produced in the "Error Logs" folder, this will list what files failed and why...but keep in mind these only list the first reason why it failed, not all possible reasons it may have failed. A number of these may not even be video files at all...but a format that should have been excluded from the search. Which brings me to the next file "UnKnown.txt" this file will be updated with one instance per unknown file extension, possibly every time you run the script and it finds something new. Now ideally I have all or at least most common non video extensions excluded from the search...this is everything on the right side of the pipe "|" symbol on line 21 at present. You may wish to add new extensions to be excluded from future searches...thus speeding the script along...but please consider sharing your additional excludes here in this thread, to help others out as well. What Next: You may wish to use one of my app's, called VideoGain (free) to process the failed video files. It's main purpose is to batch adjust audio volume, so that all the videos have more or less the same gain...so you don't have to monkey around with your volume all the time. Originally it only processed folders full of videos...not individual, but since I was already making some corrections to it already...I set it up to do single files as well. Here is where we get hackish. Download VideoGain & extract it somewhere...ideally in a folder called VideoGain so it's easier to find later on. Now Start it by double clicking on it's exe...then close the app...it will now have produced a new INI file...and we are going to edit it's contents with whatever your favorite text editor happens to be (Notepad, Notepad++, UltraEdit,..). In the VideoGain.ini all the way at the bottom...you should see an entry called "[Folders]". Now below that we'll be adding entries of our own...basically copy and paste from your Error Logs...into this file...but before each path put "Folder_#=" replacing the # with a number value...please keep each value different, and each entry on a new line. I'll likely write a simple script to help in this matter tomorrow. Anyways once all the edits are made...save the file, and restart VideoGain. You should now see all the files you want to process listed on the "Folders" tab. Now check "Direct Replace" and uncheck "Recurse Folders" (not needed). Now click on the "Settings" tab. If you had any videos that failed because they were not H264 then set the Encoder to "Conditional" which basically means if VideoGain doesn't detect the video stream to be H264..to then encode..but only then. Make further adjustments as you like to the H264 settings and Video settings. Now if you had Audio errors, you have a few picks...you can go with AAC or AC3...encoders...with the covet that AAC is limited to stereo. Right now if you select AC3...all videos will have the audio track re-encoded, bar non...I don't have an early out for that right now as I just added AC3 support...however if you select AAC and a number of your tracks are already AAC...and those tracks are Stereo...then you can select "ReplayGain (Tags)" this will do a non damaging adjustment to the AAC tracks...however all non AAC tracks will be encoded to AAC. Select "Stereo DownMix" if you plan to use AAC. All resulting files will ether be Mp4 or Mkv depending on what you selected for a container, from the drop down at the bottom of the application. Press "Start" and away you go. I would personally suggest doing at little processing as you need to. Each time something gets encoded...it gets more damaged.
-
What this solves: 1. On demand creating Roku Bif files recursively through sub folders, using Emby Servers naming scheme. (Simple Dialog Interface, Command Line and SendTo {must be compiled}). 2. Scheduled Bif file creation, 3. Allow networked computers to work on shared folders to speed things along. Only limiting factors are the speed of your network & the number of systems connected. Notes: The Folders this script is to run against must be on ether a local or network mapped drive, as the script isn't setup to handle UNC paths. Also checkout the concurrent version further down in the thread. Requirements: AutoIt FFMpeg Roku SDK Instructions: Install AutoIt and set it to execute scripts when double clicked. Create a folder somewhere...lets call it "Creat BIF" just to be unimaginative. Now inside "Create BIF" create a sub folder called "Bin". Now extract the contents of FFMpeg's "Bin" folder into your new "Bin" sub folder. Now extract "biftool.exe" from the Roku SDK into your new "Bin" sub folder. Now going back into "Create BIF" folder Right Click on it's background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Create BIF.au3" Now Right Click "Create BIF.au3" & select "Edit Script" from the context menu. Now paste the following code into: Now save the script & execute it by double clicking it and then select the folder holding your videos that you wish to process. Now go do something else, this will take a while...maybe a great while depending on the number of videos you have. The script will notify you when it's done...and if you're currious as to if it's still running there should be a icon in your system tray that looks like a blue "A". Past that you can start your Task Manager and you should more than likely see FFMpeg running in the background. By default this will create 320px aspect correct BIF files, if you wish to create 240px or any other size you'll need to edit line 7. Example: from $iVideoWidthSize = 320 to $iVideoWidthSize = 240 Update 1: I decided to let FFMpeg do all the calculations for resize...which result in a massive code reduction. Update 2: Added passing folders via command line. This is mostly aimed at adding SendTo context menu support. 1. Right Click on "Create BIF.au3" and select "Compile Script (x86)" from the context menu 2. ALT + Left Click on "Create BIF.exe" and Drag to create a shortcut...rename to remove ".exe" from the file name 3. Cut & Paste shortcut to your SendTo folder: %APPDATA%\Microsoft\Windows\SendTo\ Now you don't even need to hunt down the script when you need it. Update 3: Added very simplistic scheduling based on a 24 hour clock. Currently you can not start on one day and end on the following. Only one time block allowed per day. The script now produces an INI that can be edited "Create Bif.ini" If you choose to use the scheduling the script needs to be compiled. Once compiled & the INI edited to your liking, open up a console in the script folder. Then enter: "Create Bif.exe" ScheduleNew Now new tasks have been created in the Windows Task Scheduler. To remove tasks enter: "Create Bif.exe" ScheduleDelete To not have a task scheduled for a day, set the start time and end time to be the same. Update 4: Command Line now supports both Folders & Files...thus making a SendTo shortcut more useful. Update 5: Added auto SendTo shortcut creation...only happens if script is compiled. To trigger this...simply use the executable once...you don't even have to actually process a file. If you don't want this feature simply delete the code on and between lines 17 & 25 (currently) Update 6: Now allows only one instance to run at a time, to prevent bogging down your system. This applies to Command Line and GUI, but not Task Scheduler...as the Task Scheduler should only have one instance anyways. This allows you to cue up several folders\files to be processed, even though they are in very different locations. Update 7: Made it easier for the script to clean up after it's self.
-
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.
-
Why? My brother was a bit messy with his encodes, such as mixing Bluray with DVD, along with encodes done in ether H264 or Xvid. This moves things around, so its easier to figure out if something should be ripped again in H264 rather than leaving it in Xvid...or replace DVD rips with Blurays that are now available. Notes: The Folders this script is to run against must be on ether a local or network mapped drive, as the script isn't setup to handle UNC paths. Requirements: AutoIt FFMpeg Instructions: Install AutoIt and set it to execute scripts when double clicked. Create a folder somewhere...lets call it "Segregate Movies" just to be unimaginative. Now inside "Segregate Movies" create a sub folder called "Bin". Now extract the contents of FFMpeg's "Bin" folder into your new "Bin" sub folder. Now going back into "Segregate Movies" folder Right Click on it's background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Segregate Movies.au3" Now Right Click "Segregate Movies.au3" & select "Edit Script" from the context menu. Now paste the following code into: Now you'll have to edit a User Var namely the path to FFMpeg...normally I'd have this set automatically to the Bin folder holding the script...but I'm getting a lot of scripts depending on FFMpeg...so I'm allowing you to set the path...so you really only have 1 copy on your system...or at least 1 less do to this script allowing you to set it to a different location. Now save the script & execute it by double clicking it. You will be asked for the "Source Folder"...this should be your main "Movies" folder...ie it should hold a collection of movies each in sub folders. Next you will be asked for the "Final Folder"...this should ideally be on the same hard drive as the "Source Folder", to make things much quicker. Once done you'll be able to look into your "Final Folder" and see sub folders labeled by resolution & codec...example _1080p_H264
-
- Organization
- AutoIt
-
(and 1 more)
Tagged with:
-
Why? I had noticed that my Images for People, had grown to over 22gigs...and thought that was a bit excessive, so I wrote this script & after running it those images came in under 3gigs, and as a result I'm a happy camper now. Notes: The Folders this script is to run against must be on ether a local or network mapped drive, as the script isn't setup to handle UNC paths. This script doesn't scale up images...only scales down. Requirements: AutoIt FFMpeg Instructions: Install AutoIt and set it to execute scripts when double clicked. Create a folder somewhere...lets call it "Resize Images" just to be unimaginative. Now inside "Resize Images" create a sub folder called "Bin". Now extract the contents of FFMpeg's "Bin" folder into your new "Bin" sub folder. Now going back into "Resize Images" folder Right Click on it's background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Resize Images.au3" Now Right Click "Resize Images.au3" & select "Edit Script" from the context menu. Now paste the following code into: Now you'll have to edit some User Vars to make use of this script on your system. Now in my example use of People images...older versions of Emby used "folder.jpg" however newer ones are making use of "poster.jpg" so you may need to run it twice with different naming. Next you'll have to give the script the path to the images you wish to resize, then the max Width & Height for the images. Finally the path to FFMpeg...normally I'd have this set automatically to the Bin folder holding the script...but I'm getting a lot of scripts depending on FFMpeg...so I'm allowing you to set the path...so you really only have 1 copy on your system...or at least 1 less do to this script allowing you to set it to a different location. Now save the script & execute it by double clicking it. Now go do something else, this will take a while. The script will notify you when it's done.
-
Why: This was the second time within a month, of having to reset the PlayReady DRM used with WMC LiveTV, do to a hardware upgrade. So being lazy as I am...I wrote a script so I wouldnt' have to hunt down the Web Pages describing the proceedure, then doing everything manually. Warning: Don't run this for giggles, any DRM content you have now, may become unusable. So only run this when shit truely has hit the fan. References: Microsoft TheGreenButton Requirements: AutoIt ResetDRM (Silently Downloaded if Not Found) 7-Zip (Silently Download & Installed if No Supported Unarchiver Found) or WinRar How: The script deletes the old DRM Keys & Cache, and sets you up to create new keys. It does this by deleting the required files, and running CleanDRM, which is a part of ResetDRM, in a manner that works with both Win7 & Win8...and may also work with Vista. To do this it must extract CleanDRM from ResetDRM along with supporting files. This is ideally done by one of your installed Archive apps (WinRar or 7-Zip), but if none are found it will download and silently install 7-Zip. Instructions: Install AutoIt and set it to execute scripts when double clicked. Install one of the Archiver app's listed above. Now Right Click on desktop and select "New\AutoIt v3 Script" from the context menu, and Rename it "ResetDRM.au3" Now Right Click "ResetDRM.au3" & select "Edit Script" from the context menu. Now paste the following code into: #RequireAdmin #Include <Array.au3> Dim $aFiles[3] = ['ADVPACK.DLL' , 'CleanDRM.exe' , 'resetdrm.inf'] For $ii = 0 To UBound( $aFiles ) - 1 If FileExists( @ScriptDir & '\' & $aFiles[$ii] ) <> 1 Then If FileExists( @ScriptDir & '\ResetDRM.exe' ) <> 1 Then InetGet( 'http://go.microsoft.com/fwlink?LinkId=105000' , @ScriptDir & '\ResetDRM.exe' ) If FileExists( @ScriptDir & '\ResetDRM.exe' ) <> 1 Then MsgBox( 0 , 'Error:' , 'Failed to Download ResetDRM.exe' ) Exit EndIf $s7zip = _7zip_RegRead() $sWinRAR = _WinRAR_RegRead() Select Case $s7zip <> '' RunWait( $s7zip & ' e ResetDRM.exe -aoa' , @ScriptDir , @SW_HIDE ) Case $sWinRAR <> '' RunWait( $sWinRAR & ' e -o+ ResetDRM.exe' , @ScriptDir , @SW_HIDE ) Case Else If _7zip_Fetch() = -1 Then MsgBox( 0 , 'Error:' , 'Failed to Download 7-zip' ) Exit Else $s7zip = _7zip_RegRead() RunWait( $s7zip & ' e ResetDRM.exe -aoa' , @ScriptDir , @SW_HIDE ) EndIf EndSelect FileDelete( @ScriptDir & '\ResetDRM.exe' ) ExitLoop EndIf Next ; Stop Windows Media Center Receiver Service RunWait( @ComSpec & ' /c net stop ehRecvr' , '' , @SW_HIDE ) ; Remove Files FileDelete( @AppDataCommonDir & '\Microsoft\PlayReady\mspr.hds' ) FileDelete( @AppDataCommonDir & '\Microsoft\eHome\mcendindiv.hds ' ) ; Remove Folders DirRemove( @AppDataCommonDir & '\Microsoft\PlayReady\cache\' , 1 ) DirRemove( @AppDataCommonDir & '\Microsoft\eHome\cache\' , 1 ) ; Copy Files FileCopy( @ScriptDir & '\ADVPACK.DLL' , @DesktopDir & '\ResetDRM\ADVPACK.DLL' , 9 ) FileCopy( @ScriptDir & '\CleanDRM.exe' , @DesktopDir & '\ResetDRM\CleanDRM.exe' , 9 ) FileCopy( @ScriptDir & '\resetdrm.inf' , @DesktopDir & '\ResetDRM\resetdrm.inf' , 9 ) ; Execute ResetDRM RunWait( @ComSpec & ' /c CleanDRM -v' , @DesktopDir & '\ResetDRM\' , @SW_HIDE ) ; Remove Files DirRemove( @DesktopDir & '\ResetDRM\' , 1 ) ; Display Message MsgBox( 0 , 'Finished:' , 'Wait for Update PlayReady to Display' & @LF & 'Then Click "Update" & Finish Wizard.' , 5 ) ; Launch WMC in LiveTV Mode Run( @WindowsDir & '\ehome\ehshell.exe /mcesuperbar://tv?live=true' , '' ) Func _7zip_RegRead() $String = RegRead( 'HKLM\SOFTWARE\7-Zip' , 'Path' ) If $String = '' Then $String = RegRead( 'HKLM64\SOFTWARE\7-Zip' , 'Path' ) If $String <> '' Then If StringRight( $String , 1 ) <> '\' Then $String &= '\' If FileExists( $String & '7z.exe' ) Then Return $String & '7z.exe' Else Return '' EndIf Else Return '' EndIf EndFunc Func _WinRAR_RegRead() $String = RegRead( 'HKLM\SOFTWARE\WinRAR' , 'exe' ) If $String = '' Then $String = RegRead( 'HKLM64\SOFTWARE\WinRAR' , 'exe64' ) If $String <> '' Then $String = StringLeft( $String , StringInStr( $String , '\' , 0 , -1 )) If FileExists( $String & 'WinRAR.exe' ) Then Return $String & 'WinRAR.exe' Else Return '' EndIf Else Return '' EndIf EndFunc Func _7zip_Fetch() $sFile = @TempDir & '\' & _RandomString() & '.html' InetGet( 'http://www.7-zip.org/index.html' , $sFile ) $sBuffer = FileRead( $sFile ) FileDelete( $sFile ) $RegEx = StringRegExp( $sBuffer , '(?i)<A href="([^"]+?)">Download</A></TD>' , 3 ) If @OSArch = 'X86' Then $iDownload = _DownloadSevenZip( $RegEx , '.exe' , '/S' ) Else $iDownload = _DownloadSevenZip( $RegEx , '.msi' , '/quiet' ) EndIf Return $iDownload EndFunc Func _DownloadSevenZip( ByRef $sInput , $sExt , $sSwitch ) For $ii = 0 To UBound( $sInput ) - 1 If StringInStr( $sInput[$ii] , $sExt ) > 0 Then $sFileName = StringTrimLeft( $sInput[$ii] , StringInStr( $sInput[$ii] , '/' , 0 , -1 ) ) $iFetch = InetGet( 'http://www.7-zip.org/' & $sInput[$ii] , @ScriptDir & '\' & $sFileName ) If $iFetch = 0 Then Return -1 RunWait( @ComSpec & ' /c ' & $sFileName & ' ' & $sSwitch , @ScriptDir , @SW_HIDE ) FileDelete( @ScriptDir & '\' & $sFileName ) Return 0 EndIf Next EndFunc Func _RandomString() $sString = '' Dim $aSpace[3] For $i = 1 To 15 $aSpace[0] = Chr( Random( 65 , 90 , 1 )) ; A-Z $aSpace[1] = Chr( Random( 97 , 122 , 1 )) ; a-z $aSpace[2] = Chr( Random( 48 , 57 , 1 )) ; 0-9 $sString &= $aSpace[Random( 0 , 2 , 1 )] Next Return $sString EndFunc Now save the script & execute it by double clicking it and if all went well...then you should be greeted by WMC launched to LiveTV, given a bit of time you should be prompted to Update PlayReady DRM...Click "Update" and complete the wizard....sorry couldn't figure out a way to automate this.
-
Why: Wanted to do a quick folder defrag for my Windows based server and clients, given that I update media fairly frequently. You may wish to edit the script to defrag less frequently, as I have it setup to defrag every day at 5am. References: Microsoft Stackoverflow Requirements: AutoIt Auslogics Disk Defrag (silent) or Piriform Defraggler (console pops up briefly) How: This one hit wonder of a script, simply finds one of the above mentioned free defragger's, and sets a task in Windows Scheduler to trigger a folder defrag with that defragger. Instructions: Install AutoIt and set it to execute scripts when double clicked. Install one of the Drive Defragmentation app's listed above. Now Right Click on desktop and select "New\AutoIt v3 Script" from the context menu, and Rename it "Defrag Emby.au3" Now Right Click "Defrag Emby.au3" & select "Edit Script" from the context menu. Now paste the following code into: ; Auslogics Disk Defrag ; http://www.auslogics.com/en/software/disk-defrag/ ; Defraggler ; https://www.piriform.com/defraggler/download ; To Remove Task Via The CMD Console ; schtasks /delete /tn "Defrag Emby" /f ; 24 Hour Clock Time $sTime = '05:00' $sAuslogics = _Auslogics_FileFind() $sDefraggler = _Defraggler_RegRead() $sString = '' Select Case FileExists( @SystemDir & '\schtasks.exe' ) = 0 MsgBox( 0 , 'Error:', 'schtasks.exe Not Present.' ) Exit Case $sAuslogics <> '' $sString &= _Auslogics_String( $sAuslogics , $sString , @AppDataCommonDir & '\MediaBrowser' ) $sString &= _Auslogics_String( $sAuslogics , $sString , @AppDataCommonDir & '\MediaBrowser-Classic' ) $sString &= _Auslogics_String( $sAuslogics , $sString , @AppDataDir & '\MediaBrowser-Classic' ) $sString &= _Auslogics_String( $sAuslogics , $sString , @AppDataDir & '\MediaBrowser-Server' ) $sString &= _Auslogics_String( $sAuslogics , $sString , @AppDataDir & '\MediaBrowser-Theater' ) Case $sDefraggler <> '' $sString &= _Defraggler_String( $sDefraggler , $sString , @AppDataCommonDir & '\MediaBrowser' ) $sString &= _Defraggler_String( $sDefraggler , $sString , @AppDataCommonDir & '\MediaBrowser-Classic' ) $sString &= _Defraggler_String( $sDefraggler , $sString , @AppDataDir & '\MediaBrowser-Classic' ) $sString &= _Defraggler_String( $sDefraggler , $sString , @AppDataDir & '\MediaBrowser-Server' ) $sString &= _Defraggler_String( $sDefraggler , $sString , @AppDataDir & '\MediaBrowser-Theater' ) If $sString <> '' Then $sString &= ' /S' Case Else MsgBox( 0 , 'Error:', 'Required Files Not Present.' ) Exit EndSelect If $sString = '' Then MsgBox( 0 , 'Error:', 'Required Paths Not Present.' ) Exit Else ; Remove Old Task If Exists Run( @ComSpec & ' /c SchTasks /DELETE /TN "Defrag Emby" /F ' , '' , @SW_HIDE ) ; Create New Task Run( @ComSpec & ' /c SchTasks /Create /SC DAILY /TN "Defrag Emby" /TR "' & $sString & '" /ST ' & $sTime , '' , @SW_HIDE ) EndIf MsgBox( 0 , 'Complete:' , 'Operation has Completed.' ) Func _Auslogics_FileFind() $String = _ProgramFilesDir() & '\Auslogics\DiskDefrag\cdefrag.exe' If FileExists( $String ) Then Return $String Else Return '' EndIf EndFunc Func _Defraggler_RegRead() $String = RegRead( 'HKCU\SOFTWARE\Piriform\Defraggler' , 'InstallPath' ) If $String = '' Then $String = RegRead( 'HKCU64\SOFTWARE\Piriform\Defraggler' , 'InstallPath' ) If $String <> '' Then $String &= '\df.exe' If FileExists( $String ) Then Return $String Else Return '' EndIf EndFunc Func _ProgramFilesDir() Local $ProgramFileDir Switch @OSArch Case "X86" $ProgramFileDir = "Program Files" Case "X64" $ProgramFileDir = "Program Files (x86)" EndSwitch Return @HomeDrive & '\' & $ProgramFileDir EndFunc Func _Auslogics_String( $sAppPath , $sExcuteString , $sFolderPath ) If FileExists( $sFolderPath ) Then If StringInStr( $sFolderPath , @AppDataCommonDir ) <> 0 Then $sFolderPath = StringReplace( $sFolderPath , @AppDataCommonDir , '%ProgramData%' ) If StringInStr( $sFolderPath , @AppDataDir ) <> 0 Then $sFolderPath = StringReplace( $sFolderPath , @AppDataDir , '%APPDATA%' ) If $sExcuteString = '' Then Return '\"' & $sAppPath & '\" -path:' & $sFolderPath & ' -quiet' Else Return ' && \"' & $sAppPath & '\" -path:' & $sFolderPath & ' -quiet' EndIf Else Return '' EndIf EndFunc Func _Defraggler_String( $sAppPath , $sExcuteString , $sFolderPath ) If FileExists( $sFolderPath ) Then If StringInStr( $sFolderPath , @AppDataCommonDir ) <> 0 Then $sFolderPath = StringReplace( $sFolderPath , @AppDataCommonDir , '%ProgramData%' ) If StringInStr( $sFolderPath , @AppDataDir ) <> 0 Then $sFolderPath = StringReplace( $sFolderPath , @AppDataDir , '%APPDATA%' ) If $sExcuteString = '' Then Return '\"' & $sAppPath & '\" ' & $sFolderPath Else Return ' ' & $sFolderPath EndIf Else Return '' EndIf EndFunc Now save the script & execute it by double clicking it and if all went well...then delete the script and go do something else. Note: If you have working command lines for other defragger's I'm more than willing to add support for them. They don't need to be freeware ether. ** Update 1 ** Refactored code to be less Clumsy & Cleaner Added a few more paths to test for. Fixed fat fingering of Emby name...which resulted in "Defrag Elby" as the task name...and well this thread name...my copy & paste fetish causes a lot of problems some times.
-
- 3
-
- Auslogics
- Defraggler
-
(and 2 more)
Tagged with: