-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
227 lines (159 loc) · 6.25 KB
/
README
File metadata and controls
227 lines (159 loc) · 6.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
bitzify 0.2 alpha
GETTING STARTED:
================
You need "taglib" for the audiotags utility:
http://developer.kde.org/~wheeler/taglib.html
pkg-config is used to determine the compiler and linker flags for taglib.
Run "make" to compile the following helper utilities written in C:
audiotags # extracts metatags from Ogg/MP3/FLAC.
first20 # encodes the first 20 bytes of a file as a hexadecimal string.
urlencode # encodes unsafe characters as % HEX HEX.
htmlencode # encodes non-ASCII characters as numeric character references.
Run "make install" the executables into "$PREFIX/bin/".
You'll need the following additional tools:
sh # A functional bourne shell. mksh, ksh, bash are fine, too.
mplayer # identify media files
file # determine mime type
curl # submit metadata to bitzi.com
bitter # file hashing of bitprints (unless it's all cached)
bc # mathematical calculations
ogginfo # extract average bitrate from Ogg/Vorbis files
bitter is available from the SVN repository of gtk-gnutella.
USAGE:
======
In order to extract metadata from FILE run
bitzify --meta FILE
Note that bitzify accepts only a single FILE argument. This is
meant to avoid problems with pathnames containing whitespaces
which may accidently be unquoted and result in multiple arguments.
By default the metadata is just printed to standard output. Use
bitzify --meta --output=OUTPUT FILE
to print it to file OUTPUT instead. You can use the generated
file OUTPUT later with the --import option, in order to send it
to bitzi.com.
In order to submit metadata to bitzi.com log into your bitzi
account with your web browser, extract the the ad_user_login
cookie and store it in ~/.bitzify/cookie like this:
Set-Cookie: ad_user_login=SECRET
Then run
bitzify --submit --meta FILE
for extracting metadata from FILE and submitting it to bitzi.com.
If you store the cookie elsewhere use
bitzify --submit --cookie=COOKIE --meta FILE
whereas COOKIE is the path of the file which holds the cookie.
When you submit metadata, you will will be asked whether you want
to edit the metadata before it is actually submitted. This can be
disabled with --batch.
It is recommendable to log all submissions to bitzi, so that
you know which files have been processed and double-check if
the metadata was submitted as desired. Thus use
bitzify --submit --meta --log-file=LOG [...]
to append the metadata to LOG.
If you want to submit preprocessed metadata files instead use
the --import option:
bitzify --import --submit --cookie COOKIE FILE
Now FILE refers to the file holding the metadata. This is useful
if you want to add/modify/correct metadata for many files and
then submit them later to bitzi.
If your files are already hashed by gtk-gnutella, use the
option --sha1-cache option to avoid rehashing them:
bitzify --sha1-cache=~/.gtk-gnutella/sha1_cache [...]
If the file is not found in CACHE, the bitprint will be calculated
with bitter. To avoid specifying this argument each time, you
can also copy the cache file to ~/.bitzify/sha1_cache or create
such a symlink.
If something goes wrong you might find file names "bitzify-tmp.*"
in your temporary directory ($TMPDIR or /tmp). Just delete them
when you are sure you are not using bitzify currently.
ENVIRONMENT VARIABLES:
======================
bitzify uses the following environment variables:
TMPDIR Directory used for temporary files. Defaults to "/tmp".
VISUAL Editor to use for editing metadata. Defaults to "$EDITOR"
and if $EDITOR is also unset or empty, "vi" is used.
EDITOR See VISUAL.
EXAMPLES:
=========
# Print metadata for each FLAC file in "/audio/" for testing.
for f in /audio/*.flac; do bitzify --meta "$f"; done
# Submit metadata of all Ogg files in the current directory
for f in ./*.ogg
do
bitzify --submit --meta --cookie=~/.cookie "$f"
done
# Submit a "Best version" judgement of all MP3 files in the
# current directory for which Bitzi already provides tickets.
for f in ./*.mp3
do
bitzify --submit --judgement=best "$f"
done
# Same as above but submit the metadata too. Files that have no
# Bitzi tickets yet cannot be judged.
for f in ./*.mp3
do
bitzify --submit --meta --judgement=best "$f"
done
ADVANCED EXAMPLES:
==================
# For each file in the current directory, create a file containing the
# bitzi metadata and use the sha1 cache.
for f in ./*
do
meta=~/tmp/"${f##*/}.bitzi"
bitzify --meta --sha1-cache=~/.gtk-gnutella/sha1_cache \
--output="$meta" "$f"
done
# If you modified the metadata files you might want to check the
# metadata files. The check is only rudimentary though:
for meta in ~/tmp/*.bitzi
do
bitzify --import "$meta" >/dev/null && continue
echo "ERROR: Damaged meta data: \"$meta\""
done
# Submit all generated metadata files to bitzi and don't ask for
# confirmation.
for meta in ~/tmp/*.bitzi
do
bitzify --submit --cookie=~/.cookie --batch --import -- "$meta"
done
CAVEATS:
========
For your own and your files' safety, use an account that has only read
access to the files and directories.
Do not judge mislabeled files negatively! Instead submit metadata
with an appropriate filename.
Sometimes metatags are not correctly encoded and must be corrected
manually. Make sure you don't submit garbage.
Bitzi doesn't really have Unicode handling either. All Non-ASCII tags
are problematic. However, all submitted data should use Unicode.
Since mplayer does not provide an accurate duration for audio files
in many cases, audiofiles are decoded to PCM using a fixed sample rate,
8-bit mono samples, so that the duration can be calculated precisely.
Obviously this is rather slow.
Whether an MP3 uses VBR is not detected currently.
bitzify is mostly useful for audio and video files.
The following non-exhaustive list show which files and codecs are
typically recognized.
Audio files:
MP3 (mpg/mp3)
Ogg/Vorbis (ogg/oga)
FLAC (flac)
Video files:
Xvid (avi/mkv)
DivX (avi/mkv)
Matroska (mkv)
MPEG-1 (mpg/mpeg)
MPEG-2 (mpg/mpeg2)
MPEG-4 ASP [Xvid/DivX/WMV3] (avi/mp4/mkv)
MPEG-4 AVC [H.264/AVC] (avi/mp4/mkv)
OGM (Xvid/DivX) (ogm)
Archives:
ZIP (application/x-zip)
RAR (application/x-rar)
Text:
TXT (text/plain)
TODO:
=====
- Add support MPEG-4 audio (AAC), WAV (PCM), MPEG-2 audio.
- Login so that user doesn't have pass the cookie manually.
- Double-check "confirmed" tags, ask user.