Kodi Community Forum

Full Version: script.playlist.helper
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As i found that some context menu item and onclick actions missing when provide dynamic content, espeacially in a custom window, i create a little helper script.

So as it may is usefull for others too, i like to share it here.
May some thoughts, what can be better are welcome.

Enable Playlist Functions for Contextmenu which currently not provided by Kodi core and Provide select Actions for Skinners

beta Video


Contextmenu
  •  for dynamic container filled with currently playing playlist (playlistmusic:// ; playlistvideo://)
     - switch playlistitems (move up or down)
     - delete playlistitem

  • play all songs by artist
     - if either media window and on '. all albums' listitem entry, or if custom window for artist or album items (clears playlist, and start plaing folder)


  • activate playlist window (available inside menu 'Playlist Helper' within Contextmenu)
  • activate playercontrols dialog (available menu 'Playlist Helper' within Contextmenu)
  • save currently active playlist (available own menu 'Playlist Helper' within Contextmenu)


Select Actions
  • play selected Song if container filled with (playlistmusic:// ; playlistvideo://)
  • conditional select actions for dynamic content containers in Custom Windows/Containers (directory or file)
     - add to playlist as next title and play item (default ~ !Skin.HasSetting(< dbtype >_select_queue))
     - add to playlist as next title (if Skin.HasSetting(< dbtype >_select_queue))


Skinning Integration:

Onclick Actions ( for skinners )

    1. override onclick actions for dynamic content container
        
        
xml:
<onclick>'RunScript(script.playlist.helper,action=select)'</onclick>
        
        • by default = add the selected mediatype to playlist as next item and play it immediatly
        
        • if a skin provides settings like 'skin.hassetting(<media type*>_select_queue)' is true - it just queues the selected item as next item to be played in playlist  [*artist,album,song,genre,year]
        
            e.g.
                skin.hassetting(album_select_queue) - add as next title, playback after current title ends
                !skin.hassetting(song_select_queue) - add as next title and play it immediatly
        
    2. when dynamic container filled with currently playing playlist ( playlistmusic:// ; playlistvideo:// )  you can play the selected media item from that list, without 'clear/destroy' the current playlist
        
         
xml:
<onclick>RunScript(script.playlist.helper,action=playlist_playoffset)</onclick>
        

           - example for a playlist container
    
          
xml:

              <control type="panel" id="12345">
                     <include>playlist_container_atts</include>
                     ...
                     <!-- the other skinning stuff > -->
                     ...
                     <content>$VAR[playlistmusic]</content>
              </control>
              
              includes
                    <include name="playlist_container_atts">
                        <onfocus>SetProperty(playlist_itemcontrol,enable,home)</onfocus>
                        <onunfocus>ClearProperty(playlist_itemcontrol,home)</onunfocus>
                        <onclick>RunScript(script.playlist.helper,action=playlist_playoffset)</onclick>
                    </include>
                    <variable name="playlistmusic">
                        <value condition="string.isempty(window(home).property(playlist))">playlistmusic://</value>
                        <value>-</value>
                    </variable>
  

    3. NOTE: when use save playlist : script opens playlist window and force click save button , its on to do to find a real solution via py
       - if you dont wanna move back manually just add following onunload commands to
         dialogkeyboard.xml
              
         
xml:
 
          <onunload condition="String.IsEqual(Window(home).Property(addon_forcedaction),back)">Action(back)</onunload>
          <onunload condition="!String.IsEmpty(Window(home).Property(addon_forcedaction))">ClearProperty(addon_forcedaction,home)</onunload>


Git Hub Branch: https://github.com/marduklev/script.playlist.helper

Matrix : version to install from zip -> https://github.com/marduklev/repository....ist.helper
Leia : version to install from zip -> https://github.com/marduklev/repository....ist.helper

Sidenote:
If you wonder about the name . It may look more like a currently playng helper, but as it interacts with the playlist i decided for the short 'playlist' name.
Warning :

if you take a look at source code, be warnend i am just a py beginner :p