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
f7ce4f62
Commit
f7ce4f62
authored
Oct 13, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
song: renamed attribute "url" to "uri"
parent
28442cce
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
44 additions
and
45 deletions
+44
-45
command.c
src/command.c
+1
-1
dbUtils.c
src/dbUtils.c
+2
-2
mapper.c
src/mapper.c
+2
-2
player_thread.c
src/player_thread.c
+4
-4
song.c
src/song.c
+12
-12
song.h
src/song.h
+3
-3
song_print.c
src/song_print.c
+5
-5
song_print.h
src/song_print.h
+1
-1
song_save.c
src/song_save.c
+6
-7
song_update.c
src/song_update.c
+2
-2
songvec.c
src/songvec.c
+4
-4
songvec.h
src/songvec.h
+1
-1
dump_playlist.c
test/dump_playlist.c
+1
-1
No files found.
src/command.c
View file @
f7ce4f62
...
...
@@ -1559,7 +1559,7 @@ sticker_song_find_print_cb(struct song *song, const char *value,
{
struct
sticker_song_find_data
*
data
=
user_data
;
song_print_ur
l
(
data
->
client
,
song
);
song_print_ur
i
(
data
->
client
,
song
);
sticker_print_value
(
data
->
client
,
data
->
name
,
value
);
}
...
...
src/dbUtils.c
View file @
f7ce4f62
...
...
@@ -59,7 +59,7 @@ static int
printSongInDirectory
(
struct
song
*
song
,
G_GNUC_UNUSED
void
*
data
)
{
struct
client
*
client
=
data
;
song_print_ur
l
(
client
,
song
);
song_print_ur
i
(
client
,
song
);
return
0
;
}
...
...
@@ -258,7 +258,7 @@ visitTag(struct client *client, struct strset *set,
struct
tag
*
tag
=
song
->
tag
;
if
(
tagType
==
LOCATE_TAG_FILE_TYPE
)
{
song_print_ur
l
(
client
,
song
);
song_print_ur
i
(
client
,
song
);
return
;
}
...
...
src/mapper.c
View file @
f7ce4f62
...
...
@@ -159,9 +159,9 @@ map_song_fs(const struct song *song)
assert
(
song_is_file
(
song
));
if
(
song_in_database
(
song
))
return
map_directory_child_fs
(
song
->
parent
,
song
->
ur
l
);
return
map_directory_child_fs
(
song
->
parent
,
song
->
ur
i
);
else
return
utf8_to_fs_charset
(
song
->
ur
l
);
return
utf8_to_fs_charset
(
song
->
ur
i
);
}
char
*
...
...
src/player_thread.c
View file @
f7ce4f62
...
...
@@ -136,7 +136,7 @@ player_wait_for_decoder(struct player *player)
dc_command_wait
(
&
pc
.
notify
);
if
(
decoder_lock_has_failed
())
{
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
l
!=
NULL
);
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
i
!=
NULL
);
pc
.
errored_song
=
dc
.
next_song
;
pc
.
error
=
PLAYER_ERROR_FILE
;
pc
.
next_song
=
NULL
;
...
...
@@ -177,7 +177,7 @@ player_check_decoder_startup(struct player *player)
if
(
decoder_has_failed
())
{
/* the decoder failed */
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
l
!=
NULL
);
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
i
!=
NULL
);
decoder_unlock
();
...
...
@@ -209,7 +209,7 @@ player_check_decoder_startup(struct player *player)
"while playing
\"
%s
\"
"
,
uri
);
g_free
(
uri
);
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
l
!=
NULL
);
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
i
!=
NULL
);
pc
.
errored_song
=
dc
.
next_song
;
pc
.
error
=
PLAYER_ERROR_AUDIO
;
...
...
@@ -375,7 +375,7 @@ static void player_process_command(struct player *player)
}
else
{
/* the audio device has failed - rollback to
pause mode */
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
l
!=
NULL
);
assert
(
dc
.
next_song
==
NULL
||
dc
.
next_song
->
ur
i
!=
NULL
);
pc
.
errored_song
=
dc
.
next_song
;
pc
.
error
=
PLAYER_ERROR_AUDIO
;
...
...
src/song.c
View file @
f7ce4f62
...
...
@@ -27,18 +27,18 @@
#include <assert.h>
static
struct
song
*
song_alloc
(
const
char
*
ur
l
,
struct
directory
*
parent
)
song_alloc
(
const
char
*
ur
i
,
struct
directory
*
parent
)
{
size_t
ur
llen
;
size_t
ur
i_length
;
struct
song
*
song
;
assert
(
ur
l
);
ur
llen
=
strlen
(
url
);
assert
(
ur
llen
);
song
=
g_malloc
(
sizeof
(
*
song
)
-
sizeof
(
song
->
ur
l
)
+
urllen
+
1
);
assert
(
ur
i
);
ur
i_length
=
strlen
(
uri
);
assert
(
ur
i_length
);
song
=
g_malloc
(
sizeof
(
*
song
)
-
sizeof
(
song
->
ur
i
)
+
uri_length
+
1
);
song
->
tag
=
NULL
;
memcpy
(
song
->
ur
l
,
url
,
urllen
+
1
);
memcpy
(
song
->
ur
i
,
uri
,
uri_length
+
1
);
song
->
parent
=
parent
;
song
->
mtime
=
0
;
...
...
@@ -46,9 +46,9 @@ song_alloc(const char *url, struct directory *parent)
}
struct
song
*
song_remote_new
(
const
char
*
ur
l
)
song_remote_new
(
const
char
*
ur
i
)
{
return
song_alloc
(
ur
l
,
NULL
);
return
song_alloc
(
ur
i
,
NULL
);
}
struct
song
*
...
...
@@ -71,11 +71,11 @@ char *
song_get_uri
(
const
struct
song
*
song
)
{
assert
(
song
!=
NULL
);
assert
(
*
song
->
ur
l
);
assert
(
*
song
->
ur
i
);
if
(
!
song_in_database
(
song
)
||
directory_is_root
(
song
->
parent
))
return
g_strdup
(
song
->
ur
l
);
return
g_strdup
(
song
->
ur
i
);
else
return
g_strconcat
(
directory_get_path
(
song
->
parent
),
"/"
,
song
->
ur
l
,
NULL
);
"/"
,
song
->
ur
i
,
NULL
);
}
src/song.h
View file @
f7ce4f62
...
...
@@ -34,12 +34,12 @@ struct song {
struct
tag
*
tag
;
struct
directory
*
parent
;
time_t
mtime
;
char
ur
l
[
sizeof
(
int
)];
char
ur
i
[
sizeof
(
int
)];
};
/** allocate a new song with a remote URL */
struct
song
*
song_remote_new
(
const
char
*
ur
l
);
song_remote_new
(
const
char
*
ur
i
);
/** allocate a new song with a local file name */
struct
song
*
...
...
@@ -81,7 +81,7 @@ song_in_database(const struct song *song)
static
inline
bool
song_is_file
(
const
struct
song
*
song
)
{
return
song_in_database
(
song
)
||
song
->
ur
l
[
0
]
==
'/'
;
return
song_in_database
(
song
)
||
song
->
ur
i
[
0
]
==
'/'
;
}
#endif
src/song_print.c
View file @
f7ce4f62
...
...
@@ -26,18 +26,18 @@
#include "uri.h"
void
song_print_ur
l
(
struct
client
*
client
,
struct
song
*
song
)
song_print_ur
i
(
struct
client
*
client
,
struct
song
*
song
)
{
if
(
song_in_database
(
song
)
&&
!
directory_is_root
(
song
->
parent
))
{
client_printf
(
client
,
"%s%s/%s
\n
"
,
SONG_FILE
,
directory_get_path
(
song
->
parent
),
song
->
ur
l
);
directory_get_path
(
song
->
parent
),
song
->
ur
i
);
}
else
{
char
*
allocated
;
const
char
*
uri
;
uri
=
allocated
=
uri_remove_auth
(
song
->
ur
l
);
uri
=
allocated
=
uri_remove_auth
(
song
->
ur
i
);
if
(
uri
==
NULL
)
uri
=
song
->
ur
l
;
uri
=
song
->
ur
i
;
client_printf
(
client
,
"%s%s
\n
"
,
SONG_FILE
,
uri
);
...
...
@@ -48,7 +48,7 @@ song_print_url(struct client *client, struct song *song)
int
song_print_info
(
struct
client
*
client
,
struct
song
*
song
)
{
song_print_ur
l
(
client
,
song
);
song_print_ur
i
(
client
,
song
);
if
(
song
->
mtime
>
0
)
{
#ifndef G_OS_WIN32
...
...
src/song_print.h
View file @
f7ce4f62
...
...
@@ -30,6 +30,6 @@ song_print_info(struct client *client, struct song *song);
int
songvec_print
(
struct
client
*
client
,
const
struct
songvec
*
sv
);
void
song_print_ur
l
(
struct
client
*
client
,
struct
song
*
song
);
song_print_ur
i
(
struct
client
*
client
,
struct
song
*
song
);
#endif
src/song_save.c
View file @
f7ce4f62
...
...
@@ -41,14 +41,13 @@ song_save_quark(void)
}
static
void
song_save_ur
l
(
FILE
*
fp
,
struct
song
*
song
)
song_save_ur
i
(
FILE
*
fp
,
struct
song
*
song
)
{
if
(
song
->
parent
!=
NULL
&&
song
->
parent
->
path
!=
NULL
)
fprintf
(
fp
,
SONG_FILE
"%s/%s
\n
"
,
directory_get_path
(
song
->
parent
),
song
->
ur
l
);
directory_get_path
(
song
->
parent
),
song
->
ur
i
);
else
fprintf
(
fp
,
SONG_FILE
"%s
\n
"
,
song
->
url
);
fprintf
(
fp
,
SONG_FILE
"%s
\n
"
,
song
->
uri
);
}
static
int
...
...
@@ -56,9 +55,9 @@ song_save(struct song *song, void *data)
{
FILE
*
fp
=
data
;
fprintf
(
fp
,
SONG_KEY
"%s
\n
"
,
song
->
ur
l
);
fprintf
(
fp
,
SONG_KEY
"%s
\n
"
,
song
->
ur
i
);
song_save_ur
l
(
fp
,
song
);
song_save_ur
i
(
fp
,
song
);
if
(
song
->
tag
!=
NULL
)
tag_save
(
fp
,
song
->
tag
);
...
...
@@ -78,7 +77,7 @@ void songvec_save(FILE *fp, struct songvec *sv)
static
void
commit_song
(
struct
songvec
*
sv
,
struct
song
*
newsong
)
{
struct
song
*
existing
=
songvec_find
(
sv
,
newsong
->
ur
l
);
struct
song
*
existing
=
songvec_find
(
sv
,
newsong
->
ur
i
);
if
(
!
existing
)
{
songvec_add
(
sv
,
newsong
);
...
...
src/song_update.c
View file @
f7ce4f62
...
...
@@ -103,7 +103,7 @@ song_file_update(struct song *song)
/* check if there's a suffix and a plugin */
suffix
=
uri_get_suffix
(
song
->
ur
l
);
suffix
=
uri_get_suffix
(
song
->
ur
i
);
if
(
suffix
==
NULL
)
return
false
;
...
...
@@ -152,7 +152,7 @@ song_file_update_inarchive(struct song *song)
/* check if there's a suffix and a plugin */
suffix
=
uri_get_suffix
(
song
->
ur
l
);
suffix
=
uri_get_suffix
(
song
->
ur
i
);
if
(
suffix
==
NULL
)
return
false
;
...
...
src/songvec.c
View file @
f7ce4f62
...
...
@@ -79,7 +79,7 @@ static int songvec_cmp(const void *s1, const void *s2)
return
ret
;
/* still no difference? compare file name */
return
g_utf8_collate
(
a
->
ur
l
,
b
->
url
);
return
g_utf8_collate
(
a
->
ur
i
,
b
->
uri
);
}
static
size_t
sv_size
(
const
struct
songvec
*
sv
)
...
...
@@ -108,14 +108,14 @@ void songvec_sort(struct songvec *sv)
}
struct
song
*
songvec_find
(
const
struct
songvec
*
sv
,
const
char
*
ur
l
)
songvec_find
(
const
struct
songvec
*
sv
,
const
char
*
ur
i
)
{
int
i
;
struct
song
*
ret
=
NULL
;
g_mutex_lock
(
nr_lock
);
for
(
i
=
sv
->
nr
;
--
i
>=
0
;
)
{
if
(
strcmp
(
sv
->
base
[
i
]
->
ur
l
,
url
))
if
(
strcmp
(
sv
->
base
[
i
]
->
ur
i
,
uri
))
continue
;
ret
=
sv
->
base
[
i
];
break
;
...
...
@@ -182,7 +182,7 @@ songvec_for_each(const struct songvec *sv,
struct
song
*
song
=
sv
->
base
[
i
];
assert
(
song
);
assert
(
*
song
->
ur
l
);
assert
(
*
song
->
ur
i
);
prev_nr
=
sv
->
nr
;
g_mutex_unlock
(
nr_lock
);
/* fn() may block */
...
...
src/songvec.h
View file @
f7ce4f62
...
...
@@ -34,7 +34,7 @@ void songvec_deinit(void);
void
songvec_sort
(
struct
songvec
*
sv
);
struct
song
*
songvec_find
(
const
struct
songvec
*
sv
,
const
char
*
ur
l
);
songvec_find
(
const
struct
songvec
*
sv
,
const
char
*
ur
i
);
int
songvec_delete
(
struct
songvec
*
sv
,
const
struct
song
*
del
);
...
...
test/dump_playlist.c
View file @
f7ce4f62
...
...
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
/* dump the playlist */
while
((
song
=
playlist_plugin_read
(
playlist
))
!=
NULL
)
{
g_print
(
"%s
\n
"
,
song
->
ur
l
);
g_print
(
"%s
\n
"
,
song
->
ur
i
);
if
(
song
->
tag
!=
NULL
)
tag_save
(
stdout
,
song
->
tag
);
...
...
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