Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Outfile=ExportDVBLinkRecordings.exe
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <sqlite.au3>
- #include <sqlite.dll.au3>
- #include <File.au3>
- #include <UnixTime.au3>
- Global $aResult, $iRows, $iColumns, $iRval ; Usual SQLite stuff
- Local $hQuery,$aRow, $sMsg
- Local $sTable = "completed_recording"
- _SQLite_Startup ()
- ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR)
- $sDbName = "C:\ProgramData\DVBLogic\TVMosaic\data\recorder_database\recorder_database.db"
- Local $hDskDb = _SQLite_Open($sDbName)
- If @error Then
- MsgBox(16, "SQLite Error", "Can't open database, bye.", 10)
- Exit - 1
- EndIf
- $iRval = _SQLite_GetTable2d (-1, "SELECT * FROM completed_recording", $aResult, $iRows, $iColumns)
- If $iRval = $SQLITE_OK Then
- _ArrayDisplay($aResult)
- Else
- MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
- EndIf
- For $x = 1 to uBound($aResult)-1
- Dim $splitDrive = ""
- Dim $splitDir = ""
- Dim $splitFilename = ""
- Dim $splitExt = ""
- $filename = $aResult[$x][4]
- $channel = $aResult[$x][8]
- $showname = $aResult[$x][9]
- $showinfo = $aResult[$x][10] ;synopsis
- $seriesname = $aResult[$x][9]
- $ShowDesc = $aResult[$x][13] ;extra detail
- $startTime = _StringFormatTime("%d.%m.%Y %X", $aResult[$x][11])
- $showDate = _StringFormatTime("%d.%m.%Y", $aResult[$x][11])
- $showTime = _StringFormatTime("%X", $aResult[$x][11])
- $showDuration = _Sec2Time($aResult[$x][12])
- $arrFileName = _PathSplit($filename, $splitDrive, $splitDir, $splitFilename, $splitExt)
- $textfilePath = $splitDrive & $splitDir & $splitFilename & ".txt"
- $txtContent = "[General]" & @CRLF & "Version=1.1" & @CRLF & @CRLF & "[Media]" & @CRLF & "Created=" & $startTime & @CRLF & _
- "Channel=" & $channel & @CRLF & @CRLF & "[0]" & @CRLF & "Date=" & $showDate & @CRLF & "Time=" & $showTime & @CRLF & "Duration=" & $showDuration & @CRLF & _
- "Title=" & $showname & @CRLF & "Info=" & $showinfo & @CRLF & "Series=" & $showname & @CRLF & "Description=" & $ShowDesc & @CRLF & "Charset=255" & @CRLF & _
- "Content=160" & @CRLF & "MinimumAge=0"
- ConsoleWrite("Creating " & $textfilePath & @CRLF)
- $DVBViewerTxt = FileOpen($textfilePath, 258)
- FileWrite($DVBViewerTxt, $txtContent)
- FileClose($DVBViewerTxt)
- Next
- _SQLite_Close()
- _SQLite_Shutdown()
- Func _Sec2Time($nr_sec)
- $sec2time_hour = Int($nr_sec / 3600)
- $sec2time_min = Int(($nr_sec - $sec2time_hour * 3600) / 60)
- $sec2time_sec = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60
- Return StringFormat('%02d:%02d:%02d', $sec2time_hour, $sec2time_min, $sec2time_sec)
- EndFunc ;==>Sec2Time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement