diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-04-03 13:46:11 +0200 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-04-03 13:46:11 +0200 |
commit | 455e4bcbf950078d9e9215e7499a2e927f6ec9d5 (patch) | |
tree | 01eda370aae329500fca655954435aed80e47daf /src | |
parent | 26646e3484d7d03d68003553d6c98ecddf2fa082 (diff) |
Imported Upstream version 3.7.2
Diffstat (limited to 'src')
-rw-r--r-- | src/cdaudio-ng/cdaudio-ng.cc | 2 | ||||
-rw-r--r-- | src/cue/cue.cc | 41 | ||||
-rw-r--r-- | src/jack-ng/jack-ng.cc | 1 | ||||
-rw-r--r-- | src/scrobbler2/scrobbler_communication.cc | 16 | ||||
-rw-r--r-- | src/scrobbler2/scrobbler_xml_parsing.cc | 4 | ||||
-rw-r--r-- | src/wavpack/wavpack.cc | 4 |
6 files changed, 55 insertions, 13 deletions
diff --git a/src/cdaudio-ng/cdaudio-ng.cc b/src/cdaudio-ng/cdaudio-ng.cc index ca628ce..643484c 100644 --- a/src/cdaudio-ng/cdaudio-ng.cc +++ b/src/cdaudio-ng/cdaudio-ng.cc @@ -434,6 +434,8 @@ Tuple CDAudio::read_tuple (const char * filename, VFSFile & file) tuple.set_str (Tuple::Artist, trackinfo[trackno].performer); if (trackinfo[0].name) tuple.set_str (Tuple::Album, trackinfo[0].name); + if (trackinfo[0].performer) + tuple.set_str (Tuple::AlbumArtist, trackinfo[0].performer); if (trackinfo[trackno].genre) tuple.set_str (Tuple::Genre, trackinfo[trackno].genre); } diff --git a/src/cue/cue.cc b/src/cue/cue.cc index f733f28..aa9e389 100644 --- a/src/cue/cue.cc +++ b/src/cue/cue.cc @@ -75,6 +75,31 @@ bool CueLoader::load (const char * cue_filename, VFSFile & file, String & title, filename = String (uri_construct (cur_name, cue_filename)); decoder = filename ? aud_file_find_decoder (filename, false) : nullptr; base_tuple = decoder ? aud_file_read_tuple (filename, decoder) : Tuple (); + + if (base_tuple) + { + Cdtext * cdtext = cd_get_cdtext (cd); + + if (cdtext) + { + const char * s; + if ((s = cdtext_get (PTI_PERFORMER, cdtext))) + base_tuple.set_str (Tuple::AlbumArtist, s); + if ((s = cdtext_get (PTI_TITLE, cdtext))) + base_tuple.set_str (Tuple::Album, s); + if ((s = cdtext_get (PTI_GENRE, cdtext))) + base_tuple.set_str (Tuple::Genre, s); + } + + Rem * rem = cd_get_rem (cd); + + if (rem) + { + const char * s; + if ((s = rem_get (REM_DATE, rem))) + base_tuple.set_int (Tuple::Year, str_to_int (s)); + } + } } Track * next = (track + 1 <= tracks) ? cd_get_track (cd, track + 1) : nullptr; @@ -84,8 +109,9 @@ bool CueLoader::load (const char * cue_filename, VFSFile & file, String & title, if (base_tuple) { + StringBuf tfilename = str_printf ("%s?%d", (const char *) filename, track); Tuple tuple = base_tuple.ref (); - tuple.set_filename (filename); + tuple.set_filename (tfilename); tuple.set_int (Tuple::Track, track); int begin = (int64_t) track_get_start (cur) * 1000 / 75; @@ -113,9 +139,20 @@ bool CueLoader::load (const char * cue_filename, VFSFile & file, String & title, tuple.set_str (Tuple::Artist, s); if ((s = cdtext_get (PTI_TITLE, cdtext))) tuple.set_str (Tuple::Title, s); + if ((s = cdtext_get (PTI_GENRE, cdtext))) + tuple.set_str (Tuple::Genre, s); + } + + Rem * rem = cd_get_rem (cd); + + if (rem) + { + const char * s; + if ((s = rem_get (REM_DATE, rem))) + tuple.set_int (Tuple::Year, str_to_int (s)); } - items.append (String (filename), std::move (tuple), decoder); + items.append (String (tfilename), std::move (tuple), decoder); } if (! next_name) diff --git a/src/jack-ng/jack-ng.cc b/src/jack-ng/jack-ng.cc index f358965..ed62cbb 100644 --- a/src/jack-ng/jack-ng.cc +++ b/src/jack-ng/jack-ng.cc @@ -28,6 +28,7 @@ #include <libaudcore/runtime.h> #include <algorithm> +#include <iterator> #include <assert.h> #include <pthread.h> diff --git a/src/scrobbler2/scrobbler_communication.cc b/src/scrobbler2/scrobbler_communication.cc index e842230..ecc9e64 100644 --- a/src/scrobbler2/scrobbler_communication.cc +++ b/src/scrobbler2/scrobbler_communication.cc @@ -125,7 +125,7 @@ static gboolean send_message_to_lastfm (const char * data) CURLcode curl_requests_result = curl_easy_perform(curlHandle); if (curl_requests_result != CURLE_OK) { - AUDDBG("Could not communicate with last.fm: %s.\n", curl_easy_strerror(curl_requests_result)); + AUDERR("Could not communicate with last.fm: %s.\n", curl_easy_strerror(curl_requests_result)); return false; } @@ -171,7 +171,7 @@ static gboolean update_session_key() { g_strcmp0(error_code, "14") == 0 || //token not authorized g_strcmp0(error_code, "15") == 0 //token expired )) { - AUDDBG("error code CAUGHT: %s\n", (const char *)error_code); + AUDINFO("error code CAUGHT: %s\n", (const char *)error_code); session_key = String(); result = true; } else { @@ -213,8 +213,8 @@ static gboolean scrobbler_test_connection() { return true; } - String testmsg = create_message_to_lastfm ("user.getRecommendedArtists", 3, - "limit", "1", "api_key", SCROBBLER_API_KEY, + String testmsg = create_message_to_lastfm ("user.getInfo", 2, + "api_key", SCROBBLER_API_KEY, "sk", (const char *) session_key); gboolean success = send_message_to_lastfm(testmsg); @@ -232,7 +232,7 @@ static gboolean scrobbler_test_connection() { String error_detail; if (read_authentication_test_result(error_code, error_detail) == false) { - AUDDBG("Error code: %s. Detail: %s.\n", (const char *)error_code, + AUDINFO("Error code: %s. Detail: %s.\n", (const char *)error_code, (const char *)error_detail); if (error_code != nullptr && ( g_strcmp0(error_code, "4") == 0 || //error code 4: Authentication Failed - You do not have permissions to access the service @@ -353,7 +353,7 @@ static void delete_lines_from_scrobble_log (GSList **lines_to_remove_ptr, GSList contents = g_strjoinv("\n", finallines); success = g_file_set_contents(queuepath, contents, -1, nullptr); if (!success) { - AUDDBG("Could not write to scrobbler.log!\n"); + AUDERR("Could not write to scrobbler.log!\n"); } } @@ -432,7 +432,7 @@ static void scrobble_cached_queue() { save_line_to_remove(&lines_to_remove, i); } } else { - AUDDBG("SCROBBLE NOT OK. Error code: %s. Error detail: %s.\n", + AUDINFO("SCROBBLE NOT OK. Error code: %s. Error detail: %s.\n", (const char *)error_code, (const char *)error_detail); if (! error_code) { //net error(?) or the answer from last.fm was not well read @@ -529,7 +529,7 @@ static void send_now_playing() { //see scrobble_cached_queue() AUDDBG("NOW PLAYING OK.\n"); } else { - AUDDBG("NOW PLAYING NOT OK. Error code: %s. Error detail: %s.\n", + AUDINFO("NOW PLAYING NOT OK. Error code: %s. Error detail: %s.\n", (const char *)error_code, (const char *)error_detail); //From the API: Now Playing requests that fail should not be retried. diff --git a/src/scrobbler2/scrobbler_xml_parsing.cc b/src/scrobbler2/scrobbler_xml_parsing.cc index f555079..6f2a6d3 100644 --- a/src/scrobbler2/scrobbler_xml_parsing.cc +++ b/src/scrobbler2/scrobbler_xml_parsing.cc @@ -208,9 +208,9 @@ gboolean read_authentication_test_result (String &error_code, String &error_deta result = false; } else { - username = get_attribute_value("/lfm/recommendations[@user]", "user"); + username = get_node_string("/lfm/user/name"); if (!username) { - AUDDBG("last.fm not answering according to the API.\n"); + AUDERR("last.fm not answering according to the API.\n"); result = false; } } diff --git a/src/wavpack/wavpack.cc b/src/wavpack/wavpack.cc index 4e35df5..10224a8 100644 --- a/src/wavpack/wavpack.cc +++ b/src/wavpack/wavpack.cc @@ -111,7 +111,9 @@ static bool wv_attach (const char * filename, VFSFile & wv_input, wvc_input = VFSFile (corrFilename, "r"); } - * ctx = WavpackOpenFileInputEx (& wv_readers, & wv_input, & wvc_input, error, flags, 0); + * ctx = WavpackOpenFileInputEx (& wv_readers, & wv_input, + wvc_input ? (& wvc_input) : nullptr, error, flags, 0); + return (* ctx != nullptr); } |