Since I'm becoming more confident with shell programming every day, on a whim I jotted down some scripting ideas.
The notes sat there for only a day before I decided to stay up late and work on them. I actually managed to figure them out too!
Again, because a blog is a stupid place to put code.. it won't get put up here. Yeah yeah, I'll figure that kind of stuff out eventually.
auto-mount an ISO and play it if it's a DVD-ISO ∞
This one might seem pretty easy at a glance, but because a regular user can't be given arbitrary mount privileges it has to be done as root.
Why in the heck can't a user mount a file which they own? That's just dumb.
From what I can tell, there's no such thing as an fstab entry to give a user permission to do something like this. I suspect that if there were such a feature, it would be so hopeless as to require a per-file permission. Heck, it may require ISOs to be in a fixed special location and for them to all be identified and secured in some stupid way.
I played with autofs, thinking that I might be able to make some funky scripting which would drop a symbolic link in the right place and have it detected and mounted. No luck on that front. Perhaps there's still a way to do this though, but I missed it.
Last I played with PAM permissions. Having done a lot of work with this in the past, just to figure out a few lines of scripting to set things up, it was trivial. At first I screwed up a bit of my copy-and-paste, but I revisited it and got it working.
Now the user is prompted for the root password, and the ISO is mounted.
After that, it was pretty easy to have the script figure out the contents of the ISO and fire up gmplayer.
The same PAM trick applies for letting the user unmount.
It's a messy solution in my opinion, because I hate being asked for the root password and I hate having to manually unmount stuff, but it's the best solution I've got right now.
unzip an archive, see if there's a playable module inside and then play it ∞
This one's more for Oldschool Linux, and it's a tribute to Cubic Player (now Open Cubic Player) which could unpack a zip file and play a module within it. For some reason, audacious used to be able to do this.. and then it stopped being able to. I don't understand what was going on, and I intend to troubleshoot at some later point, but in the meantime it was an interesting problem to solve.
Having already created an intelligent unpacking script, I needed to learn how to properly
source various scripts into one, detect if there was a playable item within, play it and then use another intelligent deletion script.
This one's really really rough, and actually quite dangerous to use because it blindly unpacks and deletes.. but it works.
To get it to work, I had to do a whole lot of fiddling around, especially since it wouldn't be run from the commandline but from within a file manager. That's almost always annoying for me.
I also had a mysterious and stupid issue with files with spaces in them. I hate that so much. I quoted everything correctly and got all kinds of nasty problems to wade through.
Btw, I see Chris absolutely everywhere. He appears out of nowhere when I search for just about any issue. It's eerie.
Because somehow I know you'll end up finding this post.. thanks Chris!