Use directory as default feed title even when not run as a command line tool.

This commit is contained in:
Solderpunk 2020-03-17 21:05:03 +01:00
parent 835a7a0ac8
commit a033b73640
1 changed files with 2 additions and 3 deletions

View File

@ -35,12 +35,11 @@ def get_feed_title(directory):
the content of the first heading line in the file, otherwise return a
default feed title.
"""
default = "Just another Gemini feed"
for index_file in ("index.gmi", "index.gemini"):
index_file = os.path.join(directory, index_file)
if os.path.exists(index_file) and is_world_readable(index_file):
return extract_first_heading(index_file, default)
return default
return os.path.basename(directory)
def find_files(directory, n=10):
"""
@ -168,7 +167,7 @@ def main():
parser.add_argument('-s', '--subtitle', dest='subtitle', type=str,
help='feed subtitle')
parser.add_argument('-t', '--title', dest='title', type=str,
default=os.path.basename(cwd), help='feed title')
help='feed title')
args = parser.parse_args()
# Normalise base URL