{"id":1370,"date":"2011-08-14T16:00:37","date_gmt":"2011-08-14T23:00:37","guid":{"rendered":"https:\/\/www.reenigne.org\/blog\/?p=1370"},"modified":"2012-02-22T16:38:27","modified_gmt":"2012-02-23T00:38:27","slug":"run-a-random-file","status":"publish","type":"post","link":"https:\/\/www.reenigne.org\/blog\/run-a-random-file\/","title":{"rendered":"Run a random file"},"content":{"rendered":"<p>I have a collection of childrens' TV shows on a computer connected to the family TV. It's a good way to allow the children to watch some TV for a limited period of time without adverts. When one show finishes and they ask me to put another one, I often say \"Okay, but you have to wait 20 minutes\". Usually in that time they find something else to do and forget about the TV.<\/p>\n<p>Picking what to put on can be a bother though - if I try to play them in order I forget which one I put on last, and if I try to pick one at random I'll invariably pick some more often than others. So I wrote <a href=\"https:\/\/github.com\/reenigne\/reenigne\/tree\/master\/run_random\">run_random<\/a> (<a href=\"http:\/\/www.reenigne.org\/computer\/software\/run_random.exe\">binary<\/a>). This program takes its arguments, expands wildcards and recurses directories to obtain a list of files and then picks one at random and calls ShellExecute() on it (which, if it's a video file, will play the video).<\/p>\n<p>It's a handy little utility but it's also a good testcase for some <a href=\"https:\/\/github.com\/reenigne\/reenigne\/blob\/master\/include\/alfe\/file.h\">path and directory handling routines<\/a> I wrote for various other purposes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a collection of childrens' TV shows on a computer connected to the family TV. It's a good way to allow the children to watch some TV for a limited period of time without adverts. When one show finishes and they ask me to put another one, I often say \"Okay, but you have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,36],"tags":[],"class_list":["post-1370","post","type-post","status-publish","format-standard","hentry","category-computer","category-fatherhood"],"_links":{"self":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/comments?post=1370"}],"version-history":[{"count":2,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1649,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1370\/revisions\/1649"}],"wp:attachment":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/media?parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/categories?post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/tags?post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}