Random MP3`s to Phone

35

1

More Intructables of me: https://www.instructables.com/member/edddison/

What does it do?

It copies randomly a “number of mp3s” from my music folder to my Phone!

Prelude:

Do you still remember the times, when we used to collect mp3´s from our friends by connecting our hard drives (or during LAN-Parties), and often painlessly order, merge and label our collections?

Everybody had its own system, Genres, Alphabetical Orders, Atmospheres. We would use first Filenames and later ID3-Tags. Hours, Days, Months of just ordering our Collections, often without even listening to all of it. We knew the titles by heart and in which folder to find them, but never listened to them.

Sometimes we would just start up Winamp and push the Shuffle-Button.

Therefore, I have this huge Collection of mp3 on my Hard Drive, music from when I was 15 to now.

However, for sure, it would never fit on my Telephone and to be honest I don’t need to go around with all that Data Luggage.

So: This is a little program i wrote with the help of the internet (Stack Overflow mostly).

What does it do?

It copies randomly a “number of mp3s” from my music folder to my Phone!

Every few weeks I exchange the mp3´s with new ones, slowly progressing through my big music collection. Call it Nostalgia!

But not only this! The Program “saves”, which titles I already copied once and is taking them out of the equation! I can also manually change the titles, that will be excluded!

It isn’t the most “user-friendly” work I ever did, but let me explain step by step what to do!

I am happy if somebody else would take up the work and make it better!

You will find the zip-File with all the Components in this steps Attachment.


It contains:

Randommusic_withcomments.bat

robocopy.bat

Dummies-Folder

SD-Card-Folder

Step 1: Always Make a Backup

ALWAYS MAKE

A BACKUP! I am not liable for any problems!

Step 2: Edit Randommusic.bat

Open the Randommusic_withcomments.bat with a Text-Editor and follow the instructions (instructions start with “REM” in front of the code line)

Set Musicroot to your Source Music Folder. In my Case “D:\EigeneMusik\Musik\Musik_sortiert”

Set Playfolder to your Dummies-Folder. In my Case “D:\SSD_PC_sortieren\Musiktmp\dummies”

Set Filecount to the number of files you want to copy to your Phone. I calculate like this:

MP3-Files are ca. 3MB. So I want to use ca. 3GB of my SD-Card-Space for Music.

3000MB/3MB is 1000 Files. So I set the Filecount to 1000 or below.

Save and exit the File.

The Code of the File:

@echo off&setlocal enabledelayedexpansion

REM Musicroot = Your Source Music Folder

set "musicroot= D:\EigeneMusik\Musik\Musik_sortiert"

REM Playfolder= Your Destination-Folder as well as your Dummy-Folder

set "playfolder= D:\SSD_PC_sortieren\Musiktmp\dummies "

REM filecount = Set here, how many files you want to transfer (here 999 .mp3)

set /a filecount=1000

REM Actual Program: Dont change anything past this point!

pushd "%musicroot%"

for /r %%i in (*.mp3) do set /a files+=1& set "$!files!=%%~i"

popd

pushd "%playfolder%"

:randomloop

set /a rd=%random%%%files+1

set "mp3=!$%rd%!"

if not defined mp3 goto :randomloop

set "$%rd%="

for %%i in ("%mp3%") do if exist "%%~nxi" echo "%%~nxi" already exist in %playfolder%.& goto:randomloop

copy "%mp3%"

set /a filecount-=1

if %filecount% gtr 0 goto:randomloop

popd

Step 3: Edit Robocopy.bat

Open robocopy.bat

and set the 2 File Paths as follows:

robocopy "Path to SD-Folder" "Dummy-Folder" /create

In my Case it looks like this:

robocopy " D:\SSD_PC_sortieren\Musiktmp\SD-Card " "D:\SSD_PC_sortieren\Musiktmp\dummies" /create

What this will do, is make 0Byte-Copies of your actual music files, which will later be used as Comparison-Dummies for future use.

Step 4: Run Randommusic_withcomments.bat

Ready for a first run!

Now just double click Randommusic_withcomments.bat and wait for the magic to happen!

Don’t worry, if at first you just see a blinking dash line, the program needs to go through all your music files and index them before starting. For my 120Gb on SDD-Drive it takes 3 Minutes.

It should look something like the image.

Note, that you will find the line “File already exists”, when he encounters a Dummy-File with the same name in the Folder Dummies. Obviously this will not happen at the first run, since we didn’t create any dummies for now.

Wait until the Copying is finished.

Step 5: Move Files From Dummy to SD Card

When the Copying is finished you should find a “filecount”-number of files in your Dummies-Folder.

As you can see I already ran the program once and have Actual Files with an File Size of more than 0 bytes and Dummy-Files. Now we want to copy the “actual Files” to the Folder “SD-Card”. The easiest way is to order the Files by Size and then cut and paste the files with more than 0bytes.

Step 6: Start Robocopy.bat

Step 6:

After we moved our “real” music files to the Folder “SD-Card” we want to create dummy files of the new mp3´s and push them into the “dummy”-Folder, so in the next run through they are being excluded.

This job is done by the “robocopy.bat” file. Just start it.

Step 7: All Done!

All done! Now move the Files from “SD-Card” to your phone and start listening!

It isn’t the most “user-friendly” work I ever did, but let me explain step by step what to do!

I am happy if somebody else would take up the work and make a better version!

Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Toys Contest

      Toys Contest

    Discussions

    0
    None
    seamster

    13 days ago

    Looks good, thanks for sharing your steps! : )