User Tools

Site Tools


howto:vlc-playlist-from-file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:vlc-playlist-from-file [2022/06/14 02:59] Wulf Rajekhowto: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
 +</code>
 +
 +====== Associate VLC to webm videos ======
 +Gnome uses two lists to register applications to file types located in:
 +  * /usr/share/applications/mimeinfo.cache
 +  * /usr/share/applications/defaults.list
 +  * ~/.local/share/applications/mimeinfo.cache
 +<code>
 +#manually
 +sudo vi /usr/share/applications/mimeinfo.cache
 +sudo vi /usr/share/applications/defaults.list
 +vi ~/.local/share/applications/mimeinfo.cache
 +
 +#or via sed:
 +sudo sed -i 's#video/webm=#video/webm=vlc.desktop;#' /usr/share/applications/defaults.list
 +sudo sed -i 's#video/webm=#video/webm=vlc.desktop;#' /usr/share/applications/meminfo.cache
 +sudo sed -i 's#audio/webm=#audio/webm=vlc.desktop;#' /usr/share/applications/meminfo.cache
 +sed -i 's#video/webm=#video/webm=vlc.desktop;#' ~/.local/share/applications/meminfo.cache
 +sed -i 's#audio/webm=#audio/webm=vlc.desktop;#' ~/.local/share/applications/meminfo.cache
 </code> </code>
  
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.
-<code ~/.local/bin/vlc.sh>+<code bash ~/.local/bin/vlc.sh>
 #!/bin/bash #!/bin/bash
  
 +shopt -s nocaseglob
 shopt -s extglob shopt -s extglob
-extensions='@(avi|mp4|mkv|m4v|mov|mpg|mpeg|wmv|ogg|flac|m4a|mp3|wav)'  # list of extensions for searching in current directory+extensions='@(avi|mp4|mkv|m4v|mov|mpg|mpeg|wmv|ogg|flac|m4a|mp3|wav|webm|rmvb|asf|flv)'  # list of extensions for searching in current directory
  
 # 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 "${dirname}"/*.${extensions} -1 2>/dev/null | sort -V | wc -l) +n=$(ls "${dirname}"/*.${extensions} -1 2>/dev/null | sort -f -V | wc -l) 
-pos=$(ls "${dirname}"/*.${extensions} -1 2>/dev/null | sort -V | grep -n -F -- "${basename}" | cut -d: -f1)+pos=$(ls "${dirname}"/*.${extensions} -1 2>/dev/null | sort -f -V | grep -n -F -- "${basename}" | cut -d: -f1)
  
 # 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 "${dirname}"/*.${extensions} -1 | sort -V | tail -n$(($n-$pos+1)) >  /tmp/vlc.m3u +ls "${dirname}"/*.${extensions} -1 | sort -f -V | tail -n$(($n-$pos+1)) >  /tmp/vlc.m3u 
-ls "${dirname}"/*.${extensions} -1 | sort -V | head -n$(($pos-1))    >> /tmp/vlc.m3u+ls "${dirname}"/*.${extensions} -1 | sort -f -V | head -n$(($pos-1))    >> /tmp/vlc.m3u
  
 # launch playlist # launch playlist
-IFS=$'\n'; read -d '' -r -a files < /tmp/vlc.m3u; vlc "${files[@]}"+IFS=$'\n'; read -d '' -r -a files < /tmp/vlc.m3u; vlc --norandom "${files[@]}"
 </code> </code>
  
Line 101: Line 121:
 powershell -File %USERPROFILE%\vlc.ps1 %1 powershell -File %USERPROFILE%\vlc.ps1 %1
 </code> </code>
-<code vlc.ps1>+<code powershell vlc.ps1>
 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.
  
-<code WasteBasket.lua>+<code lua WasteBasket.lua>
 --[[ --[[
 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't exist   -- create waste directory if it doesn't exist
   if(not directory_exists(wdir)) then   if(not directory_exists(wdir)) then
-    os.execute("mkdir " .. dirname(filename) .. wdir)+    -- escaping single quote while surrounding dir in single quotes for dirs with spaces 
 +    os.execute("mkdir '" .. string.gsub(dirname(filename) .. wdir, "\'", "\\\\'" ) .. "'")
     wdir = dirname(filename) .. wdir     wdir = dirname(filename) .. wdir
   end   end
Line 294: Line 315:
  
 https://github.com/surrim/vlc-delete/ https://github.com/surrim/vlc-delete/
-<code delete.lua>+<code lua delete.lua>
 --[[ --[[
  Copyright 2015-2019 surrim  Copyright 2015-2019 surrim
howto/vlc-playlist-from-file.1655171950.txt.gz · Last modified: 2023/05/29 11:53 (external edit)