Giter Site home page Giter Site logo

vlc-delete's Introduction

Buenos días Almería!

surrim

Here is a little overview of my software projects. Everything except Serendipity is self-made. Most of the projects are using C++17/20, PHP 8.1+ and JavaScript.

Besides open source software development, I'm cycling a lot, see spirit.surrim.org/about.

Useful stuff

  • surrim/j-image-magick
    Coming soon! Jekyll ImageMagick, image batch transformations and template-based output for Jekyll. Outperforms everything else in quality, speed and key features. I'm currently looking for testers to get some feedback
  • surrim/vlc-delete (GH, GL)
    VLC extensision to delete videos from HDD
  • surrim/npxm (GH, GL)
    Nginx, PHP, XDebug and MariaDB Docker image for web development
  • surrim/hashsumplusplus (GH, GL)
    Fast hashsum calculator based on libgcrypt (GnuPG), written in C++
  • surrim/sql-export (GH, GL)
    Simple index.php + config.inc.php for exporting a SQL query as CSV
  • surrim/add-license (GH, GL)
    Bash script to add license headers to source code files
  • surrim/dsplit (GH, GL)
    Tool to split files with a rolling hash algorithm, written in C

PHP Composer projects

  • surrim/base-converter (GH, GL)
    Encodes and decodes numbers in all possible number systems, including YouTube-IDs and self invented ones
  • surrim/image-processor (GH, GL)
    Processes images with GD and/or ImageMagick
  • surrim/css-lib (GH, GL)
    Library for creating CSS with PHP
  • surrim/css-grid-config (GH, GL)
    Generates excellent CSS for grid layouts depending on custom breakpoints
  • surrim/gpx-minifier (GH, GL)
    Removes GPX metadata, keeps only geodata without losing accuracy

Serendipity CMS

  • s9y/Serendipity (GH)
    Serendipity CMS for blogs, written in PHP
  • s9y/additional_plugins (GH)
    Serendipity additional plugins (author of event_osm (OpenStreetMap) and event_geo_json (Geo-data export) plugins), using and updating it for my website since 2020

Earth 2150 / The Moon Project / Lost Souls

  • surrim/osmod (GH, GL)
    Open Source Mod for The Moon Project and Lost Souls, written in EarthC
  • surrim/moos21 (GH, GL)
    Chat client for EarthNet, written in C++

Calculators

  • surrim/fibonacciplusplus (GH, GL)
    Fast Fibonacci calculator (using GMP), written in C++
  • surrim/fibonacci-js (GH, GL)
    Pure JavaScript implementation which uses fast matrix exponentiation and BigInts to calculate any Fibonacci number
  • surrim/lla2xyz (GH, GL)
    Convert geodetic latitude, longitude and altitude to XYZ coordinates, written in HTML and JavaScript

Self invented concepts

  • surrim/fibonacci-backups (GH, GL)
    Fibonacci-based "backups to keep" calculation, written in HTML and JavaScript
  • surrim/rangemap (GH, GL)
    Data structure for handling frequency distributions.

Donations

ko-fi

vlc-delete's People

Contributors

johbii avatar surrim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vlc-delete's Issues

Stopped working suddenly after update

I'm using VLC 3.0.19
Vetinari builduser@ Oct 11 2023

and my OS is arch linux
Linux mohammad-81yh 6.1.58-1-lts #1 SMP PREEMPT_DYNAMIC Sun, 15 Oct 2023 18:38:43 +0000 x86_64 GNU/Linux

image

bind key

can you update to bind the shortcut key to [shift + delete] ?

add a hotkey

great extension 😄 ! thanks for your work!

Would it be possible to add a hotkey?

Cheers,
ben

Shortcut key

Thanks for your work on this! A shortcut key option would be a huge improvement for this extention. I would love to map it to a button on my Stream Deck to quickly delete files from a playlist as I review them.

Not working on OSX w/ VLC 3.0.8

Hi,
this looks exactly like what I was looking for, unfortunately it doesn't seem to work on OSX with VLC 3.0.8. The extension is being displayed in the menu VLC/Extensions as "VLC Delete", but when activating it only seems to remove the item from the playlist, but not from the disk. I am not able to see any error messages or similar.

