| 6 | |
| 7 | |
| 8 | class Wallpaper: |
| 9 | # Set Environment Variables |
| 10 | username = os.environ["USERNAME"] |
| 11 | # An Amazing Code You Will Love To Have |
| 12 | # All file urls |
| 13 | file_urls = { |
| 14 | "wall_src": "C:\\Users\\" |
| 15 | + username |
| 16 | + "\\AppData\\Local\\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\" |
| 17 | + "LocalState\\Assets\\", |
| 18 | "wall_dst": os.path.dirname(os.path.abspath(__file__)) + "\\Wallpapers\\", |
| 19 | "wall_mobile": os.path.dirname(os.path.abspath(__file__)) |
| 20 | + "\\Wallpapers\\mobile\\", |
| 21 | "wall_desktop": os.path.dirname(os.path.abspath(__file__)) |
| 22 | + "\\Wallpapers\\desktop\\", |
| 23 | } |
| 24 | msg = """ |
| 25 | DDDDD OOOOO NN N EEEEEEE |
| 26 | D D O O N N N E |
| 27 | D D O O N N N E |
| 28 | D D O O N N N EEEE |
| 29 | D D O O N N N E |
| 30 | D D O O N N N E |
| 31 | DDDDD OOOOO N NN EEEEEEE |
| 32 | """ |
| 33 | |
| 34 | # A method to showcase time effect |
| 35 | @staticmethod |
| 36 | def time_gap(string): |
| 37 | print(string, end="") |
| 38 | time.sleep(1) |
| 39 | print(".", end="") |
| 40 | time.sleep(1) |
| 41 | print(".") |
| 42 | |
| 43 | # A method to import the wallpapers from src folder(dir_src) |
| 44 | @staticmethod |
| 45 | def copy_wallpapers(): |
| 46 | w = Wallpaper |
| 47 | w.time_gap("Copying Wallpapers") |
| 48 | # Copy All Wallpapers From Src Folder To Dest Folder |
| 49 | for filename in os.listdir(w.file_urls["wall_src"]): |
| 50 | shutil.copy(w.file_urls["wall_src"] + filename, w.file_urls["wall_dst"]) |
| 51 | |
| 52 | # A method to Change all the Extensions |
| 53 | @staticmethod |
| 54 | def change_ext(): |
| 55 | w = Wallpaper |
| 56 | w.time_gap("Changing Extensions") |
| 57 | # Look into all the files in the executing folder and change extension |
| 58 | for filename in os.listdir(w.file_urls["wall_dst"]): |
| 59 | base_file, ext = os.path.splitext(filename) |
| 60 | if ext == "": |
| 61 | if not os.path.isdir(w.file_urls["wall_dst"] + filename): |
| 62 | os.rename( |
| 63 | w.file_urls["wall_dst"] + filename, |
| 64 | w.file_urls["wall_dst"] + filename + ".jpg", |
| 65 | ) |