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
8fa20847
Commit
8fa20847
authored
Apr 14, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pseduo-code for creating new entries in db for incremental update
git-svn-id:
https://svn.musicpd.org/mpd/trunk@743
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
32b62ade
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
directory.c
src/directory.c
+20
-8
No files found.
src/directory.c
View file @
8fa20847
...
...
@@ -363,18 +363,14 @@ int removeDeletedFromDirectory(Directory * directory) {
void
updatePath
(
char
*
utf8path
)
{
Directory
*
directory
;
Directory
*
parentDirectory
;
Song
*
song
;
char
*
shortname
;
DIR
*
dir
;
/* if path is
already in the DB
*/
if
(
NULL
==
(
directory
=
getDirectoryDetails
(
utf8path
,
&
shortname
,
/* if path is
in the DB try to update it, or else delete it
*/
if
((
directory
=
getDirectoryDetails
(
utf8path
,
&
shortname
,
&
parentDirectory
)))
{
Song
*
song
=
getSongDetails
(
utf8path
,
&
shortname
,
&
directory
);
if
(
song
&&
updateSongInfo
(
song
)
<
0
)
{
removeSongFromDirectory
(
directory
,
shortname
);
}
}
else
{
/* if updateDirectory fials, means we should delete it */
if
(
updateDirectory
(
directory
)
<
0
&&
directory
!=
mp3rootDirectory
)
{
...
...
@@ -382,6 +378,22 @@ void updatePath(char * utf8path) {
shortname
);
}
}
else
if
((
song
=
getSongDetails
(
utf8path
,
&
shortname
,
&
parentDirectory
)))
{
if
(
song
&&
updateSongInfo
(
song
)
<
0
)
{
removeSongFromDirectory
(
parentDirectory
,
shortname
);
}
}
/* apth not found in the db, see if it actually exists on the fs */
else
if
((
dir
=
opendir
(
utf8path
)))
{
closedir
(
dir
);
/* create parent/get parent directory */
/* create new directory and add to parent */
/* explore direcotry */
}
else
if
((
song
=
newSong
(
utf8path
)))
{
/* create parent/get parent directory */
/* add song to directory */
}
}
int
updateDirectory
(
Directory
*
directory
)
{
...
...
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