[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gmediaserver-devel] magic_file in libmagic1(v5.00)
From: |
SHIROUZU Hiroaki |
Subject: |
[gmediaserver-devel] magic_file in libmagic1(v5.00) |
Date: |
Sun, 03 May 2009 13:48:39 +0900 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.0 |
Hello,
I am H.Shirouzu.
I have been using gmediaserver on Debian(testing) for 1.5 years.
Thank you.
By the way, when I executed "apt-get upgrade" command at last month, libmagic1
was updated to v5.00.
And gmediaserver couldn't find MP3 files.
magic_file() in libmagic1(v5.00) returns mime-type with charset. (for example
"audio/mpeg; charset=binary").
But it seems that check_file_content_type() in metadata.c of gmediaserver
expects it returns without charset. (for example "audio/mpeg").
I modified magic string in check_file_content_type(), it worked.
(for example, if magic string is "audio/mpeg; charset=binary", it is modified
to "audio/mpeg")
Or modifying MAGIC_MIME to MAGIC_MIME_TYPE in magic_open() is possible to work.
(but I don't confirm)
P.S I hope to add inotify function in gmediaserver.
Thanks,
-- H.Shirouzu
-----------------
metadata.c in gmediaserver
-----------------
init_metadata(void)
{
magic_cookie = magic_open(MAGIC_SYMLINK|MAGIC_MIME|MAGIC_ERROR);
:
check_file_content_type(const char *fullpath)
{
magic = magic_file(magic_cookie, fullpath);
:
struct {
FileType id;
char *mime;
} mime_map[] = {
{ FILE_MP3, "audio/mpeg" }, /* XXX: FILE_MP3_ID3? */
:
};
for (c = 0; mime_map[c].mime != NULL; c++) {
if (strcmp(magic, mime_map[c].mime) == 0)
return mime_map[c].id;
}
}
-----------------
magic.h in libmagic1(v5.00)
-----------------
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
-----------------
magic.c in libmagic1(v5.00)
-----------------
magic_file(struct magic_set *ms, const char *inname)
{
return file_or_fd(ms, inname, STDIN_FILENO);
}
file_or_fd(struct magic_set *ms, const char *inname, int fd)
{
:
(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
goto done;
-----------------
funcs.c in libmagic1(v5.00)
-----------------
file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
size_t nb)
{
:
done:
if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
if (ms->flags & MAGIC_MIME_TYPE)
if (file_printf(ms, "; charset=") == -1)
rv = -1;
if (file_printf(ms, "%s", code_mime) == -1)
rv = -1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gmediaserver-devel] magic_file in libmagic1(v5.00),
SHIROUZU Hiroaki <=