Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Video database software
Date: Wed, 30 Jan 2019 17:50:26
Message-Id: 2307501.NUR5OBeR0i@dell_xps
In Reply to: Re: [gentoo-user] Video database software by Laurence Perkins
1 On Wednesday, 30 January 2019 16:06:41 GMT Laurence Perkins wrote:
2 > On Tue, 2019-01-29 at 17:57 +0000, Mick wrote:
3 > > On Tuesday, 29 January 2019 02:55:02 GMT Dale wrote:
4 > > > Andrew Udvare wrote:
5 > > > > > On 2019-01-28, at 17:54, Dale <rdalek1967@×××××.com> wrote:
6 > > > > >
7 > > > > > So far, I have installed Griffith and GCStar. I been googling
8 > > > > > for
9 > > > > > others but some either are not in the tree or I already know
10 > > > > > they won't
11 > > > > > do one thing I'd like to see. I'd also like to be able to
12 > > > > > point it to a
13 > > > > > directory and let it build the database on its own. Adding
14 > > > > > them one at
15 > > > > > a time manually just isn't feasible at all.
16 > > > >
17 > > > > Seems like you could import via command line?
18 > > > > http://wiki.gcstar.org/en/execution
19 > > > >
20 > > > > You can build the database you need locally with something like
21 > > > > exiftool
22 > > > > or MediaInfo, or even ffmpeg https://stackoverflow.com/a/8191228/
23 > > > > 374110 .
24 > > > > I highly doubt anyone with serious collections is building their
25 > > > > database
26 > > > > one item at a time.>
27 > > > >
28 > > > > > Does anyone know of a software package that will sort a lot of
29 > > > > > videos by
30 > > > > > resolution as well as track other things as well? It could be
31 > > > > > that what
32 > > > > > I'd like to have doesn't exist at all. Then again, maybe I
33 > > > > > just haven't
34 > > > > > found it yet. ;-)
35 > > > >
36 > > > > The closest thing I can think of is Kodi since it's scanner will
37 > > > > retrieve
38 > > > > all this information and store it in a straightforward database
39 > > > > format.
40 > > > > You can choose SQLite or MySQL (of course MySQL is definitely the
41 > > > > better
42 > > > > choice for larger collections). The downside is the scanner is
43 > > > > very slow,
44 > > > > especially over a network (and not optimised). The only viewer
45 > > > > for this
46 > > > > data (at the time being) is Kodi itself.
47 > > >
48 > > > Not ignoring. Just pondering this one. May take some time for me
49 > > > to
50 > > > test some stuff here. ;-)
51 > > >
52 > > > Thanks much.
53 > > >
54 > > > Dale
55 > > >
56 > > > :-) :-)
57 > >
58 > > Installing and having to maintain Kodi just to manage a list of
59 > > videos is
60 > > probably inefficient - unless you have a regular use for other Kodi
61 > > functionality. I use it mostly for audio and also the odd video. It
62 > > has
63 > > loads of useful plugins to play with.
64 > >
65 > > If Kodi is of no use, or you prefer a more portable stand alone CLI
66 > > solution,
67 > > you could look into some basic bash scripts. I couldn't code my way
68 > > out of a
69 > > paper bag, but here's two basic ideas to get you started. First to
70 > > list all
71 > > the videos into a csv file:
72 > >
73 > > find . -xtype f -iname '*.mp4' -o -iname '*.avi' -o -iname '*.mkv' >
74 > > video_list.csv
75 > >
76 > > You may have to add other types of video file containers depending on
77 > > your
78 > > video collection. As a second step, in order to list all the video
79 > > resolutions you could pass the find output to xargs:
80 > >
81 > > find . -xtype f -iname '*.mp4' -o -iname '*.avi' -o -iname '*.mkv' |
82 > > tee
83 > > video_list.csv | xargs -d '\n' exiftool -T -ImageSize
84 > >
85 > > Given my non-existent coding skills I am not sure how to append the
86 > > output of
87 > > xargs as a second column to the video_list.csv, which you could
88 > > thereafter
89 > > open with localc to do your searches, or manipulate further. Of
90 > > course,
91 > > localc is not necessary. You can always use less or grep to search
92 > > the csv
93 > > file very efficiently and also re-create it quickly when you
94 > > add/delete to
95 > > your videos.
96 > >
97 > > Other more knowledgeable contributors should be able to polish and
98 > > complete
99 > > the above, or indeed propose something different than bash (python?)
100 > > to
101 > > perform the same task.
102 > >
103 > > HTH.
104 >
105 > Nah, bash works fine and is less verbose when interacting with system
106 > utilities.
107 >
108 > To meld it all together use a for loop:
109 >
110 > #! /bin/bash
111 > #Top line lets you save it as a file and run it if you want.
112 > #Or you can run it a line at a time in your shell. Bash isn't picky.
113 > IFS="
114 > " #This bit tells it to only count new lines as new entries.
115 > #It's only necessary if your file names have spaces in them.
116 >
117 > #This assumes all your videos have proper file extensions. If
118 > #not then you'll want to make use of the "file" utility to determine
119 > #the type of your files and use grep to sort out which ones are
120 > #videos and then run that list through the for loop instead.
121 > for VIDEO in $(find . -xtype f -iname '*.mp4' -o -iname '*.avi'\
122 > -o -iname '*.mkv'); do
123 > #Things in $() get run and their stdout gets stuffed into the
124 > #command line at that point. ${} is how you insert variable values.
125 > echo "${VIDEO},$(exiftool -T -ImageSize '${VIDEO}')"
126 > done
127 >
128 > The bit with the backslashes at the end of the lines makes it not count
129 > the newline as the end of a command so it will hopefully go through the
130 > mail without getting too mangled. You should be able puzzle out how to
131 > fix it if it does.
132 >
133 >
134 > LMP
135
136 I was thinking sed or awk could be used to build two or more columns in CSV,
137 but the IFS bash variable is a neater way to achieve the same. Thanks LMP!
138 :-)
139
140 Note: your script will only work here correctly when I remove the 'single
141 quotes' from the last $VIDEO entry in the penultimate line above.
142
143
144 @Dale: Given your use case I assume the video filename will be enough, but
145 other exif header tags can be used too, by adding to the above script (check
146 man exiftool).
147 --
148 Regards,
149 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature