3
__author__ = 'paranoidi'
6
from flexget.utils.simple_persistence import SimplePersistence
7
from flexget.plugin import register_plugin
10
log = logging.getLogger('welcome')
13
class WelcomePlugin(object):
17
self.persistence = SimplePersistence(plugin='welcome')
19
def on_process_start(self, feed, entries):
20
if self.executed or not feed.manager.options.quiet:
22
count = self.persistence.setdefault('count', 5)
26
# check for old users, assume old user if db larger than 2 MB
27
if count == 5 and os.stat(feed.manager.db_filename).st_size / 1024 / 1024 >= 2:
28
log.debug('Looks like old user, skipping welcome message')
29
self.persistence['count'] = 0
33
scheduler = 'scheduler' if sys.platform.startswith('win') else 'crontab'
35
log.info('FlexGet has been successfully started from %s (--cron). '
36
'I hope you have %s under control now. This message will not be repeated again.' %
37
(scheduler, scheduler))
39
log.info('%sFlexGet has been successfully started from %s (--cron). '
40
'This message will be repeated %i times for your set up verification conveniences.' %
41
('Congratulations! ' if count == 4 else '',
43
self.persistence['count'] = count
46
register_plugin(WelcomePlugin, 'welcome', builtin=True, api_ver=2)