Wikipedia:Reference desk/Archives/Computing/2019 June 28

From Wikipedia, the free encyclopedia
Computing desk
< June 27 << May | June | Jul >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 28[edit]

Rotating folders on a randomized music playlist[edit]

So I have songs from the 1960s and songs from the 1990s and songs from the 1940s etc. Is there a way on a randomized playlist to call up the 1960s folder then the 1990s folder then the 1940s folder etc. basically linerally play the folders with randomized songs in each decade folder and then repeat.

I would ideally like to do this in VLC media player so any VLC media experts much appreciation on any helpful hints. I also have some comedy stuff as well so I wish to play folder 1940s folder 1980s folder comedy folder 1950s folder 1990s folder comedy folder 2000s folder 1960s folder comedy and then repeat while the actual song or comedy bit is randomized each cycle through the folders. Many many thanks for any help! RetroVector (talk) 04:08, 28 June 2019 (UTC)[reply]

I doubt if any media players natively provide this ability. They generally only have "all random" or "all in order" options. You would need some media player that allows you to write macros, or, if the "all in order" option plays files in alphabetical order, you could write an external program to randomize the names in a folder by prepending leading characters. For example, you could prepend AA - ZZ to give you 262 or 676 different orders. On subsequent runs, you would want the program to replace rather than prepend those characters. I suggest backing up all your media files before running the program on them. Do you have coding experience ? SinisterLefty (talk) 12:08, 28 June 2019 (UTC)[reply]
Thanks so much SinisterLefty, you seem to have some great expertise on this. My coding skills ended in high school lol, I can still do some basic things. Any web based or freeware/shareware type off the shelf recommendations that might be helpful? Oh and yes I back everything up always. Also any other suggestions are appreciated, I find it hard to believe there isn't one music player out there that can't do this, there seem to be thousands of media players figures one developer would offer this to make their product more unique, any suggestions welcome! RetroVector (talk) 21:46, 28 June 2019 (UTC)[reply]
Sorry, but I just don't think you're going to find an off-the-shelf product to do this, because it's not the type of feature that would get somebody to buy the product (maybe you're the only one). As far as writing your own program, it might be easiest to find some type of open-source program that already has code to copy files from one folder to another, written in a language you know. That way, instead of "reinventing the wheel", all you would need to do is prepend the randomized codes to the file names, and it would do all the reading and writing the same as before. What language(s) did you take in high school ? SinisterLefty (talk) 22:36, 28 June 2019 (UTC)[reply]

I don't personally think it needs to be as complicated as above. For starters I wouldn't use VLC for this sort of thing but software primarily designed for music playback. Anyway although I haven't tried it, it sounds like Poweramp for Android (not to be confused with dbPowerAmp should be able to do this via the 'Shuffle Songs, Lists In Order' option [1]. (You'd just need to get the lists in the right order first.) However Poweramp is for Android only and neither free nor free software although there is a trial version.

Since you didn't specify your OS I'll provide answers for Windows, if you have another OS apologies but I couldn't help anyway. Foobar2000 is freeware but not free software and highly extensible. Unfortunately the default only does the opposite of what you want. You can shuffle directories or albums but play in order within the album and directory [2]. I suspect that's much more in demand than what you want to do, so music players are more likely to have that as an option. I looked at plugins and it's possible foo_random_pools [3] [4] or facets [5] [6] could do what you want, but I didn't understand them well enough to say for sure. I suspect there is a simpler plugin that can just do it unfortunately this IMO isn't an easy thing to search for especially since you get a lot of results of people confused how to do the basics or unsure of the difference between shuffle and random despite the long time FAQ page as well as people convinced random isn't random because they heard the same track 3 times today etc.

If not foobar2000, I suspect there is probably some freeware probably even free software solution for Windows that can do what you want maybe even without plugins, unfortunately the earlier search comment applies to that as well.

Given what you said above, IMO a simpler solution would be semi manually by just using Foobar2000's sort - randomise function. Start by making separate playlists for each year in in Foobar2000. For simplicity make sure they are in the order you want i.e. 1940, 1990, 1960 etc. Then for each one, sort by randomise. Then just add each year to the playback queue. You will need to sort each year through each cycle of your entire collection or you will get the same order each time. It's unclear to me the number of songs, assuming it's a lot you won't have to do this too often. Note that once you have added a year to the playback queue you can resort so you could add multiple play throughs for each year if you want so you don't have to do this often. That said, given how easy it is to lose the playback queue, you may want something like foo_keep_queue [7] [8]. Maybe you will also want foo_queuecontents [9]. BTW if you still find the playback queue annoying an alternative would be to do what I suggest after for VLC and make a single large playlist.

