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
bb8a9533
Commit
bb8a9533
authored
Oct 08, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: renamed functions, "db_" prefix and no CamelCase
Yet another CamelCase removal patch.
parent
7a023eb0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
79 additions
and
68 deletions
+79
-68
command.c
src/command.c
+1
-1
database.c
src/database.c
+26
-19
database.h
src/database.h
+18
-12
dbUtils.c
src/dbUtils.c
+13
-15
directory.c
src/directory.c
+1
-1
main.c
src/main.c
+6
-6
playlist.c
src/playlist.c
+3
-3
sig_handlers.c
src/sig_handlers.c
+1
-1
stats.c
src/stats.c
+2
-2
storedPlaylist.c
src/storedPlaylist.c
+1
-1
update.c
src/update.c
+7
-7
No files found.
src/command.c
View file @
bb8a9533
...
@@ -579,7 +579,7 @@ static int handleLsInfo(struct client *client,
...
@@ -579,7 +579,7 @@ static int handleLsInfo(struct client *client,
if
(
argc
==
2
)
if
(
argc
==
2
)
path
=
argv
[
1
];
path
=
argv
[
1
];
directory
=
getD
irectory
(
path
);
directory
=
db_get_d
irectory
(
path
);
if
(
directory
==
NULL
)
{
if
(
directory
==
NULL
)
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"directory not found"
);
"directory not found"
);
...
...
src/database.c
View file @
bb8a9533
...
@@ -36,7 +36,8 @@ static struct directory *music_root;
...
@@ -36,7 +36,8 @@ static struct directory *music_root;
static
time_t
directory_dbModTime
;
static
time_t
directory_dbModTime
;
void
directory_init
(
void
)
void
db_init
(
void
)
{
{
music_root
=
newDirectory
(
NULL
,
NULL
);
music_root
=
newDirectory
(
NULL
,
NULL
);
updateDirectory
(
music_root
);
updateDirectory
(
music_root
);
...
@@ -44,13 +45,14 @@ void directory_init(void)
...
@@ -44,13 +45,14 @@ void directory_init(void)
stats
.
dbPlayTime
=
sumSongTimesIn
(
NULL
);
stats
.
dbPlayTime
=
sumSongTimesIn
(
NULL
);
}
}
void
directory_finish
(
void
)
void
db_finish
(
void
)
{
{
freeDirectory
(
music_root
);
freeDirectory
(
music_root
);
}
}
struct
directory
*
struct
directory
*
d
irectory
_get_root
(
void
)
d
b
_get_root
(
void
)
{
{
assert
(
music_root
!=
NULL
);
assert
(
music_root
!=
NULL
);
...
@@ -58,7 +60,7 @@ directory_get_root(void)
...
@@ -58,7 +60,7 @@ directory_get_root(void)
}
}
struct
directory
*
struct
directory
*
getD
irectory
(
const
char
*
name
)
db_get_d
irectory
(
const
char
*
name
)
{
{
if
(
name
==
NULL
)
if
(
name
==
NULL
)
return
music_root
;
return
music_root
;
...
@@ -67,7 +69,7 @@ getDirectory(const char *name)
...
@@ -67,7 +69,7 @@ getDirectory(const char *name)
}
}
struct
song
*
struct
song
*
get
SongFromDB
(
const
char
*
file
)
get
_get_song
(
const
char
*
file
)
{
{
struct
song
*
song
=
NULL
;
struct
song
*
song
=
NULL
;
struct
directory
*
directory
;
struct
directory
*
directory
;
...
@@ -85,7 +87,7 @@ getSongFromDB(const char *file)
...
@@ -85,7 +87,7 @@ getSongFromDB(const char *file)
dir
=
duplicated
;
dir
=
duplicated
;
}
}
if
(
!
(
directory
=
getD
irectory
(
dir
)))
if
(
!
(
directory
=
db_get_d
irectory
(
dir
)))
goto
out
;
goto
out
;
if
(
!
(
song
=
songvec_find
(
&
directory
->
songs
,
shortname
)))
if
(
!
(
song
=
songvec_find
(
&
directory
->
songs
,
shortname
)))
goto
out
;
goto
out
;
...
@@ -97,15 +99,15 @@ out:
...
@@ -97,15 +99,15 @@ out:
}
}
int
int
traverseAllIn
(
const
char
*
name
,
db_walk
(
const
char
*
name
,
int
(
*
forEachSong
)
(
struct
song
*
,
void
*
),
int
(
*
forEachSong
)
(
struct
song
*
,
void
*
),
int
(
*
forEachDir
)
(
struct
directory
*
,
void
*
),
void
*
data
)
int
(
*
forEachDir
)
(
struct
directory
*
,
void
*
),
void
*
data
)
{
{
struct
directory
*
directory
;
struct
directory
*
directory
;
if
((
directory
=
getD
irectory
(
name
))
==
NULL
)
{
if
((
directory
=
db_get_d
irectory
(
name
))
==
NULL
)
{
struct
song
*
song
;
struct
song
*
song
;
if
((
song
=
get
SongFromDB
(
name
))
&&
forEachSong
)
{
if
((
song
=
get
_get_song
(
name
))
&&
forEachSong
)
{
return
forEachSong
(
song
,
data
);
return
forEachSong
(
song
,
data
);
}
}
return
-
1
;
return
-
1
;
...
@@ -115,7 +117,8 @@ traverseAllIn(const char *name,
...
@@ -115,7 +117,8 @@ traverseAllIn(const char *name,
data
);
data
);
}
}
static
char
*
getDbFile
(
void
)
static
char
*
db_get_file
(
void
)
{
{
ConfigParam
*
param
=
parseConfigFilePath
(
CONF_DB_FILE
,
1
);
ConfigParam
*
param
=
parseConfigFilePath
(
CONF_DB_FILE
,
1
);
...
@@ -125,10 +128,11 @@ static char *getDbFile(void)
...
@@ -125,10 +128,11 @@ static char *getDbFile(void)
return
param
->
value
;
return
param
->
value
;
}
}
int
checkDirectoryDB
(
void
)
int
db_check
(
void
)
{
{
struct
stat
st
;
struct
stat
st
;
char
*
dbFile
=
getDbF
ile
();
char
*
dbFile
=
db_get_f
ile
();
/* Check if the file exists */
/* Check if the file exists */
if
(
access
(
dbFile
,
F_OK
))
{
if
(
access
(
dbFile
,
F_OK
))
{
...
@@ -185,10 +189,11 @@ int checkDirectoryDB(void)
...
@@ -185,10 +189,11 @@ int checkDirectoryDB(void)
return
0
;
return
0
;
}
}
int
writeDirectoryDB
(
void
)
int
db_save
(
void
)
{
{
FILE
*
fp
;
FILE
*
fp
;
char
*
dbFile
=
getDbF
ile
();
char
*
dbFile
=
db_get_f
ile
();
struct
stat
st
;
struct
stat
st
;
DEBUG
(
"removing empty directories from DB
\n
"
);
DEBUG
(
"removing empty directories from DB
\n
"
);
...
@@ -228,10 +233,11 @@ int writeDirectoryDB(void)
...
@@ -228,10 +233,11 @@ int writeDirectoryDB(void)
return
0
;
return
0
;
}
}
int
readDirectoryDB
(
void
)
int
db_load
(
void
)
{
{
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
char
*
dbFile
=
getDbF
ile
();
char
*
dbFile
=
db_get_f
ile
();
struct
stat
st
;
struct
stat
st
;
if
(
!
music_root
)
if
(
!
music_root
)
...
@@ -308,7 +314,8 @@ int readDirectoryDB(void)
...
@@ -308,7 +314,8 @@ int readDirectoryDB(void)
return
0
;
return
0
;
}
}
time_t
getDbModTime
(
void
)
time_t
db_get_mtime
(
void
)
{
{
return
directory_dbModTime
;
return
directory_dbModTime
;
}
}
src/database.h
View file @
bb8a9533
...
@@ -24,29 +24,35 @@
...
@@ -24,29 +24,35 @@
struct
directory
;
struct
directory
;
void
directory_init
(
void
);
void
db_init
(
void
);
void
directory_finish
(
void
);
void
db_finish
(
void
);
struct
directory
*
struct
directory
*
d
irectory
_get_root
(
void
);
d
b
_get_root
(
void
);
struct
directory
*
struct
directory
*
getD
irectory
(
const
char
*
name
);
db_get_d
irectory
(
const
char
*
name
);
struct
song
*
struct
song
*
get
SongFromDB
(
const
char
*
file
);
get
_get_song
(
const
char
*
file
);
int
traverseAllIn
(
const
char
*
name
,
int
db_walk
(
const
char
*
name
,
int
(
*
forEachSong
)
(
struct
song
*
,
void
*
),
int
(
*
forEachSong
)
(
struct
song
*
,
void
*
),
int
(
*
forEachDir
)
(
struct
directory
*
,
void
*
),
void
*
data
);
int
(
*
forEachDir
)
(
struct
directory
*
,
void
*
),
void
*
data
);
int
checkDirectoryDB
(
void
);
int
db_check
(
void
);
int
writeDirectoryDB
(
void
);
int
db_save
(
void
);
int
readDirectoryDB
(
void
);
int
db_load
(
void
);
time_t
getDbModTime
(
void
);
time_t
db_get_mtime
(
void
);
#endif
#endif
src/dbUtils.c
View file @
bb8a9533
...
@@ -110,7 +110,7 @@ int searchForSongsIn(struct client *client, const char *name,
...
@@ -110,7 +110,7 @@ int searchForSongsIn(struct client *client, const char *name,
data
.
array
.
numItems
=
numItems
;
data
.
array
.
numItems
=
numItems
;
data
.
array
.
items
=
items
;
data
.
array
.
items
=
items
;
ret
=
traverseAllIn
(
name
,
searchInDirectory
,
NULL
,
&
data
);
ret
=
db_walk
(
name
,
searchInDirectory
,
NULL
,
&
data
);
for
(
i
=
0
;
i
<
numItems
;
i
++
)
{
for
(
i
=
0
;
i
<
numItems
;
i
++
)
{
free
(
items
[
i
].
needle
);
free
(
items
[
i
].
needle
);
...
@@ -143,7 +143,7 @@ int findSongsIn(struct client *client, const char *name,
...
@@ -143,7 +143,7 @@ int findSongsIn(struct client *client, const char *name,
data
.
array
.
numItems
=
numItems
;
data
.
array
.
numItems
=
numItems
;
data
.
array
.
items
=
items
;
data
.
array
.
items
=
items
;
return
traverseAllIn
(
name
,
findInDirectory
,
NULL
,
&
data
);
return
db_walk
(
name
,
findInDirectory
,
NULL
,
&
data
);
}
}
static
void
printSearchStats
(
struct
client
*
client
,
SearchStats
*
stats
)
static
void
printSearchStats
(
struct
client
*
client
,
SearchStats
*
stats
)
...
@@ -178,7 +178,7 @@ int searchStatsForSongsIn(struct client *client, const char *name,
...
@@ -178,7 +178,7 @@ int searchStatsForSongsIn(struct client *client, const char *name,
stats
.
numberOfSongs
=
0
;
stats
.
numberOfSongs
=
0
;
stats
.
playTime
=
0
;
stats
.
playTime
=
0
;
ret
=
traverseAllIn
(
name
,
searchStatsInDirectory
,
NULL
,
&
stats
);
ret
=
db_walk
(
name
,
searchStatsInDirectory
,
NULL
,
&
stats
);
if
(
ret
==
0
)
if
(
ret
==
0
)
printSearchStats
(
client
,
&
stats
);
printSearchStats
(
client
,
&
stats
);
...
@@ -187,8 +187,8 @@ int searchStatsForSongsIn(struct client *client, const char *name,
...
@@ -187,8 +187,8 @@ int searchStatsForSongsIn(struct client *client, const char *name,
int
printAllIn
(
struct
client
*
client
,
const
char
*
name
)
int
printAllIn
(
struct
client
*
client
,
const
char
*
name
)
{
{
return
traverseAllIn
(
name
,
printSongInDirectory
,
return
db_walk
(
name
,
printSongInDirectory
,
printDirectoryInDirectory
,
client
);
printDirectoryInDirectory
,
client
);
}
}
static
int
static
int
...
@@ -213,7 +213,7 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data)
...
@@ -213,7 +213,7 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data)
int
addAllIn
(
const
char
*
name
)
int
addAllIn
(
const
char
*
name
)
{
{
return
traverseAllIn
(
name
,
directoryAddSongToPlaylist
,
NULL
,
NULL
);
return
db_walk
(
name
,
directoryAddSongToPlaylist
,
NULL
,
NULL
);
}
}
int
addAllInToStoredPlaylist
(
const
char
*
name
,
const
char
*
utf8file
)
int
addAllInToStoredPlaylist
(
const
char
*
name
,
const
char
*
utf8file
)
...
@@ -222,8 +222,7 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
...
@@ -222,8 +222,7 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
.
path
=
utf8file
,
.
path
=
utf8file
,
};
};
return
traverseAllIn
(
name
,
directoryAddSongToStoredPlaylist
,
NULL
,
return
db_walk
(
name
,
directoryAddSongToStoredPlaylist
,
NULL
,
&
data
);
&
data
);
}
}
static
int
static
int
...
@@ -247,7 +246,7 @@ sumSongTime(struct song *song, void *data)
...
@@ -247,7 +246,7 @@ sumSongTime(struct song *song, void *data)
int
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
name
)
int
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
name
)
{
{
return
traverseAllIn
(
name
,
directoryPrintSongInfo
,
return
db_walk
(
name
,
directoryPrintSongInfo
,
printDirectoryInDirectory
,
client
);
printDirectoryInDirectory
,
client
);
}
}
...
@@ -256,7 +255,7 @@ int countSongsIn(const char *name)
...
@@ -256,7 +255,7 @@ int countSongsIn(const char *name)
int
count
=
0
;
int
count
=
0
;
void
*
ptr
=
(
void
*
)
&
count
;
void
*
ptr
=
(
void
*
)
&
count
;
traverseAllIn
(
name
,
NULL
,
countSongsInDirectory
,
ptr
);
db_walk
(
name
,
NULL
,
countSongsInDirectory
,
ptr
);
return
count
;
return
count
;
}
}
...
@@ -266,7 +265,7 @@ unsigned long sumSongTimesIn(const char *name)
...
@@ -266,7 +265,7 @@ unsigned long sumSongTimesIn(const char *name)
unsigned
long
dbPlayTime
=
0
;
unsigned
long
dbPlayTime
=
0
;
void
*
ptr
=
(
void
*
)
&
dbPlayTime
;
void
*
ptr
=
(
void
*
)
&
dbPlayTime
;
traverseAllIn
(
name
,
sumSongTime
,
NULL
,
ptr
);
db_walk
(
name
,
sumSongTime
,
NULL
,
ptr
);
return
dbPlayTime
;
return
dbPlayTime
;
}
}
...
@@ -347,8 +346,7 @@ int listAllUniqueTags(struct client *client, int type, int numConditionals,
...
@@ -347,8 +346,7 @@ int listAllUniqueTags(struct client *client, int type, int numConditionals,
data
.
set
=
strset_new
();
data
.
set
=
strset_new
();
}
}
ret
=
traverseAllIn
(
NULL
,
listUniqueTagsInDirectory
,
NULL
,
ret
=
db_walk
(
NULL
,
listUniqueTagsInDirectory
,
NULL
,
&
data
);
&
data
);
if
(
type
>=
0
&&
type
<=
TAG_NUM_OF_ITEM_TYPES
)
{
if
(
type
>=
0
&&
type
<=
TAG_NUM_OF_ITEM_TYPES
)
{
const
char
*
value
;
const
char
*
value
;
...
@@ -396,8 +394,8 @@ void printSavedMemoryFromFilenames(void)
...
@@ -396,8 +394,8 @@ void printSavedMemoryFromFilenames(void)
{
{
int
sum
=
0
;
int
sum
=
0
;
traverseAllIn
(
NULL
,
sumSavedFilenameMemoryInSong
,
db_walk
(
NULL
,
sumSavedFilenameMemoryInSong
,
sumSavedFilenameMemoryInDirectory
,
(
void
*
)
&
sum
);
sumSavedFilenameMemoryInDirectory
,
(
void
*
)
&
sum
);
DEBUG
(
"saved memory from filenames: %i
\n
"
,
sum
);
DEBUG
(
"saved memory from filenames: %i
\n
"
,
sum
);
}
}
src/directory.c
View file @
bb8a9533
...
@@ -182,7 +182,7 @@ readDirectoryInfo(FILE * fp, struct directory * directory)
...
@@ -182,7 +182,7 @@ readDirectoryInfo(FILE * fp, struct directory * directory)
if
(
prefixcmp
(
buffer
,
DIRECTORY_BEGIN
))
if
(
prefixcmp
(
buffer
,
DIRECTORY_BEGIN
))
FATAL
(
"Error reading db at line: %s
\n
"
,
buffer
);
FATAL
(
"Error reading db at line: %s
\n
"
,
buffer
);
name
=
&
(
buffer
[
strlen
(
DIRECTORY_BEGIN
)]);
name
=
&
(
buffer
[
strlen
(
DIRECTORY_BEGIN
)]);
if
((
subdir
=
getD
irectory
(
name
)))
{
if
((
subdir
=
db_get_d
irectory
(
name
)))
{
assert
(
subdir
->
parent
==
directory
);
assert
(
subdir
->
parent
==
directory
);
}
else
{
}
else
{
subdir
=
newDirectory
(
name
,
directory
);
subdir
=
newDirectory
(
name
,
directory
);
...
...
src/main.c
View file @
bb8a9533
...
@@ -272,17 +272,17 @@ static void changeToUser(void)
...
@@ -272,17 +272,17 @@ static void changeToUser(void)
static
void
openDB
(
Options
*
options
,
char
*
argv0
)
static
void
openDB
(
Options
*
options
,
char
*
argv0
)
{
{
if
(
options
->
createDB
>
0
||
readDirectoryDB
()
<
0
)
{
if
(
options
->
createDB
>
0
||
db_load
()
<
0
)
{
if
(
options
->
createDB
<
0
)
{
if
(
options
->
createDB
<
0
)
{
FATAL
(
"can't open db file and using "
FATAL
(
"can't open db file and using "
"
\"
--no-create-db
\"
command line option
\n
"
"
\"
--no-create-db
\"
command line option
\n
"
"try running
\"
%s --create-db
\"\n
"
,
argv0
);
"try running
\"
%s --create-db
\"\n
"
,
argv0
);
}
}
flushWarningLog
();
flushWarningLog
();
if
(
checkDirectoryDB
()
<
0
)
if
(
db_check
()
<
0
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
d
irectory
_init
();
d
b
_init
();
if
(
writeDirectoryDB
()
<
0
)
if
(
db_save
()
<
0
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
if
(
options
->
createDB
)
if
(
options
->
createDB
)
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
...
@@ -456,8 +456,8 @@ int main(int argc, char *argv[])
...
@@ -456,8 +456,8 @@ int main(int argc, char *argv[])
finishPlaylist
();
finishPlaylist
();
start
=
clock
();
start
=
clock
();
d
irectory
_finish
();
d
b
_finish
();
DEBUG
(
"d
irectory
_finish took %f seconds
\n
"
,
DEBUG
(
"d
b
_finish took %f seconds
\n
"
,
((
float
)(
clock
()
-
start
))
/
CLOCKS_PER_SEC
);
((
float
)(
clock
()
-
start
))
/
CLOCKS_PER_SEC
);
deinit_main_notify
();
deinit_main_notify
();
...
...
src/playlist.c
View file @
bb8a9533
...
@@ -559,7 +559,7 @@ enum playlist_result addToPlaylist(const char *url, int *added_id)
...
@@ -559,7 +559,7 @@ enum playlist_result addToPlaylist(const char *url, int *added_id)
DEBUG
(
"add to playlist: %s
\n
"
,
url
);
DEBUG
(
"add to playlist: %s
\n
"
,
url
);
if
((
song
=
get
SongFromDB
(
url
)))
{
if
((
song
=
get
_get_song
(
url
)))
{
}
else
if
(
!
(
isValidRemoteUtf8Url
(
url
)
&&
}
else
if
(
!
(
isValidRemoteUtf8Url
(
url
)
&&
(
song
=
song_remote_new
(
url
))))
{
(
song
=
song_remote_new
(
url
))))
{
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
...
@@ -574,7 +574,7 @@ int addToStoredPlaylist(const char *url, const char *utf8file)
...
@@ -574,7 +574,7 @@ int addToStoredPlaylist(const char *url, const char *utf8file)
DEBUG
(
"add to stored playlist: %s
\n
"
,
url
);
DEBUG
(
"add to stored playlist: %s
\n
"
,
url
);
song
=
get
SongFromDB
(
url
);
song
=
get
_get_song
(
url
);
if
(
song
)
if
(
song
)
return
appendSongToStoredPlaylistByPath
(
utf8file
,
song
);
return
appendSongToStoredPlaylistByPath
(
utf8file
,
song
);
...
@@ -1360,7 +1360,7 @@ int PlaylistInfo(struct client *client, const char *utf8file, int detail)
...
@@ -1360,7 +1360,7 @@ int PlaylistInfo(struct client *client, const char *utf8file, int detail)
int
wrote
=
0
;
int
wrote
=
0
;
if
(
detail
)
{
if
(
detail
)
{
struct
song
*
song
=
get
SongFromDB
(
temp
);
struct
song
*
song
=
get
_get_song
(
temp
);
if
(
song
)
{
if
(
song
)
{
song_print_info
(
client
,
song
);
song_print_info
(
client
,
song
);
wrote
=
1
;
wrote
=
1
;
...
...
src/sig_handlers.c
View file @
bb8a9533
...
@@ -40,7 +40,7 @@ int handlePendingSignals(void)
...
@@ -40,7 +40,7 @@ int handlePendingSignals(void)
DEBUG
(
"got SIGHUP, rereading DB
\n
"
);
DEBUG
(
"got SIGHUP, rereading DB
\n
"
);
signal_clear
(
SIGHUP
);
signal_clear
(
SIGHUP
);
if
(
!
isUpdatingDB
())
{
if
(
!
isUpdatingDB
())
{
readDirectoryDB
();
db_load
();
playlistVersionChange
();
playlistVersionChange
();
}
}
if
(
cycle_log_files
()
<
0
)
if
(
cycle_log_files
()
<
0
)
...
...
src/stats.c
View file @
bb8a9533
...
@@ -66,7 +66,7 @@ static unsigned int getNumberOfTagItems(int type)
...
@@ -66,7 +66,7 @@ static unsigned int getNumberOfTagItems(int type)
};
};
unsigned
int
ret
;
unsigned
int
ret
;
traverseAllIn
(
NULL
,
visit_tag_items
,
NULL
,
&
data
);
db_walk
(
NULL
,
visit_tag_items
,
NULL
,
&
data
);
ret
=
strset_size
(
data
.
set
);
ret
=
strset_size
(
data
.
set
);
strset_free
(
data
.
set
);
strset_free
(
data
.
set
);
...
@@ -89,6 +89,6 @@ int printStats(struct client *client)
...
@@ -89,6 +89,6 @@ int printStats(struct client *client)
time
(
NULL
)
-
stats
.
daemonStart
,
time
(
NULL
)
-
stats
.
daemonStart
,
(
long
)(
getPlayerTotalPlayTime
()
+
0
.
5
),
(
long
)(
getPlayerTotalPlayTime
()
+
0
.
5
),
stats
.
dbPlayTime
,
stats
.
dbPlayTime
,
getDbModT
ime
());
db_get_mt
ime
());
return
0
;
return
0
;
}
}
src/storedPlaylist.c
View file @
bb8a9533
...
@@ -116,7 +116,7 @@ List *loadStoredPlaylist(const char *utf8path)
...
@@ -116,7 +116,7 @@ List *loadStoredPlaylist(const char *utf8path)
!
strncmp
(
s
,
musicDir
,
musicDir_len
))
!
strncmp
(
s
,
musicDir
,
musicDir_len
))
memmove
(
s
,
s
+
musicDir_len
+
1
,
memmove
(
s
,
s
+
musicDir_len
+
1
,
strlen
(
s
+
musicDir_len
+
1
)
+
1
);
strlen
(
s
+
musicDir_len
+
1
)
+
1
);
if
((
song
=
get
SongFromDB
(
s
)))
{
if
((
song
=
get
_get_song
(
s
)))
{
song_get_url
(
song
,
path_max_tmp
);
song_get_url
(
song
,
path_max_tmp
);
insertInListWithoutKey
(
list
,
xstrdup
(
path_max_tmp
));
insertInListWithoutKey
(
list
,
xstrdup
(
path_max_tmp
));
}
else
if
(
isValidRemoteUtf8Url
(
s
))
}
else
if
(
isValidRemoteUtf8Url
(
s
))
...
...
src/update.c
View file @
bb8a9533
...
@@ -321,7 +321,7 @@ addDirectoryPathToDB(const char *utf8path)
...
@@ -321,7 +321,7 @@ addDirectoryPathToDB(const char *utf8path)
parent
=
parent_path
(
path_max_tmp
,
utf8path
);
parent
=
parent_path
(
path_max_tmp
,
utf8path
);
if
(
strlen
(
parent
)
==
0
)
if
(
strlen
(
parent
)
==
0
)
parentDirectory
=
d
irectory
_get_root
();
parentDirectory
=
d
b
_get_root
();
else
else
parentDirectory
=
addDirectoryPathToDB
(
parent
);
parentDirectory
=
addDirectoryPathToDB
(
parent
);
...
@@ -361,7 +361,7 @@ addParentPathToDB(const char *utf8path)
...
@@ -361,7 +361,7 @@ addParentPathToDB(const char *utf8path)
parent
=
parent_path
(
path_max_tmp
,
utf8path
);
parent
=
parent_path
(
path_max_tmp
,
utf8path
);
if
(
strlen
(
parent
)
==
0
)
if
(
strlen
(
parent
)
==
0
)
parentDirectory
=
d
irectory
_get_root
();
parentDirectory
=
d
b
_get_root
();
else
else
parentDirectory
=
addDirectoryPathToDB
(
parent
);
parentDirectory
=
addDirectoryPathToDB
(
parent
);
...
@@ -385,7 +385,7 @@ static enum update_return updatePath(const char *utf8path)
...
@@ -385,7 +385,7 @@ static enum update_return updatePath(const char *utf8path)
return
UPDATE_RETURN_ERROR
;
return
UPDATE_RETURN_ERROR
;
/* if path is in the DB try to update it, or else delete it */
/* if path is in the DB try to update it, or else delete it */
if
((
directory
=
getD
irectory
(
path
)))
{
if
((
directory
=
db_get_d
irectory
(
path
)))
{
parentDirectory
=
directory
->
parent
;
parentDirectory
=
directory
->
parent
;
/* if this update directory is successfull, we are done */
/* if this update directory is successfull, we are done */
...
@@ -396,7 +396,7 @@ static enum update_return updatePath(const char *utf8path)
...
@@ -396,7 +396,7 @@ static enum update_return updatePath(const char *utf8path)
return
ret
;
return
ret
;
}
}
/* we don't want to delete the root directory */
/* we don't want to delete the root directory */
else
if
(
directory
==
d
irectory
_get_root
())
{
else
if
(
directory
==
d
b
_get_root
())
{
free
(
path
);
free
(
path
);
return
UPDATE_RETURN_NOUPDATE
;
return
UPDATE_RETURN_NOUPDATE
;
}
}
...
@@ -407,7 +407,7 @@ static enum update_return updatePath(const char *utf8path)
...
@@ -407,7 +407,7 @@ static enum update_return updatePath(const char *utf8path)
ret
=
UPDATE_RETURN_UPDATED
;
ret
=
UPDATE_RETURN_UPDATED
;
/* don't return, path maybe a song now */
/* don't return, path maybe a song now */
}
}
}
else
if
((
song
=
get
SongFromDB
(
path
)))
{
}
else
if
((
song
=
get
_get_song
(
path
)))
{
parentDirectory
=
song
->
parent
;
parentDirectory
=
song
->
parent
;
if
(
!
parentDirectory
->
stat
if
(
!
parentDirectory
->
stat
&&
statDirectory
(
parentDirectory
)
<
0
)
{
&&
statDirectory
(
parentDirectory
)
<
0
)
{
...
@@ -467,10 +467,10 @@ static void * update_task(void *_path)
...
@@ -467,10 +467,10 @@ static void * update_task(void *_path)
ret
=
updatePath
((
char
*
)
_path
);
ret
=
updatePath
((
char
*
)
_path
);
free
(
_path
);
free
(
_path
);
}
else
{
}
else
{
ret
=
updateDirectory
(
d
irectory
_get_root
());
ret
=
updateDirectory
(
d
b
_get_root
());
}
}
if
(
ret
==
UPDATE_RETURN_UPDATED
&&
writeDirectoryDB
()
<
0
)
if
(
ret
==
UPDATE_RETURN_UPDATED
&&
db_save
()
<
0
)
ret
=
UPDATE_RETURN_ERROR
;
ret
=
UPDATE_RETURN_ERROR
;
progress
=
UPDATE_PROGRESS_DONE
;
progress
=
UPDATE_PROGRESS_DONE
;
wakeup_main_task
();
wakeup_main_task
();
...
...
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