correct filename
This commit is contained in:
parent
523527447d
commit
b3379086e9
1 changed files with 1 additions and 1 deletions
42
scripts/opml2spiderss.py
Executable file
42
scripts/opml2spiderss.py
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import opml
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Prints elements recursively for all outlines
|
||||
def print_outline(outline, category):
|
||||
if len(outline) > 0:
|
||||
for o in outline:
|
||||
print_outline(o, os.path.join(category, outline.text))
|
||||
else:
|
||||
print('[[feed]]')
|
||||
print('category = \'{}\''.format(category))
|
||||
print('name = \'{}\''.format(outline.text))
|
||||
print('url = \'{}\''.format(outline.xmlUrl))
|
||||
print('')
|
||||
|
||||
'''
|
||||
Main
|
||||
'''
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description = 'Read an OPML file and print spiderss TOML format to stdout.')
|
||||
parser.add_argument('file', help = 'OPML input file')
|
||||
args = parser.parse_args()
|
||||
|
||||
file = args.file
|
||||
|
||||
try:
|
||||
outline = opml.parse(file)
|
||||
for o in outline:
|
||||
print_outline(o, '')
|
||||
except Exception as e:
|
||||
print('ERROR: {}'.format(e))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue