| 1. |
Solve : Detecting Filetype of Drag & Drop file? |
|
Answer» So i made a simple, little AAC to MP3 converter including the adding of MP3 Tags. Drag & Drop a MP4 file on to the batch.What does that mean? Quote from: Geek-9pm on March 25, 2015, 11:56:55 PM What does that mean? It means that if you have a batch file on your desktop, you then drag a MP4 or AAC file with your mouse and let the mouse button go (drop) it when it's on the batch file icon. So the batch then takes the file and processes it.This modification should process the files - inside the same folder where the original files are and handle any supported extension. If your executables are not on the path, then they will need the FULL location SPECIFIED to the files - so if they are all located on the desktop then it should work with "%userprofile%\desktop\" "%userprofile%\desktop\faad.exe" rest of the line "%userprofile%\desktop\lame.exe" rest of the line "%userprofile%\desktop\Tag.exe" rest of the line and if they are elsewhere and you need a guide, then let us know where they are located. This should also process more than one dragged file - one after another. Test it with some sample files. Code: [Select]echo off :: Original version by NiTeCr4Lr :: title AAC to MP3 CLI title AAC to MP3 CLI color 81 cls :begin pushd "%~dp1" || (echo error - the target folder "%~dp1" seems to be missing & pause & goto :EOF) faad -b 2 -l 2 -o "%~n1.wav" "%~1" lame -cbr -b320 -m j -q0 "%~n1.wav" del "%~n1.wav" Tag --auto --scheme "A - T" "%~n1.mp3" move /-Y "%~n1.mp3" "C:\Documents and Settings\NiTeCr4Lr\Bureaublad" popd shift if not "%~1"=="" goto :begin Quote from: NiTeCr4Lr on March 25, 2015, 11:42:19 PM The batch i wrote renames the file created by Faad, the wav file, since it keeps the file extension of the AAC in the filename of the freshly created WAV file.No they do not. As Foxidrive has pointed out in his code, you coded it that way! Quote from: Squashman on March 26, 2015, 08:05:45 AM No they do not. As Foxidrive has pointed out in his code, you coded it that way! I figured i'd test what you said by dragging and dropping files on to Faad.exe & Lame.exe without the batch. You're right about Faad, no file extension from the previous filetype in the new file's name. With Lame however, you were right yet wrong :p Since i've been using just the Lame part of the batch (no pun intended, that was bound to happen :p) for a couple of years now, my version of Lame is "3.98.2". The version you probably tested (or know of by experience that it doesn't add the previous file extension ) is i'm guessing "3.99.5" Since when i dropped a WAV file on the 3.99.5 version, it like Faad didn't include the previous extension anymore, yay! However, after testing the difference between 3.98.2 and 3.99.5 it became clear i'd prefer to keep using the 3.98.2 version.. Under the same conditions with the same high quality parameters 3.98.2 took 36 seconds to encode a MP3 where 3.99.5 took 1 Minute & 15 Seconds.... Quote from: foxidrive on March 26, 2015, 07:14:54 AM This modification should process the files - inside the same folder where the original files are and handle any supported extension. Thank you so much for your effort and time ! I indeed encounter a path issue. The shortcut to the batch file is on my desktop but it links to the batch, and all the other files like faad, lame & tag, in the following path "C:\Program Files\AAC to MP3 CLI" (I like to keep all finished projects there :p) I figured a simple chdir command at the beginning could fix that very easily.. Though, i saw the "%~dp1" you used at the pushd command, and since i'm not familiar with pushd (it seems like a.. pipe? thing.. Something i've been wanting to use since before i started adding the AAC/Faad & Tag parts to the original code, which was only Lame encoding, but didn't have the know how for :p) With some logical thinking i'm guessing the "%~dp1" take the d & p of "%1" right ? So that's why it's stuck on my desktop ("Bureaublad" in Dutch) since "%1" is on there :p? I'll wait for your reply before i start to mess around with the code of which those few new things i don't fully understand .. I'm trying to confirm and learn from your code, though :p. Also i'm guessing that "popd" is an 'off-switch' for "pushd" if you will ? I didn't even at all know about the Shift command and how it worked :p! I did a Shift/? seems handy ! Quote Substitution of batch parameters (%n) has been enhanced. You canFrom what you have said, all it needs is the change in the pushd command It pushes a directory onto a stack, changes to it, and the popd pops it back off again as you gathered. Pushd can have many levels but cd /d "C:\Program Files\AAC to MP3 CLI" will work here just as well above the :begin label - and remove the pushd/popd lines. Squashman has pointed out the useful help in the for /? Code: [Select]echo off :: Original version by NiTeCr4Lr :: title AAC to MP3 CLI title AAC to MP3 CLI color 81 cls :begin pushd "C:\Program Files\AAC to MP3 CLI" faad -b 2 -l 2 -o "%~n1.wav" "%~1" lame -cbr -b320 -m j -q0 "%~n1.wav" del "%~n1.wav" Tag --auto --scheme "A - T" "%~n1.mp3" move /-Y "%~n1.mp3" "C:\Documents and Settings\NiTeCr4Lr\Bureaublad" popd shift if not "%~1"=="" goto :begin Quote from: Squashman on March 26, 2015, 12:54:31 PM Using the code supplied by foxidrive i don't get how to adjust that even with the info in Squashman's post in order to get it to get it to run for the path "C:\Program Files\AAC to MP3 CLI" instead of the desktop .. Maybe i'm having a senior moment right now, very likely in fact Quote from: NiTeCr4Lr on March 26, 2015, 09:46:27 PM i don't get how to adjust that to get it to run for the path "C:\Program Files\AAC to MP3 CLI" instead of the desktop .. The most recent post runs from that folder - the pushd command changes the folder to "C:\Program Files\AAC to MP3 CLI" Did it do something odd when you tried it? Quote from: foxidrive on March 26, 2015, 06:55:13 PM From what you have said, all it needs is the change in the pushd command I don't know what a stack is in this form of terminology but if it works i'm not complaining :p Quote from: foxidrive on March 27, 2015, 03:48:54 AM The most recent post runs from that folder - the pushd command changes the folder to "C:\Program Files\AAC to MP3 CLI" Sorry, i had posted that post before i saw that you had posted ! My bad. I tried the new code and apart from the title being "FAAD" after Faad was already done and Lame had it's turn, it stopped at copying the mp3 back to "Bureaublad" because it couldn't find the MP3 due to it still having the WAV extension in it's title after Lame was done. (So the whole before mentioned in another post "Artist - Song.WAV.MP3" ..) The title is easily fixed by adding that after the Faad line again, but the filetype extension in new file name issue i do not know how to address efficiently while keeping your code night and tight :p.. So apart from using that old bit of code of mine "ren *.wav.mp3 *." and then "ren *.wav *.mp3" how could i address that ?Can you test this version and mark/copy/paste the text on the screen into a reply, when it pauses? The messages on the screen help to follow what is going wrong. Code: [Select]echo off :: Original version by NiTeCr4Lr :: title AAC to MP3 CLI title AAC to MP3 CLI color 81 cls :begin pushd "C:\Program Files\AAC to MP3 CLI" faad -b 2 -l 2 -o "%~n1.wav" "%~1" lame -cbr -b320 -m j -q0 "%~n1.wav" del "%~n1.wav" Tag --auto --scheme "A - T" "%~n1.mp3" cls move /-Y "%~n1.mp3" "C:\Documents and Settings\NiTeCr4Lr\Bureaublad" dir /b "%~n1*" pause popd shift if not "%~1"=="" goto :beginHere's the marked, copied & pasted text displayed "Het systeem kan het opgegeven bestand NIET vinden. Test.wav.mp3 Druk op een toets om door te gaan. . ." Which translated says: "System can't find the ..given.. file. Test.wav.mp3 Press a key to continue..." So like i said in the post before, it's that whole "filetype extension in new file name issue" Lame still puts out "Artist - Song.WAV.MP3" instead of "Artist - Song.MP3" because i use the 3.98.2 version of Lame which takes less than 50% of the time than the "3.99.5" version does without losing any noticeable quality, but does put out with the wav extension in the new file new sadly.. Quote from: NiTeCr4Lr on March 27, 2015, 02:02:47 PM The filetype extension in new file name issue i do not know how to address efficiently while keeping your code night and tight :p..Before I load that release of lame and test it - try this and see what it shows. BTW, where are the LAME binary files for Windows? The link you posted looks to only be for the source code. Code: [Select]echo off :: Original version by NiTeCr4Lr :: title AAC to MP3 CLI title AAC to MP3 CLI color 81 cls :begin pushd "C:\Program Files\AAC to MP3 CLI" faad -b 2 -l 2 -o "%~n1" "%~1" lame -cbr -b320 -m j -q0 "%~n1" del "%~n1" Tag --auto --scheme "A - T" "%~n1.mp3" move /-Y "%~n1.mp3" "C:\Documents and Settings\NiTeCr4Lr\Bureaublad" popd shift if not "%~1"=="" goto :begin |
|