[FR] Random file selection

A few years back I already had the idea of ​​a random file selection, especially for music-files.

Because now MTP devices are supported, which are often used to listening to music, I take the idea once again. As most music collections are larger than the space of these limited devices (MTP, MP3-Player,...) and also a manual selection is time-consuming, I really would like to see a random file selection incl. an option to set max. number of files or - more important - max. space (e.g. 700 MB for CD or xx GB for MicroSD-Card).

I would also use a external program, if it can be used with DO. Until now I've found some tools doing this, but:

  1. Mix2Stix - needs Java and has no commandline that I could use in DO
  2. PickMe - discontinued, only have max. files option and drag'n'drop to DO causes a crash of both programs

Selecting a random file can be done with dopusrt.exe. In the latest version it supports pulling the lister content into an xml file.
Now you just need some sort of script to pick one file from the xml and have dopursrt.exe select that file again in the lister.

But in case you have your mp3s sorted into subfolders (who has not ?!), this won't be any good i assume. Unless you make use of flat-view, which then again can come up heavy on your system, depending on how many files we're talking about.. o)

Not sure I fully understand the use-case... Is this so you can have Opus do some kind of ad-hoc random playlist style decision making that you can then use to add such a collection of media files to a capacity constrained media player/device/~other media?

If so - I suspect this might be a very niche use-case that is a bit outside of Opus' usual wheelhouse - though of course we'd leave it to GPSoft to say :slight_smile:. However, I don't think it would be too hard to create a rename script that could calculate the total file capacity of a group of files. I'd probably use the print folder function instead of a flatview->xml maneuver to get a CSV list of my media folder, drop that file into a static folder with a static name:

print folder="lib://my\my media\music\~new" quiet filter=media format=fname_size flatview=nofolders as=csv to "d:\my\my media\music\playlist.csv"

