Wrote a Exporting section in README

- Placeholder if no topic is selected
This commit is contained in:
Tony Bark 2025-03-13 10:29:23 -04:00
parent fa5a5b1b2e
commit 7c61c51ac2
2 changed files with 14 additions and 11 deletions

View file

@ -97,29 +97,24 @@ string SelectTopics(List<string> topics)
if (int.TryParse(input, out topicNum) == true) if (int.TryParse(input, out topicNum) == true)
topicChoice = topicDict[topicNum]; topicChoice = topicDict[topicNum];
else else
NewTopic(topics, false); NewTopic(topics);
return topicChoice; return topicChoice;
} }
/// <summary> /// <summary>
/// Selects a new topic either by prompting the user or randomly choosing one from the list. /// Allows the user to choose a new topic from a given list or default to placeholder if no selection is made.
/// </summary> /// </summary>
/// <param name="topics">A list of available topics.</param> /// <param name="topics">A list of available topics.</param>
/// <param name="retry">Indicates whether to prompt the user again if no selection was made.</param> /// <returns>The selected topic or a default placeholder if none is chosen.</returns>
/// <returns>The selected topic as a string.</returns> string NewTopic(List<string> topics)
string NewTopic(List<string> topics, bool retry = false)
{ {
var newTopic = ""; var newTopic = "";
if (UserChoice("Choose a Topic?") || retry) if (UserChoice("Choose a Topic?"))
newTopic = SelectTopics(topics); newTopic = SelectTopics(topics);
else else
{ newTopic = "===";
var rng = new Random();
var chooseTopic = rng.Next(0, topics.ToArray().Length);
newTopic = topics[chooseTopic].Trim();
}
return newTopic; return newTopic;
} }

View file

@ -2,6 +2,14 @@
This is a very simple console application that generates a list of times to publish news articles within a randomized 2-3 hour delay while avoiding time conflicts within a 30-minute window. This is a very simple console application that generates a list of times to publish news articles within a randomized 2-3 hour delay while avoiding time conflicts within a 30-minute window.
## Exporting
Once it generates a list of times, you can retry or export the times. If you export, you're requested to select from a number of topics or default to none if no selection is made. Upon export, you can start over or exit.
Choice selection is based on the Y/N keys. ``Enter`` works the same as ``Y`` while pressing any other key is the equivalent of ``N``. You can make mistakes, but it expects failure.
An optional ``config.toml`` file allows for further customization of file name, directory, and topics.
## Background ## Background
A while back, I [found a tool](https://schedule.lemmings.world) to schedule articles on Lemmy. I've been posting within a few hours apart at random minutes and I wanted to something decide that for me. I had AI write the base algorithm, everything else is my own touches. A while back, I [found a tool](https://schedule.lemmings.world) to schedule articles on Lemmy. I've been posting within a few hours apart at random minutes and I wanted to something decide that for me. I had AI write the base algorithm, everything else is my own touches.