If you're set on using VLC for this but don't mind using additional software, you can still use foobar2000 in part (again assuming Windows etc). Just save your randomly sorted play list. You can sort 10 times and save 10 times if you want. It will probably be simplest if you give your playlist a suitable filename so they can easily be sorted by the OS e.g. 00000 1940, 00001 1990, 00010 1940, 00011 1990 etc. (Remember you don't have to save them in order, provided you come up with a consistent naming structure. So you can save 00000 1940, 00010 1940 then move on to 1990.) VLC does at least support m3u so you can then just add the playlists in order to VLC. (If VLC did not support m3u, even more reason to not use it.)

Note that the way VLC handles playlists by default is it only loads them once it gets to them. So you will see all the tracks for the first play list, but only each playlist for the other play lists in the built in VLC playlist. (Likewise times etc.) If this doesn't work for you, then add each playlist in order to foobar2000 to a single playlist and save the big playlist. (Assuming the playlists are in order you should be able to just drag all of them into an empty playlist.) Alternatively you could use the earlier method of adding to playback queue and I think foo_queuecontents legacy mode will let you save the playback queue. I also suspect there's a way to save multiple play lists to one in foobar2000 perhaps with a plugin although assuming you are making multiple random sorts of each directory you will need to open each playlist anyway so this seems more complicated. Of course m3u is a very simple format anyway so you could also simply combine into one by just adding each file on top of each other e.g. with the cmd.exe copy command.

Anyway my final point is relevant to all OSes. If foobar2000 doesn't work for you I still see no reason to go around physically renaming stuff. It would surely be easy to find/make something that will generate a m3u with a random order for each track within a directory. (Remember on Windows you can generate a basic m3u just by doing a dir /b /s >>Playlist.m3u and similar for most other desktop OSes. Obviously sorting in a random order is more complicated but you need to deal with similar to rename anyway. Simply outputting the file and location rather than renaming is surely not that different.) I guess VLC should be able to handle a playlist of at least 10000 and probably even 100000. Once you have such a large playlist it probably doesn't matter it's repeating. But if you really don't want it to, you could make VLC not repeat and your program detect when playback ends and generate a new one and start that. I mean you will need to detect playback position in some form with the above solution anyway if I understood it correctly to be able to know when to rename the files.

Nil Einne (talk) 05:01, 29 June 2019 (UTC)[reply]

Thank you again SinisterLiberal and Nil Einne, a lot of great information and Nil Einne thanks a ton for that very detailed response and focus on fitting it into VLC (for various reasons I would like to make it work in VLC if possible). I will read and follow up on everything you offered, this is very great info, much appreciation. If anyone has any other suggestions or thoughts please do share and thanks again!RetroVector (talk) 16:07, 29 June 2019 (UTC)[reply]

How can one use the MediaWiki <code> tag for multiline codes?[edit]

When I try to use <code> for multiline codes I don't get a single block of code but code blocks for each line:

<x>

   <y></y>

</x>

  • I don't want to use the deprecated <source> tag instead.
  • I don't want to use <syntaxhighlight> tag instead.

How can one use the MediaWiki <code> tag for multiline codes? 182.232.16.31 (talk) 07:58, 28 June 2019 (UTC)[reply]

  • The fine manual is at WP:CODE. Assuming your issue with <syntaxhighlight> is that, well, it highlights syntax, you can use <pre> tags instead. Another option is to put a single space in front of every code line: (see the source)
this is some code
with two lines
   here is some indentation in the code

What you cannot do is use <code> tags which are not fit for the purpose you intend. TigraanClick here to contact me

Unless I change the MediaWiki PHP to parse <code> differently but yeah, I see what you meant. Thanks. 182.232.164.217 (talk) 10:39, 28 June 2019 (UTC)[reply]
<syntaxhighlight>...</syntaxhighlight> without a lang=xx attribute doesn't highlight syntax, because without knowing which language is represented, it doesn't know which highlighting rules to apply. Or you can be explicit and use <syntaxhighlight lang=text>...</syntaxhighlight>. --Redrose64 🌹 (talk) 12:18, 28 June 2019 (UTC)[reply]
<pre> tag seems best to me; please further help me by reading my next new question (and hopefully the last one on this topic). Thanks. 182.232.164.217 (talk) 15:41, 28 June 2019 (UTC)[reply]

Changing cursor keys on Windows 10[edit]

On my first laptop, there were four cursor keys, and, by them, four more keys marked Home Pg Up, Pg Dn and End.

On my second laptop, there were just the four cursor keys. The four other actions were acheived by also pressing the Fn key, over on the left hand side of the keyboard. Fortunately also on the right hand side of the keyboard was a Fn Lock button, so I could toggle between using the cursor keys for single steps and using them for browsing through a document, all just with the right hand.

My latest laptop has the same four keys, and the same alternative uses when Fn is also pressed - but it has no Fn Lock button. (Googling suggests that there is simply no way of getting this range from this manufacturer to Function Lock.)

However, next to the four cursor keys is a large Shift key, and it is possible, with just one hand, to hold down the shift key and also press a cursor keys. Currently there is no action connected to Shift+any of the cursor keys.

So my question is: is it possible on Windows 10 to copy the actions of Fn+the cursor keys to Shift+the cursor keys? xiij ~talk~ 08:46, 28 June 2019 (UTC)[reply]

See here. It used to be possible to define any unused combination, or maybe even redefine an existing one. Jmar67 (talk) 12:51, 28 June 2019 (UTC)[reply]
As far as I can see, which isn't necessarily that far, that page describing the preset shortcuts doesn't give any info as to whether unused combinations can be defined xiij ~talk~ 13:18, 28 June 2019 (UTC)[reply]

Should there be any long-term problem using <pre> tag in an RTL (opposed to LTR) MediaWiki website?[edit]

I have installed MediaWiki 1.32.0 on a personal webserver environment. From different personal preferences I need to present multiline code examples only inside <pre> tags, and not inside <source> tags or <syntaxhighlight> tags.

I might need to change the CSS of the <pre> tag directly; adding some different display, adding some margins, paddings, etc.

The site is in a certain RTL language so everything is written from right to left.

Should there be any long term problem working with CSS-modified <pre> in an RTL website?
Is there some Out-Of-Box MediaWiki feature that could at least aesthetically malfunction from this situation?

Thanks, 182.232.164.217 (talk) 10:46, 28 June 2019 (UTC)[reply]