示例#1
0
文件: scheduler.py 项目: umputun/upg
    def check(self):
        now = time.localtime(time.time())
        #print now[4], self.__last_check[4]
        if now[4] != self.__last_check[4]: #if not the same minute   
            for name, params in self.__podcasts_conf.items():
                #print "DAY", now[6], params[DAY]
                timeshift = self.__getTimeShift(params)
                now_adjusted = time.localtime(time.time() + (timeshift*3600))
                if not ( (now_adjusted[6]) in params[DAY]): 
                    continue
                dec_time = now_adjusted[3]*100+now_adjusted[4]
                #print "TIME", dec_time, params[TIME]
                if not dec_time in params[TIME]: continue
                LOG.msg("SHD: Scheduling activated for %s %d" % (name, dec_time), 2)                    
                ripper = Ripper(name, params, self.__settings, self.__updated_q, self.__ev_terminate)
                ripper.start()

            self.__last_check = now
示例#2
0
from ripper import Ripper
from excella import Excella

if __name__ == "__main__":
    r = Ripper("subjectoffering.json")
    r.load()

    entries = r.get_entries()

    # Render ripper entries into Excel spreadsheet
    e = Excella(entries, "officers.json", "scheds.xlsx")
    e.begin()
    e.close()
示例#3
0
                        type=str,
                        help='Plugin to be used',
                        required=False)
    parser.add_argument('-l',
                        help='List plugins',
                        action='store_true',
                        required=False)
    parser.add_argument('-v', nargs='?', action=VAction, dest='verbose')
    parser.add_argument('-f',
                        '--format',
                        choices=['text', 'csv', 'json'],
                        default='text')

    if len(sys.argv) == 2:
        if sys.argv[1] == '-l':
            r = Ripper()
            r.list_plugins()
            sys.exit(0)
        else:
            args, unknown = parser.parse_known_args()
    else:
        args, unknown = parser.parse_known_args()

    ripper = Ripper(args.verbose)

    if os.path.isfile(args.PATH):
        if args.plugin is not None:
            if args.plugin not in ripper.plugin_names():
                print("Bad plugin")
                sys.exit(1)
            else:
示例#4
0
 def test_init_with_default_arguments(self, mock_os, mock_re,
                                      mock_requests):
     ripper = Ripper()