Add shuffle option
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import os
|
||||
import random
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
@@ -28,6 +29,7 @@ def main():
|
||||
parser.add_argument("--xmlpath", type=str, help="Path to save the XML file containing the list of image files. (default: stored in the images folder)")
|
||||
parser.add_argument("--duration", "-d", type=int, help=f"Duration between each image in seconds (default: {DEFAULT_DURATION})")
|
||||
parser.add_argument("--transduration", "-t", type=int, help=f"Duration of transition between images (default: {DEFAULT_TRANSITION_DURATION})")
|
||||
parser.add_argument("-s", "--shuffle", action="store_true", help="Turn on shuffling of images")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -37,6 +39,7 @@ def main():
|
||||
recursive = args.recursive
|
||||
duration = args.duration
|
||||
transduration = args.transduration
|
||||
shuffle = args.shuffle
|
||||
|
||||
gnomepath = os.path.abspath(os.path.expandvars(GNOME_BACKGROUNDS_PATH))
|
||||
|
||||
@@ -61,6 +64,9 @@ def main():
|
||||
|
||||
files = getFiles(imagepath, recursive)
|
||||
|
||||
if shuffle:
|
||||
random.shuffle(files)
|
||||
|
||||
if not os.path.exists(gnomepath):
|
||||
os.makedirs(gnomepath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user