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.

Santosh Kumar
  • 1,660
  • 6
  • 22
  • 41
  • 1
    http://blog.revathskumar.com/2011/11/vlc-add-to-playlist-option-in-context.html - this link has a proper answer to this question. – user35952 Mar 17 '14 at 02:10

4 Answers4

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.

Basharat Sialvi
  • 23,936
  • 8
  • 61
  • 82
  • 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? – nutty about natty Feb 03 '13 at 15:53
  • also check http://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... – nutty about natty Feb 03 '13 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? – granadajose Dec 12 '13 at 19:26
  • This doesn't answer the question. – rootkea Dec 05 '16 at 11:22
  • @nuttyaboutnatty Check out https://askubuntu.com/a/857244/114030 – rootkea Dec 05 '16 at 11:38
  • This doesn't guarantee adding multiple files in the playlist in the right order. – Warren Parad Sep 12 '20 at 13:43
6

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.

user.dz
  • 47,137
  • 13
  • 140
  • 258
Jaysheel Utekar
  • 589
  • 8
  • 22
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

Maythux
  • 82,867
  • 54
  • 239
  • 271
  • Additional option would be `--playlist-enqueue` and for those using multiple instances `--no-playlist-autostart` – VRR Jul 24 '15 at 09: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"

rootkea
  • 301
  • 1
  • 3
  • 13