Author Topic: Playlist command JSON  (Read 8641 times)

0 Members and 1 Guest are viewing this topic.

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Playlist command JSON
« on: March 05, 2013, 04:54:33 PM »
Hi all,

Just upgraded to Frodo, to my amazement it bollocksed up both Vox commando and my audio settings which I now can't fix because the XBMC team have decided to remove the option for "Default audio device".  I'll sort that another time though, I have some semblance of sound back.

I upgraded VOX and am now slowly rebuilding my life.  Got most stuff back in but can't figure out the command to start a playlist...

XJson.Raw
Player.Open
"item":{"file":"special://profile/playlists/music/Waterfall.m3u"}, "options": { "shuffled": true}

GUI.ActivateWindow
"window": "musicplaylist"

I'm guessing as usual I'm being dumb, but I can't figure out what I'm supposed to change the path to.  I tried leaving it as it was, I tried setting it to the actual path (C:\Users\Chloe\AppData\Roaming\XBMC\userdata\playlists\music), and I've tried every variation I could think of.

XBMC just gives me a blank playlist.

What am I doing wrong?  How should my statement read?

Thanks,

-P
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #1 on: March 05, 2013, 09:41:08 PM »
I'll see if I can help you tomorrow morning, but I suggest that you copy and paste your commands directly from the VC tree so I can see exactly what you are doing and look for mistakes.

If you have not already done so, I also recommend that you install a fresh copy of 0.984 somewhere and look at the standard frodo config to see how the various commands I have created work.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #2 on: March 05, 2013, 09:43:46 PM »
I am also annoyed that they got rid of the default audio device.  What a pita.  I don't know of any way to switch devices via Json either so they screwed us again on that one!

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Playlist command JSON
« Reply #3 on: March 06, 2013, 05:38:50 AM »
Thanks bud,

I installed 0.984 last night and tried to copy your example (Playlist fresh mix sample) and make the alterations that I thought would sort it, but I think there is a lack of education on my part and my guesswork has proved fruitless.

Below is what I've got in at present, I figured I just needed to alter the file path to where the M3u is stored (C:\Users\Chloe\AppData\Roaming\XBMC\userdata\playlists\music) but I'm either writing it wrong or my assumption is wrong so I put it back to how you had it but altered the filename accordingly ...

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Waterfall" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="958" name="TellvoxToStartWaterfall" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.Open&amp;&amp;"item":{"file":"special://profile/playlists/music/Waterfall.m3u"}, "options": { "shuffled": true}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>GUI.ActivateWindow&amp;&amp;"window": "musicplaylist"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Waterfall</event>
  </command>
</commandGroup>


You'll have to let me know if you find a way around your issue with the audio, i.e. if you find a copy of Frodo where someone has hacked the option back in for 'default audio device'.

Appreciate the help as always mate.

-P
« Last Edit: August 24, 2013, 03:31:22 PM by jitterjames »
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #4 on: March 06, 2013, 09:47:03 AM »
OK, got it.

You are not crazy.  This is a weird bug in XBMC.  For some reason it thinks that .m3u files are jpeg images!

To fix this you need to create, or add to your advancedsettings.xml file so that it look like this:

Code: [Select]
<advancedsettings>
  <pictureextensions>
    <remove>.m3u</remove>
  </pictureextensions>
</advancedsettings>

if you don't already have an advancedsettings.xml file create it in your XBMC userdata folder

here is more info on advancesettings: http://wiki.xbmc.org/index.php?title=Advancedsettings.xml

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Playlist command JSON
« Reply #5 on: March 06, 2013, 05:39:28 PM »
Thank you mate.  I had an advanced settings file from a while ago when you helped me reduce the seek time when using the skip forwards and backwards buttons.  I added your code to that and it works perfectly.

Have also solved my surround sound problem.  I had to change some random settings to get it to work.  I've posted them in my previous thread on that topic in case anyone was having similar difficulties.  I now have TTS, WAV and Surround sound all coming through the same speakers.  I believe the Logitech system is handling the surround using PLII rather than the PC doing it but it sounds great.  I am a happy man!

Thanks again mate, if you ever come to England you will be drowning in Beer.

-P

Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #6 on: March 06, 2013, 09:49:20 PM »
Looking forward to it!

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Playlist command JSON
« Reply #7 on: August 24, 2013, 02:42:27 PM »
Sorry to resurrect an old thread, but part of this is actually still not working and I've only just noticed.

The playlist is not shuffled despite the "shuffled" part being set to true.  I've tried adding in various commands and looking for XBMC shortcuts but nothing is working.

Has anyone else managed to get a playlist to start shuffled?

-P
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #8 on: August 24, 2013, 06:54:35 PM »
Yeah.  This is incredibly annoying.  I can't get it to work either.  XBMC version 12 and it still can't load an m3u playlist properly yet!

Not only does it seem to fail to shuffle, it is loading the songs into the video playlist instead of the music playlist, which is causing all sorts of other confusion.  I was wondering why switching to the musicplaylist was showing blank even though music was playing.  Man, this is really sad.

Unfortunately I don't know of any other way to load a playlist through json, unless we actually iterate through the m3u file ourselves and add each song to a playlist manually.  Then we could probably also shuffle the list before playing it.  Pain in the ass though.  It would probably be best accomplised by writing a python script within xbmc.

Hellow

  • Contributor
  • ***
  • Posts: 50
  • Karma: 0
    • View Profile

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Playlist command JSON
« Reply #10 on: August 24, 2013, 09:02:49 PM »
Wow.  Telling XBMC that the m3u file was a directory would never have occurred to me in a million years.  :bonk

Here are two ways to try.  You'll need to adjust the name of the m3u file.  I think the second way is better.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Waterfall" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1003" name="TellvoxToStartWaterfall" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.ExecBuiltin</cmdType>
      <cmdString>PlayMedia(special://profile/playlists/music/hardcore.m3u)</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.SetShuffle&amp;&amp;"playerid":0, "shuffle":true</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GoTo&amp;&amp;"playerid":0, "to":0</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>GUI.ActivateWindow&amp;&amp;"window": "musicplaylist"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>1500</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XBMC.Btn.KB</cmdType>
      <cmdString>home</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Waterfall</event>
  </command>
  <command id="1016" name="TellvoxToStartWaterfall" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Playlist.Clear&amp;&amp;"playlistid": 0</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Playlist.Add&amp;&amp;"playlistid": 0, "item":{"directory":"special://profile/playlists/music/hardcore.m3u"}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.Open&amp;&amp;"item": {"playlistid": 0}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.SetShuffle&amp;&amp;"playerid":0, "shuffle":true</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GoTo&amp;&amp;"playerid":0, "to":0</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>GUI.ActivateWindow&amp;&amp;"window": "musicplaylist"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Waterfall</event>
  </command>
</commandGroup>

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Playlist command JSON
« Reply #11 on: January 18, 2014, 11:37:29 AM »
Unbelievably I've literally only just implemented this.  It's been marked as unread in my inbox all this time with me thinking "I'll get round to that one day".

Well I got round to it and it works a treat.  Thank you as always mate.  Best Developer in the world

xxx
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb