2
from flexget.plugin import register_plugin
4
log = logging.getLogger('listdir')
7
class InputListdir(object):
9
Uses local path content as an input.
13
listdir: /storage/movies/
17
from flexget import validator
18
root = validator.factory()
20
bundle = root.accept('list')
24
def on_feed_input(self, feed, config):
25
from flexget.feed import Entry
27
# If only a single path is passed turn it into a 1 element list
28
if isinstance(config, basestring):
32
for name in os.listdir(unicode(path)):
35
filepath = os.path.join(path, name)
36
# Windows paths need an extra / preceded to them
37
if not filepath.startswith('/'):
39
e['url'] = 'file://%s' % filepath
40
e['location'] = os.path.join(path, name)
44
register_plugin(InputListdir, 'listdir', api_ver=2)