Re: An Easier mp3Editor?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hart, I wrote a small, stupid, ugly script in lua for mpv, that maybe
you'll find useful until you find a proper solution.
You should put it in the folder '~/.mpv/scripts/'.

Here is what it does: while you play a file in mpv, every time you hit
'M' the current song time is appended to a text file.
The times are formatted as requested by mp3splt.
The text file is named after the mp3 file name, plus '_marks.txt'.

For example, if you listen to 'Building_with_fire.mp3', the times are
saved, separated by spaces, in the file
'Building_with_fire.mp3_marks.txt'.
When you're done you can edit the file and add 00.00.00 and EOF if you
need them, and then you can use:
    mp3splt Building_with_fire.mp3 $(cat Building_with_fire.mp3_marks.txt)
to split the file.

As I said, it's a stupid script, it doesn't check anything so use it
with care, but I'm not a programmer and I wanted to show you a
possible solution quickly. Maybe someone else will want to write
something better. Anyway I tested it quickly and it seems to work.

Here's the script:

-- SCRIPT START
function mark_time()
    audioFileName = mp.get_property("filename")
    marksFileName = audioFileName .. "_marks.txt"
    marksFile = io.open(marksFileName, "a")
    time = mp.get_property("time-pos")
    timeMin = math.floor( time / 60 )
    timeSec = math.floor(( time % 60 ) * 100 + 0.5 ) / 100
    timeSpltMin = string.format('%.2d', timeMin)
    timeSpltSec = string.format('%05.2f', timeSec)
    timeSplt = timeSpltMin .. '.' .. timeSpltSec
    marksFile:write(timeSplt .. ' ')
    marksFile:close()
    print(timeSplt .. " added to the marks file.")
end
mp.add_key_binding("M", mark_time)
-- SCRIPT END

Hope you'll find it useful.

-- Emanuele Rusconi
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user



[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux