howto:vlc-playlist-from-file
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:vlc-playlist-from-file [2022/01/08 22:58] – Wulf Rajek | howto:vlc-playlist-from-file [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== VLC ====== | ||
+ | |||
+ | ====== VLC no audio ====== | ||
+ | |||
+ | Change output module in Tools -> Preferences -> Audio from Auto to Pulseaudio or Alsa. | ||
+ | |||
+ | alternative edit config file: | ||
+ | < | ||
+ | vi ~/ | ||
+ | </ | ||
+ | < | ||
+ | # Audio output module (string) | ||
+ | aout=pulse | ||
+ | </ | ||
+ | |||
+ | ====== Associate VLC to webm videos ====== | ||
+ | Gnome uses two lists to register applications to file types located in: | ||
+ | * / | ||
+ | * / | ||
+ | * ~/ | ||
+ | < | ||
+ | #manually | ||
+ | sudo vi / | ||
+ | sudo vi / | ||
+ | vi ~/ | ||
+ | |||
+ | #or via sed: | ||
+ | sudo sed -i ' | ||
+ | sudo sed -i ' | ||
+ | sudo sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | </ | ||
+ | |||
+ | |||
====== VLC Playlist from file ====== | ====== VLC Playlist from file ====== | ||
Line 11: | Line 46: | ||
You may want to activate the loop option in VLC preferences if VLC is configured to play the next track automatically. (Tools -> Preferences -> Show all settings -> Playlist -> Repeat current item) | You may want to activate the loop option in VLC preferences if VLC is configured to play the next track automatically. (Tools -> Preferences -> Show all settings -> Playlist -> Repeat current item) | ||
+ | |||
+ | or edit ~/ | ||
+ | < | ||
+ | vi ~/ | ||
+ | </ | ||
+ | < | ||
+ | # Repeat current item (boolean) | ||
+ | repeat=1 | ||
+ | </ | ||
==== Linux ==== | ==== Linux ==== | ||
Copy vlc.sh in ~/ | Copy vlc.sh in ~/ | ||
+ | < | ||
+ | sed -i ' | ||
+ | </ | ||
note: source from github adjusted to sort numbers as Versions like nemo file manager does. | note: source from github adjusted to sort numbers as Versions like nemo file manager does. | ||
- | < | + | < |
#!/bin/bash | #!/bin/bash | ||
+ | shopt -s nocaseglob | ||
shopt -s extglob | shopt -s extglob | ||
- | extensions=' | + | extensions=' |
# kill other instances of vlc to keep playlist clean (one-instance mode) | # kill other instances of vlc to keep playlist clean (one-instance mode) | ||
Line 36: | Line 84: | ||
# count files with matching extension, and get position of filename in current directory | # count files with matching extension, and get position of filename in current directory | ||
- | n=$(ls " | + | n=$(ls " |
- | pos=$(ls " | + | pos=$(ls " |
# if the filename does not have one of the extension above, launch vlc with provided filename | # if the filename does not have one of the extension above, launch vlc with provided filename | ||
Line 46: | Line 94: | ||
# change positions in playlist such as the first element is the opened file | # change positions in playlist such as the first element is the opened file | ||
- | ls " | + | ls " |
- | ls " | + | ls " |
# launch playlist | # launch playlist | ||
- | IFS=$' | + | IFS=$' |
</ | </ | ||
Line 73: | Line 121: | ||
powershell -File %USERPROFILE%\vlc.ps1 %1 | powershell -File %USERPROFILE%\vlc.ps1 %1 | ||
</ | </ | ||
- | < | + | < |
Param([string]$filename) | Param([string]$filename) | ||
Line 116: | Line 164: | ||
When you start VLC you get a new menu item: View > Move currently playing file into wastebasket. | When you start VLC you get a new menu item: View > Move currently playing file into wastebasket. | ||
- | < | + | < |
--[[ | --[[ | ||
INSTALLATION (create directories if they do not exist): | INSTALLATION (create directories if they do not exist): | ||
Line 154: | Line 202: | ||
-- create waste directory if it doesn' | -- create waste directory if it doesn' | ||
if(not directory_exists(wdir)) then | if(not directory_exists(wdir)) then | ||
- | os.execute(" | + | |
+ | | ||
wdir = dirname(filename) .. wdir | wdir = dirname(filename) .. wdir | ||
end | end | ||
Line 265: | Line 314: | ||
</ | </ | ||
- | + | https:// | |
- | < | + | < |
--[[ | --[[ | ||
- | | + | Copyright 2015-2019 surrim |
- | | + | |
- | https:// | + | This program is free software: you can redistribute it and/or modify |
- | https:// | + | it under the terms of the GNU General Public License as published by |
- | This program is free software: you can redistribute it and/or modify | + | the Free Software Foundation, either version 3 of the License, or |
- | it under the terms of the GNU General Public License as published by | + | (at your option) any later version. |
- | the Free Software Foundation, either version 3 of the License, or | + | |
- | (at your option) any later version. | + | This program is distributed in the hope that it will be useful, |
- | This program is distributed in the hope that it will be useful, | + | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | GNU General Public License for more details. |
- | GNU General Public License for more details. | + | |
- | You should have received a copy of the GNU General Public License | + | You should have received a copy of the GNU General Public License |
- | along with this program. | + | along with this program. |
]]-- | ]]-- | ||
function descriptor() | function descriptor() | ||
- | | + | return { |
- | title = "VLC Delete"; | + | title = "VLC Delete"; |
- | version = " | + | version = " |
- | author = " | + | author = " |
- | url = " | + | url = " |
- | shortdesc = " | + | shortdesc = "&Remove current file from playlist and disk"; |
- | description = [[ | + | description = [[ |
< | < | ||
When you're playing a file, use VLC Delete to | When you're playing a file, use VLC Delete to | ||
Line 297: | Line 346: | ||
This extension has been tested on GNU Linux with VLC 2.1.5.< | This extension has been tested on GNU Linux with VLC 2.1.5.< | ||
The author is not responsible for damage caused by this extension. | The author is not responsible for damage caused by this extension. | ||
- | | + | ]]; |
- | | + | } |
end | end | ||
- | |||
- | -- Windows - Check if file exists | ||
function fileExists(file) | function fileExists(file) | ||
- | | + | return io.popen(" |
end | end | ||
- | + | function sleep(seconds) | |
- | function sleep(n) -- seconds | + | local t0 = os.clock() |
- | local t0 = os.clock() | + | local tOriginal = t0 |
- | local tOriginal=t0 | + | while os.clock() - t0 <= seconds |
- | while os.clock() - t0 <= n and os.clock()> | + | |
end | end | ||
- | + | function windowsDelete(file, | |
- | -- Windows - try and delete a file with multiple attempts and a pause between each try - waiting for the file to unlock | + | if not fileExists(" |
- | function windowsDelete(file, | + | for i = trys, 1, -1 |
- | if not fileExists('"'..file..'"') then return nil,'File does not exist' | + | do |
- | for i = trys,1,-1 | + | retval, err = os.remove(file) |
- | do | + | --retval, err = os.execute("del " |
- | retval, err = os.remove(file) | + | if retval == true then |
- | --retval, err = os.execute('del ' | + | return true |
- | if retval==true then | + | end |
- | return true | + | sleep(pause) |
- | end | + | end |
- | sleep(pause) | + | return {nil, "Unable to delete file"} |
- | end | + | |
- | return {nil,'Unable to delete file'} | + | |
end | end | ||
function removeItem() | function removeItem() | ||
- | | + | local id = vlc.playlist.current() |
- | vlc.playlist.delete(id) | + | vlc.playlist.delete(id) |
- | vlc.playlist.gotoitem(id + 1) | + | vlc.playlist.gotoitem(id + 1) |
- | vlc.deactivate() | + | vlc.deactivate() |
end | end | ||
function activate() | function activate() | ||
- | | + | local item = vlc.input.item() |
- | local uri = item: | + | local uri = item: |
- | uri = string.gsub(uri, | + | uri = string.gsub(uri, |
- | uri = vlc.strings.decode_uri(uri) | + | uri = vlc.strings.decode_uri(uri) |
- | vlc.msg.info(" | + | vlc.msg.info(" |
- | -- check for non windows | + | |
- | if (package.config: | + | |
- | retval, err = os.execute(" | + | |
- | if (retval ~= nil) then | + | |
- | uri = "/" | + | |
- | retval, err = os.execute(" | + | |
- | else | + | |
- | retval, err = os.execute(" | + | |
- | if (retval ~= nil) then | + | |
- | uri = "/" | + | |
- | retval, err = os.execute(" | + | |
- | end | + | |
- | end | + | |
- | if (retval ~= nil) then removeItem() end | + | |
- | else | + | |
- | --windows, remove from playlist first so the file isnt locked by vlc | + | |
- | removeItem() | + | |
- | uri = string.gsub(uri, | + | |
- | retval, err = windowsDelete(uri, | + | |
- | end | + | |
- | | + | if (package.config: |
- | vlc.msg.info(" | + | retval, err = os.execute(" |
- | d = vlc.dialog(" | + | if (retval ~= nil) then |
- | d: | + | uri = "/" |
- | d: | + | retval, err = os.execute(" |
- | d: | + | else |
- | d:show() | + | retval, err = os.execute(" |
- | end | + | if (retval ~= nil) then |
+ | uri = "/" | ||
+ | retval, err = os.execute(" | ||
+ | end | ||
+ | end | ||
+ | if (retval ~= nil) then removeItem() end | ||
+ | else -- windows | ||
+ | removeItem() -- remove from playlist first so the file isnt locked by vlc | ||
+ | uri = string.gsub(uri, | ||
+ | retval, err = windowsDelete(uri, | ||
+ | end | ||
+ | |||
+ | if (retval == nil) then | ||
+ | vlc.msg.info(" | ||
+ | d = vlc.dialog(" | ||
+ | d: | ||
+ | d: | ||
+ | d: | ||
+ | d:show() | ||
+ | end | ||
end | end | ||
function click_ok() | function click_ok() | ||
- | | + | d: |
- | vlc.deactivate() | + | vlc.deactivate() |
end | end | ||
function deactivate() | function deactivate() | ||
- | | + | vlc.deactivate() |
end | end | ||
function close() | function close() | ||
- | | + | deactivate() |
end | end | ||
Line 392: | Line 435: | ||
https:// | https:// | ||
+ | |||
+ | |||
+ |
howto/vlc-playlist-from-file.1641682734.txt.gz · Last modified: 2023/05/29 11:53 (external edit)