1 | #!/bin/bash
|
---|
2 | ###
|
---|
3 | # videometadata
|
---|
4 | # version 1.0.1
|
---|
5 | # Author: Christoph Holzbaur (Webmaaschter@gmx.de)
|
---|
6 | #
|
---|
7 | # This program is free software; you can redistribute it and/or modify
|
---|
8 | # it under the terms of the GNU General Public License as published by
|
---|
9 | # the Free Software Foundation; either version 2 of the License, or
|
---|
10 | # (at your option) any later version.
|
---|
11 | #
|
---|
12 | # This program is distributed in the hope that it will be useful,
|
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | # GNU General Public License for more details.
|
---|
16 |
|
---|
17 |
|
---|
18 | # This script makes two things
|
---|
19 | #
|
---|
20 | # 1. Lets assume you have an Series-Folder, and
|
---|
21 | # every Subfoder of this folder is full with Episodes of one Serie.
|
---|
22 | # The script makes Thumbnails of every videofile in every subfolder and
|
---|
23 | # updates the Database
|
---|
24 | #
|
---|
25 | # 2. Lets assume you have an Rated-Video-Folder, and
|
---|
26 | # it is full with stuff your children shouldn't see.
|
---|
27 | # The script updates the showlevel of all these files so you have
|
---|
28 | # to enter an PIN to see these Files
|
---|
29 | #
|
---|
30 | ##############################################
|
---|
31 |
|
---|
32 |
|
---|
33 | ##### Settings #####
|
---|
34 |
|
---|
35 | ### 1. General settings
|
---|
36 | # DIR where the folders with the Series are
|
---|
37 | SERIEN_DIR=/home/user/Documents/Videos/Serien
|
---|
38 |
|
---|
39 | # Where are your rated videos
|
---|
40 | RATED_DIR=/home/user/Documents/Videos/FSK
|
---|
41 | # Which showlevel should your rated Videos have
|
---|
42 | SHOWLEVEL=4
|
---|
43 |
|
---|
44 | # Which suffix does your Videos have
|
---|
45 | SUFFIX=( avi AVI mpg MPG mpeg MPEG mkv MKV ogm OGM wmv WMV )
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | ## 2. Thumbnail-Settings
|
---|
50 | # Where shold the thumbs go
|
---|
51 | THUMB_DIR=/home/user/.mythtv/MythVideo
|
---|
52 |
|
---|
53 | # set if you want to make thumbnail of your videos in your RATED_DIR
|
---|
54 | RATED_THUMBS=true
|
---|
55 |
|
---|
56 | # at which timepoin i should make the thumbnail
|
---|
57 | THUMB_TIME=00:01:00
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | ### mysql-settings
|
---|
62 | HOST=192.168.1.93
|
---|
63 | USER=mythtv
|
---|
64 | PASSW=mythtv
|
---|
65 | DATABASE=mythconverg
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|
71 | ###### nothig to configure
|
---|
72 | for SUFF in ${SUFFIX[*]}
|
---|
73 | do
|
---|
74 | for SERIE in $SERIEN_DIR/*
|
---|
75 | do
|
---|
76 | if [ -d "$SERIE" ];then
|
---|
77 | for DATEI in "$SERIE"/*.$SUFF
|
---|
78 | do
|
---|
79 | if [ -e "$DATEI" ]
|
---|
80 | then
|
---|
81 | THUMB_PATH="$THUMB_DIR/`basename "$DATEI"`.png"
|
---|
82 | if [ ! -f "$THUMB_PATH" ]
|
---|
83 | then
|
---|
84 | mplayer -ss $THUMB_TIME -nosound -frames 3 -vo png "$DATEI" && mv 00000001.png "$THUMB_PATH";rm 0000000?.png
|
---|
85 | fi
|
---|
86 | echo "UPDATE videometadata SET coverfile=\"$THUMB_PATH\" WHERE filename=\"${DATEI}\" ;" | mysql -u $USER --password=$PASSW -D $DATABASE -h $HOST
|
---|
87 | fi
|
---|
88 | done
|
---|
89 | fi
|
---|
90 | done
|
---|
91 | done
|
---|
92 |
|
---|
93 | if [ "$RATED_THUMBS" = true ];then
|
---|
94 | for SUFF in ${SUFFIX[*]}
|
---|
95 | do
|
---|
96 | for DATEI in "$RATED_DIR"/*.$SUFF
|
---|
97 | do
|
---|
98 | if [ -e "$DATEI" ]
|
---|
99 | then
|
---|
100 | THUMB_PATH="$THUMB_DIR/`basename "$DATEI"`.png"
|
---|
101 | if [ ! -f "$THUMB_PATH" ]
|
---|
102 | then
|
---|
103 | mplayer -ss $THUMB_TIME -nosound -frames 3 -vo png "$DATEI" && mv 00000001.png "$THUMB_PATH";rm 0000000?.png
|
---|
104 | fi
|
---|
105 | echo "UPDATE videometadata SET coverfile=\"$THUMB_PATH\" WHERE filename=\"${DATEI}\" ;" | mysql -u $USER --password=$PASSW -D $DATABASE -h $HOST
|
---|
106 | fi
|
---|
107 | done
|
---|
108 | done
|
---|
109 | fi
|
---|
110 |
|
---|
111 |
|
---|
112 | echo "UPDATE videometadata SET showlevel=$SHOWLEVEL WHERE filename LIKE '$RATED_DIR/%' ;" | mysql -u $USER --password=$PASSW -D $DATABASE -h $HOST
|
---|