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
8c484eec
Commit
8c484eec
authored
May 13, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add type element to Song struct, and change utf8file to utf8url
git-svn-id:
https://svn.musicpd.org/mpd/trunk@999
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
e7ae1b0c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
82 deletions
+109
-82
directory.c
src/directory.c
+6
-5
playlist.c
src/playlist.c
+14
-12
song.c
src/song.c
+79
-62
song.h
src/song.h
+10
-3
No files found.
src/directory.c
View file @
8c484eec
...
@@ -277,7 +277,7 @@ void removeSongFromDirectory(Directory * directory, char * shortname) {
...
@@ -277,7 +277,7 @@ void removeSongFromDirectory(Directory * directory, char * shortname) {
void
*
song
;
void
*
song
;
if
(
findInList
(
directory
->
songs
,
shortname
,
&
song
))
{
if
(
findInList
(
directory
->
songs
,
shortname
,
&
song
))
{
LOG
(
"removing: %s
\n
"
,((
Song
*
)
song
)
->
utf8
file
);
LOG
(
"removing: %s
\n
"
,((
Song
*
)
song
)
->
utf8
url
);
deleteFromList
(
directory
->
songs
,
shortname
);
deleteFromList
(
directory
->
songs
,
shortname
);
}
}
}
}
...
@@ -508,7 +508,7 @@ int updatePath(char * utf8path) {
...
@@ -508,7 +508,7 @@ int updatePath(char * utf8path) {
}
}
else
if
((
song
=
getSongDetails
(
path
,
&
shortname
,
&
parentDirectory
)))
{
else
if
((
song
=
getSongDetails
(
path
,
&
shortname
,
&
parentDirectory
)))
{
/* if this song update is successfull, we are done */
/* if this song update is successfull, we are done */
if
(
song
&&
isMusic
(
song
->
utf8
file
,
&
mtime
))
{
if
(
song
&&
isMusic
(
song
->
utf8
url
,
&
mtime
))
{
free
(
path
);
free
(
path
);
if
(
song
->
mtime
==
mtime
)
return
0
;
if
(
song
->
mtime
==
mtime
)
return
0
;
else
if
(
updateSongInfo
(
song
)
==
0
)
return
1
;
else
if
(
updateSongInfo
(
song
)
==
0
)
return
1
;
...
@@ -655,7 +655,8 @@ int addToDirectory(Directory * directory, char * shortname, char * name) {
...
@@ -655,7 +655,8 @@ int addToDirectory(Directory * directory, char * shortname, char * name) {
}
}
else
if
(
isMusic
(
name
,
NULL
))
{
else
if
(
isMusic
(
name
,
NULL
))
{
Song
*
song
;
Song
*
song
;
song
=
addSongToList
(
directory
->
songs
,
shortname
,
name
);
song
=
addSongToList
(
directory
->
songs
,
shortname
,
name
,
SONG_TYPE_FILE
);
if
(
!
song
)
return
-
1
;
if
(
!
song
)
return
-
1
;
LOG
(
"added %s
\n
"
,
name
);
LOG
(
"added %s
\n
"
,
name
);
return
1
;
return
1
;
...
@@ -1071,7 +1072,7 @@ int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) {
...
@@ -1071,7 +1072,7 @@ int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) {
}
}
int
printSongInDirectory
(
FILE
*
fp
,
Song
*
song
,
void
*
data
)
{
int
printSongInDirectory
(
FILE
*
fp
,
Song
*
song
,
void
*
data
)
{
myfprintf
(
fp
,
"file: %s
\n
"
,
song
->
utf8
file
);
myfprintf
(
fp
,
"file: %s
\n
"
,
song
->
utf8
url
);
return
0
;
return
0
;
}
}
...
@@ -1103,7 +1104,7 @@ int searchForTitleInDirectory(FILE * fp, Song * song, void * string) {
...
@@ -1103,7 +1104,7 @@ int searchForTitleInDirectory(FILE * fp, Song * song, void * string) {
}
}
int
searchForFilenameInDirectory
(
FILE
*
fp
,
Song
*
song
,
void
*
string
)
{
int
searchForFilenameInDirectory
(
FILE
*
fp
,
Song
*
song
,
void
*
string
)
{
char
*
dup
=
strDupToUpper
(
song
->
utf8
file
);
char
*
dup
=
strDupToUpper
(
song
->
utf8
url
);
if
(
strstr
(
dup
,(
char
*
)
string
))
printSongInfo
(
fp
,
song
);
if
(
strstr
(
dup
,(
char
*
)
string
))
printSongInfo
(
fp
,
song
);
free
(
dup
);
free
(
dup
);
return
0
;
return
0
;
...
...
src/playlist.c
View file @
8c484eec
...
@@ -161,7 +161,7 @@ int showPlaylist(FILE * fp) {
...
@@ -161,7 +161,7 @@ int showPlaylist(FILE * fp) {
int
i
;
int
i
;
for
(
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
myfprintf
(
fp
,
"%i:%s
\n
"
,
i
,(
playlist
.
songs
[
i
])
->
utf8
file
);
myfprintf
(
fp
,
"%i:%s
\n
"
,
i
,(
playlist
.
songs
[
i
])
->
utf8
url
);
}
}
return
0
;
return
0
;
...
@@ -357,7 +357,7 @@ int playlistInfo(FILE * fp,int song) {
...
@@ -357,7 +357,7 @@ int playlistInfo(FILE * fp,int song) {
}
}
for
(
i
=
begin
;
i
<
end
;
i
++
)
{
for
(
i
=
begin
;
i
<
end
;
i
++
)
{
myfprintf
(
fp
,
"file: %s
\n
"
,(
playlist
.
songs
[
i
])
->
utf8
file
);
myfprintf
(
fp
,
"file: %s
\n
"
,(
playlist
.
songs
[
i
])
->
utf8
url
);
if
((
tag
=
(
playlist
.
songs
[
i
])
->
tag
))
{
if
((
tag
=
(
playlist
.
songs
[
i
])
->
tag
))
{
printMpdTag
(
fp
,
tag
);
printMpdTag
(
fp
,
tag
);
}
}
...
@@ -380,9 +380,9 @@ void queueNextSongInPlaylist() {
...
@@ -380,9 +380,9 @@ void queueNextSongInPlaylist() {
DEBUG
(
"playlist: queue song %i:
\"
%s
\"\n
"
,
DEBUG
(
"playlist: queue song %i:
\"
%s
\"\n
"
,
playlist
.
queued
,
playlist
.
queued
,
playlist
.
songs
[
playlist
.
order
[
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8
file
);
playlist
.
queued
]]
->
utf8
url
);
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8
file
)
<
0
)
{
playlist
.
queued
]]
->
utf8
url
)
<
0
)
{
playlist
.
queued
=
-
1
;
playlist
.
queued
=
-
1
;
playlist_queueError
=
1
;
playlist_queueError
=
1
;
}
}
...
@@ -395,9 +395,9 @@ void queueNextSongInPlaylist() {
...
@@ -395,9 +395,9 @@ void queueNextSongInPlaylist() {
DEBUG
(
"playlist: queue song %i:
\"
%s
\"\n
"
,
DEBUG
(
"playlist: queue song %i:
\"
%s
\"\n
"
,
playlist
.
queued
,
playlist
.
queued
,
playlist
.
songs
[
playlist
.
order
[
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8
file
);
playlist
.
queued
]]
->
utf8
url
);
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8
file
)
<
0
)
{
playlist
.
queued
]]
->
utf8
url
)
<
0
)
{
playlist
.
queued
=
-
1
;
playlist
.
queued
=
-
1
;
playlist_queueError
=
1
;
playlist_queueError
=
1
;
}
}
...
@@ -645,10 +645,10 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
...
@@ -645,10 +645,10 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
playlist
.
current
=
orderNum
;
playlist
.
current
=
orderNum
;
DEBUG
(
"playlist: play %i:
\"
%s
\"\n
"
,
orderNum
,
DEBUG
(
"playlist: play %i:
\"
%s
\"\n
"
,
orderNum
,
(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
utf8
file
);
(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
utf8
url
);
if
(
playerPlay
(
fp
,(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
if
(
playerPlay
(
fp
,(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
utf8
file
)
<
0
)
utf8
url
)
<
0
)
{
{
stopPlaylist
(
fp
);
stopPlaylist
(
fp
);
return
-
1
;
return
-
1
;
...
@@ -1052,12 +1052,14 @@ int savePlaylist(FILE * fp, char * utf8file) {
...
@@ -1052,12 +1052,14 @@ int savePlaylist(FILE * fp, char * utf8file) {
}
}
for
(
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
if
(
playlist_saveAbsolutePaths
)
{
if
(
playlist_saveAbsolutePaths
&&
playlist
.
songs
[
i
]
->
type
==
SONG_TYPE_FILE
)
{
myfprintf
(
fileP
,
"%s
\n
"
,
rmp2amp
(
utf8ToFsCharset
((
myfprintf
(
fileP
,
"%s
\n
"
,
rmp2amp
(
utf8ToFsCharset
((
playlist
.
songs
[
i
])
->
utf8
file
)));
playlist
.
songs
[
i
])
->
utf8
url
)));
}
}
else
myfprintf
(
fileP
,
"%s
\n
"
,
else
myfprintf
(
fileP
,
"%s
\n
"
,
utf8ToFsCharset
((
playlist
.
songs
[
i
])
->
utf8
file
));
utf8ToFsCharset
((
playlist
.
songs
[
i
])
->
utf8
url
));
}
}
while
(
fclose
(
fileP
)
&&
errno
==
EINTR
);
while
(
fclose
(
fileP
)
&&
errno
==
EINTR
);
...
@@ -1203,6 +1205,6 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
...
@@ -1203,6 +1205,6 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
if
(
playPlaylistOrderNumber
(
fp
,
i
)
<
0
)
return
-
1
;
if
(
playPlaylistOrderNumber
(
fp
,
i
)
<
0
)
return
-
1
;
}
}
return
playerSeek
(
fp
,
playlist
.
songs
[
playlist
.
order
[
i
]]
->
utf8
file
,
time
);
return
playerSeek
(
fp
,
playlist
.
songs
[
playlist
.
order
[
i
]]
->
utf8
url
,
time
);
}
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
src/song.c
View file @
8c484eec
...
@@ -47,65 +47,69 @@ Song * newNullSong() {
...
@@ -47,65 +47,69 @@ Song * newNullSong() {
Song
*
song
=
malloc
(
sizeof
(
Song
));
Song
*
song
=
malloc
(
sizeof
(
Song
));
song
->
tag
=
NULL
;
song
->
tag
=
NULL
;
song
->
utf8file
=
NULL
;
song
->
utf8url
=
NULL
;
song
->
type
=
SONG_TYPE_FILE
;
return
song
;
return
song
;
}
}
Song
*
newSong
(
char
*
utf8
fil
e
)
{
Song
*
newSong
(
char
*
utf8
url
,
SONG_TYPE
typ
e
)
{
Song
*
song
=
newNullSong
();
Song
*
song
=
newNullSong
();
song
->
utf8file
=
strdup
(
utf8file
);
song
->
utf8url
=
strdup
(
utf8url
);
song
->
type
=
type
;
if
(
!
isFile
(
utf8file
,
&
(
song
->
mtime
)));
if
(
song
->
type
==
SONG_TYPE_FILE
)
{
if
(
!
isFile
(
utf8url
,
&
(
song
->
mtime
)));
#ifdef HAVE_OGG
#ifdef HAVE_OGG
else
if
(
hasOggSuffix
(
utf8file
))
{
else
if
(
hasOggSuffix
(
utf8url
))
{
song
->
tag
=
oggTagDup
(
utf8file
);
song
->
tag
=
oggTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_FLAC
#ifdef HAVE_FLAC
else
if
((
hasFlacSuffix
(
utf8file
)))
{
else
if
((
hasFlacSuffix
(
utf8url
)))
{
song
->
tag
=
flacTagDup
(
utf8file
);
song
->
tag
=
flacTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_MAD
#ifdef HAVE_MAD
else
if
(
hasMp3Suffix
(
utf8file
))
{
else
if
(
hasMp3Suffix
(
utf8url
))
{
song
->
tag
=
mp3TagDup
(
utf8file
);
song
->
tag
=
mp3TagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_AUDIOFILE
#ifdef HAVE_AUDIOFILE
else
if
(
hasWaveSuffix
(
utf8file
))
{
else
if
(
hasWaveSuffix
(
utf8url
))
{
song
->
tag
=
audiofileTagDup
(
utf8file
);
song
->
tag
=
audiofileTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_FAAD
#ifdef HAVE_FAAD
else
if
(
hasAacSuffix
(
utf8file
))
{
else
if
(
hasAacSuffix
(
utf8url
))
{
song
->
tag
=
aacTagDup
(
utf8file
);
song
->
tag
=
aacTagDup
(
utf8url
);
}
}
else
if
(
hasMp4Suffix
(
utf8file
))
{
else
if
(
hasMp4Suffix
(
utf8url
))
{
song
->
tag
=
mp4TagDup
(
utf8file
);
song
->
tag
=
mp4TagDup
(
utf8url
);
}
}
#endif
#endif
if
(
!
song
->
tag
||
song
->
tag
->
time
<
0
)
{
if
(
!
song
->
tag
||
song
->
tag
->
time
<
0
)
{
freeSong
(
song
);
freeSong
(
song
);
song
=
NULL
;
song
=
NULL
;
}
else
addSongToTables
(
song
);
}
}
else
addSongToTables
(
song
);
return
song
;
return
song
;
}
}
void
freeSong
(
Song
*
song
)
{
void
freeSong
(
Song
*
song
)
{
deleteASongFromPlaylist
(
song
);
deleteASongFromPlaylist
(
song
);
removeASongFromTables
(
song
);
if
(
song
->
type
==
SONG_TYPE_FILE
)
removeASongFromTables
(
song
);
free
(
song
->
utf8
file
);
free
(
song
->
utf8
url
);
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
free
(
song
);
free
(
song
);
}
}
void
freeJustSong
(
Song
*
song
)
{
void
freeJustSong
(
Song
*
song
)
{
free
(
song
->
utf8
file
);
free
(
song
->
utf8
url
);
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
free
(
song
);
free
(
song
);
}
}
...
@@ -114,11 +118,20 @@ SongList * newSongList() {
...
@@ -114,11 +118,20 @@ SongList * newSongList() {
return
makeList
((
ListFreeDataFunc
*
)
freeSong
);
return
makeList
((
ListFreeDataFunc
*
)
freeSong
);
}
}
Song
*
addSongToList
(
SongList
*
list
,
char
*
key
,
char
*
utf8file
)
{
Song
*
addSongToList
(
SongList
*
list
,
char
*
key
,
char
*
utf8url
,
SONG_TYPE
type
)
{
Song
*
song
=
NULL
;
Song
*
song
=
NULL
;
if
(
isMusic
(
utf8file
,
NULL
))
{
switch
(
type
)
{
song
=
newSong
(
utf8file
);
case
SONG_TYPE_FILE
:
if
(
isMusic
(
utf8url
,
NULL
))
{
song
=
newSong
(
utf8url
,
type
);
}
break
;
case
SONG_TYPE_URL
:
song
=
newSong
(
utf8url
,
type
);
break
;
}
}
if
(
song
==
NULL
)
return
NULL
;
if
(
song
==
NULL
)
return
NULL
;
...
@@ -133,7 +146,7 @@ void freeSongList(SongList * list) {
...
@@ -133,7 +146,7 @@ void freeSongList(SongList * list) {
}
}
int
printSongInfo
(
FILE
*
fp
,
Song
*
song
)
{
int
printSongInfo
(
FILE
*
fp
,
Song
*
song
)
{
myfprintf
(
fp
,
"%s%s
\n
"
,
SONG_FILE
,
song
->
utf8
file
);
myfprintf
(
fp
,
"%s%s
\n
"
,
SONG_FILE
,
song
->
utf8
url
);
if
(
song
->
tag
)
printMpdTag
(
fp
,
song
->
tag
);
if
(
song
->
tag
)
printMpdTag
(
fp
,
song
->
tag
);
...
@@ -220,13 +233,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
...
@@ -220,13 +233,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
key
=
strdup
(
&
(
buffer
[
strlen
(
SONG_KEY
)]));
key
=
strdup
(
&
(
buffer
[
strlen
(
SONG_KEY
)]));
song
=
newNullSong
();
song
=
newNullSong
();
song
->
type
=
SONG_TYPE_FILE
;
}
}
else
if
(
0
==
strncmp
(
SONG_FILE
,
buffer
,
strlen
(
SONG_FILE
)))
{
else
if
(
0
==
strncmp
(
SONG_FILE
,
buffer
,
strlen
(
SONG_FILE
)))
{
if
(
!
song
||
song
->
utf8
file
)
{
if
(
!
song
||
song
->
utf8
url
)
{
ERROR
(
"Problems reading song info
\n
"
);
ERROR
(
"Problems reading song info
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
song
->
utf8
file
=
strdup
(
&
(
buffer
[
strlen
(
SONG_FILE
)]));
song
->
utf8
url
=
strdup
(
&
(
buffer
[
strlen
(
SONG_FILE
)]));
}
}
else
if
(
0
==
strncmp
(
SONG_ARTIST
,
buffer
,
strlen
(
SONG_ARTIST
)))
{
else
if
(
0
==
strncmp
(
SONG_ARTIST
,
buffer
,
strlen
(
SONG_ARTIST
)))
{
if
(
!
song
->
tag
)
song
->
tag
=
newMpdTag
();
if
(
!
song
->
tag
)
song
->
tag
=
newMpdTag
();
...
@@ -271,45 +285,47 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
...
@@ -271,45 +285,47 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
}
}
int
updateSongInfo
(
Song
*
song
)
{
int
updateSongInfo
(
Song
*
song
)
{
char
*
utf8
file
=
song
->
utf8file
;
char
*
utf8
url
=
song
->
utf8url
;
removeASongFromTables
(
song
);
if
(
song
->
type
==
SONG_TYPE_FILE
)
{
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
removeASongFromTables
(
song
);
if
(
song
->
tag
)
freeMpdTag
(
song
->
tag
);
song
->
tag
=
NULL
;
song
->
tag
=
NULL
;
if
(
!
isFile
(
utf8file
,
&
(
song
->
mtime
)));
if
(
!
isFile
(
utf8url
,
&
(
song
->
mtime
)));
#ifdef HAVE_OGG
#ifdef HAVE_OGG
else
if
(
hasOggSuffix
(
utf8file
))
{
else
if
(
hasOggSuffix
(
utf8url
))
{
song
->
tag
=
oggTagDup
(
utf8file
);
song
->
tag
=
oggTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_FLAC
#ifdef HAVE_FLAC
else
if
((
hasFlacSuffix
(
utf8file
)))
{
else
if
((
hasFlacSuffix
(
utf8url
)))
{
song
->
tag
=
flacTagDup
(
utf8file
);
song
->
tag
=
flacTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_MAD
#ifdef HAVE_MAD
else
if
(
hasMp3Suffix
(
utf8file
))
{
else
if
(
hasMp3Suffix
(
utf8url
))
{
song
->
tag
=
mp3TagDup
(
utf8file
);
song
->
tag
=
mp3TagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_AUDIOFILE
#ifdef HAVE_AUDIOFILE
else
if
(
hasWaveSuffix
(
utf8file
))
{
else
if
(
hasWaveSuffix
(
utf8url
))
{
song
->
tag
=
audiofileTagDup
(
utf8file
);
song
->
tag
=
audiofileTagDup
(
utf8url
);
}
}
#endif
#endif
#ifdef HAVE_FAAD
#ifdef HAVE_FAAD
else
if
(
hasAacSuffix
(
utf8file
))
{
else
if
(
hasAacSuffix
(
utf8url
))
{
song
->
tag
=
aacTagDup
(
utf8file
);
song
->
tag
=
aacTagDup
(
utf8url
);
}
}
else
if
(
hasMp4Suffix
(
utf8file
))
{
else
if
(
hasMp4Suffix
(
utf8url
))
{
song
->
tag
=
mp4TagDup
(
utf8file
);
song
->
tag
=
mp4TagDup
(
utf8url
);
}
}
#endif
#endif
if
(
!
song
->
tag
||
song
->
tag
->
time
<
0
)
return
-
1
;
if
(
!
song
->
tag
||
song
->
tag
->
time
<
0
)
return
-
1
;
else
addSongToTables
(
song
);
else
addSongToTables
(
song
);
}
return
0
;
return
0
;
}
}
...
@@ -317,9 +333,10 @@ int updateSongInfo(Song * song) {
...
@@ -317,9 +333,10 @@ int updateSongInfo(Song * song) {
Song
*
songDup
(
Song
*
song
)
{
Song
*
songDup
(
Song
*
song
)
{
Song
*
ret
=
malloc
(
sizeof
(
Song
));
Song
*
ret
=
malloc
(
sizeof
(
Song
));
ret
->
utf8
file
=
strdup
(
song
->
utf8file
);
ret
->
utf8
url
=
strdup
(
song
->
utf8url
);
ret
->
mtime
=
song
->
mtime
;
ret
->
mtime
=
song
->
mtime
;
ret
->
tag
=
mpdTagDup
(
song
->
tag
);
ret
->
tag
=
mpdTagDup
(
song
->
tag
);
ret
->
type
=
song
->
type
;
return
ret
;
return
ret
;
}
}
...
...
src/song.h
View file @
8c484eec
...
@@ -30,15 +30,21 @@
...
@@ -30,15 +30,21 @@
#include "tag.h"
#include "tag.h"
#include "list.h"
#include "list.h"
typedef
enum
{
SONG_TYPE_FILE
,
SONG_TYPE_URL
}
SONG_TYPE
;
typedef
struct
_Song
{
typedef
struct
_Song
{
char
*
utf8file
;
char
*
utf8url
;
SONG_TYPE
type
;
MpdTag
*
tag
;
MpdTag
*
tag
;
time_t
mtime
;
time_t
mtime
;
}
Song
;
}
Song
;
typedef
List
SongList
;
typedef
List
SongList
;
Song
*
newSong
(
char
*
utf8
fil
e
);
Song
*
newSong
(
char
*
utf8
url
,
SONG_TYPE
typ
e
);
void
freeSong
(
Song
*
);
void
freeSong
(
Song
*
);
...
@@ -46,7 +52,8 @@ SongList * newSongList();
...
@@ -46,7 +52,8 @@ SongList * newSongList();
void
freeSongList
(
SongList
*
list
);
void
freeSongList
(
SongList
*
list
);
Song
*
addSongToList
(
SongList
*
list
,
char
*
key
,
char
*
utf8file
);
Song
*
addSongToList
(
SongList
*
list
,
char
*
key
,
char
*
utf8file
,
SONG_TYPE
type
);
int
printSongInfo
(
FILE
*
fp
,
Song
*
song
);
int
printSongInfo
(
FILE
*
fp
,
Song
*
song
);
...
...
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