I can Create a Playlist from a Folder with 1 Click and so can you!

I recently acquired a series of instructional tutorial videos that are short and so they need to be played from a playlist because it’s frustrating to click back, recall which video I’m on, find it in the list and click play from either the Android or Web App every few minutes to just to continue with my course so after trying unsuccessfully to use M3U’s/PLS’s and finding it excruciating to manually add each video to a playlist with 3 clicks, I wrote a small script to do these clicks for me in sequence.

My 1 click claim is slightly misleading, I do have to create the playlist first and setup my Web App to use the script correctly but then it’s just 1 click and type 1 number to indicate which playlist we are adding to. This will only work on the Desktop Web App (I used Chrome in a Win7 environment), no mobile devices.

I’m using a bookmarklet which lets us use some browser javascript to identify certain patterns in the webapp structure and simulate clicks.

SETUP:

  • First your files to be added to the playlist need to be in the correct order alphabetically to be added. I number them to make it easy.
  • Set view parameters to organize files “by Folder” and “List”
  • The Playlist you are adding to needs to created beforehand.
  • Determine what number your Playlist is according to the alphabetical listings of your Playlists. First=1, Second=2 etc…

Create a Bookmark or Favourite in your browser but instead of adding a URL, use the code below.

    javascript:( function(){
    var PL = (prompt('Which Playlist? ie 1, 2 or 3 etc...'))-1;
    var morebtns = document.getElementsByClassName('more-btn');
    for (var i=0;i<morebtns.length;i++) {
    (function(index) {
     setTimeout(function(){
    console.log(index);
    morebtns[index].click();
    addPL = document.getElementsByClassName('add-to-playlist-btn');
    addPL[0].click();
    selectPL = document.getElementsByClassName('playlist');
    selectPL[PL].click();
    }, 1000 * index);
    })(i);
    }
    })()

To use drill down through your folders until you are seeing the list of files you want to add to playlist (remember by Folder & List View), then click on you bookmarklet you’ve created above, enter the number of your Playlist and marvel at the clicks automatically adding each of the videos into your Playlist.

Don’t you wish PLEX came with this function?

Please share this to any other related forum posts and let me know if the script stops working because of a PLEX update or your browser functions differently.

1 Like

@Supamic said:
every few minutes to just to continue with my course so after trying unsuccessfully to use M3U’s/PLS’s and finding it excruciating to manually add each video to a playlist with 3 clicks,

If you already have a list of items in your library view, do the following:

  • Shift-click on the first item
  • scroll down (slowly) to the last item
  • Shift-click the last item
  • all items inbetween are now selected too
  • click on the ‘Add to Playlist’ icon on the left side

Done.

2 Likes