level-999999
level-999999

Reputation: 31

vlc.playlist.loop automation

Basically I have this .lua code in my vlc extension, now I am having problems in setting the VLC repeat automatically to loop all in a playlist. I have tried setting it into "all", 0, 1, 2, true, "TRUE" but it does just not set the playlist's loop value into "all".

I also cannot get the playlist loop value. I tried object.playlist().loop, vlc.playlist.loop.

I read the VLC's Lua Script and Extensions page but I still cannot get what is supposed to be that

    <status>

value or any of its acceptable strings.

function trigger()
    vlc.playlist.stop()
    vlc.playlist.sort("random")
    vlc.playlist.goto(0)
    --vlc.playlist.repeat_(<status>)
    --vlc.playlist.loop(<status>)
    vlc.playlist.play()
end

Upvotes: 1

Views: 539

Answers (3)

level-999999
level-999999

Reputation: 31

Solved it, thanks to Vyacheslav and Piglet

this would now set the vlc playlist loop to loop all, but I cannot print or vlc.msg.info the value of playlist.loop though. But it works in the end.

function trigger()
    vlc.playlist.stop()
    vlc.playlist.sort("random")
    vlc.playlist.goto(0)
    playlist = vlc.object.playlist();
    if vlc.var.get(playlist,"loop") == false then vlc.playlist.loop() end
    vlc.playlist.play()
end

Upvotes: 1

Vyacheslav
Vyacheslav

Reputation: 27221

In common case, if you do not know how it properly works, it is possible to search such code in github.com. In your case, you can use this:

https://github.com/search?utf8=%E2%9C%93&q=vlc.playlist.loop+language%3ALua&type=Code&ref=searchresults

As you can see,

you can use such code:

elseif command == "pl_loop" then
  vlc.playlist.loop()
elseif command == "pl_repeat" then
  vlc.playlist.repeat_()

or

 elseif c == 'loop' then
      if vlc.playlist.loop(v) then
        vlc.playlist.repeat_('off')
      end
    elseif c == 'repeat' then
      if vlc.playlist.repeat_(v) then
        vlc.playlist.loop('off')
      end

Upvotes: 0

Piglet
Piglet

Reputation: 28958

I have not tried it but following the documentations logic status should be either nil, true or false. If nil (or no argument) it will toggle the current state. true will enable, false disable loop or repeat.

Not sure why you expect loop to be "all".

Did you remove the -- in front of the respective line? I assume setting both doesn't make sense. And they will toggle each other internally?

Upvotes: 0

Related Questions