...which I might not do every time I want an updated file collection/selection (I have tens of thousands of mp3's, etc). But either way, the idea being - to have some list that a rename script could then operate on in order to do some vbscript pseduo random selection from the csv file. From there, I don't think you necessarily need to resort to dopusrt to actually "select" the files... maybe instead add them to a temporary file collection or something, just to make the list of files easily accessible - at which point you can make your own decisions on whether to leave the list as is or make some manual changes before copying that stuff to some other device or piece of media...

I realize thats a bit different than your actual ask - but would that work for your use case? If that'd work - I'd invest some time in trying out such a script as I might use it myself... I'd probably add in some dlg prompts to ask for other info... like a dlgchoose to ask for the target size in MB/GB, maybe a dlgchoose to ask for ~other input like genre or date range - for instance, every once in awhile I go on a particular genre kick, or I want to quickly add fairly large amount of the "newest" music I've purchased... etc. All of which you could pass as newname arguments to a rename script delimited by some char (, or ; or whatever).

@Steje: Copying a random filelist to a collection would be good enough :smiley:. I searched again in WWW for a random selector (btw you can use it also for pics etc.) and found another one, that also offers to filter by genre, year and so on. Would be nice realising with DO's filter-options.

I don't think that such a feature is outside of Opus - it's a kind of "extended" filemanagment, like editing metatags. Imagine, you want to go cycling or jogging. You have a large music collection, even 200 MB free on your player and just want to copy some music quickly (but not only the first 25 ones beginning with "A" or "0-9"!). That would be cool! Also what happens if you select music-files manually? There's no "surprise" when listening, you also won't select really randomly.

Hey Sasa.... so, any objections to printing out the dir structure and dumping to a file OUTSIDE of the code to make the random selection -> collection?

I ask because - as I mentioned, I for one have THOUSANDS of mp3's... And I usually access those songs over a NAS share... So, case in point - running a Print Folder on that top level music folder is about 1 HOUR in, and only about 60% complete (though I'm grabbing multiple bits of tag data I'm not necessarily going to do anything with in my first version of a random selection script).

More than just that though... I also thought it might be worthwhile to keep a list of which files you may have already selected randomly in this fashion so that, in the event you either WANT to generate a new list each time you run the selection and/or you update your music collection frequently (I don't make many updates nowadays, having soooo much music in my library already) there's at least a good chance that you may end up getting the same song several times across multiple selections... I was thinking of adding each file to another list so as to cross-check any future random selections against a list of previously selected files. You could naturally reset back to nothing by just deleting this ~other list file...

For me at least - I think I'd want something like this to avoid getting the same songs multiple times... I was going to just REMOVE any selected files from the the print FOLDER input file... but if you DO in fact update your library somewhat often, then you'd want to periodically dump a new folder list - if not refresh the list every time you run the selection part of this idea (again, for large cllections and/or accessing over a network share - this could take ~awhile...).

Hi, I have 1000 of files too, and I'm actually testing two programs that searches them within seconds. However, my files are stored on an internal hard drive, because NAS is too slow for me in principle (and for backups I use USB 3.0-HDD's). After several runs with these programs there were only a few duplicates and only sometimes, and I usually would copy around 150 MP3's, so a few duplicates would be not that problem.

As said, at the moment I'm testing "RandomCopy" and "Mixtape", unfortunately none of them has a command line, so I can't use them within Opus. But the programs are not bad. A question: Mixtape only generates a list of complete paths (e.g. D:\Music\Test.mp3). Could I import them into an Opus-Collection (I'm not good in scripting)? That would be a first time compromise, because the programs run as simple exe and MixTape stores its Settings in programm folder, that could be copied in DO-scripts.

As far as i know, importing a file list into a collection can be done.

There really are outstanding music (image, video) programs that already do this, and much more, much better. You seem to want to use DOpus to reinvent the wheel.

@MrC: Well, there're also better programs like faster picture-viewers or converter. There're already better programs for editing ID-Tags. Yes, and there're already other filemanagers. So why the hell we're using Dopus?

BTW I already said that I would use a tool, if someone could tell me how to import a playlist-file into a collection.

--> External Manipulation of File Collections

(First result if you search the manual for "collection", FWIW.)

I feel at some point one's needs may exceed a generalized tool and so specialized tools are required. It sounds like you're looking to build dynamic, random playlists (or playlists built on various rules) and have them synced to your handheld or external device. This seems to me a case where the excellent but general DOpus would be better supplemented with a specialized music management program that does all that you require.

Thanks Leo. And MrC: Creating random collections and copying their files IS filemanagement! Then we also wouldn't need the sync - to less options (e.g. no templates).

I think you're being hung up on the generalized category which you call "file management", and therefore desire to have DOpus do all things file-related. By that definition, almost any program performs some file management.

I meant to offer suggestions, not offense. Sounds like you've decided to use DOpus for this.

Ok, we have select manual, we have select reverse, we have select by filter, we have select all, we have select none. So why not select random? You think, it's reinventing the wheel, I think, it's an option that would fit. DO also lives from the ideas users made (including some of mine), and it's about GP to decide. Some years ago I had a Windows Mobile Device and asked for (better) MTP-support. No one was interested. Now they all have smartphones and MTP is supported (here I also could say "now I don't need it anymore, most Androids have got an USB-Mode"!). So why not "filling" it with random music (lots of people listening music via smartphone) via Opus? It's just an idea.

I generally agree that this sort of thing seems to be a rather "niche" use-case... as I imagine most ppl are content to use a dedicated media/music mgmt application for stuff like this... However, I'm NOT among them :slight_smile:. I HATE the way iTunes does... well, pretty much everything. So having a method to do the file selection in Opus then pipe files to a collection - would probably be useful to me because then I can do a single drag-n-drop of the file list from my Opus collection to CopyTrans...

I think that for Sasa - this whole idea makes more sense to him in the context of file management now that we're able to work with MTP devices like regular storage devices... So I understand the desire here. But to be honest, even if Opus were to get some kind of Select RANDOM capability it'd be at least somewhat useless for this use case without some additional capability to specify 'other' criteria... like size, no? And to tbones earlier point - I expect even such an enhancement as this would only be useful if you were to use it in flatview, as I also expect most of us have our media in some sort of folder hierarchy.

The more I think about this, the more I wonder if a Find enhancement might not be a better solution. That'd completely remove the need for any external scripting I think... for instance:

Find RANDOM SIZE={dlgstring|Specify total size of data (in GB)...}g FILTER={dlgchoose|Select Genre...|All Metal=music_genre_allmetal+Power Metal=music_genre_pmetal+Hard Rock=music_genre_hrock+Classical=music_genre_classical}} COLLNAME=iPod CLEAR=yes

...wouldn't something like that be a better way to let you specify a variable total size you want Opus to STOP finding files at, along with a RANDOM arg to tell Opus NOT to do the normal orderly directory walking, and lastly, let you use the existing filter system to restrict your find results based on whatever you want to listen to at the moment - whether that be genre, or recently added music, or from a particular artist or time period, etc...?

Either way - clearly it's up to GPSoft to decide if ~any user request makes sense for what they want the focus of Opus to be... :slight_smile:

@Sasa: I'm not sure if it makes sense for me to continue work on the script I started since it seems you might have a method using one of the tools you mentioned? I won't use some other GUI tool for this myself - so I may continue work on an Opus based script method anyway... as, up until now - I've basically just had a button on my 'MusicTools' toolbar that I use to assign manually selected files or album folders to a temporary "iPod" file collection I use for the same purpose as this use-case. But I constantly have to check the size of the files I've selected so far over in the collection, and even though I intend to do manual random selection sometimes - I still find myself gravitating toward my usual content. Trick of the mind I know - but hard habit to break. I'd rather the decision be taken more out of my hands :slight_smile:...

There's a simple, singular reason for using external tools for this type of thing. Those that have very fast databases can return results from tens or hundreds of thousands of files immediately, without recursively scanning the file system, which can take a very long time.

iTunes is probably not one to be used as a benchmark for such an application.

@Steje: Thanks. I solved it using MixTape, next thing ist writing a command that imports filelist to collection, where Leo sent me a useful link. But nevertheless I would welcome a complete DO-solution w/o using a separate tool (incl. own GUI).

@MrC: Surely some specialized tools are better, I just love doing things within DO and as long the external tools support a commandline and runs "standalone", I have no "probs" including them in my scripts-dir (like nircmd, lame-encoder, USB-Ejector, autoruns, truecrypt, etc.). But unfortunately no random-selector offers this and I really don't need an oversized MP3-Organizer.

I have created a button doing the job using a small external tool: [url]Create random music-collection for CD, Phone, MP3-Player,]