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
f8bf3afe
Commit
f8bf3afe
authored
Aug 14, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist_song: move code to playlist_check_load_song()
parent
f703da15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
playlist_song.c
src/playlist_song.c
+23
-23
No files found.
src/playlist_song.c
View file @
f8bf3afe
...
...
@@ -83,12 +83,31 @@ apply_song_metadata(struct song *dest, const struct song *src)
return
tmp
;
}
static
struct
song
*
playlist_check_load_song
(
struct
song
*
song
,
const
char
*
uri
,
bool
secure
)
{
struct
song
*
dest
;
if
(
uri_has_scheme
(
uri
))
{
dest
=
song_remote_new
(
uri
);
}
else
if
(
g_path_is_absolute
(
uri
)
&&
secure
)
{
dest
=
song_file_load
(
uri
,
NULL
);
if
(
dest
==
NULL
)
return
NULL
;
}
else
{
dest
=
db_get_song
(
uri
);
if
(
dest
==
NULL
)
/* not found in database */
return
NULL
;
}
return
apply_song_metadata
(
dest
,
song
);
}
struct
song
*
playlist_check_translate_song
(
struct
song
*
song
,
const
char
*
base_uri
,
bool
secure
)
{
struct
song
*
dest
;
if
(
song_in_database
(
song
))
/* already ok */
return
song
;
...
...
@@ -135,27 +154,8 @@ playlist_check_translate_song(struct song *song, const char *base_uri,
else
uri
=
g_strdup
(
uri
);
if
(
uri_has_scheme
(
uri
))
{
dest
=
song_remote_new
(
uri
);
g_free
(
uri
);
}
else
if
(
g_path_is_absolute
(
uri
)
&&
secure
)
{
dest
=
song_file_load
(
uri
,
NULL
);
if
(
dest
==
NULL
)
{
song_free
(
song
);
return
NULL
;
}
}
else
{
dest
=
db_get_song
(
uri
);
g_free
(
uri
);
if
(
dest
==
NULL
)
{
/* not found in database */
song_free
(
song
);
return
dest
;
}
}
dest
=
apply_song_metadata
(
dest
,
song
);
struct
song
*
dest
=
playlist_check_load_song
(
song
,
uri
,
secure
);
song_free
(
song
);
g_free
(
uri
);
return
dest
;
}
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