Tee to a table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Tee to a table

Cecil Westerhof-5
At the moment I have a script where I send the output of a ffmpeg command
to the terminal and a file. Is it possible to send the output to a SQLite
table. I like to use tcl for this.

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Simon Slavin-3
On 1 Feb 2018, at 8:25pm, Cecil Westerhof <[hidden email]> wrote:

> At the moment I have a script where I send the output of a ffmpeg command
> to the terminal and a file. Is it possible to send the output to a SQLite
> table. I like to use tcl for this.

Is the output a string of text ?

Can you use scripting commands to include it in a file which scripts the SQLite command-line tool ?

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Peter da Silva
In reply to this post by Cecil Westerhof-5
It's pretty easy in Tcl

Sqlite3 db file.sqlite
while {[gets stdin line] > 0} {
    parse_line_into index content; # or whatever you do to extract content from the line
    db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
}
db close

On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof" <[hidden email] on behalf of [hidden email]> wrote:

    At the moment I have a script where I send the output of a ffmpeg command
    to the terminal and a file. Is it possible to send the output to a SQLite
    table. I like to use tcl for this.
   
    --
    Cecil Westerhof
    _______________________________________________
    sqlite-users mailing list
    [hidden email]
    http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
   

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Cecil Westerhof-5
In reply to this post by Simon Slavin-3
2018-02-01 21:42 GMT+01:00 Simon Slavin <[hidden email]>:

> On 1 Feb 2018, at 8:25pm, Cecil Westerhof <[hidden email]> wrote:
>
> > At the moment I have a script where I send the output of a ffmpeg command
> > to the terminal and a file. Is it possible to send the output to a SQLite
> > table. I like to use tcl for this.
>
> Is the output a string of text ?
>

​Text. It start for example with:
07:00:25: converting MVI_6580.MOV
ffmpeg version 3.2.8-1~deb9u1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1'
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libebur128 --enable-libflite
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora
--enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack
--enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq
--enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2
--enable-libdc1394 --enable-libiec61883 --enable-chromaprint
--enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_6580.MOV':



Can you use scripting commands to include it in a file which scripts the
> SQLite command-line tool ?
>

​I am not sure what you mean.

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Simon Slavin-3
On 1 Feb 2018, at 8:55pm, Cecil Westerhof <[hidden email]> wrote:

>> Can you use scripting commands to include it in a file which scripts the
>> SQLite command-line tool ?
>
> ​I am not sure what you mean.

You can ignore my suggestion.  You are using Tcl and it's easier in Tcl.  Sorry, I did not notice that part of your text.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Cecil Westerhof-5
In reply to this post by Peter da Silva
2018-02-01 21:49 GMT+01:00 Peter Da Silva <[hidden email]>:

> It's pretty easy in Tcl
>
> Sqlite3 db file.sqlite
> while {[gets stdin line] > 0} {
>     parse_line_into index content; # or whatever you do to extract content
> from the line
>     db eval {INSERT INTO whatever (index, content) VALUES ($index,
> $content);}
> }
> db close
>

​Looks promising.​ The 'problem' is that I get a record pro line. But that
is not a big problem I think. On the plus side it is easy to make a GUI
instead of a command line version.

Thanks.



> On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof" <
> [hidden email] on behalf of
> [hidden email]> wrote:
>
>     At the moment I have a script where I send the output of a ffmpeg
> command
>     to the terminal and a file. Is it possible to send the output to a
> SQLite
>     table. I like to use tcl for this.
>

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Peter da Silva
You can do something like this, for one record per file:

Sqlite3 db file.sqlite
while {[gets stdin line] > 0} {
    lappend content $line
}
set content [join $content "\n"; # or otherwise manipulate the text you got back.
db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
db close

Or anything in between:

Sqlite3 db file.sqlite
while {[gets stdin line] > 0} {
    if {[matches_end_of_content $line]} {
       db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
       set content {}
   } elseif {[matches_start_of_content $line]} {
      get_index_from_content $content index
   } else {
      add_line_to_content $line content
   }
}
db close

On 2/1/18, 3:00 PM, "sqlite-users on behalf of Cecil Westerhof" <[hidden email] on behalf of [hidden email]> wrote:

    2018-02-01 21:49 GMT+01:00 Peter Da Silva <[hidden email]>:
   
    > It's pretty easy in Tcl
    >
    > Sqlite3 db file.sqlite
    > while {[gets stdin line] > 0} {
    >     parse_line_into index content; # or whatever you do to extract content
    > from the line
    >     db eval {INSERT INTO whatever (index, content) VALUES ($index,
    > $content);}
    > }
    > db close
    >
   
    ​Looks promising.​ The 'problem' is that I get a record pro line. But that
    is not a big problem I think. On the plus side it is easy to make a GUI
    instead of a command line version.
   
    Thanks.
   
   
   
    > On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof" <
    > [hidden email] on behalf of
    > [hidden email]> wrote:
    >
    >     At the moment I have a script where I send the output of a ffmpeg
    > command
    >     to the terminal and a file. Is it possible to send the output to a
    > SQLite
    >     table. I like to use tcl for this.
    >
   
    --
    Cecil Westerhof
    _______________________________________________
    sqlite-users mailing list
    [hidden email]
    http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
   

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tee to a table

Peter da Silva
Switch -glob and switch -regexp are also handy for this kind of code.

On 2/1/18, 3:07 PM, "sqlite-users on behalf of Peter Da Silva" <[hidden email] on behalf of [hidden email]> wrote:

    You can do something like this, for one record per file:
   
    Sqlite3 db file.sqlite
    while {[gets stdin line] > 0} {
        lappend content $line
    }
    set content [join $content "\n"; # or otherwise manipulate the text you got back.
    db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
    db close
   
    Or anything in between:
   
    Sqlite3 db file.sqlite
    while {[gets stdin line] > 0} {
        if {[matches_end_of_content $line]} {
           db eval {INSERT INTO whatever (index, content) VALUES ($index, $content);}
           set content {}
       } elseif {[matches_start_of_content $line]} {
          get_index_from_content $content index
       } else {
          add_line_to_content $line content
       }
    }
    db close
   
    On 2/1/18, 3:00 PM, "sqlite-users on behalf of Cecil Westerhof" <[hidden email] on behalf of [hidden email]> wrote:
   
        2018-02-01 21:49 GMT+01:00 Peter Da Silva <[hidden email]>:
       
        > It's pretty easy in Tcl
        >
        > Sqlite3 db file.sqlite
        > while {[gets stdin line] > 0} {
        >     parse_line_into index content; # or whatever you do to extract content
        > from the line
        >     db eval {INSERT INTO whatever (index, content) VALUES ($index,
        > $content);}
        > }
        > db close
        >
       
        ​Looks promising.​ The 'problem' is that I get a record pro line. But that
        is not a big problem I think. On the plus side it is easy to make a GUI
        instead of a command line version.
       
        Thanks.
       
       
       
        > On 2/1/18, 2:25 PM, "sqlite-users on behalf of Cecil Westerhof" <
        > [hidden email] on behalf of
        > [hidden email]> wrote:
        >
        >     At the moment I have a script where I send the output of a ffmpeg
        > command
        >     to the terminal and a file. Is it possible to send the output to a
        > SQLite
        >     table. I like to use tcl for this.
        >
       
        --
        Cecil Westerhof
        _______________________________________________
        sqlite-users mailing list
        [hidden email]
        http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
       
   
    _______________________________________________
    sqlite-users mailing list
    [hidden email]
    http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
   

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users