2013-06-24, 21:02
Awesome, thanks guys. Will give this a shot when I'm back at home.
curl -v -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc":"2.0","method":"Playlist.Add","params":{"playlistid":0,"item":{"directory":"special://profile/playlists/music/NiN.m3u"}},"id":1}' http://192.168.0.16:8080/jsonrpc
{"id":1,"jsonrpc":"2.0","result":{"items":[{"id":6324,"label":"04 - Sanctified.mp3","type":"song"},{"id":6325,"label":"05 - Something I Can Never Have.mp3","type":"song"},{"id":6386,"label":"12 - The Way Out Is Through.mp3","type":"song"},{"label":"Nine_Inch_Nails_-_piggy.mp3","type":"unknown"},{"id":6270,"label":"Nine Inch Nails - 15 - In This Twilight.mp3","type":"song"},{"id":6261,"label":"Nine Inch Nails - 06 - Me I'm Not.mp3","type":"song"},{"id":6391,"label":"05 - Please.mp3","type":"song"},{"label":"Nine_Inch_Nails_-_big_man_with_a_gun.mp3","type":"unknown"},{"label":"Nine_Inch_Nails_-_heresy.mp3","type":"unknown"},{"id":6393,"label":"07 - Complication.mp3","type":"song"},{"id":6380,"label":"06 - The Fragile.mp3","type":"song"},{"id":6397,"label":"11 - Ripe (With Decay).mp3","type":"song"},{"id":6381,"label":"07 - Just Like You Imagined.mp3","type":"song"},{"id":6378,"label":"04 - The Wretched.mp3","type":"song"},{"id":6263,"label":"Nine Inch Nails - 08 - My Violent Heart.mp3","type":"song"},{"id":6383,"label":"09 - Pilgramige.mp3","type":"song"},{"id":6394,"label":"08 - I'm Looking Forward To Joining You, Finally.mp3","type":"song"},{"id":6268,"label":"Nine Inch Nails - 13 - The Great Destroyer.mp3","type":"song"},{"id":6385,"label":"11 - La Mer.mp3","type":"song"},{"id":6379,"label":"05 - We're In This Together.mp3","type":"song"},{"id":6389,"label":"03 - Where Is Everybody_.mp3","type":"song"},{"id":6328,"label":"08 - That's What I Get.mp3","type":"song"},{"id":6326,"label":"06 - Kinda I Want To.mp3","type":"song"},{"id":6259,"label":"Nine Inch Nails - 04 - The Good Soldier.mp3","type":"song"},{"id":6395,"label":"09 - The Big Come Down.mp3","type":"song"},{"id":6329,"label":"09 - The Only Time.mp3","type":"song"},{"id":6377,"label":"03 - The Frail.mp3","type":"song"},{"id":6265,"label":"Nine Inch Nails - 10 - God Given.mp3","type":"song"},{"id":6264,"label":"Nine Inch Nails - 09 - The Warning.mp3","type":"song"},{"label":"Nine_Inch_Nails_-_march_of_the_pigs.mp3","type":"unknown"},{"id":6387,"label":"01 - The Way Out Is Through.mp3","type":"song"},{"id":6269,"label":"Nine Inch Nails - 14 - Another Version Of The Truth.mp3","type":"song"},{"id":6260,"label":"Nine Inch Nails - 05 - Vessel.mp3","type":"song"},{"id":6258,"label":"Nine Inch Nails - 03 - Survivalism.mp3","type":"song"},{"id":6375,"label":"01 - Somewhat Damaged.mp3","type":"song"},{"id":6266,"label":"Nine Inch Nails - 11 - Meet Your Master.mp3","type":"song"},{"id":6267,"label":"Nine Inch Nails - 12 - The Greater Good.mp3","type":"song"},{"id":6256,"label":"Nine Inch Nails - 01 - Hyperpower.mp3","type":"song"},{"id":6382,"label":"08 - Even Deeper.mp3","type":"song"},{"label":"Nine_Inch_Nails_-_closer.mp3","type":"unknown"},{"label":"Nine_Inch_Nails_-_ruiner.mp3","type":"unknown"},{"id":6257,"label":"Nine Inch Nails - 02 - The Beginning Of The End.mp3","type":"song"},{"id":6390,"label":"04 - The Mark Has Been Made.mp3","type":"song"},{"id":6392,"label":"06 - Starfuckers, Inc.mp3","type":"song"},{"id":6388,"label":"02 - Into The Void.mp3","type":"son* Connection #0 to host 192.168.0.16 left intact
g"},{"label":"Nine_Inch_Nails_-_i_do_not_want_this.mp3","type":"unknown"},{"id":6330,"label":"10 - Ringfinger.mp3","type":"song"},{"id":6376,"label":"02 - The Day The World Went Away.mp3","type":"song"},{"id":6322,"label":"02 - Terrible Lie.mp3","type":"song"},{"id":6327,"label":"07 - Sin.mp3","type":"song"},{"id":6321,"label":"01 - Head Like a Hole.mp3","type":"song"},{"id":6323,"label":"03 - Down In It.mp3","type":"song"},{"label":"Nine_Inch_Nails_-_the_becoming.mp3","type":"unknown"},{"label":"Nine_Inch_Nails_-_mr_self_destruct.mp3","type":"unknown"},{"id":6396,"label":"10 - Underneath It All.mp3","type":"song"},{"id":6271,"label":"Nine Inch Nails - 16 - Zero Sum.mp3","type":"song"},{"id":6384,"label":"10 - No, You Don't.mp3","type":"song"},{"id":6262,"label":"Nine Inch Nails - 07 - Capitol G.mp3","type":"song"}],"limits":{"end":58,"start":0,"total":58}}}* Closing connection #0
curl -v -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc":"2.0","method":"Player.SetShuffle","params":{"playerid": 0, "shuffle": true},"id":1}' http://192.168.0.16:8080/jsonrpc
{"error":{"code":-32100,"message":"Failed to execute method."},"id":1,"jsonrpc":"2.0"}* Closing connection #0
curl -v -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid": 0, "play": true},"id":1}' http://192.168.0.16:8080/jsonrpc
{"error":{"code":-32100,"message":"Failed to execute method."},"id":1,"jsonrpc":"2.0"}* Closing connection #0
Quote:Welcome to Xbmc in all it's beauty
#!/bin/bash
echo "Triggering playback of $1"
curl -v -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc":"2.0","method":"Playlist.Clear","params":{"playlistid": 0},"id":1}' http://192.168.0.16:8080/jsonrpc
curl -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": {"volume": 11}, "id": 1}' http://192.168.0.16:8080/jsonrpc
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{\"jsonrpc\":\"2.0\",\"method\":\"Playlist.Add\",\"params\":{\"playlistid\":0,\"item\":{\"directory\":\"special://profile/playlists/music/$1.m3u\"}},\"id\":1}" http://192.168.0.16:8080/jsonrpc
curl -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc":"2.0","method":"Player.Open","params":{"item": {"playlistid": 0}},"id":1}' http://192.168.0.16:8080/jsonrpc
curl -H 'Accept: application/json' -H 'Content-type: application/json' -X POST -d '{"jsonrpc": "2.0", "method": "Player.SetShuffle", "params": {"playerid": 0, "shuffle": true }, "id": 1}' http://192.168.0.16:8080/jsonrpc
Quote:http://xmbc@myip:8080/image/image://Q%3a%5cMovies3tb2%5cFilmesHD3tb2%5cThe%20Ledge%20(2011)%5cThe%20Ledge%20(2011).bluray.tbn/The other way i am using in my ipad app and works in the Ipad, but dont work in another app that i am creating
Quote:http://xmbc@myip:8080/vfs/image://Q%3a%5cMovies3tb2%5cFilmesHD3tb2%5cThe%20Ledge%20(2011)%5cThe%20Ledge%20(2011).bluray.tbn/Thanks for the help guys.
else if (player == Video)
{
if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const CVideoInfoTag *currentVideoTag = g_infoManager.GetCurrentMovieTag();
if (currentVideoTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentVideoTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
else
{
if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const MUSIC_INFO::CMusicInfoTag *currentMusicTag = g_infoManager.GetCurrentSongTag();
if (currentMusicTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentMusicTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
CVideoDatabase videodatabase;
if (strFilename.empty() || !videodatabase.Open())
return false;
CVideoInfoTag details;
if (!videodatabase.LoadVideoInfo(strFilename, details))
return false;
item->SetFromVideoInfoTag(details);
if (item->GetLabel().empty())
item->SetLabel(CUtil::GetTitleFromPath(strFilename, false));
if (item->GetLabel())
item->SetLabel(URIUtils::GetFileName(strFilename));
return true;
if (!videodatabase.LoadVideoInfo(strFilename, details))
return false;
(2013-07-15, 12:16)Tolriq Wrote: Just noticed a change in last gotham during some tests.Why? It's an else if (player == Video) which should be hit for video files and then it's an else which should only be hit for audio files
It seems that now neither the title nor the label are filled when playing a random file via JSON.
Before label was filled with the filename (without path) and seems a good thing since the label is a mandatory item.
Edit :
After some debugging I'm lost on what seems multiple strange things, so don't know if they are errors or if normal and so where I should patch.
In CPlayerOperations::GetItem
Code:else if (player == Video)
{
if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const CVideoInfoTag *currentVideoTag = g_infoManager.GetCurrentMovieTag();
if (currentVideoTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentVideoTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
else
{
if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const MUSIC_INFO::CMusicInfoTag *currentMusicTag = g_infoManager.GetCurrentSongTag();
if (currentMusicTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentMusicTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
When playing a video file the second else block will also be called is this intended ?
(2013-07-15, 12:16)Tolriq Wrote: In CVideoLibrary::FillFileItemIt should be set/retrieved by CGUIInfoManager which also does this when playing a random file from the GUI.
Code:CVideoDatabase videodatabase;
if (strFilename.empty() || !videodatabase.Open())
return false;
CVideoInfoTag details;
if (!videodatabase.LoadVideoInfo(strFilename, details))
return false;
item->SetFromVideoInfoTag(details);
if (item->GetLabel().empty())
item->SetLabel(CUtil::GetTitleFromPath(strFilename, false));
if (item->GetLabel())
item->SetLabel(URIUtils::GetFileName(strFilename));
return true;
Since the file is started from JSON for first time it's not yet in any database so
Code:if (!videodatabase.LoadVideoInfo(strFilename, details))
return false;
Will return false and the label is never set.
(2013-07-15, 12:16)Tolriq Wrote: Then on the last part I'm not sure to understand, you test if the label is empty then set it, then you set if the label is present and set it again ?
Not sure what part should be patched and with what So waiting for more details
Quote:Why? It's an else if (player == Video) which should be hit for video files and then it's an else which should only be hit for audio files
Quote:It should be set/retrieved by CGUIInfoManager which also does this when playing a random file from the GUI.
Quote:That second if condition looks wrong and should be the same as the first one. It's possible that CUtil::GetTitleFromPath(strFilename, false) is not able to determine a title from the path and returns an empty string so as a last resort we just use the filename.