2010-01-20, 01:54
This is my first post here. I have been in need of an app that can create simple quick nfo files for some TV shows I have that aren't in TVDB and the like.
I wasn't able to find one so I built one with AutoIt and thought I'd share it will you all.
Please be aware that it is very simple BUT can be modified and more features COULD be added.
If needed I can edit this post with a more detailed how-to guide, but I'm just about on my way out from work to go home and don't have time ATM.
The only thing I will mention is that if you are using the "Episode Name List" option, the file should be .txt and the name of the episodes should be on each line. See pics below.
Main Gui
![Full sized picture Image](http://dl.dropbox.com/u/3013463/XBMC/pic1.JPG)
Sample of Episode Name List file
![Full sized picture Image](http://dl.dropbox.com/u/3013463/XBMC/pic2.JPG)
What a created sample NFO looks like
![Full sized picture Image](http://dl.dropbox.com/u/3013463/XBMC/pic3.JPG)
Download here
AutoIt Source Code
Cheers,
Radsam
I wasn't able to find one so I built one with AutoIt and thought I'd share it will you all.
Please be aware that it is very simple BUT can be modified and more features COULD be added.
If needed I can edit this post with a more detailed how-to guide, but I'm just about on my way out from work to go home and don't have time ATM.
The only thing I will mention is that if you are using the "Episode Name List" option, the file should be .txt and the name of the episodes should be on each line. See pics below.
Main Gui
Sample of Episode Name List file
What a created sample NFO looks like
Download here
AutoIt Source Code
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <UpDownConstants.au3>
#include <String.au3>
#include <file.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\Quick Episode NFO\Form1.kxf
$Form1 = GUICreate("Basic TV Episode NFO Creator", 536, 143, 193, 125)
$Label1 = GUICtrlCreateLabel("Season", 32, 8, 40, 17)
$Input1 = GUICtrlCreateInput("", 32, 32, 41, 21)
GUICtrlSetData(-1, "1")
$Updown1 = GUICtrlCreateUpdown($Input1)
GUICtrlSetLimit(-1, 99, 1)
$Label2 = GUICtrlCreateLabel("Episode Start", 105, 8, 67, 17)
$Input2 = GUICtrlCreateInput("", 112, 32, 41, 21)
GUICtrlSetData(-1, "1")
$Updown2 = GUICtrlCreateUpdown($Input2)
GUICtrlSetLimit(-1, 99, 1)
$Label3 = GUICtrlCreateLabel("Episode End", 185, 8, 64, 17)
$Input3 = GUICtrlCreateInput("", 192, 32, 41, 21)
GUICtrlSetData(-1, "1")
$Updown3 = GUICtrlCreateUpdown($Input3)
GUICtrlSetLimit(-1, 99, 1)
$Label4 = GUICtrlCreateLabel("Show Name", 260, 8, 64, 17)
$Input5 = GUICtrlCreateInput("", 260, 32, 170, 21)
$Button1 = GUICtrlCreateButton("Build NFO's", 440, 32, 75, 25, 0)
$Checkbox1 = GUICtrlCreateCheckbox("Episode Name List", 32, 72, 113, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_RIGHTBUTTON,$WS_TABSTOP))
$Input4 = GUICtrlCreateInput("", 32, 96, 401, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button2 = GUICtrlCreateButton("Browse", 440, 96, 75, 25, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
Select
Case GUICtrlRead($Checkbox1) = $GUI_UNCHECKED
GUICtrlSetState($Input4, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Input2, $GUI_ENABLE)
GUICtrlSetState($Input3, $GUI_ENABLE)
GUICtrlSetState($Updown2, $GUI_ENABLE)
GUICtrlSetState($Updown3, $GUI_ENABLE)
Case GUICtrlRead($Checkbox1) = $GUI_CHECKED
GUICtrlSetState($Input4, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Input2, $GUI_DISABLE)
GUICtrlSetState($Input3, $GUI_DISABLE)
GUICtrlSetState($Updown2, $GUI_DISABLE)
GUICtrlSetState($Updown3, $GUI_DISABLE)
EndSelect
Case $Button2
$message = "Select File"
$var = FileOpenDialog($message, @ScriptDir & "\", "Text Files (*.txt)", 1 + 4 )
If @error Then
MsgBox(4096,"","No File(s) chosen")
Else
$var = StringReplace($var, "|", @CRLF)
GUICtrlSetData($Input4, $var)
GUICtrlSetTip($Input4, $var)
EndIf
Case $Button1
$sSeason = GUICtrlRead($Input1)
$sEpStart = GUICtrlRead($Input2)
$sEpEnd = GUICtrlRead($Input3)
$sShowName = GUICtrlRead($Input5)
Select
Case GUICtrlRead($Checkbox1) = $GUI_CHECKED And GUICtrlRead($Input4) <> ""
$sEpListPath = GUICtrlRead($Input4)
$file = FileOpen($sEpListPath, 0)
; Check if file opened for reading OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open Episode Name List file.")
Exit
EndIf
$sEp = 1
$sEpEnd = _FileCountLines($sEpListPath)
; Read in lines of text until the EOF is reached
While 1
$line = _StringProper(FileReadLine($file))
If @error = -1 Or $sEp = $sEpEnd Then ExitLoop
Select
Case $sSeason < 10 And $sEp < 10
$newfile = FileOpen(@ScriptDir & "\" & $sShowName & "\" & "Season" & $sSeason & "\" & $sShowName & ".S" & "0" & $sSeason & "E" & "0" & $sEp & "." & $line & ".nfo", 10);wrie mode
Case $sSeason < 10 And $sEp > 9
$newfile = FileOpen(@ScriptDir & "\" & $sShowName & "\" & "Season" & $sSeason & "\" & $sShowName & ".S" & "0" & $sSeason & "E" & $sEp & "." & $line & ".nfo", 10);wrie mode
Case $sSeason > 9 And $sEp < 10
$newfile = FileOpen(@ScriptDir & "\" & $sShowName & "\" & "Season" & $sSeason & "\" & $sShowName & ".S" & $sSeason & "E" & "0" & $sEp & "." & $line & ".nfo", 10);wrie mode
Case Else
$newfile = FileOpen(@ScriptDir & "\" & $sShowName & "\" & "Season" & $sSeason & "\" & $sShowName & ".S" & $sSeason & "E" & $sEp & "." & $line & ".nfo", 10);wrie mode
EndSelect
FileWriteLine($newfile, "<episodedetails>" & @CRLF)
FileWriteLine($newfile, " <title>" & $line & "</title>" & @CRLF)
FileWriteLine($newfile, " <season>" & $sSeason & "</season>" & @CRLF)
FileWriteLine($newfile, " <episode>" & $sEp & "</episode>" & @CRLF)
FileWriteLine($newfile, "</episodedetails>" & @CRLF)
FileClose($newfile)
$sEp += 1
Wend
FileClose($file)
MsgBox(0,"Status", "Completed creating episode NFO's.")
Case GUICtrlRead($Checkbox1) = $GUI_UNCHECKED
For $sEp = $sEpStart To $sEpEnd
If $sEp < 10 Then $sEp = "0" & $sEp
$newfile = FileOpen(@ScriptDir & "\" & $sShowName & "\" & "Season" & $sSeason & "\" & $sShowName & ".S" & $sSeason & "E" & $sEp & ".nfo", 10);wrie mode
FileWriteLine($newfile, "<episodedetails>" & @CRLF)
FileWriteLine($newfile, " <season>" & $sSeason & "</season>" & @CRLF)
FileWriteLine($newfile, " <episode>" & $sEp & "</episode>" & @CRLF)
FileWriteLine($newfile, "</episodedetails>" & @CRLF)
FileClose($newfile)
Next
MsgBox(0,"Status", "Completed creating episode NFO's.")
Case Else
MsgBox(0, "Error", "Select Episode List Name file.")
EndSelect
EndSwitch
WEnd
Cheers,
Radsam