Advertisement
beeswax

Untitled

Aug 30th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.70 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Outfile=ExportDVBLinkRecordings.exe
  3. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #include <sqlite.au3>
  5. #include <sqlite.dll.au3>
  6. #include <File.au3>
  7. #include <UnixTime.au3>
  8.  
  9. Global $aResult, $iRows, $iColumns, $iRval  ; Usual SQLite stuff
  10. Local $hQuery,$aRow, $sMsg
  11. Local $sTable = "completed_recording"
  12.  
  13. _SQLite_Startup ()
  14. ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR)
  15. $sDbName = "C:\ProgramData\DVBLogic\TVMosaic\data\recorder_database\recorder_database.db"
  16.  
  17. Local $hDskDb = _SQLite_Open($sDbName)
  18. If @error Then
  19.     MsgBox(16, "SQLite Error", "Can't open database, bye.", 10)
  20.     Exit - 1
  21. EndIf
  22.  
  23. $iRval = _SQLite_GetTable2d (-1, "SELECT * FROM completed_recording", $aResult, $iRows, $iColumns)
  24.  
  25. If $iRval = $SQLITE_OK Then
  26.     _ArrayDisplay($aResult)
  27. Else
  28.         MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
  29. EndIf
  30.  
  31. For $x = 1 to uBound($aResult)-1
  32.  
  33.    Dim $splitDrive = ""
  34.    Dim $splitDir = ""
  35.    Dim $splitFilename = ""
  36.    Dim $splitExt = ""
  37.  
  38.    $filename =      $aResult[$x][4]
  39.    $channel =       $aResult[$x][8]
  40.    $showname =      $aResult[$x][9]
  41.    $showinfo =      $aResult[$x][10]    ;synopsis
  42.    $seriesname =    $aResult[$x][9]
  43.    $ShowDesc =      $aResult[$x][13]    ;extra detail
  44.    $startTime = _StringFormatTime("%d.%m.%Y %X", $aResult[$x][11])
  45.  
  46.    $showDate = _StringFormatTime("%d.%m.%Y", $aResult[$x][11])
  47.    $showTime = _StringFormatTime("%X", $aResult[$x][11])
  48.    $showDuration = _Sec2Time($aResult[$x][12])
  49.  
  50.    $arrFileName = _PathSplit($filename, $splitDrive, $splitDir, $splitFilename, $splitExt)
  51.    $textfilePath = $splitDrive & $splitDir & $splitFilename & ".txt"
  52.  
  53.     $txtContent = "[General]" & @CRLF & "Version=1.1" & @CRLF & @CRLF & "[Media]" & @CRLF & "Created=" & $startTime & @CRLF & _
  54.     "Channel=" & $channel & @CRLF & @CRLF &  "[0]" & @CRLF & "Date=" & $showDate & @CRLF & "Time=" &  $showTime & @CRLF & "Duration=" & $showDuration & @CRLF & _
  55.     "Title=" & $showname  & @CRLF & "Info=" & $showinfo & @CRLF & "Series=" & $showname & @CRLF & "Description=" & $ShowDesc & @CRLF & "Charset=255" & @CRLF & _
  56.     "Content=160" & @CRLF & "MinimumAge=0"
  57.  
  58.     ConsoleWrite("Creating " & $textfilePath & @CRLF)
  59.  
  60.    $DVBViewerTxt = FileOpen($textfilePath, 258)
  61.    FileWrite($DVBViewerTxt, $txtContent)
  62.    FileClose($DVBViewerTxt)
  63.  
  64. Next
  65.  
  66. _SQLite_Close()
  67. _SQLite_Shutdown()
  68.  
  69. Func _Sec2Time($nr_sec)
  70.    $sec2time_hour = Int($nr_sec / 3600)
  71.    $sec2time_min = Int(($nr_sec - $sec2time_hour * 3600) / 60)
  72.    $sec2time_sec = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60
  73.    Return StringFormat('%02d:%02d:%02d', $sec2time_hour, $sec2time_min, $sec2time_sec)
  74. EndFunc   ;==>Sec2Time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement