rename file or open a file as the wrong type
-
- Prole
- Posts: 8
- Joined: Tue Feb 18, 2020 8:06 am
rename file or open a file as the wrong type
So i'm making a little... something? where I can drop in song files meant for Clone Hero and Beat Saber, and it shows a list of the songs and I can play them like an MP3 player, gonna see if I can't do something with the note files and such. but I've got a small hiccup, in that Beat Saber's audio files are ".OGG" renamed into ".EGG". I can of course manually rename the files, but I plan to drop a whole bunch into here, and that would become tedious really fast. is there a command or set of commands that would allow me to rename the file, or open it as an .OGG, ignoring the given file extension? thanks!
-
- Prole
- Posts: 8
- Joined: Tue Feb 18, 2020 8:06 am
Re: rename file or open a file as the wrong type
here's how far I've gotten so far:
but it's not opening the file from the appdata folder. I even had it write the file directory to a .txt, and copied and pasted it into Chrome and it opened the file just fine, so I know for certain the directory is correct, plus the resulting file isn't corrupted in any way. why won't it open?
Code: Select all
renameFile = love.filesystem.read("Songs/" .. SongsDir[menuSelection] .. "/song.egg")
love.filesystem.write(menuSelection .. ".ogg", renameFile)
music = love.audio.newSource(love.filesystem.getSaveDirectory() .. "/" .. menuSelection .. ".ogg", "stream")
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: rename file or open a file as the wrong type
Hi and welcome to the forums.
First it'd be nice to know what menuSelection and SongsDir[menuSelection] is, because you might be missing the SongsDir[ .. ] part from within newSource's parameter on the third line above.
That said, i think i remember that the current löve version actually tries to see if it can open a file with any decoder it can, so it shouldn't matter if the file extension is egg instead of ogg.
Finally, you don't pass absolute directories to any löve function, they only take the relative paths given by the internal virtual file system, so you'd do one of the following:
First it'd be nice to know what menuSelection and SongsDir[menuSelection] is, because you might be missing the SongsDir[ .. ] part from within newSource's parameter on the third line above.
That said, i think i remember that the current löve version actually tries to see if it can open a file with any decoder it can, so it shouldn't matter if the file extension is egg instead of ogg.
Finally, you don't pass absolute directories to any löve function, they only take the relative paths given by the internal virtual file system, so you'd do one of the following:
Code: Select all
music = love.audio.newSource(menuSelection .. ".egg", "stream")
-- or
music = love.audio.newSource(SongsDir[menuSelection] .. ".egg", "stream")
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Prole
- Posts: 8
- Joined: Tue Feb 18, 2020 8:06 am
Re: rename file or open a file as the wrong type
right now when I tell it to play .egg it sounds like lasers
the lasers are really cool, but I don't think it was doing that before...
the lasers are really cool, but I don't think it was doing that before...
Last edited by TheLegoSensei on Sat Feb 22, 2020 6:48 am, edited 2 times in total.
-
- Prole
- Posts: 8
- Joined: Tue Feb 18, 2020 8:06 am
Re: rename file or open a file as the wrong type
ah, now both .egg play, and sound like lasers (forgot to put math.floor() in several places)
-
- Prole
- Posts: 8
- Joined: Tue Feb 18, 2020 8:06 am
Re: rename file or open a file as the wrong type
OH, I didn't understand what you were telling me, but now I get it
running "love.audio.newSource("song.ogg")" will search both the original zip folder directories as well as the appdata folder directories for the file in question, so I don't need to specify the appdata folder.
that took me a while thanks for your help!
running "love.audio.newSource("song.ogg")" will search both the original zip folder directories as well as the appdata folder directories for the file in question, so I don't need to specify the appdata folder.
that took me a while thanks for your help!
Re: rename file or open a file as the wrong type
If you need to change the extension as well, select the entire file name and change it.
Who is online
Users browsing this forum: No registered users and 3 guests