commit 58f3e96ec8eeeb0fb556b28776884bb86a849bd7 parent cf93d9154290c534bc7bd6ad19455999346dbb34 Author: rbckman <rob@robinsfirma.com> Date: Sun, 19 Aug 2018 10:36:46 +0300 use tuple list instead of a dict Diffstat:
M | random/getfilms.py | | | 12 | +++++------- |
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/random/getfilms.py b/random/getfilms.py @@ -7,15 +7,13 @@ rundir = os.path.dirname(__file__) if rundir != '': os.chdir(rundir) -filmlibrary = {} -filmfolder = '/home/pi/Videos/' +films_sorted = [] +filmfolder = '/home/nemo/' films = os.walk(filmfolder).next()[1] -renderedfilms = [] -unrenderedfilms = [] for i in films: if os.path.isfile(filmfolder + i + '/' + 'settings.p') == True: lastupdate = os.path.getmtime(filmfolder + i + '/' + 'settings.p') - filmlibrary[i]=lastupdate - -print filmlibrary + append.films_sorted(i,lastupdate) +films_sorted = sorted(films, key=lambda tup: tup[1]) +print films_sorted