RndMp3Copy
Your MP3-Player has got 60 Mb left, but you can’t decide which songs to put on it?
You want to listen across your fresh new music titles, but you don’t have the time or space to copy them all to your player?
If so, RndMp3Copy will help you.
Originally, this tool was suppaman2′s idea (see Gulli-board post (German) here), but I (and several others) had a problem with it: It was dead slow.
That was probably the case because his version was scripted in AutoIt3, which is really neat for hacking things like this together, but unfortunately is rather slow. So it wasn’t really practicable to let this tool handle your complete music library.
I recoded the application in C++ using the boost::filesystem library and now it’s running like a greased lightning!
Download
RndMp3Copy Windows without GUI
RndMp3Copy Autoit GUI source code
RndMp3Copy GTK+ GUI source code
Range of functions / usage
If you are happy using the GUI, you don’t need to read this, because the GUI will do this for you.
RndMp3Copy is completely driven by parameters and doesn’t need any runtime-interaction, thus it can be easily executed as a batch script or cronjob.
-i specifies the input music directory. You can specify more than one input directory, but you have to set an individual -i for each.
-o sets the output directory (or device, if it can be accessed with a regular path [meaning, you can only use MTP devices if you mount them as a normal drive]).
-s sets the desired amount of music in megabytes, so -s 46.7 means 46 megabytes and 700 kilobytes.
You can also fill the complete device (if you have enough music to fill it up, of course) by passing “all” instead of a number.
-d specifies the naming convention for output files:
- 0: output/file.ext (default)
- 1: output/relative/path/file.ext
- 2: output/relative-path-file.ext
-l sets a so-called used-list, which means that songs mentioned in this file will be skipped. If this option is set, RndMp3Copy will create entries for every song that was copied during this process. This function is useful for example when you fill your player on a daily basis and don’t want to hear songs that you had on your player the day before.
-f sets the file formats that will be scanned for. If no file format is given, RndMp3Copy will only look for .mp3 files. With this option, you could even use RndMp3Copy to copy random e-books, videos or whatever.
You can use regular expressions to filter the data. -in specifies a pattern that must be matched, -ex specifies a pattern that must not be matched.
The switch -m sets that files won’t be copied, but moved instead.
-w will order RndMp3Copy not to end immediately after finishing, but rather wait for the user to press any key. This should only be useful for debugging / analysis purposes.
-v will enable debug output (must not be last option). If you encounter crashes or really odd behaviour, please enable this option, pipe RndMp3Copy’s output to a file and sed this to me with a brief description of what happened.
An example call:
RndMp3Copy -i ~/music/ -i /media/cdrom/music/soundtrack/ -o /media/mp3player/ -s 128 -f mp3,wma,ogg,flac -ex “(Tokio.?Hotel)” -w
This will copy about 128 mb mp3-, wma-, ogg- and flac-songs, that don’t contain the words “Tokio” and “Hotel” from two different sources to a mobile player and then waits for the user to press return.
GUI
I will deliver separate GUIs for a practical reason:
The AutoIt3-GUI used for Windows won’t work on other OSs (I think they will work using wine, though) and the GTK+ gui theoretically works on Windows, but you need to download about 100mb runtime files to get it to work.
Both GUIs only serve the purpose of generating a call with the before mentioned parameters, running the tool and showing you the text output.
Linux-Gui
The Linux-GUI bases on Glade and GTKmm / GTK+. If you have a Gnome-Desktop, you should already have these installed.
Windows-Gui
The AutoIt3-GUI should run out-of-the-box on most Windows versions. It’s supplied in the Windows package.
However, if you really want to use the GTK-GUI on Windows, you can download the sources and compile it on Windows.
ToDo-list
- Parse the complete output in GUI and show progress there
Changelog:
1.6.1
- RndMp3Copy doesn’t choke on files with ‘weird’ special characters, they will be skipped. (A real fix depends on the boost::filesystem-backend, because currently, it fails to handle certain characters…)
- Files can now also be moved instead of copied
- RegEx-Fix (thanks to ronubasg!)
1.6.0
- Code completely restructured and rewritten some parts
- Scanning directories now got a real boost – up to 9x the speed of the older version!
- You can completely fill the target device by passing -s all.
1.5.3
- RndMp3Copy now gives you a small summary
- I reformulated parts of the output to be easier to understand
- Fixed a bug in the Windows-GUI
1.5.2
- Implemented used-list
- Minor fixes
- Linux-GUI finished
- Restructured Windows- and Linux-GUIs
1.5.1
- Shuffling songs is more performant and gives “more random” results
1.5
- Ability to filter with regular expressions
- Corrupt files are skipped and don’t cause a crash
1.4
- Already existing files in the target directory are skipped now
- If one file fails to copy, it will be skipped and doesn’t cancel the whole copy process
- Finally a random seed *cough*
- Small code fixes
1.3.2
- Introduced -w parameter and fixed the -d parameter
1.3.1
- Better output
- minor fixes
1.3
- Output file naming convention using -d parameter
1.2
- Fixes
1.1
- You can pass multiple input directories
- Handling of different file types
1.0
- First release


