Ejemplo n.º 1
0
import dcore.data as data

import shutil
import os
import urllib.request
import logging
import time
import re
import random
import argparse

_meta_shell_command = 'getpics'

#outputFolder = os.path.expanduser('~/wallpapers')
outputFolder = os.path.join(data.dcoreTempData(), 'wallpapers') 
if not os.path.exists(outputFolder):
    os.makedirs(outputFolder)

linux_setpic_cmds = ['gsettings set org.gnome.desktop.background picture-uri file:///%s']
linux_setpic_cmds.append('feh --bg-scale %s')

class ScriptLogHandler(logging.FileHandler):

    """
    Save to file and output to screen.
    """

    def emit(self, record):
        print("{0}: {1}".format(record.levelname, record.getMessage()))
        logging.FileHandler.emit(self, record)
Ejemplo n.º 2
0
"""

print('pre-Starting ff')

import os
import argparse
import pickle
import datetime
import platform

import dcore.data as data

_meta_shell_command = 'ff'

search_roots = [r'~/sync']
cacheLoc = os.path.join(data.dcoreTempData(), os.path.split(__file__)[1] + ".cache")
cacheExpiryInSeconds = 21*24*60*60 # Before automatically force regenerating.

def getArgs():
    parser = argparse.ArgumentParser()
    parser.add_argument('grep', type=str, nargs='*', default = None)
    parser.add_argument('-r', '--reset', action="store_true", help="Force re-creation of the cache.")
    parser.add_argument('-o', '--open', action="store_true", help="Open with OS-configured program.")
    parser.add_argument('-v', '--vim', action="store_true", help="Open in text editor all files that match.")
    args = parser.parse_args()
    return args

def getAllFiles(rootdir = '.'):
    F = []
    for dirpath, dirnames, filenames in os.walk(rootdir):
        for f in filenames: