Anon 09/29/2024 (Sun) 14:28 No.11164 del
I quickly made a simple thing which plays a bunch of audio files via one audio file! I tested it on Everfree_Radio_RIP MLP music and saw that the output did indeed share blocks. I know I made something like this before, but IIRC, it was clunky or not easy to use or was proof-of-concept. The code I wrote now is "elegant" and nice, but it is only missing a thing to output specified-size sets of audio files (like 100 mp3 files -> 1 mp3 file which is 1 GB, and only output 1GB sets, however many MP3s that is each time).

You don't even need HTML/webpage to play the playlist of MP3 files, which gets kinda complicated with JavaScript and whatever. You just open the MP3 which is a hour(s)-long set of MP3s and listen to it, pause, rewind, do whatever. The only negative is the padding blocks take up a small amount of extra space, and you may need to refer to the input list if you want to know the name/creator of the track that you want to know about.

Here's the code:
read -p "Path: " path; read -p "Chunk size: " bs; ipfs ls -s $path\
 | head -n4 | sed "s/ .*//g" | bs=$bs xargs -d "\n" sh -c 'for args do n=$(ipfs files stat \
/ipfs/$args | grep ^Size: | sed "s/.* //g"); nth=$(expr $(expr $n / $bs) \* $bs); \
next=$(expr $nth + $bs); diff=$(expr $next - $n); ipfs cat $args; head -c$diff /dev/zero; \
done' _ | ipfs add -rH --raw-leaves --chunker=size-$bs # 1048576
Explanation:
. Remove " | head -n4" to add everything in the folder. Or replace that with "grep..." to filter out non-MP3s like text files in the folder.
. Input a path which contains MP3 files only (or whatever audio type which you can glue multiple of those files together and it will be playable) - I did /ipfs/QmU6KWPmEQpjXqX9f1qnUSqkCymnP1GsqQUDVTQiBoxpZy/Everfree_Radio_RIP
. Enter the chunk size of the files in the folder with individual audio files (meaning that each MP3 file has no more than one mp3 file header)

This is also helpful if you want to share/save/download/duplicate a small amount of large files instead of many small files. With a 60GB set: instead of sharing thousands of files, you can share 60 one-gigabyte files.

I was reminded of this when I wanted to listen to the album "Brian Wilson Presents Smile" via just one file or video. However, those full album individual videos have all been deleted off of YouTube, apparently. Therefore, I searched desuarchive /mu/ and got a set of MP3s from MediaFire. I didn't have a thing to easily play them one after the other, so I made what I wanted here:
https://ipfs.hypha.coop/ipfs/QmYYEigqrV2T239ExV7Smih2cGKChHERahccRA8Yc5oNpj
. that album via a single file, while also retaining the original/source files
. it's less than 1GB, so I didn't consider block sharing via padding and stuff (between the individual files and the combined file).

Message too long. Click here to view full text.