Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6599e05a
Commit
6599e05a
authored
Mar 09, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strip return characters that are in the id3 tags
git-svn-id:
https://svn.musicpd.org/mpd/trunk@229
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
ff1659ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
3 deletions
+23
-3
directory.c
src/directory.c
+1
-1
song.c
src/song.c
+1
-2
tag.c
src/tag.c
+13
-0
utils.c
src/utils.c
+6
-0
utils.h
src/utils.h
+2
-0
No files found.
src/directory.c
View file @
6599e05a
...
...
@@ -555,7 +555,7 @@ int readDirectoryDB() {
}
}
else
{
ERROR
(
"unknown line in db info: %s
\n
"
,
ERROR
(
"
directory:
unknown line in db info: %s
\n
"
,
buffer
);
}
}
...
...
src/song.c
View file @
6599e05a
...
...
@@ -179,8 +179,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
song
->
mtime
=
atoi
(
&
(
buffer
[
strlen
(
SONG_TITLE
)]));
}
else
{
ERROR
(
"unknown line in db: %s
\n
"
,
buffer
);
exit
(
-
1
);
ERROR
(
"songinfo: unknown line in db: %s
\n
"
,
buffer
);
}
}
...
...
src/tag.c
View file @
6599e05a
...
...
@@ -22,6 +22,7 @@
#include "sig_handlers.h"
#include "mp3_decode.h"
#include "audiofile_decode.h"
#include "utils.h"
#include <sys/stat.h>
#include <stdlib.h>
...
...
@@ -102,24 +103,28 @@ MpdTag * id3Dup(char * utf8filename) {
str
=
getID3Info
(
tag
,
ID3_FRAME_ARTIST
);
if
(
str
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
stripReturnChar
(
str
);
ret
->
artist
=
str
;
}
str
=
getID3Info
(
tag
,
ID3_FRAME_TITLE
);
if
(
str
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
stripReturnChar
(
str
);
ret
->
title
=
str
;
}
str
=
getID3Info
(
tag
,
ID3_FRAME_ALBUM
);
if
(
str
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
stripReturnChar
(
str
);
ret
->
album
=
str
;
}
str
=
getID3Info
(
tag
,
ID3_FRAME_TRACK
);
if
(
str
)
{
if
(
!
ret
)
ret
=
newMpdTag
();
stripReturnChar
(
str
);
ret
->
track
=
str
;
}
...
...
@@ -195,21 +200,25 @@ MpdTag * oggTagDup(char * utf8file) {
if
(
!
s1
||
!
s2
);
else
if
(
0
==
strcasecmp
(
s1
,
"artist"
))
{
if
(
!
ret
->
artist
)
{
stripReturnChar
(
s2
);
ret
->
artist
=
strdup
(
s2
);
}
}
else
if
(
0
==
strcasecmp
(
s1
,
"title"
))
{
if
(
!
ret
->
title
)
{
stripReturnChar
(
s2
);
ret
->
title
=
strdup
(
s2
);
}
}
else
if
(
0
==
strcasecmp
(
s1
,
"album"
))
{
if
(
!
ret
->
album
)
{
stripReturnChar
(
s2
);
ret
->
album
=
strdup
(
s2
);
}
}
else
if
(
0
==
strcasecmp
(
s1
,
"tracknumber"
))
{
if
(
!
ret
->
track
)
{
stripReturnChar
(
s2
);
ret
->
track
=
strdup
(
s2
);
}
}
...
...
@@ -257,6 +266,7 @@ MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
artist
=
dup
;
}
}
...
...
@@ -270,6 +280,7 @@ MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
album
=
dup
;
}
}
...
...
@@ -283,6 +294,7 @@ MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
title
=
dup
;
}
}
...
...
@@ -296,6 +308,7 @@ MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
dup
=
malloc
(
len
+
1
);
memcpy
(
dup
,
&
(
block
->
data
.
vorbis_comment
.
comments
[
offset
].
entry
[
pos
]),
len
);
dup
[
len
]
=
'\0'
;
stripReturnChar
(
dup
);
ret
->
track
=
dup
;
}
}
...
...
src/utils.c
View file @
6599e05a
...
...
@@ -37,3 +37,9 @@ char * strDupToUpper(char * str) {
return
ret
;
}
void
stripReturnChar
(
char
*
string
)
{
if
(
string
&&
(
string
=
strstr
(
string
,
"
\n
"
)))
{
*
string
=
'\0'
;
}
}
src/utils.h
View file @
6599e05a
...
...
@@ -25,4 +25,6 @@ char * myFgets(char * buffer, int bufferSize, FILE * fp);
char
*
strDupToUpper
(
char
*
str
);
void
stripReturnChar
(
char
*
string
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment