update stream count by 1 seem impossible
Jamroom Developers
Hello Michael,
getting correct song and artist is what im been trying to do for such long time.
Brian change the _update function to:
------
function view_jrShoutcastPlayer_update($_post, $_user, $_conf)
{
if (!isset($_post['song']) || strlen($_post['song']) == 0) {
return jrCore_json_response(array('error' => 'invalid song title'));
}
if (!isset($_post['profile_name'])) {
return jrCore_json_response(array('error' => 'invalid profile name'));
}
// Get all audio files that are part of this album
$_sp = array(
'search' => array(
"audio_title = {$_post['song']}",
"profile_name = {$_post['profile_name']}",
// "audio_artist = {$_post['profile_name']}"
// "_item_id = 3" - use by brian for testing
),
'return_item_id_only' => true,
'exclude_jrUser_keys' => true,
'exclude_jrProfile_quota_keys' => true,
'order_by' => false,
'limit' => 1
);
$_rt = jrCore_db_search_items('jrAudio', $_sp);
if (isset($_rt) && is_array($_rt)) {
jrCore_db_increment_key('jrAudio', reset($_rt), 'audio_file_stream_count', 1, true);
return jrCore_json_response(array('success' => 1));
}
return jrCore_json_response(array('error' => 'update failed'));
}
------
I noticed the reset($_rt) in the increment line... ???
However, that didn't work so I will try the changes you suggest.
The column that show the artist in the jr_jraudio_item_key table are
audio_artist i.e Billy Joel
audio_file_artist i.e Billy Joel
.... shows the song in the table are
audio_file_title i e Uptown girl
audio_title i.e Uptown girl
audio_title_url shows Uptown-girl
profile_url is not present in that table.
I ´ll inform you when tested the code...
Thank you // Jacob