Regards

My way Implement fixed key

I'm using autokey app on linux, basically it select VLC window then simulate keyboard press alt + ir

import subprocess

def focus_or_open_vlc():
    process = subprocess.Popen(['pgrep', '-f', 'vlc'], stdout=subprocess.PIPE)
    output, _ = process.communicate()
    if process.returncode == 0:
     # Vlc is already running, focus on the active Vlc window
     dolphin_windows = subprocess.check_output(['wmctrl', '-l', '-p']).decode().splitlines()
     for window in dolphin_windows:
         if any(pid in window for pid in output.decode().split()):
             window_id = window.split()[0]
             subprocess.Popen(['wmctrl', '-ia', window_id])
                         
             # Launch vlc-delete extension
             time.sleep(0.5)
             keyboard.send_keys("<alt>+ir")
             
             break
    else:
        # Dolphin is not running, so open a new instance
        subprocess.Popen(['/usr/bin/vlc', '--started-from-file', '/mnt/storage/Music/with-lyric/'])

focus_or_open_vlc()

Here You Go - Alternate Script (Autohotkey v2+) -- Press DEL (or SHIFT+DEL) to Delete Videos + Move

Here is a a relatively better script than vlc-delete that I wrote using AutoHotkey (v2+) that not only works when VLC is in true full-screen mode, unlike vlc-delete, but this script also allows using multiple customizable hotkeys to do the following:

  1. Delete the video to recycle bin (default shortcut key: DEL)
  2. Delete the video permanently from disk (default shortcut key: SHIFT+DEL)
  3. Move the video file to an arbitrary location e.g. C:\ (default shortcut key: CTRL+Z)

I added a lot of code comments for your convenience. And, the default shortcut keys can be changed easily to whatever you want, as seen in the code below.

; Delete/Move a playing VLC video (via hotkeys) then jumps to the next video in the playlist.
; ------------------------------------------
; DEL       = Delete video to the recycle bin
; SHIFT+DEL = Permanently delete video of disk
; CTRL+Z    = Move video to arbitrary location
; ------------------------------------------

MOVE_ACTION_DIR := "C:\"
MEDIA_INFO_DIALOG_TITLE := "Current Media Information"
WAIT_FOR_MEDIA_INFO_DIALOG_SECS := 0.25
WAIT_FOR_MEDIA_INFO_DIALOG_RETRIES := 10
CLIPBOARD_WAIT_SECS := 1
WAIT_FOR_NEXT_VID_SECS := 0.10
WAIT_FOR_NEXT_VID_RETRIES := 10
GIVE_BACK_MOUSE_CONTROL_AFTER_SECS := 5

#Requires AutoHotkey >=2.0
#SingleInstance Force
#HotIf WinActive("ahk_class Qt5QWindowIcon")  ; only trigger the use of hotkeys if a VLC window is active

~Shift & Delete:: {  ; SHIFT+DEL = Permanently delete video off disk
    KeyWait "Delete", "Up"
    KeyWait "Shift", "Up"
    DoPermDelete()
    Return
}

~Delete:: {  ; DEL = Delete video to the recycle bin
    KeyWait "Delete", "Up"
    DoRecycleDelete()
    Return
}

~Ctrl & z:: {  ; CTRL+Z = Move video to arbitrary location
    KeyWait "Ctrl", "Up"
    KeyWait "z", "Up"
    DoMove(MOVE_ACTION_DIR)
    Return
}

