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
89a78a5f
Commit
89a78a5f
authored
Jan 08, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DespotifyUtils: pass const ds_track reference
parent
bc23a6bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
17 deletions
+17
-17
DespotifyUtils.cxx
src/DespotifyUtils.cxx
+10
-10
DespotifyUtils.hxx
src/DespotifyUtils.hxx
+1
-1
DespotifyInputPlugin.cxx
src/input/DespotifyInputPlugin.cxx
+1
-1
DespotifyPlaylistPlugin.cxx
src/playlist/DespotifyPlaylistPlugin.cxx
+5
-5
No files found.
src/DespotifyUtils.cxx
View file @
89a78a5f
...
...
@@ -85,28 +85,28 @@ void mpd_despotify_unregister_callback(void (*cb)(struct despotify_session *, in
Tag
*
mpd_despotify_tag_from_track
(
struct
ds_track
*
track
)
mpd_despotify_tag_from_track
(
const
ds_track
&
track
)
{
char
tracknum
[
20
];
char
comment
[
80
];
char
date
[
20
];
if
(
!
track
->
has_meta_data
)
if
(
!
track
.
has_meta_data
)
return
new
Tag
();
TagBuilder
tag
;
snprintf
(
tracknum
,
sizeof
(
tracknum
),
"%d"
,
track
->
tracknumber
);
snprintf
(
date
,
sizeof
(
date
),
"%d"
,
track
->
year
);
snprintf
(
tracknum
,
sizeof
(
tracknum
),
"%d"
,
track
.
tracknumber
);
snprintf
(
date
,
sizeof
(
date
),
"%d"
,
track
.
year
);
snprintf
(
comment
,
sizeof
(
comment
),
"Bitrate %d Kbps, %sgeo restricted"
,
track
->
file_bitrate
/
1000
,
track
->
geo_restricted
?
""
:
"not "
);
tag
.
AddItem
(
TAG_TITLE
,
track
->
title
);
tag
.
AddItem
(
TAG_ARTIST
,
track
->
artist
->
name
);
track
.
file_bitrate
/
1000
,
track
.
geo_restricted
?
""
:
"not "
);
tag
.
AddItem
(
TAG_TITLE
,
track
.
title
);
tag
.
AddItem
(
TAG_ARTIST
,
track
.
artist
->
name
);
tag
.
AddItem
(
TAG_TRACK
,
tracknum
);
tag
.
AddItem
(
TAG_ALBUM
,
track
->
album
);
tag
.
AddItem
(
TAG_ALBUM
,
track
.
album
);
tag
.
AddItem
(
TAG_DATE
,
date
);
tag
.
AddItem
(
TAG_COMMENT
,
comment
);
tag
.
SetTime
(
track
->
length
/
1000
);
tag
.
SetTime
(
track
.
length
/
1000
);
return
tag
.
CommitNew
();
}
...
...
src/DespotifyUtils.hxx
View file @
89a78a5f
...
...
@@ -45,7 +45,7 @@ struct despotify_session *mpd_despotify_get_session(void);
* @return a pointer to the filled in tags structure
*/
Tag
*
mpd_despotify_tag_from_track
(
struct
ds_track
*
track
);
mpd_despotify_tag_from_track
(
const
ds_track
&
track
);
/**
* Register a despotify callback.
...
...
src/input/DespotifyInputPlugin.cxx
View file @
89a78a5f
...
...
@@ -52,7 +52,7 @@ class DespotifyInputStream {
ds_track
*
_track
)
:
base
(
input_plugin_despotify
,
uri
,
mutex
,
cond
),
session
(
_session
),
track
(
_track
),
tag
(
mpd_despotify_tag_from_track
(
track
)),
tag
(
mpd_despotify_tag_from_track
(
*
track
)),
len_available
(
0
),
eof
(
false
)
{
memset
(
&
pcm
,
0
,
sizeof
(
pcm
));
...
...
src/playlist/DespotifyPlaylistPlugin.cxx
View file @
89a78a5f
...
...
@@ -34,7 +34,7 @@ extern "C" {
#include <stdlib.h>
static
void
add_song
(
std
::
forward_list
<
SongPointer
>
&
songs
,
struct
ds_track
*
track
)
add_song
(
std
::
forward_list
<
SongPointer
>
&
songs
,
ds_track
&
track
)
{
const
char
*
dsp_scheme
=
despotify_playlist_plugin
.
schemes
[
0
];
Song
*
song
;
...
...
@@ -45,10 +45,10 @@ add_song(std::forward_list<SongPointer> &songs, struct ds_track *track)
snprintf
(
uri
,
sizeof
(
uri
),
"%s://"
,
dsp_scheme
);
ds_uri
=
uri
+
strlen
(
dsp_scheme
)
+
3
;
if
(
despotify_track_to_uri
(
track
,
ds_uri
)
!=
ds_uri
)
{
if
(
despotify_track_to_uri
(
&
track
,
ds_uri
)
!=
ds_uri
)
{
/* Should never really fail, but let's be sure */
FormatDebug
(
despotify_domain
,
"Can't add track %s"
,
track
->
title
);
"Can't add track %s"
,
track
.
title
);
return
;
}
...
...
@@ -67,7 +67,7 @@ parse_track(struct despotify_session *session,
if
(
track
==
nullptr
)
return
false
;
add_song
(
songs
,
track
);
add_song
(
songs
,
*
track
);
return
true
;
}
...
...
@@ -82,7 +82,7 @@ parse_playlist(struct despotify_session *session,
for
(
ds_track
*
track
=
playlist
->
tracks
;
track
!=
nullptr
;
track
=
track
->
next
)
add_song
(
songs
,
track
);
add_song
(
songs
,
*
track
);
return
true
;
}
...
...
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