shuffle subdirectories, sort subdirectory contents #575
-
|
Hi, my collection of pictures is organized in a directory tree which generally follows the structure Is it possible to configure picframe to follow this behaviour? From the docs it looks like the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Hi @ilveroluca, the way the list of image files is generated now doesn't lend itself to doing this in a very natural way. At some point we will probably change the way the random list is created, moving the ranomisation into python and away from sqlite. At that point it might become easier to include behavior like you want. In the mean time you could achieve the effect you want by hacking the source code. There are disadvantages: this won't work with potrait pairs and will stop the normal selection and sorting from working, you might break something or you might loose your mod later if you upgrade the picframe source to a later version. So make copies of the file before and after changing it. Assuming you have a vanilla installation. In if not self.__portrait_pairs: # TODO SQL insertion? Does it matter in this app?
#sql = """SELECT file_id FROM all_data WHERE {0} ORDER BY {1}
# """.format(where_clause, sort_clause)
sql = "CREATE TEMPORARY TABLE IF NOT EXISTS folderorder (sortorder INTEGER PRIMARY KEY, folder_id)"
cursor.execute(sql)
sql = "DELETE FROM folderorder"
cursor.execute(sql)
sql = "INSERT INTO folderorder (folder_id) SELECT DISTINCT folder_id FROM folder ORDER BY random()"
cursor.execute(sql)
sql = """SELECT file_id FROM file
JOIN folderorder
ON folderorder.folder_id = file.folder_id
ORDER BY folderorder.sortorder, random()
"""
return cursor.execute(sql).fetchall()
else: # make two SELECTSReally the CREATE TABLE should be done elsewhere and it doesn't really need to be a temporary TABLE if you're going to use this order all the time! But a scheme like this will probably do what you want. Paddy PS that last |
Beta Was this translation helpful? Give feedback.
-
|
Hi @paddywwoof. Thanks for the detailed reply! |
Beta Was this translation helpful? Give feedback.
-
|
This discussion has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns. |
Beta Was this translation helpful? Give feedback.
Hi @ilveroluca, the way the list of image files is generated now doesn't lend itself to doing this in a very natural way. At some point we will probably change the way the random list is created, moving the ranomisation into python and away from sqlite. At that point it might become easier to include behavior like you want.
In the mean time you could achieve the effect you want by hacking the source code. There are disadvantages: this won't work with potrait pairs and will stop the normal selection and sorting from working, you might break something or you might loose your mod later if you upgrade the picframe source to a later version. So make copies of the file before and after changing…