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/06/08 00:38] – [Usage] Wulf Rajek | howto:vlc-playlist-from-file [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 12: | Line 12: | ||
# Audio output module (string) | # Audio output module (string) | ||
aout=pulse | 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 ' | ||
</ | </ | ||
Line 44: | Line 63: | ||
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 64: | 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 74: | 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 101: | Line 121: | ||
powershell -File %USERPROFILE%\vlc.ps1 %1 | powershell -File %USERPROFILE%\vlc.ps1 %1 | ||
</ | </ | ||
- | < | + | < |
Param([string]$filename) | Param([string]$filename) | ||
Line 144: | 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 182: | 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 293: | Line 314: | ||
</ | </ | ||
+ | https:// | ||
+ | <code lua delete.lua> | ||
+ | --[[ | ||
+ | Copyright 2015-2019 surrim | ||
+ | |||
+ | This program is free software: you can redistribute it and/or modify | ||
+ | it under the terms of the GNU General Public License as published by | ||
+ | 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, | ||
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | GNU General Public License for more details. | ||
- | <code - delete.lua> | + | You should have received a copy of the GNU General Public License |
- | --[[ | + | along with this program. |
- | Copyright 2015-2016 surrim | + | |
- | https:// | + | |
- | https:// | + | |
- | https:// | + | |
- | This program is free software: you can redistribute it and/or modify | + | |
- | it under the terms of the GNU General Public License as published by | + | |
- | 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, | + | |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of | + | |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | |
- | GNU General Public License for more details. | + | |
- | | + | |
- | 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 325: | 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 | ||
howto/vlc-playlist-from-file.1654645117.txt.gz · Last modified: 2023/05/29 11:53 (external edit)