DoAction(action) {
    BlockInput "MouseMove"  ; block user from using the mouse
    SetTimer AllowMouse, GIVE_BACK_MOUSE_CONTROL_AFTER_SECS * 1000  ; restore the mouse for the user at some point if something goes wrong
    vlcTitle := WinGetTitle("A") ; vlc should be the active window because it's the only way this line got called
    isFullScreen := false

    ; open the media information dialog

    Send "^i" ; CTRL+I is harcoded in vlc to open the media info dialog
    if !WinWait(MEDIA_INFO_DIALOG_TITLE, , WAIT_FOR_MEDIA_INFO_DIALOG_SECS) {
        ; cant find information window - vlc in fullscreen?
        ; attempt to leave fullscreen and retry opening information dialog
        Send "{ESC}" ; leave fullscreen
        Sleep 10
        Send "^i"
        isFullScreen := true ; user was indeed in fullscreen - remember so we can restore it later
        retry := 1
        while !WinWait(MEDIA_INFO_DIALOG_TITLE, , WAIT_FOR_MEDIA_INFO_DIALOG_SECS) {            
            retry++
            if retry == WAIT_FOR_MEDIA_INFO_DIALOG_RETRIES { ; something went wrong.
                Msgbox "Can't find Media Information dialog. Aborting!"
                Return
            }
            Send "^i"
        }
    }

    ; save the full path (as seen in the information dialog) of the video that is playing to the clipboard

    MouseGetPos &orgMouseX, &orgMouseY
    orgClipboardContent := ClipboardAll()
    WinActivate MEDIA_INFO_DIALOG_TITLE
    WinWaitActive MEDIA_INFO_DIALOG_TITLE
    WinGetPos , , &width, &height, MEDIA_INFO_DIALOG_TITLE
    fileLocationX := width/2
    fileLocationY := height-52    
    CoordMode "Mouse", "Window"
    MouseMove fileLocationX, fileLocationY, 1
    Click 3 ; selects the entire path
    Send "^c" ; copies the path to the clipboard
    CoordMode "Mouse", "Screen"
    MouseMove orgMouseX, orgMouseY, 1
    if !ClipWait(CLIPBOARD_WAIT_SECS) {
        WinClose MEDIA_INFO_DIALOG_TITLE
        WinWaitClose MEDIA_INFO_DIALOG_TITLE
        MsgBox "Can't delete/move file!  Problem finding file location nside Media Information dialog."
        Return
    }
    WinClose MEDIA_INFO_DIALOG_TITLE
    WinWaitClose MEDIA_INFO_DIALOG_TITLE

    ; if the user was originally in fullscreen this restore it now

    if isFullScreen {
        ; restore fullscreen if it was orginally set
        WinGetPos , , &width, &height, vlcTitle
        videoX := width/2
        videoY := height/2
        CoordMode "Mouse", "Window"
        MouseMove videoX, videoY, 1
        Click 2
        CoordMode "Mouse", "Screen"
        MouseMove orgMouseX, orgMouseY, 1
    }

    ; move to the next video -- so it can delete/move this video (because vlc locks the running video)

    Send "{PgDn Down}"
    retry := 1
    while WinGetTitle("A") == vlcTitle { ; wait for the next video to start playing
        Sleep WAIT_FOR_NEXT_VID_SECS * 1000 ; give it some more time to move to next video
        retry++
        if retry == WAIT_FOR_NEXT_VID_RETRIES { ; something went wrong.  no more videos? (we cant delete/move if its only 1 video)
            MsgBox "Didn't detect next video change. Only 1 video left?`nCan't delete/move this video."
            Return
        }
    }
    vlcTitle := WinGetTitle("A")

    ; perform action (delete/move the video now)

    BlockInput "MouseMoveOff"  ; allow the user to have control over the mouse now (in case the delete/move takes too long)
    try
        if action == "del_perm"
            FileDelete A_Clipboard
        else if action == "del_recycle" {
            ;WinActivate "ahk_class Shell_TrayWnd"
            ;WinWaitActive "ahk_class Shell_TrayWnd"
            FileRecycle A_Clipboard
        } else
            FileMove A_Clipboard, action
    catch as err
        MsgBox "Problem deleting/moving file:`n`n" A_Clipboard "`n`n(" err.What " - " err.Message ")"
    A_Clipboard := orgClipboardContent
    try
        WinActivate vlcTitle
    catch
        WinActivate "ahk_class Qt5QWindowIcon" ; strange, we can't find the player! ok just activate any vlc window blindly
}

DoPermDelete() {
    DoAction("del_perm")
}

DoRecycleDelete() {
    DoAction("del_recycle")
}

DoMove(path) {
    DoAction(path)
}

AllowMouse() {
    BlockInput "MouseMoveOff"
}

Playlist not saved after delete

