21

The Problem

While you are playing any song or other media file on VLC and open another such file, then another instance of VLC opens. (You aren't going to hear and understand anything until you are a robot)

What I Want

I what to add a "Add to VLC Playlist" to the right click menu of Nautilus as similar in Windows.

1

4 Answers 4

16

It can be fixed in VLC preferences:

  • Open VLC preferences by going to tools menu

enter image description here

  • In preferences, Enable "Allow only one instance" and "Enqueue files in one instance mode" like shown below:

enter image description here

  • Click save. That's it!

From now on when you open files with VLC they will be enqueued in your playlist.

6
  • 3
    The original question was about how to "add Add to VLC Playlist to the right click menu of Nautilus". This is not answered, yet. I, too, would like to know how that can be done. I'm not a fan of forcing "only one instance". Any takers? Feb 3, 2013 at 15:53
  • also check brainstorm.ubuntu.com/idea/17697 where a work-around is suggested using nautilus-actions (a config. tool), but I'm not that fond of that make-shift solution... Feb 3, 2013 at 18:34
  • This answer is good, but it is more a workaround than a real solution. Is there some (easy) way to add the enqueue option to the right click menu? Dec 12, 2013 at 19:26
  • This doesn't answer the question.
    – rootkea
    Dec 5, 2016 at 11:22
  • @nuttyaboutnatty Check out askubuntu.com/a/857244/114030
    – rootkea
    Dec 5, 2016 at 11:38
6
+25

You can do that using nautilus-action-Configuration-Tool

  1. Install the tool using using

    sudo apt-get install nautilus-action
    
  2. After that close all the open nautilus instances

    nautilus -q
    
  3. Open nautilus-action-Configuration-Tool.

  4. Then click on add new action button and name your action.
  5. Click the Command tab and enter the command

    vlc --one-instance
    

    You should also enter the appropriate parameter into the Parameters box — you can click the Legend button to see a list of parameters you can use.

    In our case, we want the %f parameter to feed filename or better %B if we may have spaces in it.We can also view all the detailes about the parameters by clicking on the Legend button.

    Nautilus-Actions shows you a preview of the command it will run, so you’ll know you’re on the right track.

3
  • 2
    What could you do if filename has space in it?! you should use %B not %f
    – Maythux
    Jul 23, 2015 at 14:57
  • Yes @Maythux if the filename has space you should use %B my bad. Also you can check clicking the legend Button Jul 24, 2015 at 4:53
  • This package is no longer available. Sep 12, 2020 at 13:43
5

First Method:

Create a new script called add-to-vlc inside the directory ~/.gnome2/nautilus-scripts

Add this to the file:

#!/bin/bash
for File in "$@"
do
if [ -d "$File" ]; then
zenity --error --text="'$File' is a directory."
exit
fi
done
vlc --one-instance "$File"

Give permissions to the file:

chmod +x add-to-vlc

Now restart nautilus:

nautilus -q 

Now you can use it just right click on a file then go to scripts entry and choose add-to-vlc


Second Method:

Install nautilus actions:

sudo apt-get install nautilus-actions

Restart Nautilus:

nautilus -q

Launch the Nautilus-Actions Configuration Tool from Dash:

enter image description here

In the Action Tab Enter the name you want to save:

enter image description here

In the command tab add the command as below in the picture(path:/usr/bin/vlc and Parameters: --one-instance %B)

enter image description here

Now save and exit, now whenever you right click on a file you can go to Nautlus Actions and choose Add to vlc:

enter image description here

1
  • Additional option would be --playlist-enqueue and for those using multiple instances --no-playlist-autostart
    – VRR
    Jul 24, 2015 at 9:58
0

Solution using no other application/tool: (For Nautilus 3)

  1. Create a file ~/.local/share/nautilus/scripts/Add to VLC playlist with following content in it:

    #! /bin/bash  
    echo -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | xargs -d '\n' vlc --one-instance --playlist-enqueue  
    

    Command to create the required file:

    echo -e "#! /bin/bash \necho -n \"\$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS\" | xargs -d '\\\n' vlc --one-instance --playlist-enqueue" > ~/.local/share/nautilus/scripts/"Add to VLC playlist"  
    
  2. Make it executable:

    chmod u+x ~/.local/share/nautilus/scripts/"Add to VLC playlist"  
    

Done!

  • Now right click on any media file(s) and select Add to VLC Playlist from Scripts submenu.
  • Works for directories too!
    Just include the intended directory or directories (containing audio/video media) in the selection.

For Naultilus 2
Change ~/.local/share/nautilus/scripts/"Add to VLC playlist" to ~/.gnome2/nautilus-scripts/"Add to VLC playlist"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .