On Wednesday, 30 January 2019 16:06:41 GMT Laurence Perkins wrote:
> On Tue, 2019-01-29 at 17:57 +0000, Mick wrote:
> > On Tuesday, 29 January 2019 02:55:02 GMT Dale wrote:
> > > Andrew Udvare wrote:
> > > > > On 2019-01-28, at 17:54, Dale <rdalek1...@gmail.com> wrote:
> > > > > 
> > > > > So far, I have installed Griffith and GCStar.  I been googling
> > > > > for
> > > > > others but some either are not in the tree or I already know
> > > > > they won't
> > > > > do one thing I'd like to see.  I'd also like to be able to
> > > > > point it to a
> > > > > directory and let it build the database on its own.  Adding
> > > > > them one at
> > > > > a time manually just isn't feasible at all.
> > > > 
> > > > Seems like you could import via command line?
> > > > http://wiki.gcstar.org/en/execution
> > > > 
> > > > You can build the database you need locally with something like
> > > > exiftool
> > > > or MediaInfo, or even ffmpeg https://stackoverflow.com/a/8191228/
> > > > 374110 .
> > > > I highly doubt anyone with serious collections is building their
> > > > database
> > > > one item at a time.>
> > > > 
> > > > > Does anyone know of a software package that will sort a lot of
> > > > > videos by
> > > > > resolution as well as track other things as well?  It could be
> > > > > that what
> > > > > I'd like to have doesn't exist at all.  Then again, maybe I
> > > > > just haven't
> > > > > found it yet.  ;-)
> > > > 
> > > > The closest thing I can think of is Kodi since it's scanner will
> > > > retrieve
> > > > all this information and store it in a straightforward database
> > > > format.
> > > > You can choose SQLite or MySQL (of course MySQL is definitely the
> > > > better
> > > > choice for larger collections). The downside is the scanner is
> > > > very slow,
> > > > especially over a network (and not optimised). The only viewer
> > > > for this
> > > > data (at the time being) is Kodi itself.
> > > 
> > > Not ignoring.  Just pondering this one.  May take some time for me
> > > to
> > > test some stuff here.  ;-)
> > > 
> > > Thanks much.
> > > 
> > > Dale
> > > 
> > > :-)  :-)
> > 
> > Installing and having to maintain Kodi just to manage a list of
> > videos is
> > probably inefficient - unless you have a regular use for other Kodi
> > functionality.  I use it mostly for audio and also the odd video.  It
> > has
> > loads of useful plugins to play with.
> > 
> > If Kodi is of no use, or you prefer a more portable stand alone CLI
> > solution,
> > you could look into some basic bash scripts. I couldn't code my way
> > out of a
> > paper bag, but here's two basic ideas to get you started.  First to
> > list all
> > the videos into a csv file:
> > 
> > find . -xtype f -iname '*.mp4' -o -iname '*.avi' -o -iname '*.mkv' >
> > video_list.csv
> > 
> > You may have to add other types of video file containers depending on
> > your
> > video collection.  As a second step, in order to list all the video
> > resolutions you could pass the find output to xargs:
> > 
> > find . -xtype f -iname '*.mp4' -o -iname '*.avi' -o -iname '*.mkv' |
> > tee
> > video_list.csv | xargs -d '\n' exiftool -T -ImageSize
> > 
> > Given my non-existent coding skills I am not sure how to append the
> > output of
> > xargs as a second column to the video_list.csv, which you could
> > thereafter
> > open with localc to do your searches, or manipulate further.  Of
> > course,
> > localc is not necessary.  You can always use less or grep to search
> > the csv
> > file very efficiently and also re-create it quickly when you
> > add/delete to
> > your videos.
> > 
> > Other more knowledgeable contributors should be able to polish and
> > complete
> > the above, or indeed propose something different than bash (python?)
> > to
> > perform the same task.
> > 
> > HTH.
> 
> Nah, bash works fine and is less verbose when interacting with system
> utilities.
> 
> To meld it all together use a for loop:
> 
> #! /bin/bash
> #Top line lets you save it as a file and run it if you want.
> #Or you can run it a line at a time in your shell.  Bash isn't picky.
> IFS="
> "  #This bit tells it to only count new lines as new entries.
>    #It's only necessary if your file names have spaces in them.
> 
> #This assumes all your videos have proper file extensions.  If
> #not then you'll want to make use of the "file" utility to determine
> #the type of your files and use grep to sort out which ones are
> #videos and then run that list through the for loop instead.
> for VIDEO in $(find . -xtype f -iname '*.mp4' -o -iname '*.avi'\
>                 -o -iname '*.mkv'); do
>   #Things in $() get run and their stdout gets stuffed into the
>   #command line at that point. ${} is how you insert variable values.
>   echo "${VIDEO},$(exiftool -T -ImageSize '${VIDEO}')"
> done
> 
> The bit with the backslashes at the end of the lines makes it not count
> the newline as the end of a command so it will hopefully go through the
> mail without getting too mangled.  You should be able puzzle out how to
> fix it if it does.
> 
> 
> LMP

I was thinking sed or awk could be used to build two or more columns in CSV, 
but the IFS bash variable is a neater way to achieve the same. Thanks LMP!  
:-)

Note:  your script will only work here correctly when I remove the 'single 
quotes' from the last $VIDEO entry in the penultimate line above. 


@Dale:  Given your use case I assume the video filename will be enough, but 
other exif header tags can be used too, by adding to the above script (check 
man exiftool).
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to