Can you add something like a "save playlist" command/function after using vlc-delete?

Currently the file is deleted permanently.

But it is only removed from the playlist until you close VLC.

When you start VLC again with that playlist, the files are listed, but cannot be played, because, obviously, the physical file does not exist.

And due to a VLC generic bug, when it cannot play an a file in the playlist that does not exist, the CPU usage goes to 100% until you kill VLC.

Strangely enough, there is no vlc.playlist.save command that we can add?

https://code.videolan.org/videolan/vlc/-/blob/master/share/lua/README.txt
https://code.videolan.org/videolan/vlc/-/blob/master/share/lua/playlist/README.txt

Don't know if this plugin works in other OSes, but in Windows (10/11) it surely didn't work, so I had to do many fixes and turn this plugin into Windows only using only core Windows batch functions for operations

Don't know if this plugin works in other OSes, but in Windows (10/11) it surely didn't work, so I had to do many fixes and turn this plugin into Windows only using only core Windows batch functions for operations.

So in hopes that this inspires others here to rectify the errors in the Lua libraries so that they don't throw errors when dealing with File I/O operations in Windows, here's the code and the Stackoverflow page where also I mentioned this as an answer to my own question:

-- Copy this file to %ProgramFiles%\VideoLAN\VLC\lua\extensions\ and restart VLC Media player.
function descriptor()
    return {
        title = "VLC Delete Media File(Windows only)";
        version = "1.0";
        author = "Vicky Dev";
        shortdesc = "&Remove current file from playlist and disk";
        description = [[
<h1>VLC Delete Media File(Windows only)</h1>"
When you're playing a file, use this to easily
delete the current file from your <b>playlist</b> and <b>disk</b> with one click.<br>
Disclaimer: The author is not responsible for damage caused by this extension.
        ]];
    }
end

function sleep(seconds)
    local t0 = os.clock()
    local tOriginal = t0
    while os.clock() - t0 <= seconds and os.clock() >= tOriginal do end
end

function removeItem()
    local id = vlc.playlist.current()
    vlc.playlist.delete(id)
    vlc.playlist.gotoitem(id + 1)
    vlc.deactivate()
end

function activate()
    local item = vlc.input.item()
    local uri = item:uri()
    uri = string.gsub(uri, "^file:///", "")
    uri = vlc.strings.decode_uri(uri)
    path = string.gsub(uri, "/", "\\")
    vlc.msg.info("[VLC Delete Media File(Windows only)] removing: "..uri.." : "..path)
    removeItem()
    retval, err = os.execute("if exist ".."\""..path.."\"".." @(call )")
    if (type(retval) == 'number' and retval == 0) then
        os.execute("del /f /a /q ".."\""..path.."\"")
    end
end

function click_ok()
    d:delete()
    vlc.deactivate()
end

function deactivate()
    vlc.deactivate()
end

function close()
    deactivate()
end

function meta_changed()
end

Does not work with Windows UNC paths

When directly viewing files on a Windows UNC path e.g. \SERVER\Share\File.mp4 it says the file does not exist.

I also could not see from the script if the video is stopped before it deletes because VLC has a nasty habit of locking the file until it opens the next one.

mac os shows as installed but is not in view menu

Is this broken for new mac vlcs? Anything I can do?

I moved the lua in two places on my osx, it shows as installed addon with check mark, but when I click view in menu there's nothing there new about deleting.

Video not deleted if file name contains an emoji (windows)

Hi,

The extension does not work if the file name contains an emoji (testtest ❤️.mp4 for example).

lua info: [vlc-delete] removing: C:/Users/Jonas/Desktop/testtest ❤️.mp4
lua info: [vlc-delete] windows detected
lua info: [vlc-delete] before string.gsub: C:/Users/Jonas/Desktop/testtest ❤️.mp4
lua info: [vlc-delete] after string.gsub: C:\Users\Jonas\Desktop\testtest ❤️.mp4
main info: playlist is empty
lua info: [vlc-delete] error: File does not exist

fileExists("\"" .. file .. "\"") fails to detect the file, but I don't know why...

Thanks

keyboard shortcut

Hi,
Is it possible to add a shortcut on DELETE key on keyboard ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.