Moin Moin ADI64,
cooles Programm, hab ich grad entdeckt und ausprobiert. Meine Anregung dazu: die Zufallsfunktion deutlich verbessern. Aus fast 100.000 Titeln kopiert er bereits beim zweiten Durchlauf bei 500 Titels den ersten Titel doppelt. Beim dritten Durchlauf ist bereits der 93te Versuch schonmal dagewesen. Beim vierten Durchlauf ist bereits der 9te File schon vorhanden. Ich kenne mich mit Zufallsverteilungen nicht so aus, aber so richtig zufällig scheint mir das nicht… Ich habe mir vorher die Musik mit randomisierten Winamp-Playlisten und einem Playlist-Kopierer kopiert, wobei auch hier der Zufall nicht sehr zufällig war: bei 1000 Stücken höre ich dann 6x denselben Interpreten. Ich kenne mich mit der Programmierung von “echten” Zufallszahlen nicht so aus, kann Dir daher auch leider keine Hilfe anbieten. Solltest Du meine Anregung berücksichtigen, schicke mir doch bitte eine Mail zurück. Danke Dir!
@Johnny
Hey und danke für deinen Kommentar.
Version 1.4 mit einem besseren Zufallsgenerator ist raus. Außerdem überprüft die neue Version, ob die Files schon existieren und wenn dies so ist, werden diese Files übersprungen.
Wirklich tolles Tool! Genau sowas habe ich gesucht. Es wäre richtig toll, wenn der freie Speicherplatz des MP3-Players noch ermittelt werden könnte, so dass man den Player dann restlos füllen kann (ohne, dass man manuell eine Größe für die zu kopierenden Musikstücke angeben muss).
So ein Feature habe ich in der Konsolenversion in Version 1.6.0 schon hinzugefügt, allerdings war es noch nicht im GUI und noch nicht dokumentiert, da es noch einen kleinen Fehler hatte.
Den habe ich soeben behoben und die Option “zugänglich” gemacht, man kann also jetzt auch den kompletten Player befüllen (es wird aber nicht alles gelöscht, sondern nur der noch verfügbare Platz genutzt).
Danke für den Artikel über RndMp3Copy!
Wow, das ging ja jetzt echt schnell. Da bin ich wirklich sprachlos. Cool!
Suuuper, danke, so ein Programm hab ich schon eeewig gesucht!
Bei EINER Datei hats jedoch nicht hingehauen – bei der Fehlersuche fand ich ein “\x92″ – Char im Namen, weswegen es eine “abnormal program termination” gab:
“Scanning directories…
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.”
Dummerweise hab ich bei der Fehlersuche den originaldateinamen überschrieben, das Apostroph war im Explorer nicht zu sehen:
“Orkidea & David West – God’s Garden.mp3″ (Titel: God?s Garden).
Ansonsten – danke nochmals, super Programm.
Danke für den Hinweis!
Ja, mit komischen Umlauten und Sonderzeichen hab ich noch etwas meine Probleme. Einige Sonderzeichen erkennt er und überspringt diese Songs, aber bei manchen verschluckt er sich noch. Da muss ich wohl noch mal schauen…
Hallo!
Ich habe mehrere Tausend mp3s, die rndmp3copy benutzen soll, in mehrere Unterordner verteilt, aber leider bringt das Programm mir jedes Mal nach um die zweitausend mp3s diese Meldung: This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
Was kann ich machen?
Danke für Eure Hilfe.
Markus
Moin,
Version 1.6.1 ist raus und enthält Fixes für das Problem von Quantenkosmos und Markus
ADI64, RndMp3Copy ist genau DAS Programm, wonach ich gesucht habe. Doch leider scheitere ich bereits beim Starten des Programms…
“RndMp3Copy.exe” und “rndmp3copy_gui_windows.exe” habe ich in einen eigenen Programmordner (C:\Program Files\RndMp3Copy)kopiert und starte das Programm via Desktopverknüpfung. Dann definiere ich die verschiedenen Parameter. Bis hierhin klappt alles wunderbar. Nach dem “Let’s Go!” erscheint beim Windows Vista-System zur Kontrolle folgende Kommandozeile:
C:\Windows\system32\cmd.exe /k C:\Program Files\RndMp3Copy\RndMp3Copy.exe -i “G:\Musikformat_MP3_V2″ -o “I:” -s all -d 0 -w -f “mp3″
Nach dem Bestätigen mit OK erscheint allerdings folgende Fehlermeldung (von “Administrator: C:\Windows\system32\cmd.exe”):
Der Befehl “C:Program” ist entweder falsch geschrieben oder konnte nicht gefunden werden.
C:\Program Files\RndMp3Copy>
Was mache ich falsch? Schon mal besten Dank für die Hilfe und Unterstützung!
Mein System: Windows Vista (32Bit) + 7 (64Bit)